[open-ils-commits] r18311 - in trunk/Open-ILS/src/perlmods/OpenILS/Application: . Trigger (erickson)

svn at svn.open-ils.org svn at svn.open-ils.org
Wed Oct 13 12:13:26 EDT 2010


Author: erickson
Date: 2010-10-13 12:13:23 -0400 (Wed, 13 Oct 2010)
New Revision: 18311

Modified:
   trunk/Open-ILS/src/perlmods/OpenILS/Application/Trigger.pm
   trunk/Open-ILS/src/perlmods/OpenILS/Application/Trigger/Event.pm
Log:
when the target for an event is no longer around, immediately invalidate the event and prevent the event from bubbling up for further processing

Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/Trigger/Event.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/Trigger/Event.pm	2010-10-13 16:03:25 UTC (rev 18310)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/Trigger/Event.pm	2010-10-13 16:13:23 UTC (rev 18311)
@@ -112,6 +112,11 @@
         $self->editor->xact_rollback || return undef;
     }
 
+    unless($self->target) {
+        $self->update_state('invalid');
+        $self->valid(0);
+    }
+
     return $self;
 }
 

Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/Trigger.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/Trigger.pm	2010-10-13 16:03:25 UTC (rev 18310)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/Trigger.pm	2010-10-13 16:13:23 UTC (rev 18311)
@@ -644,7 +644,7 @@
             $logger->error("trigger: Event creation failed with ".shift());
         };
 
-        next unless $e; 
+        next if !$e or $e->event->state eq 'invalid'; 
 
         try {
             $e->build_environment;
@@ -717,10 +717,17 @@
             my @steps = split /\./, $group;
             my $group_field = pop(@steps); # we didn't flesh to this, it's a field not an object
 
-            # find the grouping object
-            my $node = $e->target;
-            $node = $node->$_() for ( @steps );
+            my $node;
+            eval {
+                $node = $e->target;
+                $node = $node->$_() for ( @steps );
+            };
 
+            unless($node) { # should not get here, but to be safe..
+                $e->update_state('invalid');
+                next;
+            }
+
             # get the grouping value for the grouping object on this event
             my $ident_value = $node->$group_field();
             if(ref $ident_value) {



More information about the open-ils-commits mailing list