--- /dev/null
+[%- depths = attrs.copy_counts.size;
+ depth = 0;
+ displayed_ous = {};
+ hiding_disabled = ctx.org_hiding_disabled();
+ WHILE depth < depths;
+ org_unit = ctx.get_aou(attrs.copy_counts.$depth.org_unit);
+ ou_name = org_unit.name;
+ displayed_ous.$ou_name = 1;
+ IF attrs.copy_counts.$depth.count > 0 AND (
+ hiding_disabled OR ctx.org_within_hiding_scope(org_unit.id));
+%]
+<div class="result_count">
+[% IF ctx.get_aou(attrs.copy_counts.$depth.org_unit).opac_visible == 't' %]
+ [% l('[quant,_1,hold,holds] on first copy returned of [quant,_2,copy,copies]',
+ rec.hold_count, attrs.copy_counts.$depth.count) | html
+ %]
+ </br>
+ [% l('[quant,_1,copy,copies] available',
+ attrs.copy_counts.$depth.available) | html
+ %]
+[% END %]
+</div>
+[%- END;
+ depth = depth + 1;
+ END;
+
+ depth = attrs.plib_copy_counts.size - 1;
+ org_unit = ctx.get_aou(attrs.plib_copy_counts.$depth.org_unit);
+ ou_name = org_unit.name;
+ UNLESS displayed_ous.exists(ou_name);
+
+%]
+[%- IF attrs.plib_copy_counts.$depth.count > 0 AND (
+ hiding_disabled OR ctx.org_within_hiding_scope(org_unit.id)) %]
+<div class="result_count preferred">[%
+ l('[quant,_1,copy,copies] available',
+ attrs.copy_counts.$depth.available) | html
+ %]
+</div>
+[%- END %]
+[%- END %]
+
[% END %]
</table>
- <div>
- [% l('[quant,_1,hold,holds] on first copy returned of [quant,_2,copy,copies]',
- rec.hold_count, attrs.copy_counts.count) %]
- <br/>
- [% l('[quant,_1,copy,copies] available', attrs.copy_counts.available) %]
- </div>
+ [% PROCESS "opac/parts/result/copy_counts.tt2" %]
[% IF rec.user_circulated %]
<div class="result_item_circulated">
<img src="[% ctx.media_prefix %]/images/green_check.png" alt="[% l('Checked Out Before') %]"/>
}
}
+ # KCLS custom
+ # Adds hold count to records in context
+ for my $rec ( @{ $ctx->{records} } ) {
+ $rec->{hold_count} = $U->simplereq(
+ 'open-ils.circ', 'open-ils.circ.bre.holds.count', $rec->{id});
+ }
+
for my $rec (@{$ctx->{records}}) {
my ($res_rec) = grep { $_->[0] == $rec->{$id_key} } @{$results->{ids}};
$rec->{badges} = [split(',', $res_rec->[1])] if $res_rec->[1];