Bugzilla – Attachment 95014 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: Easy readability and simplify logic in buildKohaItemsNamespace
Bug-23414-Easy-readability-and-simplify-logic-in-b.patch (text/plain), 3.28 KB, created by
Jonathan Druart
on 2019-11-04 15:36:39 UTC
(
hide
)
Description:
Bug 23414: Easy readability and simplify logic in buildKohaItemsNamespace
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2019-11-04 15:36:39 UTC
Size:
3.28 KB
patch
obsolete
>From a8f3c16e750fa7b58b4c51d480859efe86245a5f Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Mon, 4 Nov 2019 16:29:23 +0100 >Subject: [PATCH] Bug 23414: Easy readability and simplify logic in > buildKohaItemsNamespace > >This patch improves true/false logic and avoid autovivication. >Also note that xml_escape already deals with empty string. > >An unecessary call to GetReserveStatus is removed. >--- > C4/XSLT.pm | 26 +++++++++++++------------- > 1 file changed, 13 insertions(+), 13 deletions(-) > >diff --git a/C4/XSLT.pm b/C4/XSLT.pm >index 9b435cb1fe..9ed7dc3b54 100644 >--- a/C4/XSLT.pm >+++ b/C4/XSLT.pm >@@ -292,10 +292,14 @@ Is only used in this module currently. > sub buildKohaItemsNamespace { > my ($biblionumber, $hidden_items) = @_; > >- my $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','reserves']}); >+ $hidden_items ||= []; >+ my @items = Koha::Items->search( >+ { >+ 'me.biblionumber' => $biblionumber, >+ 'me.itemnumber' => { not_in => $hidden_items } >+ }, >+ { prefetch => [ 'branchtransfers', 'reserves' ] } >+ ); > > my $shelflocations = > { map { $_->{authorised_value} => $_->{opac_description} } Koha::AuthorisedValues->get_descriptions_by_koha_field( { frameworkcode => "", kohafield => 'items.location' } ) }; >@@ -305,14 +309,10 @@ sub buildKohaItemsNamespace { > my %branches = map { $_->branchcode => $_->branchname } Koha::Libraries->search({}, { order_by => 'branchname' }); > > my $itemtypes = { map { $_->{itemtype} => $_ } @{ Koha::ItemTypes->search->unblessed } }; >- my $location = ""; >- my $ccode = ""; > my $xml = ''; > for my $item (@items) { > my $status; > >- my $reservestatus = C4::Reserves::GetReserveStatus( $item->itemnumber ); >- > if ($item->has_pending_hold) { > $status = 'Pending hold'; > } >@@ -343,12 +343,12 @@ sub buildKohaItemsNamespace { > else { > $status = "available"; > } >- my $homebranch = $item->homebranch? xml_escape($branches{$item->homebranch}):''; >- my $holdingbranch = $item->holdingbranch? xml_escape($branches{$item->holdingbranch}):''; >- $location = $item->location? xml_escape($shelflocations->{$item->location}||$item->location):''; >- $ccode = $item->ccode? xml_escape($ccodes->{$item->ccode}||$item->ccode):''; >+ my $homebranch = xml_escape($branches{$item->homebranch}); >+ my $holdingbranch = xml_escape($branches{$item->holdingbranch}); >+ my $location = xml_escape($item->location && exists $shelflocations->{$item->location} ? $shelflocations->{$item->location} : $item->location); >+ my $ccode = xml_escape($item->ccode && exists $ccodes->{$item->ccode} ? $ccodes->{$item->ccode} : $item->ccode); > my $itemcallnumber = xml_escape($item->itemcallnumber); >- my $stocknumber = $item->stocknumber? xml_escape($item->stocknumber):''; >+ my $stocknumber = xml_escape($item->stocknumber); > $xml .= > "<item>" > . "<homebranch>$homebranch</homebranch>" >-- >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