bug 4403: look in appropriate theme/lang for bib display XSL
authorGalen Charlton <gmcharlt@gmail.com>
Sat, 8 May 2010 22:59:41 +0000 (18:59 -0400)
committerGalen Charlton <gmcharlt@gmail.com>
Sat, 8 May 2010 22:59:41 +0000 (18:59 -0400)
Note: approach used can be described as a hack at best; the current
language should probably become a session attribute.

Signed-off-by: Galen Charlton <gmcharlt@gmail.com>
C4/Output.pm
C4/XSLT.pm

index b512f30..49a0ff0 100644 (file)
@@ -134,6 +134,17 @@ sub gettemplate {
     return $template;
 }
 
+# FIXME - this is a horrible hack to cache
+# the current known-good language, temporarily
+# put in place to resolve bug 4403.  It is
+# used only by C4::XSLT::XSLTParse4Display;
+# the language is set via the usual call
+# to themelanguage.
+my $_current_language = 'en';
+sub _current_language {
+    return $_current_language;
+}
+
 #---------------------------------------------------------------------------------------------------------
 # FIXME - POD
 sub themelanguage {
@@ -193,6 +204,8 @@ sub themelanguage {
             #}
         }
     }
+
+    $_current_language = $lang; # FIXME part of bad hack to paper over bug 4403
     return ( $theme, $lang );
 }
 
index e67aa54..6fd93b4 100644 (file)
@@ -27,6 +27,7 @@ use C4::Koha;
 use C4::Biblio;
 use C4::Circulation;
 use C4::Reserves;
+use C4::Output qw//;
 use Encode;
 use XML::LibXML;
 use XML::LibXSLT;
@@ -146,12 +147,16 @@ sub XSLTParse4Display {
         my $xslfile;
         if ($interface eq 'intranet') {
             $xslfile = C4::Context->config('intrahtdocs') . 
-                      "/prog/en/xslt/" .
+                      '/' . C4::Context->preference("template") . 
+                      '/' . C4::Output::_current_language() .
+                      '/xslt/' .
                       C4::Context->preference('marcflavour') .
                       "slim2intranet$xsl_suffix.xsl";
         } else {
             $xslfile = C4::Context->config('opachtdocs') . 
-                      "/prog/en/xslt/" .
+                      '/' . C4::Context->preference("opacthemes") . 
+                      '/' . C4::Output::_current_language() .
+                      '/xslt/' .
                       C4::Context->preference('marcflavour') .
                       "slim2OPAC$xsl_suffix.xsl";
         }