From 1e3edf151024915fbd2d2abf5c39884f9ef265b3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 29 Mar 2024 17:08:31 +0100 Subject: [PATCH 1/6] FIX bad search on _ char in like when Debugbar is on --- htdocs/debugbar/class/TraceableDB.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/debugbar/class/TraceableDB.php b/htdocs/debugbar/class/TraceableDB.php index 9b40abdb668..6cae03edf9c 100644 --- a/htdocs/debugbar/class/TraceableDB.php +++ b/htdocs/debugbar/class/TraceableDB.php @@ -292,7 +292,7 @@ class TraceableDB extends DoliDB */ public function escapeforlike($stringtoencode) { - return str_replace(array('_', '\\', '%'), array('\_', '\\\\', '\%'), (string) $stringtoencode); + return $this->db->escapeforlike($stringtoencode); } // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps From bf00047cc448d44283a78327f308bf31c959e2ec Mon Sep 17 00:00:00 2001 From: sonikf <93765174+sonikf@users.noreply.github.com> Date: Sun, 31 Mar 2024 11:54:38 +0300 Subject: [PATCH 2/6] fix #29142 --- htdocs/commande/list.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 36270401bb5..0141f9df4f6 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -480,6 +480,7 @@ if (empty($reshook)) { $rang = ($nbOrders > 1) ? -1 : $lines[$i]->rang; //there may already be rows from previous orders if (!empty($createbills_onebythird)) { + $TFactThirdNbLines[$cmd->socid]++; $rang = $TFactThirdNbLines[$cmd->socid]; } @@ -515,9 +516,6 @@ if (empty($reshook)) { ); if ($result > 0) { $lineid = $result; - if (!empty($createbills_onebythird)) { //increment rang to keep order - $TFactThirdNbLines[$cmd->socid]++; - } } else { $lineid = 0; $error++; From e00e35a2df173210d978655da0338a943a1db990 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Sun, 31 Mar 2024 18:28:57 +0200 Subject: [PATCH 3/6] FIX empty array with php8.2 --- htdocs/user/class/usergroup.class.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/htdocs/user/class/usergroup.class.php b/htdocs/user/class/usergroup.class.php index a96028a5993..e728f099e1d 100644 --- a/htdocs/user/class/usergroup.class.php +++ b/htdocs/user/class/usergroup.class.php @@ -224,6 +224,9 @@ class UserGroup extends CommonObject $ret[$obj->rowid] = $newgroup; } + if (!is_array($ret[$obj->rowid]->usergroup_entity)) { + $ret[$obj->rowid]->usergroup_entity = array(); + } $ret[$obj->rowid]->usergroup_entity[] = $obj->usergroup_entity; } @@ -299,6 +302,9 @@ class UserGroup extends CommonObject } } if ($mode != 1 && !empty($obj->usergroup_entity)) { + if (!is_array($ret[$obj->rowid]->usergroup_entity)) { + $ret[$obj->rowid]->usergroup_entity = array(); + } $ret[$obj->rowid]->usergroup_entity[] = $obj->usergroup_entity; } } From 49af1da76cbd851c2d2b2120e166681ff21ae23b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 31 Mar 2024 19:14:02 +0200 Subject: [PATCH 4/6] Fix #29031 Fix #29059 --- htdocs/core/lib/functions.lib.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 46f462790a8..8abd9593810 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -978,6 +978,9 @@ function sanitizeVal($out = '', $check = 'alphanohtml', $filter = null, $options } break; case 'intcomma': + if (is_array($out)) { + $out = implode(',', $out); + } if (preg_match('/[^0-9,-]+/i', $out)) { $out = ''; } From a001d4825275d78a86cd953521ac4153b21ee5af Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 31 Mar 2024 21:17:20 +0200 Subject: [PATCH 5/6] Clean duplicate comment --- htdocs/core/modules/expedition/doc/pdf_espadon.modules.php | 6 ------ htdocs/core/modules/expedition/doc/pdf_rouget.modules.php | 6 ------ htdocs/core/modules/reception/doc/pdf_squille.modules.php | 6 ------ htdocs/core/modules/stocktransfer/doc/pdf_eagle.modules.php | 6 ------ 4 files changed, 24 deletions(-) diff --git a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php index acd8bf1e262..fdd8809fba9 100644 --- a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php @@ -996,12 +996,6 @@ class pdf_espadon extends ModelePdfExpedition } $pdf->SetDrawColor(128, 128, 128); - if (isModEnabled('barcode')) { - // TODO Build code bar with function writeBarCode of barcode module for sending ref $object->ref - //$pdf->SetXY($this->marge_gauche+3, $this->marge_haute+3); - //$pdf->Image($logo,10, 5, 0, 24); - } - $posx = $this->page_largeur - $w - $this->marge_droite; $posy = $this->marge_haute; diff --git a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php index 9258a1fb58c..5ef1c8d04de 100644 --- a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php @@ -906,12 +906,6 @@ class pdf_rouget extends ModelePdfExpedition } $pdf->SetDrawColor(128, 128, 128); - if (isModEnabled('barcode')) { - // TODO Build code bar with function writeBarCode of barcode module for sending ref $object->ref - //$pdf->SetXY($this->marge_gauche+3, $this->marge_haute+3); - //$pdf->Image($logo,10, 5, 0, 24); - } - $posx = $this->page_largeur - $w - $this->marge_droite; $posy = $this->marge_haute; diff --git a/htdocs/core/modules/reception/doc/pdf_squille.modules.php b/htdocs/core/modules/reception/doc/pdf_squille.modules.php index e7e91dbfd89..fc47c858dc7 100644 --- a/htdocs/core/modules/reception/doc/pdf_squille.modules.php +++ b/htdocs/core/modules/reception/doc/pdf_squille.modules.php @@ -906,12 +906,6 @@ class pdf_squille extends ModelePdfReception } $pdf->SetDrawColor(128, 128, 128); - if (isModEnabled('barcode')) { - // TODO Build code bar with function writeBarCode of barcode module for reception ref $object->ref - //$pdf->SetXY($this->marge_gauche+3, $this->marge_haute+3); - //$pdf->Image($logo,10, 5, 0, 24); - } - $posx = $this->page_largeur - $w - $this->marge_droite; $posy = $this->marge_haute; diff --git a/htdocs/core/modules/stocktransfer/doc/pdf_eagle.modules.php b/htdocs/core/modules/stocktransfer/doc/pdf_eagle.modules.php index 7f42f2e83c2..8a6ad2e17c0 100644 --- a/htdocs/core/modules/stocktransfer/doc/pdf_eagle.modules.php +++ b/htdocs/core/modules/stocktransfer/doc/pdf_eagle.modules.php @@ -992,12 +992,6 @@ class pdf_eagle extends ModelePDFStockTransfer } $pdf->SetDrawColor(128, 128, 128); - if (isModEnabled('barcode')) { - // TODO Build code bar with function writeBarCode of barcode module for sending ref $object->ref - //$pdf->SetXY($this->marge_gauche+3, $this->marge_haute+3); - //$pdf->Image($logo,10, 5, 0, 24); - } - $posx = $this->page_largeur - $w - $this->marge_droite; $posy = $this->marge_haute; From e1e8e45a5294bd8cc98e2dc0d35fcaeb14fb0bfd Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Tue, 2 Apr 2024 18:47:28 +0200 Subject: [PATCH 6/6] Fix cronjob.class.php --- htdocs/cron/class/cronjob.class.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/cron/class/cronjob.class.php b/htdocs/cron/class/cronjob.class.php index 266909fe17b..1c5ed95a7df 100644 --- a/htdocs/cron/class/cronjob.class.php +++ b/htdocs/cron/class/cronjob.class.php @@ -1295,11 +1295,10 @@ class Cronjob extends CommonObject } else { $result = call_user_func_array(array($object, $this->methodename), $params_arr); } - + $errmsg = ''; if ($result === false || (!is_bool($result) && $result != 0)) { $langs->load("errors"); - $errmsg = ''; if (!is_array($object->errors) || !in_array($object->error, $object->errors)) { $errmsg .= $object->error; }