Bug 12237: Remove the "horrible hack" in C4::Templates
Use C4::Languages::getlanguage() instead of
C4::Templates::_current_language()
Test plan:
1/ Set one of the 4 XSLT sysprefs to 'default'
2/ Go to the corresponding page
3/ Switch language and check that the right XSLT is used
4/ Set the same syspref to something with '{langcode}' in it. For
example:
"../koha-tmpl/opac-tmpl/bootstrap/{langcode}/xslt/UNIMARCslim2OPACDetail.xsl"
5/ Go back to the corresponding page
6/ Switch language and check that the right XSLT is used
7/ Change a compact.xsl for a language (for example
koha-tmpl/intranet-tmpl/prog/fr-FR/xslt/compact.xsl) to be able to see
differences
8/ Go to a biblio detail page in staff interface and click on "MARC
Preview: Show"
9/ Close the popup, switch language and click again on the same link
10/ Check that the correct XSLT is used.
Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Works as described following test plan.
No koha-qa errors
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
No problems found, passes tests and QA script.
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
This commit is contained in:
parent
fb772f1a90
commit
a0c17a8c3a
|
|
@ -163,20 +163,6 @@ sub utf8_hashref {
|
|||
utf8::encode($hashref->{$key}) if utf8::is_utf8($hashref->{$key});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# 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;
|
||||
}
|
||||
|
||||
|
||||
# wrapper method to allow easier transition from HTML template pro to Template Toolkit
|
||||
sub param {
|
||||
|
|
@ -296,7 +282,6 @@ sub themelanguage {
|
|||
# Try to find first theme for the selected language
|
||||
for my $theme (@themes) {
|
||||
if ( -e "$htdocs/$theme/$lang/modules/$tmpl" ) {
|
||||
$_current_language = $lang;
|
||||
return ($theme, $lang, \@themes)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -162,7 +162,7 @@ sub XSLTParse4Display {
|
|||
if ( $xslfilename =~ /^\s*"?default"?\s*$/i ) {
|
||||
my $htdocs;
|
||||
my $theme;
|
||||
my $lang = C4::Templates::_current_language();
|
||||
my $lang = C4::Languages::getlanguage();
|
||||
my $xslfile;
|
||||
if ($xslsyspref eq "XSLTDetailsDisplay") {
|
||||
$htdocs = C4::Context->config('intrahtdocs');
|
||||
|
|
@ -189,7 +189,7 @@ sub XSLTParse4Display {
|
|||
}
|
||||
|
||||
if ( $xslfilename =~ m/\{langcode\}/ ) {
|
||||
my $lang = C4::Templates::_current_language();
|
||||
my $lang = C4::Languages::getlanguage();
|
||||
$xslfilename =~ s/\{langcode\}/$lang/;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ if(!ref $record) {
|
|||
}
|
||||
|
||||
if($view eq 'card') {
|
||||
my $themelang = '/' . C4::Templates::_current_language();
|
||||
my $themelang = '/' . C4::Languages::getlanguage($input);
|
||||
my $xmlrecord= $importid? $record->as_xml(): GetXmlBiblio($biblionumber);
|
||||
my $xslfile =
|
||||
C4::Context->config('intrahtdocs') . '/prog' . $themelang . "/xslt/compact.xsl";
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ if ($view eq 'card' || $view eq 'html') {
|
|||
my $xslfilename;
|
||||
my $htdocs = C4::Context->config('opachtdocs');
|
||||
my $theme = C4::Context->preference("opacthemes");
|
||||
my $lang = C4::Templates::_current_language();
|
||||
my $lang = C4::Languages::getlanguage($input);
|
||||
|
||||
if ($view eq 'card'){
|
||||
$xslfile = "compact.xsl";
|
||||
|
|
|
|||
Loading…
Reference in New Issue