Add debugging logs to accounting entry creation
- Add debug logs to track CA-3 lines found - Add debug logs to track OD entries creation - Add debug logs to track line 8, 20, and balancing entries - Help diagnose why no OD journal entries are being created
This commit is contained in:
parent
308ec34a4a
commit
e0e4ff5689
@ -910,6 +910,9 @@ class DeclarationTVA
|
||||
return false;
|
||||
}
|
||||
|
||||
// Debug: Log CA-3 lines found
|
||||
error_log("DEBUG: Found " . count($ca3_lines) . " CA-3 lines for declaration " . $declaration_id);
|
||||
|
||||
// Create lookup array for CA-3 data
|
||||
$ca3_lookup = array();
|
||||
foreach ($ca3_lines as $line) {
|
||||
@ -923,6 +926,7 @@ class DeclarationTVA
|
||||
|
||||
// Create OD journal entries
|
||||
$od_entries = $this->createODJournalEntries($declaration, $ca3_lookup, $journal_config);
|
||||
error_log("DEBUG: OD entries result: " . ($od_entries ? "SUCCESS" : "FAILED"));
|
||||
if (!$od_entries) {
|
||||
return false;
|
||||
}
|
||||
@ -950,18 +954,23 @@ class DeclarationTVA
|
||||
|
||||
// Get line 8 VAT accounts (debit side)
|
||||
$line8_entries = $this->getLine8VATAccountsForAccounting($declaration, $ca3_lookup);
|
||||
error_log("DEBUG: Line 8 entries: " . count($line8_entries));
|
||||
$entries = array_merge($entries, $line8_entries);
|
||||
|
||||
// Get line 20 accounts (credit side)
|
||||
$line20_entries = $this->getLine20AccountsForAccounting($declaration, $ca3_lookup);
|
||||
error_log("DEBUG: Line 20 entries: " . count($line20_entries));
|
||||
$entries = array_merge($entries, $line20_entries);
|
||||
|
||||
// Add balancing entry
|
||||
$balancing_entry = $this->getVATResultEntryForAccounting($declaration, $ca3_lookup, $journal_config);
|
||||
error_log("DEBUG: Balancing entry: " . ($balancing_entry ? "FOUND" : "NONE"));
|
||||
if ($balancing_entry) {
|
||||
$entries[] = $balancing_entry;
|
||||
}
|
||||
|
||||
error_log("DEBUG: Total OD entries to create: " . count($entries));
|
||||
|
||||
// Create accounting entries in Dolibarr
|
||||
return $this->saveAccountingEntries($entries, $declaration);
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user