TVA-CODE small bug

This commit is contained in:
sparkyx 2024-06-18 16:20:27 +02:00
parent 2e9b11932d
commit 2fa3bc8823
3 changed files with 4 additions and 3 deletions

View file

@ -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();
/*

View file

@ -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();

View file

@ -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
{