TPac: non-inherited org unit visibility : hide copy counts
authorBill Erickson <berick@esilibrary.com>
Wed, 21 Mar 2012 18:34:19 +0000 (14:34 -0400)
committerBill Erickson <berick@esilibrary.com>
Fri, 30 Mar 2012 13:18:35 +0000 (09:18 -0400)
Avoid showing copy counts for non-opac-visible org units in the search
results and record details page.  This is important when the
'opac.org_unit.non_inheritied_visibility' global flag is enabled, as org
units along the tree may be non-visible.

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Open-ILS/src/templates/opac/parts/record/copy_counts.tt2
Open-ILS/src/templates/opac/parts/result/copy_counts.tt2

index a573161..cd59442 100644 (file)
@@ -7,7 +7,12 @@
         WHILE depth < depths;
             ou_avail = ctx.copy_summary.$depth.available;
             ou_id = ctx.copy_summary.$depth.org_unit;
-            ou_name = ctx.get_aou(ou_id).name;
+            cp_org_unit = ctx.get_aou(ou_id);
+            IF cp_org_unit.opac_visible == 'f' AND !ctx.is_staff;
+                depth = depth + 1;
+                NEXT;
+            END;
+            ou_name = cp_org_unit.name;
             displayed_ous.$ou_name = 1;
     %]
     <li>
index d95d3a7..c049ebf 100644 (file)
@@ -7,11 +7,13 @@
         IF attrs.copy_counts.$depth.count > 0;
 %]
 <div class="result_count">
+[% IF ctx.get_aou(attrs.copy_counts.$depth.org_unit).opac_visible == 't' AND !ctx.is_staff %]
     [% l('[_1] of [quant,_2,copy,copies] available at [_3].',
         attrs.copy_counts.$depth.available,
         attrs.copy_counts.$depth.count,
         ou_name) | html
     %]
+[% END %]
 </div>
 [%-     END;
     depth = depth + 1;