Bug 15263: (QA followup) Use the new XSLTParse4Display everywhere
authorTomas Cohen Arazi <tomascohen@theke.io>
Wed, 20 Apr 2016 17:44:27 +0000 (14:44 -0300)
committerKyle M Hall <kyle@bywatersolutions.com>
Wed, 4 May 2016 13:40:35 +0000 (13:40 +0000)
Edit: fixed catalogue/detail.pl and opac/opac-detail.pl so they use the right
XSLT syspref.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
catalogue/detail.pl
opac/opac-detail.pl
opac/opac-tags.pl

index 873d33e..4917673 100755 (executable)
@@ -16,8 +16,7 @@
 # along with Koha; if not, see <http://www.gnu.org/licenses>.
 
 
-use strict;
-use warnings;
+use Modern::Perl;
 
 use CGI qw ( -utf8 );
 use C4::Acquisition qw( GetHistory );
@@ -84,9 +83,18 @@ my $showallitems = $query->param('showallitems');
 my $marcflavour  = C4::Context->preference("marcflavour");
 
 # XSLT processing of some stuff
-if (C4::Context->preference("XSLTDetailsDisplay") ) {
-    $template->param('XSLTDetailsDisplay' =>'1',
-        'XSLTBloc' => XSLTParse4Display($biblionumber, $record, "XSLTDetailsDisplay") );
+my $xslfile = C4::Context->preference('XSLTDetailsDisplay');
+my $lang   = $xslfile ? C4::Languages::getlanguage()  : undef;
+my $sysxml = $xslfile ? C4::XSLT::get_xslt_sysprefs() : undef;
+
+if ( $xslfile ) {
+    $template->param(
+        XSLTDetailsDisplay => '1',
+        XSLTBloc => XSLTParse4Display(
+                        $biblionumber, $record, "XSLTDetailsDisplay",
+                        1, undef, $sysxml, $xslfile, $lang
+                    )
+    );
 }
 
 $template->param( 'SpineLabelShowPrintOnBibDetails' => C4::Context->preference("SpineLabelShowPrintOnBibDetails") );
index 5ec80b7..98afe3e 100755 (executable)
@@ -20,8 +20,7 @@
 # along with Koha; if not, see <http://www.gnu.org/licenses>.
 
 
-use strict;
-use warnings;
+use Modern::Perl;
 
 use CGI qw ( -utf8 );
 use C4::Acquisition qw( SearchOrders );
@@ -141,8 +140,17 @@ my $marcflavour      = C4::Context->preference("marcflavour");
 my $ean = GetNormalizedEAN( $record, $marcflavour );
 
 # XSLT processing of some stuff
-if (C4::Context->preference("OPACXSLTDetailsDisplay") ) {
-    $template->param( 'XSLTBloc' => XSLTParse4Display($biblionumber, $record, "OPACXSLTDetailsDisplay" ) );
+my $xslfile = C4::Context->preference('OPACXSLTDetailsDisplay');
+my $lang   = $xslfile ? C4::Languages::getlanguage()  : undef;
+my $sysxml = $xslfile ? C4::XSLT::get_xslt_sysprefs() : undef;
+
+if ( $xslfile ) {
+    $template->param(
+        XSLTBloc => XSLTParse4Display(
+                        $biblionumber, $record, "OPACXSLTDetailsDisplay",
+                        1, undef, $sysxml, $xslfile, $lang
+                    )
+    );
 }
 
 my $OpacBrowseResults = C4::Context->preference("OpacBrowseResults");
index e7f892c..665d6b6 100755 (executable)
@@ -30,8 +30,8 @@ C4::Scrubber is used to remove all markup content from the sumitted text.
 
 =cut
 
-use strict;
-use warnings;
+use Modern::Perl;
+
 use CGI qw ( -utf8 );
 use CGI::Cookie; # need to check cookies before having CGI parse the POST request
 
@@ -234,9 +234,18 @@ if ($loggedinuser) {
         $tag->{subtitle} = GetRecordValue( 'subtitle', $record, GetFrameworkCode( $tag->{biblionumber} ) );
         $tag->{title} = $biblio->{title};
         $tag->{author} = $biblio->{author};
-        if (C4::Context->preference("OPACXSLTResultsDisplay")) {
-            $tag->{XSLTBloc} = XSLTParse4Display($tag->{biblionumber}, $record, "OPACXSLTResultsDisplay");
+
+        my $xslfile = C4::Context->preference('OPACXSLTResultsDisplay');
+        my $lang   = $xslfile ? C4::Languages::getlanguage()  : undef;
+        my $sysxml = $xslfile ? C4::XSLT::get_xslt_sysprefs() : undef;
+
+        if ( $xslfile ) {
+            $tag->{XSLTBloc} = XSLTParse4Display(
+                    $tag->{ biblionumber }, $record, "OPACXSLTResultsDisplay",
+                    1, undef, $sysxml, $xslfile, $lang
+            );
         }
+
         my $date = $tag->{date_created} || '';
         $date =~ /\s+(\d{2}\:\d{2}\:\d{2})/;
         $tag->{time_created_display} = $1;