template improvement: fall back on english if the template file doesn't exist
authorJoshua Ferraro <jmf@liblime.com>
Sun, 11 Nov 2007 03:57:29 +0000 (21:57 -0600)
committerJoshua Ferraro <jmf@liblime.com>
Sat, 5 Jan 2008 08:59:12 +0000 (02:59 -0600)
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
C4/Output.pm

index 64d2aa0..e73d1b6 100644 (file)
@@ -81,8 +81,15 @@ sub gettemplate {
     #    warn "PATH : $path";
     my ( $theme, $lang ) = themelanguage( $htdocs, $tmplbase, $interface, $query );
     my $opacstylesheet = C4::Context->preference('opacstylesheet');
+
+       # if the template doesn't exist, load the English one as a last resort
+       my $filename = "$htdocs/$theme/$lang/".($interface eq 'intranet'?"modules":"")."/$tmplbase";
+       unless (-f $filename) {
+               $lang = 'en';
+               $filename = "$htdocs/$theme/$lang/".($interface eq 'intranet'?"modules":"")."/$tmplbase";
+       }
     my $template       = HTML::Template::Pro->new(
-        filename          => "$htdocs/$theme/$lang/modules/$tmplbase",
+               filename          => $filename,
         die_on_bad_params => 1,
         global_vars       => 1,
         case_sensitive    => 1,