[freeside-commits] branch FREESIDE_3_BRANCH updated. a34e47965f71b62f49f20262736a7e3fc794b637

Mark Wells mark at 420.am
Sat Dec 6 13:01:13 PST 2014


The branch, FREESIDE_3_BRANCH has been updated
       via  a34e47965f71b62f49f20262736a7e3fc794b637 (commit)
      from  715120170b58861d2957266a2802df2e412979c8 (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 a34e47965f71b62f49f20262736a7e3fc794b637
Author: Mark Wells <mark at freeside.biz>
Date:   Sat Dec 6 13:00:58 2014 -0800

    avoid double-counting package-classed fees on the sales report, #32472

diff --git a/FS/FS/Report/Table.pm b/FS/FS/Report/Table.pm
index 934287a..69686df 100644
--- a/FS/FS/Report/Table.pm
+++ b/FS/FS/Report/Table.pm
@@ -886,14 +886,24 @@ sub with_classnum {
   @$classnum = grep /^\d+$/, @$classnum;
   my $in = 'IN ('. join(',', @$classnum). ')';
 
-  my $expr = "
-         ( COALESCE(part_pkg.classnum, 0) $in AND pkgpart_override IS NULL)
-      OR ( COALESCE(part_fee.classnum, 0) $in AND feepart IS NOT NULL )";
   if ( $use_override ) {
-    $expr .= "
-      OR ( COALESCE(override.classnum, 0) $in AND pkgpart_override IS NOT NULL )";
+    # then include packages if their base package is in the set and they are 
+    # not overridden,
+    # or if they are overridden and their override package is in the set,
+    # or fees if they are in the set
+    return "(
+         ( COALESCE(part_pkg.classnum, 0) $in AND cust_pkg.pkgpart IS NOT NULL AND pkgpart_override IS NULL )
+      OR ( COALESCE(override.classnum, 0) $in AND pkgpart_override IS NOT NULL )
+      OR ( COALESCE(part_fee.classnum, 0) $in AND cust_bill_pkg.feepart IS NOT NULL )
+    )";
+  } else {
+    # include packages if their base package is in the set,
+    # or fees if they are in the set
+    return "(
+         ( COALESCE(part_pkg.classnum, 0) $in AND cust_pkg.pkgpart IS NOT NULL )
+      OR ( COALESCE(part_fee.classnum, 0) $in AND cust_bill_pkg.feepart IS NOT NULL )
+    )";
   }
-  "( $expr )";
 }
 
 sub with_usageclass {

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

Summary of changes:
 FS/FS/Report/Table.pm |   22 ++++++++++++++++------
 1 file changed, 16 insertions(+), 6 deletions(-)




More information about the freeside-commits mailing list