From: Bill Erickson Date: Wed, 29 Oct 2014 21:05:59 +0000 (-0400) Subject: KMAIN-324 Fixes bug: Copy and Hold count were not displaying properly X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=ddc522e34b168b04148c276a543da9e1fe69dc65;p=working%2FEvergreen.git KMAIN-324 Fixes bug: Copy and Hold count were not displaying properly Cross-port: 77f6b0d --- diff --git a/KCLS/openils/var/templates_kcls/opac/parts/result/copy_counts.tt2 b/KCLS/openils/var/templates_kcls/opac/parts/result/copy_counts.tt2 new file mode 100644 index 0000000000..43d1ba20c8 --- /dev/null +++ b/KCLS/openils/var/templates_kcls/opac/parts/result/copy_counts.tt2 @@ -0,0 +1,42 @@ +[%- 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)); +%] +
+[% 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 + %] +
+ [% l('[quant,_1,copy,copies] available', + attrs.copy_counts.$depth.available) | html + %] +[% END %] +
+[%- 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)) %] +
[% + l('[quant,_1,copy,copies] available', + attrs.copy_counts.$depth.available) | html + %] +
+[%- END %] +[%- END %] + diff --git a/KCLS/openils/var/templates_kcls/opac/parts/result/table.tt2 b/KCLS/openils/var/templates_kcls/opac/parts/result/table.tt2 index 9375560f06..691a6bb99c 100644 --- a/KCLS/openils/var/templates_kcls/opac/parts/result/table.tt2 +++ b/KCLS/openils/var/templates_kcls/opac/parts/result/table.tt2 @@ -158,12 +158,7 @@ [% END %] -
- [% l('[quant,_1,hold,holds] on first copy returned of [quant,_2,copy,copies]', - rec.hold_count, attrs.copy_counts.count) %] -
- [% l('[quant,_1,copy,copies] available', attrs.copy_counts.available) %] -
+ [% PROCESS "opac/parts/result/copy_counts.tt2" %] [% IF rec.user_circulated %]
[% l('Checked Out Before') %] diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Search.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Search.pm index c21566a628..01fb36f199 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Search.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Search.pm @@ -568,6 +568,13 @@ sub load_rresults { } } + # 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];