fix selfservice display when there are term discounts defined, looks like fallout...
authorMark Wells <mark@freeside.biz>
Thu, 12 Nov 2015 23:34:55 +0000 (15:34 -0800)
committerMark Wells <mark@freeside.biz>
Fri, 13 Nov 2015 00:52:08 +0000 (16:52 -0800)
FS/FS/cust_main/Billing.pm
FS/FS/cust_main/Billing_Discount.pm

index b7837c5..333b07f 100644 (file)
@@ -1357,7 +1357,8 @@ sub _make_lines {
       } else {
         # the normal case
       $next_bill = $part_pkg->add_freq($sdate, $options{freq_override} || 0);
-      return "unparsable frequency: ". $part_pkg->freq
+      return "unparsable frequency: ".
+        ($options{freq_override} || $part_pkg->freq)
         if $next_bill == -1;
       }  
   
index 9dda389..e64c761 100644 (file)
@@ -90,8 +90,11 @@ sub discount_terms {
 
   my @discount_pkgs = $self->_discount_pkgs_and_bill;
   shift @discount_pkgs; #discard bill;
-  
-  map { $terms{$_->months} = 1 }
+
+  # convert @discount_pkgs (the list of packages that have available discounts)
+  # to a list of distinct term lengths in months, and strip any decimal places
+  # from the number of months, not that it should have any 
+  map { $terms{sprintf('%.0f', $_->months)} = 1 }
     grep { $_->months && $_->months > 1 }
     map { $_->discount }
     map { $_->part_pkg->part_pkg_discount }