From e4987c8f3bc22f64eac05e7bcb0fbaf7fa245670 Mon Sep 17 00:00:00 2001 From: Eric <1468823+rycks@users.noreply.github.com> Date: Wed, 18 Oct 2023 03:05:05 +0200 Subject: [PATCH] fix #26244 todelete could contains dupplicate val (#26245) --- htdocs/core/actions_massactions.inc.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index 225e118b2a0..b2cd79f2c9b 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -1291,7 +1291,9 @@ if (!$error && ($massaction == 'delete' || ($action == 'delete' && $confirm == ' $objecttmp = new $objectclass($db); $nbok = 0; - foreach ($toselect as $toselectid) { + //$toselect could contain duplicate entries, cf https://github.com/Dolibarr/dolibarr/issues/26244 + $unique_arr = array_unique($toselect); + foreach ($unique_arr as $toselectid) { $result = $objecttmp->fetch($toselectid); if ($result > 0) { // Refuse deletion for some objects/status