Bugzilla – Attachment 91914 Details for
Bug 23414
Improve performance of C4/XSLT/buildKohaItemsNamespace
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 23414: Prefetch transfers, use only default framework, use elsif
Bug-23414-Prefetch-transfers-use-only-default-fram.patch (text/plain), 4.88 KB, created by
Nick Clemens (kidclamp)
on 2019-08-01 18:37:48 UTC
(
hide
)
Description:
Bug 23414: Prefetch transfers, use only default framework, use elsif
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2019-08-01 18:37:48 UTC
Size:
4.88 KB
patch
obsolete
>From c36e025b4275153ea5f2df3fd9927b3f3c0850b7 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Thu, 1 Aug 2019 17:01:28 +0000 >Subject: [PATCH] Bug 23414: Prefetch transfers, use only default framework, > use elsif > >This further cleans up the code, before we tested each condition though we return only one status line. > >Koha mappings can no longer differ by framework so we don't need to fetch the biblio framework > >Prefetching should offer a boost > >To test: >Same as before - there is not as big a boost form this, but there shouldn't be a hit >--- > C4/XSLT.pm | 67 +++++++++++++++++++++++++++++--------------------------------- > 1 file changed, 31 insertions(+), 36 deletions(-) > >diff --git a/C4/XSLT.pm b/C4/XSLT.pm >index 845067da17..0a35eb349e 100644 >--- a/C4/XSLT.pm >+++ b/C4/XSLT.pm >@@ -293,14 +293,14 @@ sub buildKohaItemsNamespace { > my ($biblionumber, $hidden_items) = @_; > > my $search_params; >- $search_params->{biblionumber} = $biblionumber; >- $search_params->{itemnumber} = { not_in => $hidden_items } if $hidden_items; >- my @items = Koha::Items->search($search_params); >+ $search_params->{'me.biblionumber'} = $biblionumber; >+ $search_params->{'me.itemnumber'} = { not_in => $hidden_items } if $hidden_items; >+ my @items = Koha::Items->search($search_params,{prefetch=>'branchtransfers'}); > > my $shelflocations = >- { map { $_->{authorised_value} => $_->{opac_description} } Koha::AuthorisedValues->get_descriptions_by_koha_field( { frameworkcode => GetFrameworkCode($biblionumber), kohafield => 'items.location' } ) }; >+ { map { $_->{authorised_value} => $_->{opac_description} } Koha::AuthorisedValues->get_descriptions_by_koha_field( { frameworkcode => "", kohafield => 'items.location' } ) }; > my $ccodes = >- { map { $_->{authorised_value} => $_->{opac_description} } Koha::AuthorisedValues->get_descriptions_by_koha_field( { frameworkcode => GetFrameworkCode($biblionumber), kohafield => 'items.ccode' } ) }; >+ { map { $_->{authorised_value} => $_->{opac_description} } Koha::AuthorisedValues->get_descriptions_by_koha_field( { frameworkcode => "", kohafield => 'items.ccode' } ) }; > > my %branches = map { $_->branchcode => $_->branchname } Koha::Libraries->search({}, { order_by => 'branchname' }); > >@@ -311,39 +311,34 @@ sub buildKohaItemsNamespace { > for my $item (@items) { > my $status; > >- my ( $transfertwhen, $transfertfrom, $transfertto ) = C4::Circulation::GetTransfers($item->itemnumber); >- > my $reservestatus = C4::Reserves::GetReserveStatus( $item->itemnumber ); > >- if ( ( $item->itype && $itemtypes->{ $item->itype }->{notforloan} ) || $item->notforloan || $item->onloan || $item->withdrawn || $item->itemlost || $item->damaged || >- (defined $transfertwhen && $transfertwhen ne '') || $item->{itemnotforloan} || (defined $reservestatus && $reservestatus eq "Waiting") || $item->has_pending_hold ){ >- if ( $item->notforloan < 0) { >- $status = "On order"; >- } >- if ( $item->notforloan && $item->notforloan > 0 || $item->itype && $itemtypes->{ $item->itype }->{notforloan} && $itemtypes->{ $item->itype }->{notforloan} == 1 ) { >- $status = "reference"; >- } >- if ($item->onloan) { >- $status = "Checked out"; >- } >- if ( $item->withdrawn) { >- $status = "Withdrawn"; >- } >- if ($item->itemlost) { >- $status = "Lost"; >- } >- if ($item->damaged) { >- $status = "Damaged"; >- } >- if (defined $transfertwhen && $transfertwhen ne '') { >- $status = 'In transit'; >- } >- if (defined $reservestatus && $reservestatus eq "Waiting") { >- $status = 'Waiting'; >- } >- if ($item->has_pending_hold) { >- $status = 'Pending hold'; >- } >+ if ( $item->notforloan < 0) { >+ $status = "On order"; >+ } >+ elsif ( $item->notforloan && $item->notforloan > 0 || $item->itype && $itemtypes->{ $item->itype }->{notforloan} && $itemtypes->{ $item->itype }->{notforloan} == 1 ) { >+ $status = "reference"; >+ } >+ elsif ($item->onloan) { >+ $status = "Checked out"; >+ } >+ elsif ( $item->withdrawn) { >+ $status = "Withdrawn"; >+ } >+ elsif ($item->itemlost) { >+ $status = "Lost"; >+ } >+ elsif ($item->damaged) { >+ $status = "Damaged"; >+ } >+ elsif ($item->get_transfer) { >+ $status = 'In transit'; >+ } >+ elsif (defined $reservestatus && $reservestatus eq "Waiting") { >+ $status = 'Waiting'; >+ } >+ elsif ($item->has_pending_hold) { >+ $status = 'Pending hold'; > } else { > $status = "available"; > } >-- >2.11.0
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 23414
:
91913
|
91914
|
91915
|
94537
|
94580
|
94581
|
95010
|
95011
|
95012
|
95014
|
95015
|
95069
|
95070
|
95071
|
95072
|
95073
|
95083
|
95084
|
95085
|
95086
|
95087
|
95088
|
95089