20 lines
880 B
Diff
20 lines
880 B
Diff
# UNDF: UNDF-2026-000000868
|
|
--- a/htdocs/accountancy/class/bookkeeping.class.php
|
|
+++ b/htdocs/accountancy/class/bookkeeping.class.php
|
|
@@ -3720,6 +3720,7 @@
|
|
$resqlAlreadyExtourne = $this->db->query($sqlAlreadyExtourne);
|
|
$alreadyExtourneT = array();
|
|
+ $alreadyExtourneSet = array(); // Hash set for O(1) lookup instead of O(N) in_array
|
|
if ($resqlAlreadyExtourne) {
|
|
while ($obj4 = $this->db->fetch_object($resqlAlreadyExtourne)) {
|
|
$alreadyExtourneT []= $obj4->piece_num;
|
|
+ $alreadyExtourneSet[$obj4->piece_num] = true;
|
|
}
|
|
}
|
|
@@ -3753,7 +3755,7 @@
|
|
|
|
if ($bookKeeping->fetch($extourneId)) {
|
|
- if (in_array($bookKeeping->piece_num, $alreadyExtourneT)) {
|
|
+ if (isset($alreadyExtourneSet[$bookKeeping->piece_num])) {
|
|
setEventMessages($langs->trans("AlreadyReturnedAccount", $bookKeeping->piece_num), null, 'errors');
|
|
} else {
|