FIX same broken feature for propal and invoice

This commit is contained in:
Regis Houssin
2025-01-05 17:30:54 +01:00
parent fdd39afc6d
commit 672992a791
3 changed files with 10 additions and 14 deletions

View File

@@ -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 = '';
}