Bug 15448: Remove items fetch

We fetch them already too many times.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 6cd68dd05b)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
This commit is contained in:
Jonathan Druart 2021-01-14 10:44:46 +01:00 committed by Fridolin Somers
parent 60e08d51bb
commit 54a9ef09bf
1 changed files with 2 additions and 2 deletions

View File

@ -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;