Silence warnings in search results for holdable copies
authorDan Scott <dscott@laurentian.ca>
Sat, 4 Aug 2012 15:04:17 +0000 (11:04 -0400)
committerBill Erickson <berick@esilibrary.com>
Wed, 15 Aug 2012 17:14:14 +0000 (13:14 -0400)
Have not yet determined the exact reason the holdable copies size is not
defined in some instances in the search results only, but this commit
prevents warnings from being spewed by apache about undefined variables.

Signed-off-by: Dan Scott <dscott@laurentian.ca>
Signed-off-by: Bill Erickson <berick@esilibrary.com>

Open-ILS/src/templates/opac/parts/result/table.tt2

index 225c21a..bc52adb 100644 (file)
                                                 <div class="result_table_utils_cont">
                                                     <div class="result_table_utils">
 [%- search_ou = ctx.search_ou;
+    num_holdable_copies = attrs.marc_xml.findnodes('//*[local-name()="holdings" and @has_holdable="true"]').size || 0;
     IF ctx.place_unfillable ||
-        ( attrs.marc_xml.findnodes('//*[local-name()="holdings" and @has_holdable="true"]').size > 0
+        ( num_holdable_copies > 0
             && (ctx.holds_block.enabled != 'true' || attrs.org_copy_counts.$search_ou.available == 0)
         )
 %]