Bugzilla – Attachment 153047 Details for
Bug 33497
Reduce DB calls on staff detail page
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 33497: Add a filter relationship for branchtransfers
Bug-33497-Add-a-filter-relationship-for-branchtran.patch (text/plain), 2.16 KB, created by
Jonathan Druart
on 2023-07-05 10:31:59 UTC
(
hide
)
Description:
Bug 33497: Add a filter relationship for branchtransfers
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2023-07-05 10:31:59 UTC
Size:
2.16 KB
patch
obsolete
>From ed95a64cd5e77aa191f988454e4ee5a5d150a015 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Fri, 10 Mar 2023 16:14:50 +0000 >Subject: [PATCH] Bug 33497: Add a filter relationship for branchtransfers > >This uses the new relationship from bug 33493 to fetch the transfers for items > >To test: >1 - Transfer some items on a bib >2 - View the biblio details page in the staff interface >3 - Apply patch >4 - Confirm the view is the same > >Signed-off-by: David Nind <david@davidnind.com> > >Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >--- > Koha/Biblio.pm | 7 +++---- > catalogue/detail.pl | 2 +- > 2 files changed, 4 insertions(+), 5 deletions(-) > >diff --git a/Koha/Biblio.pm b/Koha/Biblio.pm >index 05d8e7872ea..43b53e17b07 100644 >--- a/Koha/Biblio.pm >+++ b/Koha/Biblio.pm >@@ -494,11 +494,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 $search_params = { -or => [biblionumber => $self->id] }; >- push @{$search_params->{'-or'}}, itemnumber => { -in => $host_itemnumbers } if $host_itemnumbers; >- >- return Koha::Items->search($search_params); >+ push @itemnumbers, @{ $host_itemnumbers }; >+ return Koha::Items->search({ "me.itemnumber" => { -in => \@itemnumbers } }); > } > > =head3 host_items >diff --git a/catalogue/detail.pl b/catalogue/detail.pl >index f99afe40ada..31ebfc2743e 100755 >--- a/catalogue/detail.pl >+++ b/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; >-- >2.25.1
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 33497
:
149467
|
149468
|
149573
|
149574
|
151861
|
151862
|
151863
|
151866
|
153046
| 153047 |
153048
|
153049
|
153183