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