[freeside-commits] branch FREESIDE_2_3_BRANCH updated. 55bea78010c7ce83909202773e746f5a33852b45

Ivan ivan at 420.am
Wed Mar 13 15:54:53 PDT 2013


The branch, FREESIDE_2_3_BRANCH has been updated
       via  55bea78010c7ce83909202773e746f5a33852b45 (commit)
      from  9a4f4f3eb604881f976546566efc671ffe65fdf2 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 55bea78010c7ce83909202773e746f5a33852b45
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Wed Mar 13 15:54:50 2013 -0700

    optimize line item detail "Credited" column inefficiency sometimes causing load issues for big installs, RT#21933

diff --git a/httemplate/search/cust_bill_pkg.cgi b/httemplate/search/cust_bill_pkg.cgi
index c421711..48eb96c 100644
--- a/httemplate/search/cust_bill_pkg.cgi
+++ b/httemplate/search/cust_bill_pkg.cgi
@@ -684,12 +684,12 @@ my $pay_sub = "SELECT SUM(cust_bill_pay_pkg.amount)
 push @select, "($pay_sub) AS pay_amount";
 
 #total credits
-my $credit_sub = "SELECT SUM(cust_credit_bill_pkg.amount) AS credit_amount,
-    billpkgnum
-  FROM cust_credit_bill_pkg
-  GROUP BY billpkgnum";
-$join_pkg .= " LEFT JOIN ($credit_sub) AS item_credit USING (billpkgnum)";
-push @select,   'item_credit.credit_amount';
+my $credit_sub = "
+  SELECT SUM(cust_credit_bill_pkg.amount)
+    FROM cust_credit_bill_pkg
+      WHERE cust_bill_pkg.billpkgnum = cust_credit_bill_pkg.billpkgnum
+";
+push @select, "($credit_sub) AS credit_amount";
 
 my $where = ' WHERE '. join(' AND ', @where);
 

-----------------------------------------------------------------------

Summary of changes:
 httemplate/search/cust_bill_pkg.cgi |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)




More information about the freeside-commits mailing list