@@ -, +, @@ result objects --- Koha/Item.pm | 9 +++++---- opac/opac-reserve.pl | 3 ++- 2 files changed, 7 insertions(+), 5 deletions(-) --- a/Koha/Item.pm +++ a/Koha/Item.pm @@ -361,9 +361,9 @@ sub effective_itemtype { sub home_branch { my ($self) = @_; - $self->{_home_branch} ||= Koha::Libraries->find( $self->homebranch() ); + my $hb_rs = $self->_result->homebranch; - return $self->{_home_branch}; + return Koha::Library->_new_from_dbic( $hb_rs ); } =head3 holding_branch @@ -373,9 +373,9 @@ sub home_branch { sub holding_branch { my ($self) = @_; - $self->{_holding_branch} ||= Koha::Libraries->find( $self->holdingbranch() ); + my $hb_rs = $self->_result->holdingbranch; - return $self->{_holding_branch}; + return Koha::Library->_new_from_dbic( $hb_rs ); } =head3 biblio @@ -1415,6 +1415,7 @@ sub to_api_mapping { sub itemtype { my ( $self ) = @_; + return Koha::ItemTypes->find( $self->effective_itemtype ); } --- a/opac/opac-reserve.pl +++ a/opac/opac-reserve.pl @@ -155,12 +155,13 @@ foreach my $biblioNumber (@biblionumbers) { my $items = Koha::Items->search_ordered( [ biblionumber => $biblioNumber, - itemnumber => { + 'me.itemnumber' => { -in => [ $biblio->host_items->get_column('itemnumber') ] } ], + { prefetch => [ 'issue', 'homebranch', 'holdingbranch' ] } )->filter_by_visible_in_opac({ patron => $patron }); $biblioData->{items} = [$items->as_list]; # FIXME Potentially a lot in memory here! --