From 873170aa5225dec7b01ad043a846b451c3fffc2c Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Fri, 12 Aug 2022 15:04:30 +0000 Subject: [PATCH] Bug 31314: (QA follow-up) Search Koha::Items not $biblio->items To get the host items we need to search all items, not those limited to the same biblionumber To test: 1 - Enable EasyAnalytics 2 - Attach an item to a record 3 - Confirm it is listed in the items list on opac reserve Signed-off-by: Nick Clemens Signed-off-by: Tomas Cohen Arazi --- opac/opac-reserve.pl | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/opac/opac-reserve.pl b/opac/opac-reserve.pl index 6cdbbbd3df..26a4d8c23b 100755 --- a/opac/opac-reserve.pl +++ b/opac/opac-reserve.pl @@ -1,5 +1,6 @@ #!/usr/bin/perl + # Copyright Katipo Communications 2002 # Copyright Koha Development team 2012 # @@ -151,20 +152,16 @@ foreach my $biblioNumber (@biblionumbers) { my $marcrecord = $biblio->metadata->record; - my $items = - $biblio->items->filter_by_visible_in_opac( { patron => $patron } ); - my $host_items = - $biblio->host_items->filter_by_visible_in_opac( { patron => $patron } ); - $items = $biblio->items->search_ordered( - { + my $items = Koha::Items->search_ordered( + [ + biblionumber => $biblioNumber, itemnumber => { -in => [ - $items->get_column('itemnumber'), - $host_items->get_column('itemnumber') + $biblio->host_items->get_column('itemnumber') ] } - } - ); + ], + )->filter_by_visible_in_opac({ patron => $patron }); $biblioData->{items} = [$items->as_list]; # FIXME Potentially a lot in memory here! -- 2.39.5