summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Kohler <ivan@freeside.biz>2014-11-20 11:42:22 -0800
committerIvan Kohler <ivan@freeside.biz>2014-11-20 11:42:22 -0800
commit7e78fde169d6e1b25c7e82a9bbcc399d87a2fa02 (patch)
tree42efeb7e84572e3b1700899d6e7b6dad77a9496f
parent074e048b805fea95151739aca652425b39e73163 (diff)
optimize once_percust condition
-rw-r--r--FS/FS/part_event/Condition/once_percust.pm14
1 files changed, 7 insertions, 7 deletions
diff --git a/FS/FS/part_event/Condition/once_percust.pm b/FS/FS/part_event/Condition/once_percust.pm
index 67767f91b..2773ca020 100644
--- a/FS/FS/part_event/Condition/once_percust.pm
+++ b/FS/FS/part_event/Condition/once_percust.pm
@@ -52,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'
+ )
";
}