X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fpart_event%2FCondition%2Fonce.pm;h=d004814ffb33da8ed0600603c1843d996f37220d;hb=0af38652da3b3be7da2d35b048285ef6f2194e1a;hp=bb0fa22a54f51a9fb139c8a3bfb60b6fbfc8c55c;hpb=5495c7c68eb78c00a3c38da89fab7c7f98911927;p=freeside.git diff --git a/FS/FS/part_event/Condition/once.pm b/FS/FS/part_event/Condition/once.pm index bb0fa22a5..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; } @@ -20,13 +20,15 @@ sub condition { my $obj_pkey = $object->primary_key; my $tablenum = $object->$obj_pkey(); - - my @existing = qsearch( 'cust_event', { - 'eventpart' => $self->eventpart, - 'tablenum' => $tablenum, - #'status' => { op=>'NOT IN', value=>"('failed','new')" }, - 'status' => { op=>'!=', value=>'failed' }, - 'addl_sql' => ( $opt{'cust_event'}->eventnum =~ /^(\d+)$/ + + 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 " : '' ),