From 922a76249c1b86bde3aa82d752b4b225a379d876 Mon Sep 17 00:00:00 2001 From: Lucas Gass Date: Tue, 7 May 2024 16:03:54 +0000 Subject: [PATCH] Bug 36797: Change WHILE loop into FOREACH To test: 1. Find a record that has 1000 non-waiting holds with different priorities. 2. Try loading the reserve page for that record ( /reserve/request.pl?biblionumber=X ) 3. Error: Template process failed: undef error - WHILE loop terminated (> 1000 iterations) 4. APPLY PATCH 5. Try again, this time the page should load. 6. Try testing on a record with less than 1000 holds, making sure the priorities are still set right. 7. Make sure you can change your priorities and everything works right. Signed-off-by: Martin Renvoize --- .../prog/en/includes/holds_table.inc | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/holds_table.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/holds_table.inc index e939247f4b2..9b6850d3b9a 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/holds_table.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/holds_table.inc @@ -27,17 +27,11 @@ [%- SET found_holds = 0 -%] [%- SET last_priority = holds.last.priority -%] - [% BLOCK priority_dropdown %] - [%- SET loop_priority = 1 -%] - [%- WHILE loop_priority <= last_priority -%] - [%- IF this_priority == loop_priority -%] - - [%- ELSE -%] - - [%- END -%] - [%- loop_priority = loop_priority + 1- %] - [%- END -%] + [% SET all_priorities = [] %] + [% FOREACH hold IN holds %] + [% all_priorities.push( hold.priority ) %] [% END %] + [% FOREACH hold IN holds %] [%- IF !hold.found && first_priority == 0 -%] @@ -63,7 +57,13 @@ [% IF Koha.Preference('HoldsSplitQueue') == "nothing" && !hold.found %]