From 85716b57f62b9de89327561f37cc3807d5fd6787 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Tue, 27 Dec 2011 16:20:08 -0500 Subject: [PATCH] Use hold current shelf lib to determine availability : opac hold count 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 --- Open-ILS/src/perlmods/lib/OpenILS/Application/Actor.pm | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Actor.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Actor.pm index c54debf431..93f1a75274 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Actor.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Actor.pm @@ -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 + ) }; } -- 2.11.0