@@ -, +, @@ --- C4/HoldsQueue.pm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) --- a/C4/HoldsQueue.pm +++ a/C4/HoldsQueue.pm @@ -370,13 +370,14 @@ sub GetItemsAvailableToFillHoldRequestsForBib { =cut +our $libraries = { map { $_->branchcode => $_ } Koha::Libraries->search()->as_list() }; sub _checkHoldPolicy { my ($item, $request) = @_; return 0 unless $item->{holdallowed}; return 0 if $item->{holdallowed} == 1 && $item->{homebranch} ne $request->{borrowerbranch}; - my $library = Koha::Libraries->find($item->{homebranch}); + my $library = $libraries->{$item->{homebranch}}; return 0 if $item->{'holdallowed'} == 3 && !$library->validate_hold_sibling({branchcode => $request->{borrowerbranch}}); @@ -386,7 +387,7 @@ sub _checkHoldPolicy { return 0 if $hold_fulfillment_policy eq 'homebranch' && $request->{branchcode} ne $item->{$hold_fulfillment_policy}; return 0 if $hold_fulfillment_policy eq 'holdingbranch' && $request->{branchcode} ne $item->{$hold_fulfillment_policy}; - my $patronLibrary = Koha::Libraries->find($request->{borrowerbranch}); + my $patronLibrary = $libraries->{$request->{borrowerbranch}}; return 0 if $hold_fulfillment_policy eq 'patrongroup' && !patronLibrary->validate_hold_sibling({branchcode => $request->{branchcode}}); --