summaryrefslogtreecommitdiff
path: root/FS
diff options
context:
space:
mode:
authorivan <ivan>2007-10-02 00:22:41 +0000
committerivan <ivan>2007-10-02 00:22:41 +0000
commit5495c7c68eb78c00a3c38da89fab7c7f98911927 (patch)
treee088f8d83c847f517dd2ce40551b8299bb9e0ba7 /FS
parent4688c4a55a51c4ce2100c1c98e7e650eb77ac95d (diff)
proper fix for once.pm bug? hopefully it works :)
Diffstat (limited to 'FS')
-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);