summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--FS/FS/cust_event.pm1
-rw-r--r--FS/FS/part_event/Condition.pm2
-rw-r--r--FS/FS/part_event/Condition/once.pm9
3 files changed, 10 insertions, 2 deletions
diff --git a/FS/FS/cust_event.pm b/FS/FS/cust_event.pm
index 13b3efa4b..355bc2532 100644
--- a/FS/FS/cust_event.pm
+++ b/FS/FS/cust_event.pm
@@ -190,6 +190,7 @@ sub test_conditions {
my $part_event = $self->part_event;
my $object = $self->cust_X;
my @conditions = $part_event->part_event_condition;
+ %opt{'cust_event'} = $self;
#no unsatisfied conditions
#! grep ! $_->condition( $object, %opt ), @conditions;
diff --git a/FS/FS/part_event/Condition.pm b/FS/FS/part_event/Condition.pm
index 268b9e6a0..0b9d57912 100644
--- a/FS/FS/part_event/Condition.pm
+++ b/FS/FS/part_event/Condition.pm
@@ -125,6 +125,8 @@ Available additional arguments:
$time = $opt{'time'}; #use this instead of time or $^T
+ $cust_event = $opt{'cust_event'}; #to retreive the cust_event object being tested
+
Return a true value if the condition has been met, and a false value if it has
not.
diff --git a/FS/FS/part_event/Condition/once.pm b/FS/FS/part_event/Condition/once.pm
index ba3ccbb61..bb0fa22a5 100644
--- a/FS/FS/part_event/Condition/once.pm
+++ b/FS/FS/part_event/Condition/once.pm
@@ -16,7 +16,7 @@ sub remove_warning {
}
sub condition {
- my($self, $object) = @_;
+ my($self, $object, %opt) = @_;
my $obj_pkey = $object->primary_key;
my $tablenum = $object->$obj_pkey();
@@ -24,7 +24,12 @@ sub condition {
my @existing = qsearch( 'cust_event', {
'eventpart' => $self->eventpart,
'tablenum' => $tablenum,
- 'status' => { op=>'NOT IN', value=>"('failed','new')" },
+ #'status' => { op=>'NOT IN', value=>"('failed','new')" },
+ 'status' => { op=>'!=', value=>'failed' },
+ 'addl_sql' => ( $opt{'cust_event'}->eventnum =~ /^(\d+)$/
+ ? " AND eventnum != $1 "
+ : ''
+ ),
} );
! scalar(@existing);