[freeside-commits] branch master updated. 308c73858741a153c8e10aecaf7f00e534824013

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


The branch, master has been updated
       via  308c73858741a153c8e10aecaf7f00e534824013 (commit)
       via  e24da2a00485cfe81e34731ebebb6d69d4b0eab9 (commit)
      from  beff2bed3d06a91072427a15efef08b24c7cc8df (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 308c73858741a153c8e10aecaf7f00e534824013
Author: Mark Wells <mark at freeside.biz>
Date:   Fri Feb 28 12:47:31 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 111f22d..916d44b 100755
--- a/httemplate/search/report_tax.cgi
+++ b/httemplate/search/report_tax.cgi
@@ -274,7 +274,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 e24da2a00485cfe81e34731ebebb6d69d4b0eab9
Author: Mark Wells <mark at freeside.biz>
Date:   Fri Feb 28 12:25:57 2014 -0800

    unbreak non-usage fees after #27687

diff --git a/FS/FS/part_fee.pm b/FS/FS/part_fee.pm
index 186fb34..ccf1351 100644
--- a/FS/FS/part_fee.pm
+++ b/FS/FS/part_fee.pm
@@ -265,6 +265,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
@@ -275,6 +277,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