Remove OD entries debug code to clean up logs

- Remove verbose debug logging for OD journal entries creation
- Keep only essential error handling for OD entries
- Focus debug output on bank journal entries issue
- Clean up overwhelming log output while maintaining bank debugging
This commit is contained in:
Frank Cools 2025-10-09 00:54:25 +02:00
parent 1fc83fe5d0
commit 44b0cfa249

View File

@ -895,7 +895,6 @@ class DeclarationTVA
*/
public function createAccountingEntries($declaration_id, $user)
{
error_log("DEBUG: createAccountingEntries called for declaration ID: " . $declaration_id);
// Get declaration data
$fetch_result = $this->fetch($declaration_id);
@ -958,7 +957,6 @@ class DeclarationTVA
// Create OD journal entries
$od_entries = $this->createODJournalEntries($declaration, $ca3_lookup, $journal_config, $user);
error_log("DEBUG: OD entries result: " . ($od_entries ? "SUCCESS" : "FAILED"));
if (!$od_entries) {
return false;
}
@ -1312,19 +1310,8 @@ class DeclarationTVA
error_log("DEBUG: No journal label found for OD code");
}
// 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) . ")");
error_log("DEBUG: Debit entry error message: '" . $debit->error . "'");
error_log("DEBUG: Debit entry ID after create: " . $debit->id);
// Check if entry was created successfully (ID > 0 means success)
if ($debit->id > 0) {
error_log("DEBUG: Debit entry created successfully with ID: " . $debit->id);
} else {
if ($debit->id <= 0) {
throw new Exception('Failed to create debit entry: ' . $debit->error);
}
}
@ -1373,19 +1360,8 @@ class DeclarationTVA
error_log("DEBUG: No journal label found for OD code");
}
// 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) . ")");
error_log("DEBUG: Credit entry error message: '" . $credit->error . "'");
error_log("DEBUG: Credit entry ID after create: " . $credit->id);
// Check if entry was created successfully (ID > 0 means success)
if ($credit->id > 0) {
error_log("DEBUG: Credit entry created successfully with ID: " . $credit->id);
} else {
if ($credit->id <= 0) {
throw new Exception('Failed to create credit entry: ' . $credit->error);
}
}
@ -1535,7 +1511,6 @@ class DeclarationTVA
}
// Create accounting entries
error_log("DEBUG: About to call createAccountingEntries with user: " . ($user ? "VALID" : "NULL"));
$accounting_result = $this->createAccountingEntries($declaration_id, $user);
if (!$accounting_result) {
$this->error = 'Failed to create accounting entries: ' . $this->error;