From 1000e749697b5cd4f4984e3f9234b76a5a62f6ad Mon Sep 17 00:00:00 2001 From: Jason Stephenson Date: Wed, 14 May 2014 15:46:29 -0400 Subject: [PATCH] LP 1319560: Silence template error messages in Apache error log. We get a number of messages like the following in our Apache error logs on a constant basis: Argument "" isn't numeric in addition (+) at /openils/var/templates/opac/parts/record/navigation.tt2 line 6. Argument "" isn't numeric in division (/) at /openils/var/templates/opac/results.tt2 line 1. Argument "" isn't numeric in numeric ge (>=) at /openils/var/templates/opac/parts/record/navigation.tt2 line 38. Argument "" isn't numeric in numeric gt (>) at /openils/var/templates/opac/myopac/holds/edit.tt2 line 106. Argument "" isn't numeric in numeric gt (>) at /openils/var/templates/opac/myopac/holds.tt2 line 42. Argument "" isn't numeric in numeric gt (>) at /openils/var/templates/opac/parts/place_hold.tt2 line 98. Argument "" isn't numeric in numeric gt (>) at /openils/var/templates/opac/parts/record/summary.tt2 line 56. Argument "" isn't numeric in numeric gt (>) at /openils/var/templates/opac/parts/result/table.tt2 line 87. Argument "" isn't numeric in numeric lt (<) at /openils/var/templates/opac/myopac/hold_history.tt2 line 122. Argument "" isn't numeric in numeric lt (<) at /openils/var/templates/opac/myopa/result/table.tt2 line 87. Argument "" isn't numeric in numeric lt (<) at /openils/var/templates/opac/myopac/hold_history.tt2 line 122. Argument "" isn't numeric in numeric lt (<) at /openils/var/templates/opac/myopac/holds.tt2 line 215. This commit adds some sanity checking to make those messages go away. Signed-off-by: Jason Stephenson Signed-off-by: Ben Shum --- Open-ILS/src/templates/opac/myopac/hold_history.tt2 | 2 +- Open-ILS/src/templates/opac/myopac/holds.tt2 | 8 ++++---- Open-ILS/src/templates/opac/myopac/holds/edit.tt2 | 2 +- Open-ILS/src/templates/opac/parts/place_hold.tt2 | 2 +- Open-ILS/src/templates/opac/parts/record/navigation.tt2 | 2 +- Open-ILS/src/templates/opac/parts/record/summary.tt2 | 2 +- Open-ILS/src/templates/opac/parts/result/table.tt2 | 2 +- Open-ILS/src/templates/opac/results.tt2 | 2 +- 8 files changed, 11 insertions(+), 11 deletions(-) diff --git a/Open-ILS/src/templates/opac/myopac/hold_history.tt2 b/Open-ILS/src/templates/opac/myopac/hold_history.tt2 index a28b5b4f20..8412f42ddb 100644 --- a/Open-ILS/src/templates/opac/myopac/hold_history.tt2 +++ b/Open-ILS/src/templates/opac/myopac/hold_history.tt2 @@ -47,7 +47,7 @@
- [% IF ctx.holds.size < 1 %] + [% IF ctx.holds.size && ctx.holds.size < 1 %]
[% l('No holds found.') %]
diff --git a/Open-ILS/src/templates/opac/myopac/holds.tt2 b/Open-ILS/src/templates/opac/myopac/holds.tt2 index 08ebfce726..6dbd4a269d 100644 --- a/Open-ILS/src/templates/opac/myopac/holds.tt2 +++ b/Open-ILS/src/templates/opac/myopac/holds.tt2 @@ -3,9 +3,9 @@ PROCESS "opac/parts/hold_status.tt2"; WRAPPER "opac/parts/myopac/base.tt2"; myopac_page = "holds"; - limit = ctx.holds_limit; - offset = ctx.holds_offset; - count = ctx.holds_ids.size; + limit = (ctx.holds_limit.defined) ? ctx.holds_limit : 0; + offset = (ctx.holds_offset.defined) ? ctx.holds_offset : 0; + count = (ctx.holds_ids.size.defined) ? ctx.holds_ids.size : 0; %]

[% l('My Holds') %]

