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

svn at svn.open-ils.org svn at svn.open-ils.org
Thu Apr 8 17:50:26 EDT 2010


Author: phasefx
Date: 2010-04-08 17:50:20 -0400 (Thu, 08 Apr 2010)
New Revision: 16182

Modified:
   trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm
Log:
Tweak the descriptions for the on-shelf holds retrieval methods, and add a variant that filters to shelf-expired holds.

Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm	2010-04-08 21:50:13 UTC (rev 16181)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm	2010-04-08 21:50:20 UTC (rev 16182)
@@ -1427,7 +1427,7 @@
     api_name  => 'open-ils.circ.captured_holds.on_shelf.retrieve',
     stream    => 1,
     signature => q/
-		Returns a list of un-fulfilled holds for a given title id
+		Returns a list of un-fulfilled holds (on the Holds Shelf) for a given title id
 		@param authtoken The login session key
 		@param org The org id of the location in question
 	/
@@ -1438,12 +1438,24 @@
     api_name  => 'open-ils.circ.captured_holds.id_list.on_shelf.retrieve',
     stream    => 1,
     signature => q/
-		Returns a list ids of un-fulfilled holds for a given title id
+		Returns list ids of un-fulfilled holds (on the Holds Shelf) for a given title id
 		@param authtoken The login session key
 		@param org The org id of the location in question
 	/
 );
 
+__PACKAGE__->register_method(
+    method    => 'fetch_captured_holds',
+    api_name  => 'open-ils.circ.captured_holds.id_list.expired_on_shelf.retrieve',
+    stream    => 1,
+    signature => q/
+		Returns list ids of shelf-expired un-fulfilled holds for a given title id
+		@param authtoken The login session key
+		@param org The org id of the location in question
+	/
+);
+
+
 sub fetch_captured_holds {
 	my( $self, $conn, $auth, $org ) = @_;
 
@@ -1453,29 +1465,32 @@
 
 	$org ||= $e->requestor->ws_ou;
 
-    my $hold_ids = $e->json_query(
-        { 
-            select => { ahr => ['id'] },
-            from   => {
-                ahr => {
-                    acp => {
-                        field => 'id',
-                        fkey  => 'current_copy'
-                    },
-                }
-            }, 
-            where => {
-                '+acp' => { status => OILS_COPY_STATUS_ON_HOLDS_SHELF },
-                '+ahr' => {
-                    capture_time     => { "!=" => undef },
-                    current_copy     => { "!=" => undef },
-                    fulfillment_time => undef,
-                    pickup_lib       => $org,
-                    cancel_time      => undef,
-                  }
+    my $query = { 
+        select => { ahr => ['id'] },
+        from   => {
+            ahr => {
+                acp => {
+                    field => 'id',
+                    fkey  => 'current_copy'
+                },
             }
-        },
-    );
+        }, 
+        where => {
+            '+acp' => { status => OILS_COPY_STATUS_ON_HOLDS_SHELF },
+            '+ahr' => {
+                capture_time     => { "!=" => undef },
+                current_copy     => { "!=" => undef },
+                fulfillment_time => undef,
+                pickup_lib       => $org,
+                cancel_time      => undef,
+              }
+        }
+    };
+    if($self->api_name =~ /expired/) {
+        $query->{'where'}->{'+ahr'}->{'shelf_expire_time'} = {'<' => 'now'};
+        $query->{'where'}->{'+ahr'}->{'shelf_time'} = {'!=' => undef};
+    }
+    my $hold_ids = $e->json_query( $query );
 
     for my $hold_id (@$hold_ids) {
         if($self->api_name =~ /id_list/) {



More information about the open-ils-commits mailing list