From 91b90d7409b4a206998972327d2bd9b741573edb Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Sun, 5 Jan 2025 15:41:29 +0100 Subject: [PATCH 1/4] FIX avoid phan error --- htdocs/commande/class/commande.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index eeaadca9ada..16bffa5f448 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -4465,6 +4465,7 @@ class OrderLine extends CommonOrderLine { $error = 0; + // @phpstan-ignore-next-line @phan-suppress-next-line PhanTypeMismatchProperty $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 From d42c8ba012496cefcfdca1f4b546158cde86a7f8 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Sun, 5 Jan 2025 15:50:09 +0100 Subject: [PATCH 2/4] FIX quelle perte de temps --- htdocs/commande/class/commande.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 16bffa5f448..e6b0dac13ed 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -1535,6 +1535,7 @@ class Commande extends CommonOrder $pu_ht = price2num($pu_ht); $pu_ht_devise = price2num($pu_ht_devise); $pu_ttc = price2num($pu_ttc); + // @phpstan-ignore-next-line @phan-suppress-next-line PhanTypeMismatchProperty $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,1' or '5.1' or '5.1(XXX)', we must clean only if '5,1' @@ -4465,7 +4466,6 @@ class OrderLine extends CommonOrderLine { $error = 0; - // @phpstan-ignore-next-line @phan-suppress-next-line PhanTypeMismatchProperty $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 From 22ed2d6a259178fd46e93639e5c5d89dbe0744c7 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Sun, 5 Jan 2025 16:02:23 +0100 Subject: [PATCH 3/4] FIX tic tac tic tac --- htdocs/commande/class/commande.class.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index e6b0dac13ed..cf754586c9f 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -1535,7 +1535,6 @@ class Commande extends CommonOrder $pu_ht = price2num($pu_ht); $pu_ht_devise = price2num($pu_ht_devise); $pu_ttc = price2num($pu_ttc); - // @phpstan-ignore-next-line @phan-suppress-next-line PhanTypeMismatchProperty $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,1' or '5.1' or '5.1(XXX)', we must clean only if '5,1' @@ -4248,7 +4247,7 @@ class OrderLine extends CommonOrderLine /** * Buy price without taxes - * @var float + * @var float|null */ public $pa_ht; public $marge_tx; From 56e03c5d19b76a8f9e720f459c1aa14364d911d0 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Sun, 5 Jan 2025 16:09:03 +0100 Subject: [PATCH 4/4] FIX on the road again --- htdocs/commande/class/commande.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index cf754586c9f..26bb1125cbf 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -4247,7 +4247,7 @@ class OrderLine extends CommonOrderLine /** * Buy price without taxes - * @var float|null + * @var float|string|null */ public $pa_ht; public $marge_tx;