Add debugging for bank account details

- Add debug logs to track bank account ID from config
- Add debug logs to show bank account query and results
- Help identify why bank account code is empty
This commit is contained in:
Frank Cools 2025-10-08 22:00:55 +02:00
parent 2bdb44ee00
commit 0dcab38b4a

View File

@ -999,8 +999,11 @@ class DeclarationTVA
$bank_config = $config->getBankAccountConfiguration(); $bank_config = $config->getBankAccountConfiguration();
$bank_account_id = $bank_config['bank_account']; $bank_account_id = $bank_config['bank_account'];
error_log("DEBUG: Bank account ID from config: " . $bank_account_id);
if (empty($bank_account_id) || $bank_account_id == 0) { if (empty($bank_account_id) || $bank_account_id == 0) {
// No bank account configured - skip bank entries // No bank account configured - skip bank entries
error_log("DEBUG: No bank account configured - skipping bank entries");
return true; return true;
} }
@ -1262,11 +1265,15 @@ class DeclarationTVA
LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account a ON a.rowid = ba.account_number LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account a ON a.rowid = ba.account_number
WHERE ba.rowid = " . (int)$bank_account_id . " AND ba.entity = " . $this->entity; WHERE ba.rowid = " . (int)$bank_account_id . " AND ba.entity = " . $this->entity;
error_log("DEBUG: Bank account query: " . $sql);
$result = $this->db->query($sql); $result = $this->db->query($sql);
if ($result && $this->db->num_rows($result) > 0) { if ($result && $this->db->num_rows($result) > 0) {
return $this->db->fetch_array($result); $bank_data = $this->db->fetch_array($result);
error_log("DEBUG: Bank account data: " . print_r($bank_data, true));
return $bank_data;
} }
error_log("DEBUG: No bank account found for ID: " . $bank_account_id);
return false; return false;
} }