From 96288033a5ba127fc77ab2883dae770c2d51fac5 Mon Sep 17 00:00:00 2001 From: Frank Cools Date: Thu, 9 Oct 2025 00:20:28 +0200 Subject: [PATCH] Translate journal label using dol_gettext() - Use dol_gettext() to translate the journal label key to actual text - Convert 'ACCOUNTING_MISCELLANEOUS_JOURNAL' to proper translated label - Add debug logging to show both original key and translated text - Fix journal label to match working OD journal entries --- core/class/declarationtva.class.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/core/class/declarationtva.class.php b/core/class/declarationtva.class.php index f109377..b4fbafb 100644 --- a/core/class/declarationtva.class.php +++ b/core/class/declarationtva.class.php @@ -1264,13 +1264,14 @@ class DeclarationTVA $debit->fk_user_modification = $user->id; $debit->label_operation = $declaration->declaration_name; - // Get journal label from database + // Get journal label from database and translate it $journal_label_sql = "SELECT label FROM " . MAIN_DB_PREFIX . "accounting_journal WHERE code = 'OD' AND entity = " . $this->entity; $journal_label_result = $this->db->query($journal_label_sql); if ($journal_label_result && $this->db->num_rows($journal_label_result) > 0) { $journal_label_obj = $this->db->fetch_object($journal_label_result); - $debit->journal_label = $journal_label_obj->label; - error_log("DEBUG: Retrieved journal label: " . $journal_label_obj->label); + $translated_label = dol_gettext($journal_label_obj->label); + $debit->journal_label = $translated_label; + error_log("DEBUG: Retrieved journal label: " . $journal_label_obj->label . " -> " . $translated_label); } else { error_log("DEBUG: No journal label found for OD code"); } @@ -1318,13 +1319,14 @@ class DeclarationTVA $credit->fk_user_modification = $user->id; $credit->label_operation = $declaration->declaration_name; - // Get journal label from database + // Get journal label from database and translate it $journal_label_sql = "SELECT label FROM " . MAIN_DB_PREFIX . "accounting_journal WHERE code = 'OD' AND entity = " . $this->entity; $journal_label_result = $this->db->query($journal_label_sql); if ($journal_label_result && $this->db->num_rows($journal_label_result) > 0) { $journal_label_obj = $this->db->fetch_object($journal_label_result); - $credit->journal_label = $journal_label_obj->label; - error_log("DEBUG: Retrieved journal label: " . $journal_label_obj->label); + $translated_label = dol_gettext($journal_label_obj->label); + $credit->journal_label = $translated_label; + error_log("DEBUG: Retrieved journal label: " . $journal_label_obj->label . " -> " . $translated_label); } else { error_log("DEBUG: No journal label found for OD code"); }