diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index c633ac44b74..6fa8a2bd379 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -612,7 +612,7 @@ class Propal extends CommonObject } $txlocaltax1 = price2num($txlocaltax1); $txlocaltax2 = price2num($txlocaltax2); - $pa_ht = price2num($pa_ht); + $pa_ht = price2num($pa_ht); // do not convert to float here, it breaks the functioning of $pa_ht_isemptystring if ($price_base_type == 'HT') { $pu = $pu_ht; } else { @@ -840,7 +840,7 @@ class Propal extends CommonObject } $txlocaltax1 = price2num($txlocaltax1); $txlocaltax2 = price2num($txlocaltax2); - $pa_ht = price2num($pa_ht); + $pa_ht = price2num($pa_ht); // do not convert to float here, it breaks the functioning of $pa_ht_isemptystring if (empty($qty) && empty($special_code)) { $special_code = 3; // Set option tag } @@ -4234,6 +4234,7 @@ class PropaleLigne extends CommonObjectLine dol_syslog(get_class($this)."::insert rang=".$this->rang); $pa_ht_isemptystring = (empty($this->pa_ht) && $this->pa_ht == ''); // If true, we can use a default value. If this->pa_ht = '0', we must use '0'. + $this->pa_ht = (float) $this->pa_ht; // convert to float after check if empty value // Clean parameters if (empty($this->tva_tx)) { @@ -4278,9 +4279,6 @@ class PropaleLigne extends CommonObjectLine if (!is_numeric($this->qty)) { $this->qty = 0; } - if (empty($this->pa_ht)) { - $this->pa_ht = 0; - } if (empty($this->multicurrency_subprice)) { $this->multicurrency_subprice = 0; } @@ -4453,6 +4451,7 @@ class PropaleLigne extends CommonObjectLine $error = 0; $pa_ht_isemptystring = (empty($this->pa_ht) && $this->pa_ht == ''); // If true, we can use a default value. If this->pa_ht = '0', we must use '0'. + $this->pa_ht = (float) $this->pa_ht; // convert to float after check if empty value if (empty($this->id) && !empty($this->rowid)) { $this->id = $this->rowid; @@ -4507,9 +4506,6 @@ class PropaleLigne extends CommonObjectLine if (empty($this->subprice)) { $this->subprice = 0; } - if (empty($this->pa_ht)) { - $this->pa_ht = 0; - } // if buy price not defined, define buyprice as configured in margin admin if ($this->pa_ht == 0 && $pa_ht_isemptystring) { diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 26bb1125cbf..2ac0d52671a 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -3130,7 +3130,7 @@ class Commande extends CommonOrder $remise_percent = (float) price2num($remise_percent); $qty = (float) price2num($qty); $pu = price2num($pu); - $pa_ht = (float) price2num($pa_ht); + $pa_ht = price2num($pa_ht); // do not convert to float here, it breaks the functioning of $pa_ht_isemptystring $pu_ht_devise = price2num($pu_ht_devise); if (!preg_match('/\((.*)\)/', (string) $txtva)) { $txtva = price2num($txtva); // $txtva can have format '5.0(XXX)' or '5' @@ -4629,6 +4629,7 @@ class OrderLine extends CommonOrderLine $error = 0; $pa_ht_isemptystring = (empty($this->pa_ht) && $this->pa_ht == ''); // If true, we can use a default value. If this->pa_ht = '0', we must use '0'. + $this->pa_ht = (float) $this->pa_ht; // convert to float after check if empty value // Clean parameters if (empty($this->tva_tx)) { @@ -4679,9 +4680,6 @@ class OrderLine extends CommonOrderLine if (empty($this->fk_parent_line)) { $this->fk_parent_line = 0; } - if (empty($this->pa_ht)) { - $this->pa_ht = 0; - } if (empty($this->ref_ext)) { $this->ref_ext = ''; } diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 700f6fac245..00caede5161 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -3877,7 +3877,7 @@ class Facture extends CommonInvoice $pu_ht = price2num($pu_ht); $pu_ht_devise = price2num($pu_ht_devise); $pu_ttc = price2num($pu_ttc); - $pa_ht = price2num($pa_ht); + $pa_ht = price2num($pa_ht); // do not convert to float here, it breaks the functioning of $pa_ht_isemptystring if (!preg_match('/\((.*)\)/', (string) $txtva)) { $txtva = price2num($txtva); // $txtva can have format '5.0(XXX)' or '5' } @@ -4137,7 +4137,7 @@ class Facture extends CommonInvoice $qty = price2num($qty); $pu = price2num($pu); $pu_ht_devise = price2num($pu_ht_devise); - $pa_ht = price2num($pa_ht); + $pa_ht = price2num($pa_ht); // do not convert to float here, it breaks the functioning of $pa_ht_isemptystring if (!preg_match('/\((.*)\)/', (string) $txtva)) { $txtva = price2num($txtva); // $txtva can have format '5.0(XXX)' or '5' } @@ -6256,6 +6256,7 @@ class FactureLigne extends CommonInvoiceLine $error = 0; $pa_ht_isemptystring = (empty($this->pa_ht) && $this->pa_ht == ''); // If true, we can use a default value. If this->pa_ht = '0', we must use '0'. + $this->pa_ht = (float) $this->pa_ht; // convert to float after check if empty value dol_syslog(get_class($this)."::insert rang=".$this->rang, LOG_DEBUG); @@ -6496,6 +6497,7 @@ class FactureLigne extends CommonInvoiceLine $error = 0; $pa_ht_isemptystring = (empty($this->pa_ht) && $this->pa_ht == ''); // If true, we can use a default value. If this->pa_ht = '0', we must use '0'. + $this->pa_ht = (float) $this->pa_ht; // convert to float after check if empty value // Clean parameters $this->desc = trim($this->desc);