From 4317c968d979f199dd6fd1bce8bd703ada5650a6 Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Mon, 12 Jul 2021 13:58:51 +0000 Subject: [PATCH] Bug 28702: Make buildKohaItemsNamespace take an array If we fetch some of the authorised values and before hand we can reduce the amount of work needed in this routine. We stil require queries for pending holds and transfers, but these are lighter than fetching the items To test: 1 - Perform a search on the OPAC 2 - Add the results to a list 3 - Load the list several times and use developer tools (F12) to view the time to load in the network tab 4 - Repeat a search several times and use developer tools (F12) to view the time to load in the network tab 5 - Record the times noted above 6 - Apply patch 7 - Repeat the search and list view and compare to before the patch 8 - prove -v t/db_dependent/XSLT.t Signed-off-by: Michal Urban --- C4/Search.pm | 2 +- C4/XSLT.pm | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/C4/Search.pm b/C4/Search.pm index 2b739c9aa5..afd68b09ee 100644 --- a/C4/Search.pm +++ b/C4/Search.pm @@ -1639,7 +1639,7 @@ sub searchResults { }); #Build branchnames hash - my %branches = map { $_->branchcode => $_->branchname } Koha::Libraries->search({}, { order_by => 'branchname' })->as_list; + my %branches = map { $_->branchcode => $_->branchname } Koha::Libraries->search({}, { order_by => 'branchname' }); my $description = $is_opac ? 'opac_description' : 'lib'; my $shelflocations = diff --git a/C4/XSLT.pm b/C4/XSLT.pm index 065360410a..25281861bd 100644 --- a/C4/XSLT.pm +++ b/C4/XSLT.pm @@ -249,6 +249,7 @@ sub XSLTParse4Display { my $hidden_items = $params->{hidden_items} || []; my $variables = $params->{xslt_variables}; my $items_rs = $params->{items_rs}; + my $items = $params->{items}; die "Mandatory \$params->{xsl_syspref} was not provided, called with biblionumber $params->{biblionumber}" if not defined $params->{xsl_syspref}; @@ -369,6 +370,7 @@ sub buildKohaItemsNamespace { } my $homebranch = xml_escape( $item->{homebranch} ); my $holdingbranch = xml_escape( $item->{holdingbranch} ); + my $resultbranch = xml_escape( $item->{resultbranch}); my $location = xml_escape( $item->{location} ); my $ccode = xml_escape( $item->{ccode} ); my $itemcallnumber = xml_escape($item->{itemcallnumber}); -- 2.25.1