From 2fa3bc882303a9ce2de7693d59c0520ba9134d9a Mon Sep 17 00:00:00 2001 From: sparkyx Date: Tue, 18 Jun 2024 16:20:27 +0200 Subject: [PATCH] TVA-CODE small bug --- include/class/acc_ledger_purchase.class.php | 2 +- include/class/acc_ledger_sale.class.php | 2 +- include/class/acc_tva.class.php | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/include/class/acc_ledger_purchase.class.php b/include/class/acc_ledger_purchase.class.php index 06e2f3baa..c5b36ca87 100644 --- a/include/class/acc_ledger_purchase.class.php +++ b/include/class/acc_ledger_purchase.class.php @@ -168,7 +168,7 @@ class Acc_Ledger_Purchase extends Acc_Ledger if ( $g_parameter->MY_TVA_USE=='Y') { $tva_rate = Acc_Tva::build($this->db,${'e_march' . $i . '_tva_id'}); - if ($tva_rate === null) + if ($tva_rate->tva_id == -1) throw new Exception(_('La fiche ').${'e_march'.$i}._('a un code tva invalide').' ['.${'e_march'.$i.'_tva_id'}.']',13); $tva_rate->load(); /* diff --git a/include/class/acc_ledger_sale.class.php b/include/class/acc_ledger_sale.class.php index 369c782bb..bde50793d 100644 --- a/include/class/acc_ledger_sale.class.php +++ b/include/class/acc_ledger_sale.class.php @@ -157,7 +157,7 @@ class Acc_Ledger_Sale extends Acc_Ledger { if ($g_parameter->MY_TVA_USE == 'Y') { $tva_rate = Acc_Tva::build($this->db,${'e_march' . $i . '_tva_id'}); $tva_rate->load(); - if ($tva_rate === null) + if ($tva_rate->tva_id === -1 ) throw new Exception(_('La fiche ') . ${'e_march' . $i} . _('a un code tva invalide') . ' [' . ${'e_march' . $i . '_tva_id'} . ']', 13); $tva_rate->load(); diff --git a/include/class/acc_tva.class.php b/include/class/acc_tva.class.php index 6ab1eb3e1..141faacfc 100644 --- a/include/class/acc_tva.class.php +++ b/include/class/acc_tva.class.php @@ -104,9 +104,10 @@ class Acc_Tva } /** - *Load the VAT, + *@brief Load the VAT, return 0 if the TVA_ID exists otherwise -1 *@note if the label is not found then we get an message error, so the best is probably *to initialize the VAT object with default value + * */ public function load():int {