add ability to unconditionally send email
authorGalen Charlton <gmc@esilibrary.com>
Mon, 8 Aug 2016 20:50:08 +0000 (16:50 -0400)
committerGalen Charlton <gmc@esilibrary.com>
Mon, 8 Aug 2016 20:52:40 +0000 (16:52 -0400)
Defines a open-ils.trigger.event.autocreate.ignore_opt_in method
that does what it says on the tin; caller is reponsible for not
abusing this.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/CircNotify.pm
Open-ILS/src/perlmods/lib/OpenILS/Application/Trigger.pm

index 4629e15..48fc6a8 100644 (file)
@@ -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 );
index ed83cba..920175b 100644 (file)
@@ -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;