X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fpart_event%2FCondition%2Fonce.pm;h=d004814ffb33da8ed0600603c1843d996f37220d;hb=90393980e5f2859ee1e186fa461f48f5129e803e;hp=8c24e83ff2de7dde86408c2b41b4d89f9629c58a;hpb=eb4ff7f73c5d4bdf74a3472448b5a195598ff4cd;p=freeside.git diff --git a/FS/FS/part_event/Condition/once.pm b/FS/FS/part_event/Condition/once.pm index 8c24e83ff..d004814ff 100644 --- a/FS/FS/part_event/Condition/once.pm +++ b/FS/FS/part_event/Condition/once.pm @@ -7,7 +7,7 @@ use FS::cust_event; use base qw( FS::part_event::Condition ); -sub description { "Don't run this event again after it has completed sucessfully"; } +sub description { "Don't run this event again after it has completed successfully"; } sub implicit_flag { 10; } @@ -16,15 +16,22 @@ sub remove_warning { } sub condition { - my($self, $object) = @_; + my($self, $object, %opt) = @_; my $obj_pkey = $object->primary_key; my $tablenum = $object->$obj_pkey(); - - my @existing = qsearch( 'cust_event', { - 'eventpart' => $self->eventpart, - 'tablenum' => $tablenum, - 'status' => { op=>'!=', value=>'failed' }, + + my @existing = qsearch( { + 'table' => 'cust_event', + 'hashref' => { + 'eventpart' => $self->eventpart, + 'tablenum' => $tablenum, + 'status' => { op=>'!=', value=>'failed' }, + }, + 'extra_sql' => ( $opt{'cust_event'}->eventnum =~ /^(\d+)$/ + ? " AND eventnum != $1 " + : '' + ), } ); ! scalar(@existing);