From 6cd68dd05bdac2787fa0b67b7f90a5836c57745c Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Thu, 14 Jan 2021 10:44:46 +0100 Subject: [PATCH] Bug 15448: Remove items fetch We fetch them already too many times. Signed-off-by: Jonathan Druart --- opac/opac-reserve.pl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/opac/opac-reserve.pl b/opac/opac-reserve.pl index d6e6745c6b..b90a2061b2 100755 --- a/opac/opac-reserve.pl +++ b/opac/opac-reserve.pl @@ -462,7 +462,7 @@ foreach my $biblioNum (@biblionumbers) { my @notforloan_avs = Koha::AuthorisedValues->search_by_koha_field({ kohafield => 'items.notforloan', frameworkcode => $frameworkcode }); my $notforloan_label_of = { map { $_->authorised_value => $_->opac_description } @notforloan_avs }; - my $visible_items = { map { $_->itemnumber => 1 } $biblio->items->filter_by_visible_in_opac( { patron => $patron } )->as_list }; + my $visible_items = { map { $_->itemnumber => $_ } $biblio->items->filter_by_visible_in_opac( { patron => $patron } )->as_list }; # Only keep the items that are visible in the opac (i.e. those in %visible_items) # FIXME: We should get rid of itemInfos altogether and use $visible_items @@ -473,7 +473,7 @@ foreach my $biblioNum (@biblionumbers) { my $numCopiesOPACAvailable = 0; foreach my $itemInfo (@{$biblioData->{itemInfos}}) { my $itemNum = $itemInfo->{itemnumber}; - my $item = Koha::Items->find( $itemNum ); + my $item = $visible_items->{$itemNum}; my $itemLoopIter = {}; $itemLoopIter->{itemnumber} = $itemNum; -- 2.39.5