[open-ils-commits] r14957 - trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ (erickson)

svn at svn.open-ils.org svn at svn.open-ils.org
Wed Nov 18 16:02:47 EST 2009


Author: erickson
Date: 2009-11-18 16:02:42 -0500 (Wed, 18 Nov 2009)
New Revision: 14957

Modified:
   trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm
Log:
added a batch/streaming version of the uber-hold retrieval call

Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm	2009-11-18 16:36:57 UTC (rev 14956)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm	2009-11-18 21:02:42 UTC (rev 14957)
@@ -960,7 +960,7 @@
     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,8 +1908,27 @@
 	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 = {};
 
 	my $hold = $e->retrieve_action_hold_request(
@@ -1922,6 +1941,11 @@
 		]
 	) 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);
 



More information about the open-ils-commits mailing list