From 6dd317d2535078f632504ce2355f202ad826869d Mon Sep 17 00:00:00 2001 From: erickson Date: Tue, 17 Nov 2009 17:07:59 +0000 Subject: [PATCH] added user hold summary method that breaks down a users holds by status. stub of clear-shelf processor git-svn-id: svn://svn.open-ils.org/ILS/trunk@14941 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- .../src/perlmods/OpenILS/Application/Circ/Holds.pm | 48 ++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm b/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm index 3ddb8e510f..1ec30c6e7f 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm @@ -1996,6 +1996,54 @@ sub find_hold_mvr { } +__PACKAGE__->register_method( + method => 'clear_shelf_process', + stream => 1, + api_name => 'open-ils.circ.hold.clear_shelf.process' +); + +sub clear_shelf_process { + my($self, $client, $auth) = @_; + + my $e = new_editor(authtoken=>$auth, xact => 1); + $e->checkauth or return $e->die_event; + $e->allowed('UPDATE_HOLD') or return $e->die_event; + + # Find holds that expired on the holds shelf + + # Cancel the expired holds + + # ... +} + + +__PACKAGE__->register_method( + method => 'usr_hold_summary', + api_name => 'open-ils.circ.holds.user_summary', + signature => q/ + Returns a summary of holds statuses for a given user + / +); + +sub usr_hold_summary { + my($self, $conn, $auth, $user_id) = @_; + + my $e = new_editor(authtoken=>$auth); + $e->checkauth or return $e->event; + $e->allowed('VIEW_HOLD') or return $e->event; + + my $holds = $e->search_action_hold_request( + { + usr => $user_id , + fulfillment_time => undef, + cancel_time => undef, + } + ); + + my %summary = (1 => 0, 2 => 0, 3 => 0, 4 => 0); + $summary{_hold_status($e, $_)} += 1 for @$holds; + return \%summary; +} 1; -- 2.11.0