From 93eed5bc55e6ca66eb0127135cd8fc9899d050fa Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Thu, 22 Apr 2021 18:00:54 -0400 Subject: [PATCH] LP1904036 getting started with unified offline data retrieval Signed-off-by: Bill Erickson Signed-off-by: Jane Sandberg Signed-off-by: Galen Charlton --- .../src/perlmods/lib/OpenILS/Application/Circ.pm | 61 ++++++++++++++++++++++ 1 file changed, 61 insertions(+) diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ.pm index 6436f79e4d..7b00442b64 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ.pm @@ -2145,6 +2145,67 @@ sub get_copy_due_date { } +__PACKAGE__->register_method( + method => 'get_offline_data', + api_name => 'open-ils.circ.offline.data.retrieve', + signature => { + desc => q/Returns a stream of data needed by clients to + support an offline interface. /, + params => [ + {desc => 'Authentication token', type => 'string'} + ], + return => {desc => q/ + /} + } +); + +sub get_offline_data { + my ($self, $client, $auth) = @_; + + my $e = new_editor(authtoken => $auth); + return $e->event unless $e->checkauth; + return $e->event unless $e->allowed('STAFF_LOGIN'); + + my $org_ids = $U->get_org_ancestors($e->requestor->ws_ou); + + $client->respond({ + idlClass => 'cnct', + data => $e->search_config_non_cataloged_type({owning_lib => $org_ids}) + }); + + my $surveys = $e->search_action_survey([{ + owner => $org_ids, + start_date => {'<=' => 'now'}, + end_date => {'>=' => 'now'} + }, { + flesh => 2, + flesh_fields => { + asv => ['questions'], + asvq => ['answers'] + } + } + ]); + + $client->respond({idlClass => 'asv', data => $surveys}); + + $client->respond({idlClass => 'cit', + data => $e->retrieve_all_config_identification_type}); + + $client->respond({idlClass => 'cnal', + data => $e->retrieve_all_config_net_access_level}); + + $client->respond({idlClass => 'fdoc', + data => $e->retrieve_all_config_idl_field_doc}); + + my $perm_groups = $e->search_permission_grp_tree([ + {parent => undef}, + {flesh => 99, flesh_fields => {pgt => ['children']}} + ]); + + $client->respond({idlClass => 'pgt', data => $perm_groups}); + + return undef; +} -- 2.11.0