LP1040147 Return wrong-shelf holds in clearable list
authorBill Erickson <berick@esilibrary.com>
Fri, 7 Jun 2013 13:42:57 +0000 (09:42 -0400)
committerJason Etheridge <jason@esilibrary.com>
Fri, 7 Jun 2013 16:25:03 +0000 (12:25 -0400)
1. Change the staff client "View Shelf-Expired Holds" action label to
"View Clearable Holds".

2.  When "View Clearable Holds" is selected, display both shelf-expired
and wrong-shelf holds.

New API calls:

open-ils.circ.captured_holds.expired_on_shelf_or_wrong_shelf.retrieve
open-ils.circ.captured_holds.id_list.expired_on_shelf_or_wrong_shelf.retrieve

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Jason Etheridge <jason@esilibrary.com>
Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Holds.pm
Open-ILS/xul/staff_client/chrome/content/main/constants.js

index 7e06492..924da08 100644 (file)
@@ -2056,6 +2056,30 @@ __PACKAGE__->register_method(
     /
 );
 
+__PACKAGE__->register_method(
+    method    => 'fetch_captured_holds',
+    api_name  => 
+      'open-ils.circ.captured_holds.expired_on_shelf_or_wrong_shelf.retrieve',
+    stream    => 1,
+    authoritative => 1,
+    signature => q/
+        Returns list of shelf-expired un-fulfilled holds OR wrong shelf holds
+        for a given shelf lib
+    /
+);
+
+__PACKAGE__->register_method(
+    method    => 'fetch_captured_holds',
+    api_name  => 
+      'open-ils.circ.captured_holds.id_list.expired_on_shelf_or_wrong_shelf.retrieve',
+    stream    => 1,
+    authoritative => 1,
+    signature => q/
+        Returns list of shelf-expired un-fulfilled holds OR wrong shelf holds
+        for a given shelf lib
+    /
+);
+
 
 sub fetch_captured_holds {
     my( $self, $conn, $auth, $org, $match_copy ) = @_;
@@ -2097,6 +2121,17 @@ sub fetch_captured_holds {
     }
     my $hold_ids = $e->json_query( $query );
 
+    if ($self->api_name =~ /wrong_shelf/) {
+        # fetch holds whose current_shelf_lib is $org, but whose pickup 
+        # lib is some other org unit.  Ignore already-retrieved holds.
+        my $wrong_shelf =
+            pickup_lib_changed_on_shelf_holds(
+                $e, $org, [map {$_->{id}} @$hold_ids]);
+        # match the layout of other items in $hold_ids
+        push (@$hold_ids, {id => $_}) for @$wrong_shelf;
+    }
+
+
     for my $hold_id (@$hold_ids) {
         if($self->api_name =~ /id_list/) {
             $conn->respond($hold_id->{id});
index 0956d9e..80748ca 100644 (file)
@@ -140,7 +140,7 @@ var api = {
     'HTML_HOLD_PULL_LIST' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.hold_pull_list.print' },
     'FM_AHR_ONSHELF_RETRIEVE' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.captured_holds.on_shelf.retrieve' },
     'FM_AHR_ID_LIST_ONSHELF_RETRIEVE' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.captured_holds.id_list.on_shelf.retrieve.authoritative', 'secure' : false },
-    'FM_AHR_ID_LIST_EXPIRED_ONSHELF_RETRIEVE' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.captured_holds.id_list.expired_on_shelf.retrieve.authoritative', 'secure' : false },
+    'FM_AHR_ID_LIST_EXPIRED_ONSHELF_RETRIEVE' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.captured_holds.id_list.expired_on_shelf_or_wrong_shelf.retrieve', 'secure' : false },
     'FM_AHR_COUNT_FOR_BRE' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.bre.holds.count', 'secure' : false },
     'FM_AHR_COUNT_RETRIEVE' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.hold_requests.count', 'cacheable' : true, 'ttl' : 60000  },
     'FM_AHR_COUNT_RETRIEVE.authoritative' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.hold_requests.count.authoritative', 'cacheable' : true, 'ttl' : 60000  },