RT# 81150 Google now requires api key for drawing api
[freeside.git] / httemplate / search / cust_bill_pkg_discount.html
index d0f9bcf..691a11e 100644 (file)
@@ -38,7 +38,7 @@ Parameters:
         if ( $_[0]->pkgdiscountnum ) {
             # Standard discount, not a waived setup fee
             my $discount = qsearchs('discount',{
-                pkgdiscountnum => $_[0]->pkgdiscountnum
+                discountnum => $_[0]->discountnum
             });
             return $discount->description;
         } else {
@@ -71,9 +71,7 @@ Parameters:
     sub {
       my $row = shift;
       if ($row->pkgdiscountnum) {
-        $row->setuprecur eq 'setup'
-          ? 'Setup'
-          : sprintf( '%.2f', $row->months ),
+        return sprintf( '%.2f', $row->months );
       } else {
         return 'Setup';
       }
@@ -144,7 +142,6 @@ my @select = (qw(
 
   cust_main.custnum
 
-  cust_pkg_discount.setuprecur
   cust_pkg_discount.discountnum
   cust_pkg.waive_setup),
 
@@ -227,7 +224,11 @@ if ( $cgi->param('usernum') =~ /^(\d+)$/ ) {
 }
 
 # Filter: Include waived setup fees
-if ( !$cgi->param('include_waived_setup') ) {
+if ( $cgi->param('include_waived_setup') ) {
+  # Filter a hidden fee attached to a package with a waived setup fee from
+  # causing the waived-fee for that package to be double-counted
+  push @where, 'cust_bill_pkg.pkgpart_override IS NULL';
+} else {
   push @where, "cust_bill_pkg_discount.pkgdiscountnum IS NOT NULL";
 }