From 478b4bec5ab555c5fb01713186f95345eaf4d60d Mon Sep 17 00:00:00 2001 From: erickson Date: Wed, 13 Oct 2010 16:13:23 +0000 Subject: [PATCH] when the target for an event is no longer around, immediately invalidate the event and prevent the event from bubbling up for further processing git-svn-id: svn://svn.open-ils.org/ILS/trunk@18311 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/src/perlmods/OpenILS/Application/Trigger.pm | 15 +++++++++++---- .../src/perlmods/OpenILS/Application/Trigger/Event.pm | 5 +++++ 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Trigger.pm b/Open-ILS/src/perlmods/OpenILS/Application/Trigger.pm index c9c1553e4..ae83a7755 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Trigger.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Trigger.pm @@ -644,7 +644,7 @@ sub gather_events { $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,9 +717,16 @@ sub grouped_events { 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(); diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Trigger/Event.pm b/Open-ILS/src/perlmods/OpenILS/Application/Trigger/Event.pm index 1a1989550..c6894a686 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Trigger/Event.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Trigger/Event.pm @@ -112,6 +112,11 @@ sub init { $self->editor->xact_rollback || return undef; } + unless($self->target) { + $self->update_state('invalid'); + $self->valid(0); + } + return $self; } -- 2.11.0