X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fpart_event%2FCondition%2Fonce.pm;h=adab2432aa158bb84d4ba9fd368265fc025c551e;hb=8b33800764316232933f5996ac3fe9ea1793d944;hp=ba3ccbb61151e1ffb566959881090a4288b2894a;hpb=84fbfcfd5c664a6c05939b2c79997f16eded5efa;p=freeside.git diff --git a/FS/FS/part_event/Condition/once.pm b/FS/FS/part_event/Condition/once.pm index ba3ccbb61..adab2432a 100644 --- a/FS/FS/part_event/Condition/once.pm +++ b/FS/FS/part_event/Condition/once.pm @@ -16,15 +16,23 @@ 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=>'NOT IN', value=>"('failed','new')" }, + my @existing = qsearch( { + 'table' => 'cust_event', + 'hashref' => { + 'eventpart' => $self->eventpart, + 'tablenum' => $tablenum, + #'status' => { op=>'NOT IN', value=>"('failed','new')" }, + 'status' => { op=>'!=', value=>'failed' }, + }, + 'addl_sql' => ( $opt{'cust_event'}->eventnum =~ /^(\d+)$/ + ? " AND eventnum != $1 " + : '' + ), } ); ! scalar(@existing);