From 04322b97ce2e70080dee0c4524df0a493c9a39a6 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". --- C4/Reserves.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/C4/Reserves.pm b/C4/Reserves.pm index 503771e914..d048f2aae9 100644 --- a/C4/Reserves.pm +++ b/C4/Reserves.pm @@ -1220,8 +1220,6 @@ sub IsAvailableForItemLevelRequest { $item->withdrawn || ($item->damaged && !C4::Context->preference('AllowHoldsOnDamagedItems')); - my $on_shelf_holds = Koha::IssuingRules->get_onshelfholds_policy( { item => $item, patron => $patron } ); - if ($pickup_branchcode) { my $destination = Koha::Libraries->find($pickup_branchcode); return 0 unless $destination; @@ -1235,6 +1233,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::IssuingRules->get_onshelfholds_policy( { item => $item, patron => $patron } ); + if ( $on_shelf_holds == 1 ) { return 1; } elsif ( $on_shelf_holds == 2 ) { -- 2.17.1