From 26bce766893e49766ed2eff565541c3ba0bf7490 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Wed, 9 Nov 2011 16:44:10 -0500 Subject: [PATCH] TPac; display hold count in results page Using same wording and layout as kcls jspac skin. Signed-off-by: Bill Erickson --- .../perlmods/lib/OpenILS/WWW/EGCatLoader/Search.pm | 3 ++- .../src/perlmods/lib/OpenILS/WWW/EGCatLoader/Util.pm | 19 ++++++++++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) 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 1bf8b61c63..0b991dcac3 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Search.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Search.pm @@ -429,7 +429,8 @@ sub load_rresults { site => $site, depth => $depth, pref_lib => $ctx->{pref_ou}, - } + }, + 1 ); $self->timelog("Returned from get_records_and_facets()"); diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Util.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Util.pm index 498a04f472..39ebb2d69d 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Util.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Util.pm @@ -215,7 +215,7 @@ sub generic_redirect { } sub get_records_and_facets { - my ($self, $rec_ids, $facet_key, $unapi_args) = @_; + my ($self, $rec_ids, $facet_key, $unapi_args, $get_hold_stats) = @_; $unapi_args ||= {}; $unapi_args->{site} ||= $self->ctx->{aou_tree}->()->shortname; @@ -275,10 +275,27 @@ sub get_records_and_facets { 'open-ils.search.facet_cache.retrieve', $facet_key, 10 ) if $facet_key; + # gather up the unapi recs $ses->session_wait(1); $self->timelog("get_records_and_facets():past session wait"); + if ($get_hold_stats) { + # note: this happens after the batch unapi call to ensure + # that @data has the record blobs we're expecting. + my $hses = OpenSRF::MultiSession->new( + app => 'open-ils.circ', + cap => 10, # XXX config + success_handler => sub { + my($self, $req) = @_; + my ($blob) = grep {$_->{id} eq $req->{params}->[0]} @data; + $blob->{hold_count} = $req->{response}->[0]->content; + } + ); + $hses->request('open-ils.circ.bre.holds.count', $_) for @$rec_ids; + $hses->session_wait(1); + } + my $facets = {}; if ($facet_key) { my $tmp_facets = $facet_req->gather(1); -- 2.11.0