From d784f3e22b80d2d2b9289d9c9f6ce9a1a1694cdd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 4 Jan 2025 09:30:26 +0100 Subject: [PATCH 1/5] Update .pre-commit-config.yaml --- .pre-commit-config.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 6c5643e6e78..79f360dbd2d 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -154,6 +154,7 @@ repos: ] pass_filenames: false # Run on all files - id: php-lint + stages: [manual] - id: php-stan stages: [manual] files: \.(php)$ From f5c32492b254846eab62ca649836d93d107464ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20France?= Date: Sat, 4 Jan 2025 15:42:01 +0100 Subject: [PATCH 2/5] exclude directory --- .pre-commit-config.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 79f360dbd2d..942c72fe876 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -154,7 +154,8 @@ repos: ] pass_filenames: false # Run on all files - id: php-lint - stages: [manual] + exclude: + (?x)^(htdocs/includes/.*)$ - id: php-stan stages: [manual] files: \.(php)$ From 027e05eef3999b8528f92647f163f10d9db7821e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20France?= Date: Sat, 4 Jan 2025 16:19:40 +0100 Subject: [PATCH 3/5] fix --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 942c72fe876..2790006957e 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -155,7 +155,7 @@ repos: pass_filenames: false # Run on all files - id: php-lint exclude: - (?x)^(htdocs/includes/.*)$ + (?x)^(htdocs/includes/symfony/.*)$ - id: php-stan stages: [manual] files: \.(php)$ From 51de37712b36839556e3b26ada6e68525b6b0f63 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20France?= Date: Sat, 4 Jan 2025 16:24:17 +0100 Subject: [PATCH 4/5] fix --- .../includes/tecnickcom/tcpdf/include/barcodes/pdf417.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/includes/tecnickcom/tcpdf/include/barcodes/pdf417.php b/htdocs/includes/tecnickcom/tcpdf/include/barcodes/pdf417.php index 3b1774eaae4..9a58a21f673 100644 --- a/htdocs/includes/tecnickcom/tcpdf/include/barcodes/pdf417.php +++ b/htdocs/includes/tecnickcom/tcpdf/include/barcodes/pdf417.php @@ -878,7 +878,7 @@ class PDF417 { $txtarr = array(); // array of characters and sub-mode switching characters $codelen = strlen($code); for ($i = 0; $i < $codelen; ++$i) { - $chval = ord($code{$i}); + $chval = ord($code[$i]); if (($k = array_search($chval, $this->textsubmodes[$submode])) !== false) { // we are on the same sub-mode $txtarr[] = $k; @@ -888,7 +888,7 @@ class PDF417 { // search new sub-mode if (($s != $submode) AND (($k = array_search($chval, $this->textsubmodes[$s])) !== false)) { // $s is the new submode - if (((($i + 1) == $codelen) OR ((($i + 1) < $codelen) AND (array_search(ord($code{($i + 1)}), $this->textsubmodes[$submode]) !== false))) AND (($s == 3) OR (($s == 0) AND ($submode == 1)))) { + if (((($i + 1) == $codelen) OR ((($i + 1) < $codelen) AND (array_search(ord($code[($i + 1)]), $this->textsubmodes[$submode]) !== false))) AND (($s == 3) OR (($s == 0) AND ($submode == 1)))) { // shift (temporary change only for this char) if ($s == 3) { // shift to puntuaction @@ -952,7 +952,7 @@ class PDF417 { $cw = array_merge($cw, $cw6); } else { for ($i = 0; $i < $sublen; ++$i) { - $cw[] = ord($code{$i}); + $cw[] = ord($code[$i]); } } $code = $rest; From 724567c291ad343f3f9a6e884c1e61dc318f5314 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Sat, 4 Jan 2025 22:44:57 +0100 Subject: [PATCH 5/5] FIX broken feature with check $pa_ht_isemptystring --- htdocs/commande/class/commande.class.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index f5adbc2b460..eeaadca9ada 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -1535,7 +1535,7 @@ class Commande extends CommonOrder $pu_ht = price2num($pu_ht); $pu_ht_devise = price2num($pu_ht_devise); $pu_ttc = price2num($pu_ttc); - $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 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' } @@ -4466,6 +4466,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 dol_syslog(get_class($this)."::insert rang=".$this->rang); @@ -4506,9 +4507,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 = ''; }