From 61bc28597b4f2bb5cd38161a2f7639dfa9886c4a Mon Sep 17 00:00:00 2001 From: Frank Cools Date: Tue, 7 Oct 2025 11:59:00 +0200 Subject: [PATCH] Add debugging to getAccountLabel method to diagnose account name issue - Added error_log statements to track account lookup process - Removed entity filtering temporarily to test if that's the issue - Will help identify why account names are not showing from chart of accounts - Check error logs after generating PDF to see what's happening --- core/class/declarationtva_pdf.class.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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; }