[freeside-commits] branch FREESIDE_3_BRANCH updated. c9f959936fe3c12a565c2152e9a967ab88916c64

Mark Wells mark at 420.am
Fri Feb 28 12:48:25 PST 2014


The branch, FREESIDE_3_BRANCH has been updated
       via  c9f959936fe3c12a565c2152e9a967ab88916c64 (commit)
       via  4757eb16173dcc09d37b2f3856c0b7aba0e4652f (commit)
      from  e1c6b4af716fecad943bf282b50c0d459b986720 (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 c9f959936fe3c12a565c2152e9a967ab88916c64
Author: Mark Wells <mark at freeside.biz>
Date:   Fri Feb 28 12:48:14 2014 -0800

    report fixes, #25899

diff --git a/httemplate/search/cust_bill_pkg_referral.html b/httemplate/search/cust_bill_pkg_referral.html
index a39fa57..f8e2ea7 100644
--- a/httemplate/search/cust_bill_pkg_referral.html
+++ b/httemplate/search/cust_bill_pkg_referral.html
@@ -133,7 +133,9 @@ my $agentnums_sql =
 my($beginning, $ending) = FS::UI::Web::parse_beginning_ending($cgi);
 
 my @where = ( $agentnums_sql,
-              'cust_bill_pkg.pkgnum != 0', # exclude taxes
+              # exclude taxes
+              '(cust_bill_pkg.pkgnum != 0 OR '.
+                'cust_bill_pkg.feepart IS NOT NULL)',
               "cust_bill._date >= $beginning",
               "cust_bill._date <= $ending",
             );
@@ -187,11 +189,13 @@ if ( $cgi->param('classnum') =~ /^(\d+)$/ ) {
 
   if ( $use_override ) {
     push @where, "(
-      part_pkg.classnum $comparison AND pkgpart_override IS NULL OR
-      override.classnum $comparison AND pkgpart_override IS NOT NULL
+      (part_pkg.classnum $comparison AND pkgpart_override IS NULL) OR
+      (override.classnum $comparison AND pkgpart_override IS NOT NULL) OR
+      (part_fee.classnum $comparison AND feepart IS NOT NULL)
     )";
   } else {
-    push @where, "part_pkg.classnum $comparison";
+    push @where, 
+    "(part_pkg.classnum $comparison) OR (part_fee.classnum $comparison)";
   }
 }
 
@@ -231,15 +235,19 @@ $join_pkg .=  ' LEFT JOIN cust_pkg USING ( pkgnum )
                 LEFT JOIN part_pkg USING ( pkgpart )
                 LEFT JOIN part_pkg AS override
                   ON pkgpart_override = override.pkgpart 
+                LEFT JOIN part_fee USING ( feepart )
                 LEFT JOIN pkg_class ON '; #...
 
 if ( $use_override ) {
   # join to whichever pkgpart is appropriate
   $join_pkg .= '
       ( pkgpart_override IS NULL     AND part_pkg.classnum = pkg_class.classnum )
-   OR ( pkgpart_override IS NOT NULL AND override.classnum = pkg_class.classnum )';
+   OR ( pkgpart_override IS NOT NULL AND override.classnum = pkg_class.classnum )
+   OR ( feepart IS NOT NULL AND part_fee.classnum = pkg_class.classnum )';
 } else {
-  $join_pkg .= 'part_pkg.classnum = pkg_class.classnum';
+  $join_pkg .= '
+      ( part_pkg.classnum = pkg_class.classnum )
+   OR ( part_fee.classnum = pkg_class.classnum )';
 }
 
 my $where = ' WHERE '. join(' AND ', @where);
@@ -261,7 +269,7 @@ my $last_pay_sql = "SELECT MAX(_date)
   FROM cust_bill_pay JOIN cust_bill_pay_pkg USING (billpaynum)
   WHERE cust_bill_pay_pkg.billpkgnum = cust_bill_pkg.billpkgnum";
 
-push @select, 'part_pkg.pkg',
+push @select, 'COALESCE(part_pkg.pkg, part_fee.itemdesc) AS pkg',
               'part_pkg.freq',
               'cust_main.custnum',
               'cust_main.first',
diff --git a/httemplate/search/report_tax.cgi b/httemplate/search/report_tax.cgi
index d71fcf9..6dc9ffc 100755
--- a/httemplate/search/report_tax.cgi
+++ b/httemplate/search/report_tax.cgi
@@ -341,7 +341,8 @@ if ( $cgi->param('agentnum') =~ /^(\d+)$/ ) {
   $where .= ' AND cust_main.agentnum = '. $agent->agentnum;
 }
 
-my $nottax = 'cust_bill_pkg.pkgnum != 0';
+my $nottax = 
+  '(cust_bill_pkg.pkgnum != 0 OR cust_bill_pkg.feepart IS NOT NULL)';
 
 # one query for each column of the report
 # plus separate queries for the totals row

commit 4757eb16173dcc09d37b2f3856c0b7aba0e4652f
Author: Mark Wells <mark at freeside.biz>
Date:   Fri Feb 28 12:48:12 2014 -0800

    unbreak non-usage fees after #27687

diff --git a/FS/FS/part_fee.pm b/FS/FS/part_fee.pm
index fe63250..2f48bfe 100644
--- a/FS/FS/part_fee.pm
+++ b/FS/FS/part_fee.pm
@@ -269,6 +269,8 @@ sub lineitem {
                 ' FROM cust_bill_pkg WHERE billpkgnum = ?';
       @item_base = map { FS::Record->scalar_sql($sql, $_->billpkgnum) }
                     @items;
+
+      $amount += $total_base * $self->percent / 100;
     }
   } else {
     # the fee applies to _this_ invoice.  It has no payments or credits, so
@@ -279,6 +281,8 @@ sub lineitem {
       $total_base = $cust_bill->charged;
       @item_base = map { $_->setup + $_->recur }
                     @items;
+
+      $amount += $total_base * $self->percent / 100;
     }
   }
 

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

Summary of changes:
 FS/FS/part_fee.pm                             |    4 ++++
 httemplate/search/cust_bill_pkg_referral.html |   22 +++++++++++++++-------
 httemplate/search/report_tax.cgi              |    3 ++-
 3 files changed, 21 insertions(+), 8 deletions(-)




More information about the freeside-commits mailing list