From 836ad7e7c4343eea8fdecc3a2a2776200748f3ab 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 Signed-off-by: Nick Clemens --- .../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 b532ff9fe74..af0e79c8c47 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/holds_table.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/holds_table.inc @@ -31,17 +31,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 -%] @@ -67,7 +61,13 @@ [% IF Koha.Preference('HoldsSplitQueue') == "nothing" && !hold.found %]