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 <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Nick Clemens 2022-08-12 15:04:30 +00:00 committed by Tomas Cohen Arazi
parent c61f2a64fc
commit 873170aa52
Signed by: tomascohen
GPG key ID: 0A272EA1B2F3C15F

View file

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