From: Mike Rylander Date: Tue, 19 May 2020 19:13:57 +0000 (-0400) Subject: A/T components of Curbside X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=1ebda8f91ec1f8144b7265318f960980d08137aa;p=working%2FEvergreen.git A/T components of Curbside This commit adds a reactor and validator for automating parts of the basic Curbside workflows. Signed-off-by: Galen Charlton --- diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Trigger/Reactor/CurbsideSlot.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Trigger/Reactor/CurbsideSlot.pm new file mode 100644 index 0000000000..e95b09f9c4 --- /dev/null +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Trigger/Reactor/CurbsideSlot.pm @@ -0,0 +1,44 @@ +package OpenILS::Application::Trigger::Reactor::CurbsideSlot; +use base 'OpenILS::Application::Trigger::Reactor'; +use strict; use warnings; +use OpenILS::Utils::CStoreEditor q/:funcs/; +use OpenILS::Application::AppUtils; +my $U = "OpenILS::Application::AppUtils"; + +$Data::Dumper::Indent = 0; + + +sub ABOUT { + return < 1); + + my $h = $$env{target}; + my ($slot) = $e->search_action_curbside({patron => $h->usr, org => $h->pickup_lib, slot => undef}); + if (!$slot) { + $slot = Fieldmapper::action::curbside->new; + $slot->org($h->pickup_lib); + $slot->patron($h->usr); + $e->create_action_curbside($slot); + $e->commit; + + my $ses = OpenSRF::AppSession->create('open-ils.trigger'); + $ses->request('open-ils.trigger.event.autocreate', 'hold.offer_curbside', $h, $h->pickup_lib); + + } else { + $e->rollback; + } + + return 1; +} + +1; diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Trigger/Validator/Curbside.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Trigger/Validator/Curbside.pm new file mode 100644 index 0000000000..f6101fbc19 --- /dev/null +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Trigger/Validator/Curbside.pm @@ -0,0 +1,13 @@ +package OpenILS::Application::Trigger::Validator::Curbside; +use strict; use warnings; +use OpenILS::Application::AppUtils; +my $U = 'OpenILS::Application::AppUtils'; + +sub handler { + my ($self, $env) = @_; + return $U->is_true( + $U->ou_ancestor_setting_value($env->{target}->pickup_lib, 'circ.curbside') + ); +} + +1;