From 8dc6110c459b080b43476552ef96275d79111912 Mon Sep 17 00:00:00 2001 From: Tim Otte Date: Tue, 15 Sep 2020 11:33:22 +0200 Subject: [PATCH] Fixed a bug where a price equal zero would be replaced with the product price --- htdocs/comm/propal/card.php | 4 ++-- htdocs/commande/card.php | 2 +- htdocs/compta/facture/card.php | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index f275f16ee03..6ee54218adc 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -825,7 +825,7 @@ if (empty($reshook)) $error++; } - if ($prod_entry_mode == 'free' && empty($idprod) && $price_ht == '' && $price_ht_devise == '') // Unit price can be 0 but not ''. Also price can be negative for proposal. + if ($prod_entry_mode == 'free' && empty($idprod) && $price_ht === '' && $price_ht_devise === '') // Unit price can be 0 but not ''. Also price can be negative for proposal. { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("UnitPriceHT")), null, 'errors'); $error++; @@ -966,7 +966,7 @@ if (empty($reshook)) $tmpprodvat = price2num(preg_replace('/\s*\(.*\)/', '', $prod->tva_tx)); // if price ht is forced (ie: calculated by margin rate and cost price). TODO Why this ? - if (!empty($price_ht)) { + if (isset($price_ht)) { $pu_ht = price2num($price_ht, 'MU'); $pu_ttc = price2num($pu_ht * (1 + ($tmpvat / 100)), 'MU'); } // On reevalue prix selon taux tva car taux tva transaction peut etre different diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 8cc3fd48aca..01db6a68fb9 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -820,7 +820,7 @@ if (empty($reshook)) $tmpprodvat = price2num(preg_replace('/\s*\(.*\)/', '', $prod->tva_tx)); // if price ht is forced (ie: calculated by margin rate and cost price). TODO Why this ? - if (!empty($price_ht)) { + if (isset($price_ht)) { $pu_ht = price2num($price_ht, 'MU'); $pu_ttc = price2num($pu_ht * (1 + ($tmpvat / 100)), 'MU'); } diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 3d06f665e22..79936020cb4 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -2016,7 +2016,7 @@ if (empty($reshook)) $tmpprodvat = price2num(preg_replace('/\s*\(.*\)/', '', $prod->tva_tx)); // if price ht was forced (ie: from gui when calculated by margin rate and cost price). TODO Why this ? - if (!empty($price_ht)) + if (isset($price_ht)) { $pu_ht = price2num($price_ht, 'MU'); $pu_ttc = price2num($pu_ht * (1 + ($tmpvat / 100)), 'MU');