From: Galen Charlton Date: Mon, 8 Aug 2016 20:50:08 +0000 (-0400) Subject: LP#1356477: add ability to unconditionally send email X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=7e3a8e2c61f4ee24317d11d478930851671b1c1d;p=evergreen%2Fmasslnc.git LP#1356477: add ability to unconditionally send email This patch defines and uses an open-ils.trigger.event.autocreate.ignore_opt_in method that does what it says on the tin; the caller is reponsible for not abusing this. This supports a use case in the webstaff checkout interface where staff can choose to have the receipt be emailed, provided that the patron record has an email address defined, even if the user setting to email receipts by default is not set. (It is assumed that the staff member would have gotten permission from the patron on the spot.) Signed-off-by: Galen Charlton Signed-off-by: Mike Rylander --- diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/CircNotify.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/CircNotify.pm index 4629e15ed8..48fc6a809c 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/CircNotify.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/CircNotify.pm @@ -74,7 +74,7 @@ sub circ_batch_notify { ); $multi->request( - 'open-ils.trigger.event.autocreate', + 'open-ils.trigger.event.autocreate.ignore_opt_in', $hook => $_ => $e->requestor->ws_ou ) for ( @$circs ); $client->status( new OpenSRF::DomainObject::oilsContinueStatus ); diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Trigger.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Trigger.pm index ed83cbae1b..920175b5c7 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Trigger.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Trigger.pm @@ -72,7 +72,7 @@ sub create_active_events_for_object { for my $def ( @$defs ) { next if ($granularity && $def->granularity ne $granularity ); - if ($def->usr_field && $def->opt_in_setting) { + if (!$self->{ignore_opt_in} && $def->usr_field && $def->opt_in_setting) { my $ufield = $def->usr_field; my $uid = $target->$ufield; $uid = $uid->id if (ref $uid); # fleshed user object, unflesh it @@ -124,6 +124,14 @@ __PACKAGE__->register_method( stream => 1, argc => 3 ); +__PACKAGE__->register_method( + api_name => 'open-ils.trigger.event.autocreate.ignore_opt_in', + method => 'create_active_events_for_object', + api_level => 1, + stream => 1, + argc => 3, + ignore_opt_in => 1 +); sub create_event_for_object_and_def { my $self = shift;