projects
/
freeside.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
a2faece
)
optimize cust_pay__otaker_ivan upgrade fix (pretty obsolete at this point?)
author
Ivan Kohler
<ivan@freeside.biz>
Wed, 28 Jan 2015 10:26:47 +0000
(
02:26
-0800)
committer
Ivan Kohler
<ivan@freeside.biz>
Wed, 28 Jan 2015 10:26:47 +0000
(
02:26
-0800)
FS/FS/cust_pay.pm
patch
|
blob
|
history
diff --git
a/FS/FS/cust_pay.pm
b/FS/FS/cust_pay.pm
index
87fad02
..
df567a5
100644
(file)
--- 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
#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";
my $count_sql = "SELECT COUNT(*) FROM cust_pay $where";