fix final month application of percentage discounts to bundled packages, RT#17045
[freeside.git] / FS / FS / cust_bill.pm
index 35ce48c..3aa75ec 100644 (file)
@@ -4993,7 +4993,7 @@ sub _items_cust_bill_pkg {
           ) {
             my $time_period;
             my $date_style = $conf->config('cust_bill-line_item-date_style');
-            if ( $date_style eq 'month_of' ) {
+            if ( defined($date_style) && $date_style eq 'month_of' ) {
               $time_period = time2str('The month of %B', $cust_bill_pkg->sdate);
             } else {
               $time_period =      time2str($date_format, $cust_bill_pkg->sdate).
@@ -5261,6 +5261,9 @@ sub _items_discounts_avail {
                  join(', ', map { "#$_" } $plan->pkgnums)
       if $list_pkgnums;
 
+    # discounts for non-integer months don't work anyway
+    $months = sprintf("%d", $months);
+
     +{
       description => $self->mt('Save [_1]% by paying for [_2] months',
                                 $percent, $months),