From bf90e0df41200ce2d2a4c054a9887a797b45b4db Mon Sep 17 00:00:00 2001 From: Dan Scott Date: Tue, 14 Aug 2012 16:51:59 -0400 Subject: [PATCH] Avoid top-level copy counts in TPAC Signed-off-by: Dan Scott --- .../opac/parts/record/copy_counts.tt2 | 48 ++++++++++++++++++++++ .../opac/parts/result/copy_counts.tt2 | 36 ++++++++++++++++ 2 files changed, 84 insertions(+) create mode 100644 Open-ILS/src/templates_conifer/opac/parts/record/copy_counts.tt2 create mode 100644 Open-ILS/src/templates_conifer/opac/parts/result/copy_counts.tt2 diff --git a/Open-ILS/src/templates_conifer/opac/parts/record/copy_counts.tt2 b/Open-ILS/src/templates_conifer/opac/parts/record/copy_counts.tt2 new file mode 100644 index 0000000000..b71e732d34 --- /dev/null +++ b/Open-ILS/src/templates_conifer/opac/parts/record/copy_counts.tt2 @@ -0,0 +1,48 @@ + +

[% l('Available copies') %]

+
    + [%- depths = ctx.copy_summary.size; + depth = 1; + displayed_ous = {}; + WHILE depth < depths; + ou_avail = ctx.copy_summary.$depth.available; + ou_id = ctx.copy_summary.$depth.org_unit; + 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; + %] +
  • + [% l('[quant,_1,copy,copies] at [_2].', ou_avail, ou_name) | html %] + [%- this_depth = ctx.get_aou(ou_id).ou_type.depth; + IF ou_avail > 0 && this_depth != ctx.copy_depth %] + + [%- l('(Show)'); %] + [%- END; %] +
  • + [%- depth = depth + 1; + END; + + depth = attrs.plib_copy_counts.size - 1; + ou_name = ctx.get_aou(attrs.plib_copy_counts.$depth.org_unit).name; + ou_id = attrs.plib_copy_counts.$depth.org_unit; + UNLESS depth < 0 || displayed_ous.exists(ou_name); + %] + [%- IF attrs.plib_copy_counts.$depth.count > 0; %] +
  • [% + l('[_1] of [quant,_2,copy,copies] available at [_3].', + attrs.plib_copy_counts.$depth.available, + attrs.plib_copy_counts.$depth.count, + ou_name) | html + %] [% + l('(Show preferred library)'); + %]
  • + [%- END %] + [%- END %] +
+
diff --git a/Open-ILS/src/templates_conifer/opac/parts/result/copy_counts.tt2 b/Open-ILS/src/templates_conifer/opac/parts/result/copy_counts.tt2 new file mode 100644 index 0000000000..fec87fa903 --- /dev/null +++ b/Open-ILS/src/templates_conifer/opac/parts/result/copy_counts.tt2 @@ -0,0 +1,36 @@ +[%- depths = attrs.copy_counts.size; + depth = 1; + displayed_ous = {}; + WHILE depth < depths; + ou_name = ctx.get_aou(attrs.copy_counts.$depth.org_unit).name; + displayed_ous.$ou_name = 1; + IF attrs.copy_counts.$depth.count > 0; +%] +
+[% IF ctx.get_aou(attrs.copy_counts.$depth.org_unit).opac_visible == 't' %] + [% l('[_1] of [quant,_2,copy,copies] available at [_3].', + attrs.copy_counts.$depth.available, + attrs.copy_counts.$depth.count, + ou_name) | html + %] +[% END %] +
+[%- END; + depth = depth + 1; + END; + + depth = attrs.plib_copy_counts.size - 1; + ou_name = ctx.get_aou(attrs.plib_copy_counts.$depth.org_unit).name; + UNLESS displayed_ous.exists(ou_name); + +%] +[%- IF attrs.plib_copy_counts.$depth.count > 0; %] +
[% + l('[_1] of [quant,_2,copy,copies] available at [_3].', + attrs.plib_copy_counts.$depth.available, + attrs.plib_copy_counts.$depth.count, + ou_name) | html + %] +
+[%- END %] +[%- END %] -- 2.11.0