]> git.evergreen-ils.org Git - working/Evergreen.git/blob - Open-ILS/src/templates/opac/parts/record/copy_counts.tt2
TPAC: Suppress copy counts for libraries that own zero copies
[working/Evergreen.git] / Open-ILS / src / templates / opac / parts / record / copy_counts.tt2
1 <span id="rdetail_copy_counts">
2     <h2>[% l('Available copies') %]</h2>
3     <ul>
4     [%- depths = ctx.copy_summary.size;
5         depth = 0;
6         displayed_ous = {};
7         WHILE depth < depths;
8             ou_avail = ctx.copy_summary.$depth.available;
9             ou_id = ctx.copy_summary.$depth.org_unit;
10             ou_name = ctx.get_aou(ou_id).name;
11             displayed_ous.$ou_name = 1;
12     %]
13     <li>
14     [% l('[quant,_1,copy,copies] at [_2].', ou_avail, ou_name) | html %]
15     [%- this_depth = ctx.get_aou(ou_id).ou_type.depth;
16         IF ou_avail > 0 && this_depth != ctx.copy_depth %]
17     <a href="[% mkurl('', {copy_depth => this_depth}, ['copy_offset']); %]"
18        title="[% l('Show copies at [_1]', ou_name); %]">
19        [%- l('(Show)'); %]</a>
20     [%- END; %]
21     </li>
22     [%- depth = depth + 1;
23         END;
24
25         depth = attrs.plib_copy_counts.size - 1;
26         ou_name = ctx.get_aou(attrs.plib_copy_counts.$depth.org_unit).name;
27         ou_id = attrs.plib_copy_counts.$depth.org_unit;
28         UNLESS depth < 0 || displayed_ous.exists(ou_name);
29     %]
30     [%- IF attrs.plib_copy_counts.$depth.count > 0; %]
31     <li class="preferred">[%
32         l('[_1] of [quant,_2,copy,copies] available at [_3].',
33             attrs.plib_copy_counts.$depth.available,
34             attrs.plib_copy_counts.$depth.count,
35             ou_name) | html
36     %] <a href="[% mkurl('', {locg => ou_id}, ['copy_offset']); %]"
37        title="[% l('Show copies at [_1]', ou_name); %]">[%
38        l('(Show preferred library)');
39     %]</a></li>
40     [%- END %]
41     [%- END %]
42     </ul>
43 </span>