Bug 6972: Hardcoded template paths to en in showmarc
authorMaxime Pelletier <maxime.pelletier@libeo.com>
Tue, 4 Oct 2011 18:32:08 +0000 (14:32 -0400)
committerChris Cormack <chrisc@catalyst.net.nz>
Wed, 19 Oct 2011 12:48:52 +0000 (01:48 +1300)
Couldn't help but reformat the indentation a bit.

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Card view works correctly in cataloguing search.
Plain view/labelled show correctly in OPAC.

Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Fixing merge conflict.

catalogue/showmarc.pl
opac/opac-showmarc.pl

index 5e03798..97e7ed7 100755 (executable)
@@ -2,8 +2,6 @@
 
 # Koha library project  www.koha-community.org
 
-# Licensed under the GPL
-
 # Copyright 2007 Liblime
 # Parts copyright 2010 BibLibre
 #
@@ -66,11 +64,11 @@ if($importid) {
                $xmlrecord = $record->as_xml();
        } 
 }
-               
-if($view eq 'card') {
-$xmlrecord = GetXmlBiblio($biblionumber) unless $xmlrecord;
 
-my $xslfile = C4::Context->config('intrahtdocs')."/prog/en/xslt/compact.xsl";
+if($view eq 'card') {
+    my $themelang = '/' . C4::Context->preference("opacthemes") .  '/' . C4::Templates::_current_language();
+    $xmlrecord = GetXmlBiblio($biblionumber) unless $xmlrecord;
+my $xslfile = C4::Context->config('intrahtdocs').$themelang."/xslt/compact.xsl";
 my $parser = XML::LibXML->new();
 my $xslt = XML::LibXSLT->new();
 my $source = $parser->parse_string($xmlrecord);
@@ -80,13 +78,11 @@ my $results = $stylesheet->transform($source);
 my $newxmlrecord = $stylesheet->output_string($results);
 $newxmlrecord=Encode::decode_utf8($newxmlrecord) unless utf8::is_utf8($newxmlrecord); #decode only if not in perl internal format
 print $input->header(-charset => 'UTF-8'), $newxmlrecord;
-
 } else {
+    $record =GetMarcBiblio($biblionumber) unless $record;
 
-$record =GetMarcBiblio($biblionumber) unless $record; 
-
-my $formatted = $record->as_formatted;
-$template->param( MARC_FORMATTED => $formatted );
+    my $formatted = $record->as_formatted;
+    $template->param( MARC_FORMATTED => $formatted );
 
 my $output= $template->output;
 $output=Encode::decode_utf8($output) unless utf8::is_utf8($output);
index 673069e..aec114b 100755 (executable)
@@ -62,18 +62,19 @@ if ($importid) {
        $record = MARC::Record->new_from_usmarc($marc) ;
        if($view eq 'card') {
                $xmlrecord = $record->as_xml();
-       } 
+       }
 }
 
-
 if ($view eq 'card' || $view eq 'html') {
     $xmlrecord = GetXmlBiblio($biblionumber) unless $xmlrecord;
     my $xslfile;
+    my $themelang = '/' . C4::Context->preference("opacthemes") .  '/' . C4::Templates::_current_language();
+
     if ($view eq 'card'){
-       $xslfile = C4::Context->config('opachtdocs')."/prog/en/xslt/compact.xsl";
+        $xslfile = C4::Context->config('opachtdocs').$themelang."/xslt/compact.xsl";
     }
     else { # must be html
-       $xslfile = C4::Context->config('opachtdocs')."/prog/en/xslt/MARC21slim2OPACMARCdetail.xsl";     
+        $xslfile = C4::Context->config('opachtdocs').$themelang."/xslt/MARC21slim2OPACMARCdetail.xsl";
     }
     my $parser = XML::LibXML->new();
     my $xslt   = XML::LibXSLT->new();