[freeside-commits] freeside/FS/FS/Cron bill.pm,1.2.2.14,1.2.2.15

Ivan,,, ivan at wavetail.420.am
Sat Apr 25 10:03:02 PDT 2009


Update of /home/cvs/cvsroot/freeside/FS/FS/Cron
In directory wavetail.420.am:/tmp/cvs-serv31686

Modified Files:
      Tag: FREESIDE_1_7_BRANCH
	bill.pm 
Log Message:
well.  that never returned any results at all.  reverting.  RT#4412

Index: bill.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/Cron/bill.pm,v
retrieving revision 1.2.2.14
retrieving revision 1.2.2.15
diff -u -d -r1.2.2.14 -r1.2.2.15
--- bill.pm	24 Apr 2009 19:06:15 -0000	1.2.2.14
+++ bill.pm	25 Apr 2009 17:02:59 -0000	1.2.2.15
@@ -64,30 +64,29 @@
   # or
   my $where_bill_event = <<"END";
     0 < ( select count(*) from cust_bill
-
-            LEFT JOIN cust_bill_pay USING ( invnum )
-            LEFT JOIN cust_credit_bill USING ( invnum )
-            LEFT JOIN part_bill_event ON (
-              cust_main.payby = part_bill_event.payby
-              AND ( disabled IS NULL or disabled = '' )
-              AND seconds <= $time - cust_bill._date
-            )
-            LEFT JOIN cust_bill_event ON (
-              part_bill_event.eventpart = cust_bill_event.eventpart
-              AND cust_bill_event.invnum = cust_bill_event.invnum
-              AND status = 'done'
-            )
-
             where cust_main.custnum = cust_bill.custnum
-
-            GROUP BY cust_bill.invnum, cust_bill.charged
-            HAVING
-            0 < charged
-                                  - coalesce( sum(cust_bill_pay.amount) ,0 )
-                                  - coalesce( sum(cust_credit_bill.amount), 0 )
-            AND
-            0 < COUNT( cust_bill_event.eventnum IS NULL )
-
+              and 0 < charged
+                      - 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 = '' )
+                            and seconds <= $time - cust_bill._date
+                            and 0 = ( select count(*) from cust_bill_event
+                                       where cust_bill.invnum = cust_bill_event.invnum
+                                         and part_bill_event.eventpart = cust_bill_event.eventpart
+                                         and status = 'done'
+                                    )
+  
+                      )
         )
 END
   



More information about the freeside-commits mailing list