From fe1b2e488207bf13cf39ba6100af6f14a0fd3c12 Mon Sep 17 00:00:00 2001 From: Joshua Ferraro Date: Sat, 10 Nov 2007 21:57:29 -0600 Subject: [PATCH] template improvement: fall back on english if the template file doesn't exist Signed-off-by: Joshua Ferraro --- C4/Output.pm | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/C4/Output.pm b/C4/Output.pm index 64d2aa01fe..e73d1b6b35 100644 --- a/C4/Output.pm +++ b/C4/Output.pm @@ -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, -- 2.39.5