diff --git a/core/class/declarationtva.class.php b/core/class/declarationtva.class.php index d5be98f..f5733a2 100644 --- a/core/class/declarationtva.class.php +++ b/core/class/declarationtva.class.php @@ -999,8 +999,11 @@ class DeclarationTVA $bank_config = $config->getBankAccountConfiguration(); $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) { // No bank account configured - skip bank entries + error_log("DEBUG: No bank account configured - skipping bank entries"); return true; } @@ -1262,11 +1265,15 @@ class DeclarationTVA 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; + error_log("DEBUG: Bank account query: " . $sql); $result = $this->db->query($sql); 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; }