diff options
author | Ivan Kohler <ivan@freeside.biz> | 2015-01-28 02:26:47 -0800 |
---|---|---|
committer | Ivan Kohler <ivan@freeside.biz> | 2015-01-28 02:26:47 -0800 |
commit | f4b7701c4c1e574ebe29e05db694d131d2799b35 (patch) | |
tree | 54114fb637cf262fee79e1145f912fe255ae50a1 | |
parent | a2faeced765b00c0339fd86d7905cb77318e3d20 (diff) |
optimize cust_pay__otaker_ivan upgrade fix (pretty obsolete at this point?)
-rw-r--r-- | FS/FS/cust_pay.pm | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/FS/FS/cust_pay.pm b/FS/FS/cust_pay.pm index 87fad02f1..df567a5c1 100644 --- a/FS/FS/cust_pay.pm +++ b/FS/FS/cust_pay.pm @@ -942,10 +942,11 @@ sub _upgrade_data { #class method #not the most efficient, but hey, it only has to run once - my $where = "WHERE ( otaker IS NULL OR otaker = '' OR otaker = 'ivan' ) ". - " AND usernum IS NULL ". - " AND 0 < ( SELECT COUNT(*) FROM cust_main ". - " WHERE cust_main.custnum = cust_pay.custnum ) "; + my $where = " WHERE ( otaker IS NULL OR otaker = '' OR otaker = 'ivan' ) + AND usernum IS NULL + AND EXISTS ( SELECT 1 FROM cust_main + WHERE cust_main.custnum = cust_pay.custnum ) + "; my $count_sql = "SELECT COUNT(*) FROM cust_pay $where"; |