X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fpart_event%2FCondition%2Fonce_percust.pm;h=2773ca0204dc1294e9a4889af949ebf0fed9ba66;hb=bb7e827141c9ed68f30765c9ca2ddcd1d760ad2d;hp=b8a8fbfb6d5dce003dbd877ef9fe4f7f98947ae7;hpb=58f99accce35aa76abe9ff852f6c6ee84e8ce712;p=freeside.git diff --git a/FS/FS/part_event/Condition/once_percust.pm b/FS/FS/part_event/Condition/once_percust.pm index b8a8fbfb6..2773ca020 100644 --- a/FS/FS/part_event/Condition/once_percust.pm +++ b/FS/FS/part_event/Condition/once_percust.pm @@ -45,7 +45,6 @@ sub condition { } -#XXX test? sub condition_sql { my( $self, $table ) = @_; @@ -53,13 +52,13 @@ sub condition_sql { my $pkey = $pkey{$table}; - "0 = ( SELECT COUNT(*) FROM cust_event - WHERE cust_event.eventpart = part_event.eventpart - AND cust_event.tablenum IN ( - SELECT $pkey FROM $table AS once_percust - WHERE once_percust.custnum = cust_main.custnum ) - AND status != 'failed' - ) + "NOT EXISTS ( SELECT 1 FROM cust_event + WHERE cust_event.eventpart = part_event.eventpart + AND cust_event.tablenum IN ( + SELECT $pkey FROM $table AS once_percust + WHERE once_percust.custnum = cust_main.custnum ) + AND status != 'failed' + ) "; }