From eb956eb4cf3d44f45ad54be58fe95d7355a2b8bf Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Tue, 23 Apr 2019 18:03:33 +0000 Subject: [PATCH] Bug 22753: Fix hold priority adjustment, move to top Since the holds table can be split we need to calculate the first priority for each table. However, currently we use the first in the loop, not taking into account the waiting status. This patchset sets the first_priority to the first non-found hold Additionally, some clean-up is done to not display the alter priority arrows for waiting holds. To test: 1 - Place several holds on a title 2 - Confirm one of the holds to be waiting 3 - Attempt to move the last hold to the top 4 - Nothing happens 5 - Apply patch 6 - Note that the waiting hold has no options to move in the list 7 - Attempt to move the last hold to the top 8 - It moves as expected! 9 - Split the holds queue by pickup library 10 - PLace some holds for pickup at another branch 11 - Confirm moving these holds works within their own table 12 - Unsplit the queue 13 - Ensure the holds end where you expect (moving in a split table didn't move above holds form another table) Signed-off-by: Liz Rea Signed-off-by: Katrin Fischer Signed-off-by: Nick Clemens --- .../prog/en/includes/holds_table.inc | 74 +++++++++++-------- 1 file changed, 42 insertions(+), 32 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 995c7d28df..9181f19507 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/holds_table.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/holds_table.inc @@ -20,7 +20,11 @@ [% IF SuspendHoldsIntranet %] [% END %] + [% SET first_priority = 0 %] + [% SET last_priority = holds.last.priority %] + [% FOREACH hold IN holds %] + [% IF !hold.found && first_priority == 0 %][% first_priority = hold.priority %][% END %] @@ -70,29 +74,31 @@ [% IF ( CAN_user_reserveforothers_modify_holds_priority ) %] - [% SET first_priority = holds.first.priority %] - [% SET last_priority = holds.last.priority %] - [% SET prev_priority = loop.prev.priority %] - [% SET next_priority = loop.next.priority %] - [% holds.index | html %] - - - - Go up - - - - Go top - - - - Go bottom - - - - Go down - - + [% UNLESS hold.found %] + [% SET prev_priority = loop.prev.priority %] + [% SET next_priority = loop.next.priority %] + [% holds.index | html %] + + + + Go up + + + + Go top + + + + Go bottom + + + + Go down + + + [% ELSE %] + + [% END %] [% END %] @@ -161,15 +167,19 @@ [% IF ( CAN_user_reserveforothers_modify_holds_priority ) %] - - - [% IF ( hold.lowestPriority ) %] - Unset lowest priority - [% ELSE %] - Set to lowest priority - [% END %] - - + [% UNLESS hold.found %] + + + [% IF ( hold.lowestPriority ) %] + Unset lowest priority + [% ELSE %] + Set to lowest priority + [% END %] + + + [% ELSE %] + + [% END %] [% END %] -- 2.39.5