@@ -, +, @@ --- Koha/Biblio.pm | 7 +++---- catalogue/detail.pl | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) --- a/Koha/Biblio.pm +++ a/Koha/Biblio.pm @@ -449,11 +449,10 @@ sub items { return Koha::Items->_new_from_dbic( $items_rs ) unless $params->{host_items}; + my @itemnumbers = $items_rs->get_column('itemnumber')->all; my $host_itemnumbers = $self->_host_itemnumbers(); - my $params = { -or => [biblionumber => $self->id] }; - push @{$params->{'-or'}}, itemnumber => { -in => $host_itemnumbers } if $host_itemnumbers; - - return Koha::Items->search($params); + push @itemnumbers, @{ $host_itemnumbers }; + return Koha::Items->search({ "me.itemnumber" => { -in => \@itemnumbers } }); } =head3 host_items --- a/catalogue/detail.pl +++ a/catalogue/detail.pl @@ -193,7 +193,7 @@ my $itemtypes = { map { $_->itemtype => $_ } @{ Koha::ItemTypes->search_with_loc my $params; my $patron = Koha::Patrons->find( $borrowernumber ); $params->{ itemlost } = 0 if $patron->category->hidelostitems && !$showallitems; -my $items = $biblio->items({ host_items => 1 })->search_ordered( $params, { prefetch => ['issue','branchtransfers'] } ); +my $items = $biblio->items({ host_items => 1 })->search_ordered( $params, { prefetch => ['issue','branchtransfer'] } ); # flag indicating existence of at least one item linked via a host record my $hostrecords = $biblio->host_items->count; --