From 637846f450461c1e830e3da70bf5bc6e4af099bb Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Fri, 27 May 2022 13:07:04 +0000 Subject: [PATCH] Bug 30860: Get all items info for CanBookBeReserved on opac-reserve.pl Repeat test above on OPAC --- opac/opac-reserve.pl | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/opac/opac-reserve.pl b/opac/opac-reserve.pl index 85f2659a87..96bbe2e613 100755 --- a/opac/opac-reserve.pl +++ b/opac/opac-reserve.pl @@ -428,6 +428,7 @@ foreach my $biblioNum (@biblionumbers) { # (before this loop was inside that sub loop so it was O(n^2) ) my $items_any_available; $items_any_available = ItemsAnyAvailableAndNotRestricted( { biblionumber => $biblioNum, patron => $patron }) if $patron; + my $can_book_be_reserved = CanBookBeReserved( $borrowernumber, $biblioNum, undef, { return_all_items => 1 }); foreach my $item (@{$biblioData->{items}}) { my $item_info = $item->unblessed; @@ -469,7 +470,7 @@ foreach my $biblioNum (@biblionumbers) { # items_any_available defined outside of the current loop, # so we avoiding loop inside IsAvailableForItemLevelRequest: my $policy_holdallowed = - CanItemBeReserved( $patron, $item )->{status} eq 'OK' && + $can_book_be_reserved->{$item->itemnumber}->{status} eq 'OK' && IsAvailableForItemLevelRequest($item, $patron, undef, $items_any_available); if ($policy_holdallowed) { @@ -530,7 +531,7 @@ foreach my $biblioNum (@biblionumbers) { } } - my $status = CanBookBeReserved( $borrowernumber, $biblioNum )->{status}; + my $status = $can_book_be_reserved->{status}; $biblioLoopIter{holdable} &&= $status eq 'OK'; $biblioLoopIter{$status} = 1; -- 2.30.2