fix #26244 todelete could contains dupplicate val (#26245)

This commit is contained in:
Eric 2023-10-18 03:05:05 +02:00 committed by GitHub
parent 95a15ae6f9
commit e4987c8f3b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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