[freeside-commits] freeside/FS/bin freeside-daily,1.19,1.20

Ivan,,, ivan at wavetail.420.am
Fri Jul 8 16:06:33 PDT 2005


Update of /home/cvs/cvsroot/freeside/FS/bin
In directory wavetail:/tmp/cvs-serv6540

Modified Files:
	freeside-daily 
Log Message:
fix bug with new efficient customer-finding code.  sql isn't perl, null != 0

Index: freeside-daily
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/bin/freeside-daily,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- freeside-daily	9 Jun 2005 07:19:31 -0000	1.19
+++ freeside-daily	8 Jul 2005 23:06:31 -0000	1.20
@@ -43,10 +43,16 @@
   0 < ( select count(*) from cust_bill
           where cust_main.custnum = cust_bill.custnum
             and 0 < charged
-                    - ( select sum(amount) from cust_bill_pay
-                          where cust_bill.invnum = cust_bill_pay.invnum )
-                    - ( select sum(amount) from cust_credit_bill
-                          where cust_bill.invnum = cust_credit_bill.invnum )
+                    - coalesce(
+                                ( select sum(amount) from cust_bill_pay
+                                    where cust_bill.invnum = cust_bill_pay.invnum )
+                                ,0
+                              )
+                    - coalesce(
+                                ( select sum(amount) from cust_credit_bill
+                                    where cust_bill.invnum = cust_credit_bill.invnum )
+                                ,0
+                              )
             and 0 < ( select count(*) from part_bill_event
                         where payby = cust_main.payby
                           and ( disabled is null or disabled = '' )
@@ -61,7 +67,7 @@
       )
 END
 
-my $extra_sql = ( scalar(%search) ? ' AND ' : ' WHERE ' ). "$where_pkg OR $where_bill_event";
+my $extra_sql = ( scalar(%search) ? ' AND ' : ' WHERE ' ). "( $where_pkg OR $where_bill_event )";
 
 my @cust_main;
 if ( @ARGV ) {



More information about the freeside-commits mailing list