Bugzilla – Attachment 148433 Details for
Bug 33167
Cleanup staff interface catalog details page
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 33167: Use 'host_items' param to fetch all items at once
Bug-33167-Use-hostitems-param-to-fetch-all-items-a.patch (text/plain), 2.66 KB, created by
Nick Clemens (kidclamp)
on 2023-03-20 18:44:08 UTC
(
hide
)
Description:
Bug 33167: Use 'host_items' param to fetch all items at once
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2023-03-20 18:44:08 UTC
Size:
2.66 KB
patch
obsolete
>From 5ed70f0097ac882b773fc25dba69ed22ccc46a0f Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Fri, 10 Mar 2023 12:40:30 +0000 >Subject: [PATCH] Bug 33167: Use 'host_items' param to fetch all items at once > >This patch adjusts the detail page to fetch items and host items >together, and prefetches transfers and checkouts > >To test: >1 - Enable easy analytics >2 - Attach some items to a bib >3 - Checkout an item on the bib >4 - View the details page >5 - Apply patch >6 - View details page, confirm nothign has changed >--- > catalogue/detail.pl | 18 ++++++------------ > 1 file changed, 6 insertions(+), 12 deletions(-) > >diff --git a/catalogue/detail.pl b/catalogue/detail.pl >index cad270d1c8..3c2bb5c88d 100755 >--- a/catalogue/detail.pl >+++ b/catalogue/detail.pl >@@ -193,20 +193,14 @@ 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->search_ordered( $params )->as_list; >+my $items = $biblio->items({ host_items => 1 })->search_ordered( $params, { prefetch => ['issue','branchtransfers'] } ); > > # flag indicating existence of at least one item linked via a host record >-my $hostrecords; >-# adding items linked via host biblios >-my $hostitems = $biblio->host_items; >-if ( $hostitems->count ) { >- $hostrecords = 1; >- push @items, $hostitems->as_list; >-} >+my $hostrecords = $biblio->host_items->count; > > my $dat = &GetBiblioData($biblionumber); >-$dat->{'count'} = $biblio->items->count + $hostitems->count; >-$dat->{'showncount'} = scalar @items + $hostitems->count; >+$dat->{'count'} = $biblio->items({ host_items => 1 })->count; >+$dat->{'showncount'} = $items->count; > $dat->{'hiddencount'} = $dat->{'count'} - $dat->{'showncount'}; > > >@@ -355,7 +349,7 @@ if ($currentbranch and C4::Context->preference('SeparateHoldings')) { > my $separatebranch = C4::Context->preference('SeparateHoldingsBranch') || 'homebranch'; > my ( $itemloop_has_images, $otheritemloop_has_images ); > >-foreach my $item (@items) { >+while ( my $item = $items->next ) { > my $itembranchcode = $item->$separatebranch; > > my $item_info = $item->unblessed; >@@ -490,7 +484,7 @@ $template->param( > materials => $materials_flag, > ); > >-if (C4::Context->preference("AlternateHoldingsField") && scalar @items == 0) { >+if (C4::Context->preference("AlternateHoldingsField") && scalar $items->count == 0) { > my $fieldspec = C4::Context->preference("AlternateHoldingsField"); > my $subfields = substr $fieldspec, 3; > my $holdingsep = C4::Context->preference("AlternateHoldingsSeparator") || ' '; >-- >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 33167
:
148029
|
148082
|
148083
|
148084
|
148085
|
148431
|
148432
|
148433
|
148434
|
149677
|
149704
|
150075
|
150076