[Koha-patches] [PATCH] [SIGEND-OFF] Bug 6972: Hardcoded template paths to en in showmarc

Katrin Fischer Katrin.Fischer.83 at web.de
Thu Oct 13 00:08:19 CEST 2011


From: Maxime Pelletier <maxime.pelletier at libeo.com>

Couldn't help but reformat the indentation a bit.

http://bugs.koha-community.org/show_bug.cgi?id=6972
Signed-off-by: Katrin Fischer <Katrin.Fischer.83 at web.de>
Card view works correctly in cataloguing search.
Plain view/labelled show correctly in OPAC.
---
 catalogue/showmarc.pl |   38 +++++++++++++++++++-------------------
 opac/opac-showmarc.pl |    9 +++++----
 2 files changed, 24 insertions(+), 23 deletions(-)

diff --git a/catalogue/showmarc.pl b/catalogue/showmarc.pl
index bd557e9..8c59bb2 100755
--- a/catalogue/showmarc.pl
+++ b/catalogue/showmarc.pl
@@ -63,29 +63,29 @@ if($importid) {
 		$xmlrecord = $record->as_xml();
 	} 
 }
-		
+
 if($view eq 'card') {
-$xmlrecord = GetXmlBiblio($biblionumber) unless $xmlrecord;
+    my $themelang = '/' . C4::Context->preference("opacthemes") .  '/' . C4::Templates::_current_language();
 
-my $xslfile = C4::Context->config('intrahtdocs')."/prog/en/xslt/compact.xsl";
-my $parser = XML::LibXML->new();
-my $xslt = XML::LibXSLT->new();
-my $source = $parser->parse_string($xmlrecord);
-my $style_doc = $parser->parse_file($xslfile);
-my $stylesheet = $xslt->parse_stylesheet($style_doc);
-my $results = $stylesheet->transform($source);
-my $newxmlrecord = $stylesheet->output_string($results);
-#warn $newxmlrecord;
-print "Content-type: text/html\n\n";
-utf8::encode($newxmlrecord);
-print $newxmlrecord;
+    $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);
+    my $style_doc = $parser->parse_file($xslfile);
+    my $stylesheet = $xslt->parse_stylesheet($style_doc);
+    my $results = $stylesheet->transform($source);
+    my $newxmlrecord = $stylesheet->output_string($results);
+    #warn $newxmlrecord;
+    print "Content-type: text/html\n\n";
+    utf8::encode($newxmlrecord);
+    print $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 );
 
-output_html_with_http_headers $input, $cookie, $template->output;
+    output_html_with_http_headers $input, $cookie, $template->output;
 }
diff --git a/opac/opac-showmarc.pl b/opac/opac-showmarc.pl
index 4475512..3b9a0ac 100755
--- a/opac/opac-showmarc.pl
+++ b/opac/opac-showmarc.pl
@@ -59,18 +59,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();
-- 
1.7.4.1



More information about the Koha-patches mailing list