The is a problem in the logic, fallback must be:
1. Requested (theme, lang, tmpl)
a. return (theme, lang, tmpl), if not
b. return (fallback, lang, tmpl), if not
c. return (theme, 'en', tmpl), if not as last resort
d. return (fallback, 'en', tmpl)
Previous patch missed option 'c', worked for CCSR
but not bootstrap, sorry.
Signed-off-by: Petter Goksoyr Asen <boutrosboutrosboutros@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
my $fallback = C4::Context->preference( ($interface eq 'intranet') ? 'template' : 'OPACFallback' );
push @themes, $fallback;
- # Try to find first theme for the selected language
+ # Try to find first theme for the selected theme/lang, then for fallback/lang
for my $theme (@themes) {
if ( -e "$htdocs/$theme/$lang/modules/$tmpl" ) {
return ($theme, $lang, \@themes);
}
}
- # Otherwise, return fallback theme in English 'en'
- return ($fallback, 'en', \@themes);
+ # Otherwise return theme/'en', last resort fallback/'en'
+ for my $theme (@themes) {
+ if ( -e "$htdocs/$theme/en/modules/$tmpl" ) {
+ return ($theme, 'en', \@themes);
+ }
+ }
}