From: Galen Charlton Date: Tue, 2 Jun 2020 22:36:08 +0000 (-0400) Subject: add open-ils.curbside.open_user_appointments_at_lib X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=3863ea9152974e2e07eb43000b164df45994d151;p=working%2FEvergreen.git add open-ils.curbside.open_user_appointments_at_lib Needed so that staff members can fetch a user's current apointment(s) Signed-off-by: Galen Charlton --- diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Curbside.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Curbside.pm index baf8ce1af8..dd9fef56ee 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Curbside.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Curbside.pm @@ -61,6 +61,45 @@ __PACKAGE__->register_method( } ); +sub fetch_appointments { # returns appointment for user at location + my ($self, $conn, $authtoken, $usr, $org) = @_; + + my $e = new_editor(xact => 1, authtoken => $authtoken); + return $e->die_event unless $e->checkauth; + + $org ||= $e->requestor->ws_ou; + + return new OpenILS::Event("CURBSIDE_NOT_ALLOWED") unless ($U->is_true( + $U->ou_ancestor_setting_value($org, 'circ.curbside') + )); + + return new OpenILS::Event("BAD_PARAMS", "desc" => "No user ID supplied") unless $usr; + + my $slots = $e->search_action_curbside([{ + patron => $usr, + delivered => { '=' => undef }, + org => $org, + },{ + order_by => { acsp => {slot => {direction => 'asc'}} } + }]); + + $conn->respond($_) for @$slots; + return undef; +} +__PACKAGE__->register_method( + method => "fetch_appointments", + api_name => "open-ils.curbside.open_user_appointments_at_lib", + stream => 1, + signature => { + params => [ + {type => 'string', desc => 'Authentication token'}, + {type => 'number', desc => 'Patron ID'}, + {type => 'number', desc => 'Optional pickup library. If not supplied, taken from WS of session.'}, + ], + return => { desc => 'A stream of appointments that the authenticated user owns'} + } +); + sub fetch_holds_for_patron_at_pickup_lib { my ($self, $conn, $authtoken, $usr, $org) = @_;