Add detailed field debugging and journal code validation
- Log all Bookkeeping field values before create() call - Check if journal code 'OD' exists in accounting_journal table - Help identify which field or validation is causing the -1 return - Debug the exact field values being passed to create()
This commit is contained in:
parent
285bbb0ce9
commit
1fdbf7be62
@ -1251,6 +1251,18 @@ class DeclarationTVA
|
||||
$debit->import_key = '';
|
||||
$debit->entity = $this->entity;
|
||||
|
||||
// Debug: Log all field values before create
|
||||
error_log("DEBUG: Debit entry fields - doc_date: " . $debit->doc_date . ", doc_ref: " . $debit->doc_ref . ", code_journal: " . $debit->code_journal . ", numero_compte: " . $debit->numero_compte . ", montant: " . $debit->montant . ", sens: " . $debit->sens . ", fk_doc: " . $debit->fk_doc . ", entity: " . $debit->entity);
|
||||
|
||||
// Check if journal code exists
|
||||
$journal_check_sql = "SELECT code FROM " . MAIN_DB_PREFIX . "accounting_journal WHERE code = 'OD' AND entity = " . $this->entity;
|
||||
$journal_check_result = $this->db->query($journal_check_sql);
|
||||
if ($journal_check_result && $this->db->num_rows($journal_check_result) > 0) {
|
||||
error_log("DEBUG: Journal code 'OD' exists in system");
|
||||
} else {
|
||||
error_log("DEBUG: Journal code 'OD' NOT FOUND in system - this might be the issue");
|
||||
}
|
||||
|
||||
$result = $debit->create($user);
|
||||
error_log("DEBUG: Debit entry create result: " . $result . " (type: " . gettype($result) . ")");
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user