X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=FS%2FFS%2Fpart_event%2FCondition%2Fonce.pm;h=464e49e9e7cd16ac0adc0e4c5b741970360c4345;hp=d004814ffb33da8ed0600603c1843d996f37220d;hb=55017a988ebdd9456d66b23f973b560733abfb55;hpb=b5c4237a34aef94976bc343c8d9e138664fc3984 diff --git a/FS/FS/part_event/Condition/once.pm b/FS/FS/part_event/Condition/once.pm index d004814ff..464e49e9e 100644 --- a/FS/FS/part_event/Condition/once.pm +++ b/FS/FS/part_event/Condition/once.pm @@ -12,7 +12,7 @@ sub description { "Don't run this event again after it has completed successfull sub implicit_flag { 10; } sub remove_warning { - 'Are you sure you want to remove this condition? Doing so will allow this event to run every time the other conditions are satisfied, even if it has already run sucessfully.'; #better error msg? + 'Are you sure you want to remove this condition? Doing so will allow this event to run every time the other conditions are satisfied, even if it has already run successfully.'; #better error msg? } sub condition { @@ -43,11 +43,12 @@ sub condition_sql { my %tablenum = %{ FS::part_event->eventtable_pkey_sql }; - "0 = ( SELECT COUNT(*) FROM cust_event - WHERE cust_event.eventpart = part_event.eventpart - AND cust_event.tablenum = $tablenum{$table} - AND status != 'failed' - ) + "NOT EXISTS ( SELECT 1 FROM cust_event + WHERE cust_event.eventpart = part_event.eventpart + AND cust_event.tablenum = $tablenum{$table} + AND status != 'failed' + LIMIT 1 + ) "; }