Fix OU logic for determining hold availability
authorDan Scott <dscott@laurentian.ca>
Fri, 27 Jul 2012 16:34:33 +0000 (12:34 -0400)
committerDan Scott <dscott@laurentian.ca>
Tue, 31 Jul 2012 17:29:08 +0000 (13:29 -0400)
We'll use search_ou directly - not necessarily the best option, but
better than using the search_ou value as a depth. Not sure if preferred
library or physical loc would be better here;
E_TOO_MANY_LOCATION_OPTIONS!

Signed-off-by: Dan Scott <dscott@laurentian.ca>
Open-ILS/src/templates/opac/parts/misc_util.tt2
Open-ILS/src/templates/opac/parts/record/summary.tt2
Open-ILS/src/templates/opac/parts/result/table.tt2

index 524a66b..124d124 100644 (file)
         FOR node IN xml.findnodes(xpath);
             FOR attr IN ['count', 'available', 'unshadow', 'transcendant', 'org_unit']; 
                 depth = node.getAttribute('depth');
+                org_unit = node.getAttribute('org_unit');
                 args.copy_counts.$depth.$attr = node.getAttribute(attr);
+                args.org_copy_counts.$org_unit.$attr = node.getAttribute(attr);
             END;
         END;
-        
+
         # Get preferred library copy count
         args.plib_copy_counts = {};
         count_type = 'pref_lib';
index 0ea975c..75a5964 100644 (file)
     </div>
 
     <div id="rdetail_actions_div">
-        [%- depth = ctx.search_ou - 1; IF ctx.copy_summary.$depth.available == 0 OR ctx.holds_block.enabled == 'false' %]
+        [%- search_ou = ctx.search_ou; IF attrs.org_copy_counts.$search_ou.available == 0 OR ctx.holds_block.enabled == 'false' %]
         <div class="rdetail_aux_utils place_hold">
             <a href="[% mkurl(ctx.opac_root _ '/place_hold', 
                 {hold_target => ctx.bre_id, hold_type => 'T', hold_source_page => mkurl()}, stop_parms) %]" 
             class="no-dec"><img src="[% ctx.media_prefix %]/images/green_check.png" alt="[% l('place hold') %]" /><span 
             class="place_hold">[% l('Place Hold') %]</span></a>
         </div>
-        [% END %]
+        [%- END -%]
         <div class="rdetail_aux_utils toggle_list">
         [%  IF ctx.user;
             INCLUDE "opac/parts/bookbag_actions.tt2";
index 8fa61e4..3a60ed1 100644 (file)
                                             <td nowrap='nowrap' width="1" align="right">
                                                 <div class="result_table_utils_cont">
                                                     <div class="result_table_utils">
-                                                        [%- depth = ctx.search_ou - 1; IF args.copy_counts.$depth.available == 0 OR ctx.holds_block.enabled == 'false' %]
+                                                        [%- search_ou = ctx.search_ou; IF attrs.org_copy_counts.$search_ou.available == 0 OR ctx.holds_block.enabled == 'false' %]
                                                         <div class="results_aux_utils place_hold"><a
                                                                 href="[% mkurl(ctx.opac_root _ '/place_hold', 
                                                                     {hold_target => rec.id, hold_type => 'T', hold_source_page => mkurl()}) %]" 
                                                                 src="[% ctx.media_prefix %]/images/green_check.png"
                                                                 alt=""/><span class="result_place_hold">[% l('Place Hold') %]</span></a>
                                                         </div>
-                                                        [% END %]
+                                                        [%- END -%]
                                                         <div class="results_aux_utils result_util">
                                                             [%  IF ctx.user;
                                                                 INCLUDE "opac/parts/bookbag_actions.tt2";