avoid showing discounts redundantly on invoices, #31273
authorMark Wells <mark@freeside.biz>
Mon, 17 Nov 2014 03:27:52 +0000 (19:27 -0800)
committerMark Wells <mark@freeside.biz>
Mon, 17 Nov 2014 03:27:52 +0000 (19:27 -0800)
FS/FS/Template_Mixin.pm

index 29c50b2..0928ee5 100644 (file)
@@ -3036,6 +3036,14 @@ sub _items_cust_bill_pkg {
         ) {
 
           my @discounts = $cust_bill_pkg->cust_bill_pkg_discount;
+          # special case: if there are old "discount details" on this line 
+          # item, don't show discount line items
+          if ( FS::cust_bill_pkg_detail->count(
+              "detail LIKE 'Includes discount%' AND billpkgnum = " .
+              $cust_bill_pkg->billpkgnum
+             ) > 0 ) {
+             @discounts = ();
+          }
           if( @discounts ) {
             warn "$me _items_cust_bill_pkg including discounts for ".
               $cust_bill_pkg->billpkgnum."\n"