summaryrefslogtreecommitdiff
path: root/FS/FS/part_event/Condition/once.pm
diff options
context:
space:
mode:
Diffstat (limited to 'FS/FS/part_event/Condition/once.pm')
-rw-r--r--FS/FS/part_event/Condition/once.pm11
1 files changed, 6 insertions, 5 deletions
diff --git a/FS/FS/part_event/Condition/once.pm b/FS/FS/part_event/Condition/once.pm
index d004814ff..f1645828b 100644
--- a/FS/FS/part_event/Condition/once.pm
+++ b/FS/FS/part_event/Condition/once.pm
@@ -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
+ )
";
}