diff --git a/core/class/declarationtva_pdf.class.php b/core/class/declarationtva_pdf.class.php index 6ad4fbb..8407ffe 100644 --- a/core/class/declarationtva_pdf.class.php +++ b/core/class/declarationtva_pdf.class.php @@ -2119,16 +2119,21 @@ class DeclarationTVA_PDF { $sql = "SELECT label FROM " . MAIN_DB_PREFIX . "accounting_account WHERE account_number = '" . $this->db->escape($account_code) . "' - AND entity = " . $this->entity . " AND active = 1 LIMIT 1"; + // Debug logging + error_log("DeclarationTVA: Looking for account " . $account_code . " with entity " . $this->entity); + error_log("DeclarationTVA: SQL query: " . $sql); + $result = $this->db->query($sql); if ($result && $this->db->num_rows($result) > 0) { $obj = $this->db->fetch_object($result); + error_log("DeclarationTVA: Found account label: " . $obj->label); return $obj->label; } + error_log("DeclarationTVA: Account " . $account_code . " not found, using generic label"); // If account not found in chart of accounts, return generic label return 'Compte ' . $account_code; }