Add debugging for ref field and set it twice
- Add debug logging to check ref field value before create() - Set ref field again after all other fields to ensure it's not overwritten - Help identify why ref field is still empty in database - Debug both debit and credit entries
This commit is contained in:
parent
3393759675
commit
d628c43806
@ -1265,6 +1265,9 @@ class DeclarationTVA
|
||||
$debit->fk_user_modification = $user->id;
|
||||
$debit->label_operation = $declaration->declaration_name;
|
||||
|
||||
// Set ref field again to ensure it's not overwritten
|
||||
$debit->ref = $declaration->declaration_name;
|
||||
|
||||
// Get journal label from database and translate it
|
||||
$journal_label_sql = "SELECT label FROM " . MAIN_DB_PREFIX . "accounting_journal WHERE code = 'OD' AND entity = " . $this->entity;
|
||||
$journal_label_result = $this->db->query($journal_label_sql);
|
||||
@ -1278,6 +1281,7 @@ class DeclarationTVA
|
||||
|
||||
// Final check of montant before create
|
||||
error_log("DEBUG: Final montant check before create: " . $debit->montant);
|
||||
error_log("DEBUG: Final ref field check: " . $debit->ref);
|
||||
|
||||
$result = $debit->create($user);
|
||||
error_log("DEBUG: Debit entry create result: " . $result . " (type: " . gettype($result) . ")");
|
||||
@ -1320,6 +1324,9 @@ class DeclarationTVA
|
||||
$credit->fk_user_modification = $user->id;
|
||||
$credit->label_operation = $declaration->declaration_name;
|
||||
|
||||
// Set ref field again to ensure it's not overwritten
|
||||
$credit->ref = $declaration->declaration_name;
|
||||
|
||||
// Get journal label from database and translate it
|
||||
$journal_label_sql = "SELECT label FROM " . MAIN_DB_PREFIX . "accounting_journal WHERE code = 'OD' AND entity = " . $this->entity;
|
||||
$journal_label_result = $this->db->query($journal_label_sql);
|
||||
@ -1333,6 +1340,7 @@ class DeclarationTVA
|
||||
|
||||
// Final check of montant before create
|
||||
error_log("DEBUG: Final montant check before create: " . $credit->montant);
|
||||
error_log("DEBUG: Final ref field check: " . $credit->ref);
|
||||
|
||||
$result = $credit->create($user);
|
||||
error_log("DEBUG: Credit entry create result: " . $result . " (type: " . gettype($result) . ")");
|
||||
|
||||
Loading…
Reference in New Issue
Block a user