Tweak the descriptions for the on-shelf holds retrieval methods, and add a variant...
authorphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 8 Apr 2010 21:50:20 +0000 (21:50 +0000)
committerphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 8 Apr 2010 21:50:20 +0000 (21:50 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@16182 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm

index 39dd4a7..6141c61 100644 (file)
@@ -1427,7 +1427,7 @@ __PACKAGE__->register_method(
     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 @@ __PACKAGE__->register_method(
     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 @@ sub fetch_captured_holds {
 
        $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/) {