Bugzilla – Attachment 139068 Details for
Bug 31314
Remove GetItemsInfo from opac-reserve.pl
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 31314: (QA follow-up) Prefetch and make routines use result objects
Bug-31314-QA-follow-up-Prefetch-and-make-routines-.patch (text/plain), 2.12 KB, created by
Nick Clemens (kidclamp)
on 2022-08-12 15:39:14 UTC
(
hide
)
Description:
Bug 31314: (QA follow-up) Prefetch and make routines use result objects
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2022-08-12 15:39:14 UTC
Size:
2.12 KB
patch
obsolete
>From a1d96cc5d1287b01aaf087ac8208258e73e819d4 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Fri, 12 Aug 2022 15:33:45 +0000 >Subject: [PATCH] Bug 31314: (QA follow-up) Prefetch and make routines use > result objects > >This reduces lookups for the related items that we now fetch in the templates > >Signed-off-by: Nick Clemens <nick@bywatersolutions.com> >--- > Koha/Item.pm | 9 +++++---- > opac/opac-reserve.pl | 3 ++- > 2 files changed, 7 insertions(+), 5 deletions(-) > >diff --git a/Koha/Item.pm b/Koha/Item.pm >index b3ac362334..b596e1cd0b 100644 >--- a/Koha/Item.pm >+++ b/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 ); > } > >diff --git a/opac/opac-reserve.pl b/opac/opac-reserve.pl >index 26a4d8c23b..20f67e8313 100755 >--- a/opac/opac-reserve.pl >+++ b/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! >-- >2.30.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 31314
:
138823
|
138882
|
138916
|
139066
|
139067
| 139068