From cb36f36382d0c471e5d16be17a6f813d81c5ebc9 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Thu, 10 Mar 2016 14:47:36 +0000 Subject: [PATCH] Bug 15263: (follow-up) XSLT display fetches sysprefs for every result processed Set variables ($sysxml, $xslfilename, $lang) if they are not passed to the subroutine. This happens from catalogue/detail.pl, opac/opac-shelves.pl, opac/opac-tags.pl and virtualshelves/shelves.pl. Signed-off-by: Mirko Tietgen Signed-off-by: Tomas Cohen Arazi Signed-off-by: Kyle M Hall --- C4/Search.pm | 4 ++-- C4/XSLT.pm | 10 ++++++---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/C4/Search.pm b/C4/Search.pm index 017d172ad8..b33eed4ced 100644 --- a/C4/Search.pm +++ b/C4/Search.pm @@ -1887,7 +1887,7 @@ sub searchResults { my $xslsyspref = $interface . "XSLTResultsDisplay"; my $xslfile = C4::Context->preference($xslsyspref); my $lang = C4::Languages::getlanguage(); - my ($sysxml) = C4::XSLT::_get_xslt_sysprefs(); + my $sysxml = C4::XSLT::get_xslt_sysprefs(); # loop through all of the records we've retrieved for ( my $i = $offset ; $i <= $times - 1 ; $i++ ) { @@ -2218,7 +2218,7 @@ sub searchResults { # XSLT processing of some stuff # we fetched the sysprefs already before the loop through all retrieved record! if (!$scan && $xslfile) { - $oldbiblio->{XSLTResultsRecord} = XSLTParse4Display($oldbiblio->{biblionumber}, $marcrecord, $xslsyspref, 1, \@hiddenitems, $sysxml, $xslfile); + $oldbiblio->{XSLTResultsRecord} = XSLTParse4Display($oldbiblio->{biblionumber}, $marcrecord, $xslsyspref, 1, \@hiddenitems, $sysxml, $xslfile, $lang); # the last parameter tells Koha to clean up the problematic ampersand entities that Zebra outputs } diff --git a/C4/XSLT.pm b/C4/XSLT.pm index e74a742701..a2bbaabc51 100644 --- a/C4/XSLT.pm +++ b/C4/XSLT.pm @@ -160,7 +160,7 @@ sub _get_best_default_xslt_filename { return $xslfilename; } -sub _get_xslt_sysprefs { +sub get_xslt_sysprefs { my $sysxml = "\n"; foreach my $syspref ( qw/ hidelostitems OPACURLOpenInNewWindow DisplayOPACiconsXSLT URLLinkText viewISBD @@ -188,11 +188,14 @@ sub _get_xslt_sysprefs { sub XSLTParse4Display { my ( $biblionumber, $orig_record, $xslsyspref, $fixamps, $hidden_items, $sysxml, $xslfilename, $lang ) = @_; - #my $xslfilename = C4::Context->preference($xslsyspref); + + $sysxml ||= C4::Context->preference($xslsyspref); + $xslfilename ||= C4::Context->preference($xslsyspref); + $lang ||= C4::Languages::getlanguage(); + if ( $xslfilename =~ /^\s*"?default"?\s*$/i ) { my $htdocs; my $theme; - # my $lang = C4::Languages::getlanguage(); my $xslfile; if ($xslsyspref eq "XSLTDetailsDisplay") { $htdocs = C4::Context->config('intrahtdocs'); @@ -219,7 +222,6 @@ sub XSLTParse4Display { } if ( $xslfilename =~ m/\{langcode\}/ ) { - my $lang = C4::Languages::getlanguage(); $xslfilename =~ s/\{langcode\}/$lang/; } -- 2.39.5