LP#1660059 - Allow for undef value for A/T Processing Group Context Field user/csharp/lp1660059_handle_undef_value_for_at_group_field
authorChris Sharp <csharp@georgialibraries.org>
Sat, 28 Jan 2017 18:19:29 +0000 (13:19 -0500)
committerChris Sharp <csharp@georgialibraries.org>
Sat, 28 Jan 2017 18:19:29 +0000 (13:19 -0500)
For an action_trigger.event_definition that uses action.hold_request.sms_notify
as the Processing Group Context Field/group_field, the event processing
shows multiple Perl warnings and the open-ils.trigger process dies.

Tracing this to the relevant code in Trigger.pm shows that there is a
check to make sure that the fieldmapper object actually exists ($node),
but then assumes that the $ident_value (the actual field) is defined/not null.

Adding an additional check fixes the problem.

Signed-off-by: Chris Sharp <csharp@georgialibraries.org>
Open-ILS/src/perlmods/lib/OpenILS/Application/Trigger.pm

index 920175b..c5bc93e 100644 (file)
@@ -777,6 +777,9 @@ sub grouped_events {
 
             # get the grouping value for the grouping object on this event
             my $ident_value = $node->$group_field();
+            unless($ident_value) { # this can legitimately be undef, so we need to handle it if so
+                $e->update_state('invalid');
+            }
             if(ref $ident_value) {
                 my $ident_field = $ident_value->Identity; 
                 $ident_value = $ident_value->$ident_field()