diff --git a/core/class/declarationtva.class.php b/core/class/declarationtva.class.php index fb389f4..4464a28 100644 --- a/core/class/declarationtva.class.php +++ b/core/class/declarationtva.class.php @@ -1264,6 +1264,14 @@ class DeclarationTVA $debit->fk_user_modification = $user->id; $debit->label_operation = $declaration->declaration_name; + // Get journal label from database + $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; + } + // Final check of montant before create error_log("DEBUG: Final montant check before create: " . $debit->montant); @@ -1307,6 +1315,14 @@ class DeclarationTVA $credit->fk_user_modification = $user->id; $credit->label_operation = $declaration->declaration_name; + // Get journal label from database + $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; + } + // Final check of montant before create error_log("DEBUG: Final montant check before create: " . $credit->montant);