From 80b752afb103e86d7c1cb97b7966ebe33134b59d Mon Sep 17 00:00:00 2001 From: Jeff Godin Date: Thu, 26 Dec 2013 14:54:29 -0500 Subject: [PATCH] Don't try to use Titlecase wrapper if not defined Don't try to call the function passed from Lingua::EN::Titlecase function if the tc variable is undefined. This avoids having blank titles when the template is used in an environment where EGWeb isn't passing the function to the templates. Signed-off-by: Jeff Godin --- templates_tadlskin/opac/parts/misc_util.tt2 | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/templates_tadlskin/opac/parts/misc_util.tt2 b/templates_tadlskin/opac/parts/misc_util.tt2 index a252df34ea..d340a33a3a 100644 --- a/templates_tadlskin/opac/parts/misc_util.tt2 +++ b/templates_tadlskin/opac/parts/misc_util.tt2 @@ -43,13 +43,13 @@ titresults = xml.findnodes('//*[@tag="245"]/*[@code="a" or @code="b" or @code="n" or @code="p"]'); titresults_content = []; FOR sub IN titresults; - IF sub.getAttribute('code') == 'a'; + IF sub.getAttribute('code') == 'a' && tc.defined; titresults_content.push(tc.title(sub.textContent.replace(' :$',':'))); - ELSIF sub.getAttribute('code') == 'b'; + ELSIF sub.getAttribute('code') == 'b' && tc.defined; titresults_content.push(tc.title(sub.textContent)); ELSE; titresults_content.push(sub.textContent); - END; + END; END; args.title = titresults_content.join(" "); # Avoid ugly trailing syntax on brief titles @@ -59,9 +59,9 @@ titsubs = xml.findnodes('//*[@tag="245"]/*[@code]'); titsubs_content = []; FOR sub IN titsubs; - IF sub.getAttribute('code') == 'a'; + IF sub.getAttribute('code') == 'a' && tc.defined; titsubs_content.push(tc.title(sub.textContent.replace(' :$',':'))); - ELSIF sub.getAttribute('code') == 'b'; + ELSIF sub.getAttribute('code') == 'b' && tc.defined; titsubs_content.push(tc.title(sub.textContent)); ELSE; titsubs_content.push(sub.textContent); -- 2.11.0