@@ -96,7 +96,7 @@ - [% IF ctx.holds.size < 1 %] + [% IF ctx.holds.size && ctx.holds.size < 1 %]
[% l('No holds found.') %]
[% ELSE %] diff --git a/Open-ILS/src/templates/opac/parts/place_hold.tt2 b/Open-ILS/src/templates/opac/parts/place_hold.tt2 index 1a497f7da8..8c70ca5ac7 100644 --- a/Open-ILS/src/templates/opac/parts/place_hold.tt2 +++ b/Open-ILS/src/templates/opac/parts/place_hold.tt2 @@ -96,7 +96,7 @@ [% l('Advanced Hold Options') %] [% END %] [% IF hdata.metarecord_filters.formats.size OR # should this be size > 1 - hdata.metarecord_filters.langs.size > 1; + (hdata.metarecord_filters.langs.size && hdata.metarecord_filters.langs.size > 1); PROCESS metarecord_hold_filters_selector hold_data=hdata; END; END %] diff --git a/Open-ILS/src/templates/opac/parts/record/navigation.tt2 b/Open-ILS/src/templates/opac/parts/record/navigation.tt2 index 29b1106a68..8b38a7f67c 100644 --- a/Open-ILS/src/templates/opac/parts/record/navigation.tt2 +++ b/Open-ILS/src/templates/opac/parts/record/navigation.tt2 @@ -1,4 +1,4 @@ -[% IF ctx.search_result_index >= 0 %] +[% IF ctx.search_result_index.defined && ctx.search_result_index >= 0 %]
[% l('◄ Search Results') %] diff --git a/Open-ILS/src/templates/opac/parts/record/summary.tt2 b/Open-ILS/src/templates/opac/parts/record/summary.tt2 index 44746c4054..7381acd772 100644 --- a/Open-ILS/src/templates/opac/parts/record/summary.tt2 +++ b/Open-ILS/src/templates/opac/parts/record/summary.tt2 @@ -43,7 +43,7 @@ [%- search_ou = ctx.search_ou; IF ctx.place_unfillable || ( attrs.marc_xml.findnodes('//*[local-name()="holdings" and @has_holdable="true"]').size > 0 - && (ctx.holds_block.enabled != 'true' || attrs.org_copy_counts.$search_ou.available == 0) + && (ctx.holds_block.enabled != 'true' && !attrs.org_copy_counts.$search_ou.available) ) %]
diff --git a/Open-ILS/src/templates/opac/parts/result/table.tt2 b/Open-ILS/src/templates/opac/parts/result/table.tt2 index eac0bc547e..ef3734bf56 100644 --- a/Open-ILS/src/templates/opac/parts/result/table.tt2 +++ b/Open-ILS/src/templates/opac/parts/result/table.tt2 @@ -87,7 +87,7 @@ [% html_text_attr('title', l('Display record details for "[_1]"', attrs.title)) %]> [% attrs.title | html %] - [% IF rec.mr_constituent_count > 1 %] + [% IF rec.mr_constituent_count.defined && rec.mr_constituent_count > 1 %] ([% rec.mr_constituent_count %]) diff --git a/Open-ILS/src/templates/opac/results.tt2 b/Open-ILS/src/templates/opac/results.tt2 index 1bd4d32029..a3cb0e1e28 100644 --- a/Open-ILS/src/templates/opac/results.tt2 +++ b/Open-ILS/src/templates/opac/results.tt2 @@ -11,7 +11,7 @@ page = CGI.param('page'); page = page.match('^\d+$') ? page : 0; # verify page is a sane value - page_count = ctx.page_size == 0 ? 1 : POSIX.ceil(ctx.hit_count / ctx.page_size); + page_count = (!ctx.page_size.defined || !ctx.hit_count.defined || ctx.page_size == 0) ? 1 : POSIX.ceil(ctx.hit_count / ctx.page_size); PROCESS "opac/parts/misc_util.tt2"; PROCESS get_library; -- 2.11.0
[% IF hold.metarecord_filters.formats.size OR - hold.metarecord_filters.langs.size > 1; + (hold.metarecord_filters.langs.size.defined && hold.metarecord_filters.langs.size > 1); PROCESS metarecord_hold_filters_selector hold_data=hold; END %]