Add detailed field debugging for Bookkeeping entries

- Log all field values before create() call for both debit and credit entries
- Help identify which fields are empty or incorrect
- Debug the exact values being passed to Bookkeeping objects
- Show field-by-field breakdown to find missing values
This commit is contained in:
Frank Cools 2025-10-08 22:32:52 +02:00
parent b110313245
commit 5ace391b5b

View File

@ -1258,6 +1258,18 @@ class DeclarationTVA
$debit->fk_doc = $declaration->rowid;
$debit->fk_user_author = $user->id;
// Debug: Log all field values before create
error_log("DEBUG: Debit entry fields before create:");
error_log("DEBUG: - doc_date: " . $debit->doc_date);
error_log("DEBUG: - doc_ref: " . $debit->doc_ref);
error_log("DEBUG: - code_journal: " . $debit->code_journal);
error_log("DEBUG: - numero_compte: " . $debit->numero_compte);
error_log("DEBUG: - label_compte: " . $debit->label_compte);
error_log("DEBUG: - montant: " . $debit->montant);
error_log("DEBUG: - sens: " . $debit->sens);
error_log("DEBUG: - fk_doc: " . $debit->fk_doc);
error_log("DEBUG: - fk_user_author: " . $debit->fk_user_author);
$result = $debit->create($user);
error_log("DEBUG: Debit entry create result: " . $result . " (type: " . gettype($result) . ")");
error_log("DEBUG: Debit entry error message: '" . $debit->error . "'");
@ -1292,6 +1304,18 @@ class DeclarationTVA
$credit->fk_doc = $declaration->rowid;
$credit->fk_user_author = $user->id;
// Debug: Log all field values before create
error_log("DEBUG: Credit entry fields before create:");
error_log("DEBUG: - doc_date: " . $credit->doc_date);
error_log("DEBUG: - doc_ref: " . $credit->doc_ref);
error_log("DEBUG: - code_journal: " . $credit->code_journal);
error_log("DEBUG: - numero_compte: " . $credit->numero_compte);
error_log("DEBUG: - label_compte: " . $credit->label_compte);
error_log("DEBUG: - montant: " . $credit->montant);
error_log("DEBUG: - sens: " . $credit->sens);
error_log("DEBUG: - fk_doc: " . $credit->fk_doc);
error_log("DEBUG: - fk_user_author: " . $credit->fk_user_author);
$result = $credit->create($user);
error_log("DEBUG: Credit entry create result: " . $result . " (type: " . gettype($result) . ")");
error_log("DEBUG: Credit entry error message: '" . $credit->error . "'");