Ticket #32336 Unit prices not showing on quotations
[freeside.git] / FS / FS / Template_Mixin.pm
index 29c50b2..2fae464 100644 (file)
@@ -2729,6 +2729,8 @@ sub _items_cust_bill_pkg {
             'pkgnum'      => $cust_bill_pkg->pkgpart, #so it displays in Ref
             'description' => $description,
             'amount'      => sprintf("%.2f", $cust_bill_pkg->setup),
+            'unit_amount'   => sprintf("%.2f", $cust_bill_pkg->unitsetup),
+            'quantity'    => $cust_bill_pkg->quantity,
             'preref_html' => ( $opt{preref_callback}
                                  ? &{ $opt{preref_callback} }( $cust_bill_pkg )
                                  : ''
@@ -2740,6 +2742,12 @@ sub _items_cust_bill_pkg {
             'pkgnum'      => $cust_bill_pkg->pkgpart, #so it displays in Ref
             'description' => "$desc (". $cust_bill_pkg->part_pkg->freq_pretty.")",
             'amount'      => sprintf("%.2f", $cust_bill_pkg->recur),
+            'unit_amount'   => sprintf("%.2f", $cust_bill_pkg->unitrecur),
+            'quantity'    => $cust_bill_pkg->quantity,
+           'preref_html' => ( $opt{preref_callback}
+                                 ? &{ $opt{preref_callback} }( $cust_bill_pkg )
+                                 : ''
+                             ),
           };
         }
 
@@ -3036,6 +3044,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"