From 1e72012fbc7f1ff9437fa8ef126987c5a51371a5 Mon Sep 17 00:00:00 2001 From: erickson Date: Wed, 18 Nov 2009 21:02:42 +0000 Subject: [PATCH] added a batch/streaming version of the uber-hold retrieval call git-svn-id: svn://svn.open-ils.org/ILS/trunk@14957 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- .../src/perlmods/OpenILS/Application/Circ/Holds.pm | 28 ++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm b/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm index 1ec30c6e7f..b8d08d720a 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm @@ -960,7 +960,7 @@ sub retrieve_hold_queue_status_impl { return { total_holds => scalar(@$q_holds), queue_position => $qpos, - potential_copies => $num_potentials, + potential_copies => $num_potentials->{count}, status => _hold_status($e, $hold), estimated_wait => int($estimated_wait) }; @@ -1908,7 +1908,26 @@ sub uber_hold { my($self, $client, $auth, $hold_id) = @_; my $e = new_editor(authtoken=>$auth); $e->checkauth or return $e->event; - $e->allowed('VIEW_HOLD') or return $e->event; + return uber_hold_impl($e, $hold_id); +} + +__PACKAGE__->register_method( + method => 'batch_uber_hold', + authoritative => 1, + stream => 1, + api_name => 'open-ils.circ.hold.details.batch.retrieve' +); + +sub batch_uber_hold { + my($self, $client, $auth, $hold_ids) = @_; + my $e = new_editor(authtoken=>$auth); + $e->checkauth or return $e->event; + $client->respond(uber_hold_impl($e, $_)) for @$hold_ids; + return undef; +} + +sub uber_hold_impl { + my($e, $hold_id) = @_; my $resp = {}; @@ -1922,6 +1941,11 @@ sub uber_hold { ] ) or return $e->event; + if($hold->usr->id ne $e->requestor->id) { + # A user is allowed to see his/her own holds + $e->allowed('VIEW_HOLD') or return $e->event; + } + my $user = $hold->usr; $hold->usr($user->id); -- 2.11.0