Use hold current shelf lib to determine availability : opac hold count
authorBill Erickson <berick@esilibrary.com>
Tue, 27 Dec 2011 21:20:08 +0000 (16:20 -0500)
committerBill Erickson <berick@esilibrary.com>
Wed, 4 Jan 2012 20:48:22 +0000 (15:48 -0500)
The availability of a hold can now be determined by
hold.current_shelf_lib == hold.pickup_lib.

This change updates the API call for open hold counts for a patron.

open-ils.actor.user.hold_requests.count

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Open-ILS/src/perlmods/lib/OpenILS/Application/Actor.pm

index c54debf..93f1a75 100644 (file)
@@ -1840,7 +1840,7 @@ sub hold_request_count {
     }
 
     my $holds = $e->json_query({
-        select => {ahr => ['shelf_time']},
+        select => {ahr => ['pickup_lib', 'current_shelf_lib']},
         from => 'ahr',
         where => {
             usr => $user_id,
@@ -1851,7 +1851,12 @@ sub hold_request_count {
 
        return { 
         total => scalar(@$holds), 
-        ready => scalar(grep { $_->{shelf_time} } @$holds) 
+        ready => scalar(
+            grep { 
+                $_->{current_shelf_lib} and # avoid undef warnings
+                $_->{pickup_lib} eq $_->{current_shelf_lib} 
+            } @$holds
+        ) 
     };
 }