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 <fridolin.somers@biblibre.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This commit is contained in:
Andrew Nugged 2019-12-19 18:20:24 +02:00 committed by Martin Renvoize
parent 7ecd21a1e4
commit edef63e5a8
No known key found for this signature in database
GPG Key ID: 422B469130441A0F
1 changed files with 2 additions and 2 deletions

View File

@ -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 ) {