From edef63e5a890a80d4cd9b02a4b6cbd7fe3d72890 Mon Sep 17 00:00:00 2001 From: Andrew Nugged Date: Thu, 19 Dec 2019 18:20:24 +0200 Subject: [PATCH] Bug 24185: Make holds page faster - Call to subroutine moved below "if" `$on_shelf_holds` was assigned before "return .. if" but not used in that code piece, so sometimes it was useless. Moved assignment after "return .. if". Signed-off-by: Fridolin Somers Signed-off-by: Jonathan Druart Signed-off-by: Martin Renvoize --- C4/Reserves.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/C4/Reserves.pm b/C4/Reserves.pm index 3074254e57..437180ea76 100644 --- a/C4/Reserves.pm +++ b/C4/Reserves.pm @@ -1241,8 +1241,6 @@ sub IsAvailableForItemLevelRequest { $item->withdrawn || ($item->damaged && !C4::Context->preference('AllowHoldsOnDamagedItems')); - my $on_shelf_holds = Koha::CirculationRules->get_onshelfholds_policy( { item => $item, patron => $patron } ); - if ($pickup_branchcode) { my $destination = Koha::Libraries->find($pickup_branchcode); return 0 unless $destination; @@ -1256,6 +1254,8 @@ sub IsAvailableForItemLevelRequest { return 0 unless $branchitemrule->{hold_fulfillment_policy} ne 'holdgroup' || $home_library->validate_hold_sibling( {branchcode => $pickup_branchcode} ); } + my $on_shelf_holds = Koha::CirculationRules->get_onshelfholds_policy( { item => $item, patron => $patron } ); + if ( $on_shelf_holds == 1 ) { return 1; } elsif ( $on_shelf_holds == 2 ) { -- 2.39.5