[freeside-commits] branch master updated. b663d0e826c248c218dc9365d4e2d74db2648e48

Mark Wells mark at 420.am
Fri Dec 4 16:54:27 PST 2015


The branch, master has been updated
       via  b663d0e826c248c218dc9365d4e2d74db2648e48 (commit)
       via  d2916480d64ae7b0b86bd73feabc1c5a45b664f7 (commit)
      from  11a4787e386291574aca2357421b586e365252d9 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit b663d0e826c248c218dc9365d4e2d74db2648e48
Author: Mark Wells <mark at freeside.biz>
Date:   Fri Dec 4 16:45:29 2015 -0800

    correctly handle percentage discounts with duration less than package billing cycle, #39165, from #19173

diff --git a/FS/FS/part_pkg/discount_Mixin.pm b/FS/FS/part_pkg/discount_Mixin.pm
index 4c86753..801737b 100644
--- a/FS/FS/part_pkg/discount_Mixin.pm
+++ b/FS/FS/part_pkg/discount_Mixin.pm
@@ -142,11 +142,12 @@ sub calc_discount {
     } else {
       
       # we are calculating a recurring fee discount. estimate the recurring
-      # fee:
-      # XXX it would be more accurate for calc_recur to just _tell us_ what
-      # it's going to charge
+      # fee. Note we use $months here rather than $chg_months so that if the
+      # remaining discount amount is for less time than the package period,
+      # the "estimated recurring fee" is only for as long as the discount
+      # lasts.
 
-      my $recur_charge = $br * $chg_months / $self->freq;
+      my $recur_charge = $br * $months / $self->freq;
       # round this, because the real recur charge is rounded
       $recur_charge = sprintf('%.2f', $recur_charge);
 
@@ -233,7 +234,6 @@ sub calc_discount {
       'pkgdiscountnum' => $cust_pkg_discount->pkgdiscountnum,
       'amount'         => $amount,
       'months'         => $months,
-      # 'setuprecur' is implied by the cust_pkg_discount link
     };
     push @{ $param->{'discounts'} }, $cust_bill_pkg_discount;
     $tot_discount += $amount;

commit d2916480d64ae7b0b86bd73feabc1c5a45b664f7
Author: Mark Wells <mark at freeside.biz>
Date:   Fri Dec 4 16:44:09 2015 -0800

    fix spelling

diff --git a/httemplate/view/cust_main/packages/status.html b/httemplate/view/cust_main/packages/status.html
index 1a215f3..aa5320b 100644
--- a/httemplate/view/cust_main/packages/status.html
+++ b/httemplate/view/cust_main/packages/status.html
@@ -547,7 +547,7 @@ sub pkg_status_row_discount {
     if ( $discount->months > 0 and $cust_pkg_discount->months_used > 0 ) {
       my $remaining = $discount->months - $cust_pkg_discount->months_used;
       $remaining = sprintf('%.2f', $remaining) if $remaining =~ /\./;
-      $label .= <br> . emt("([_1] months remaining)",$remaining);
+      $label .= <br> . emt(" ([quant,_1,month,months] remaining)",$remaining);
     }
     $label .= '</SPAN>';
 

-----------------------------------------------------------------------

Summary of changes:
 FS/FS/part_pkg/discount_Mixin.pm               |   10 +++++-----
 httemplate/view/cust_main/packages/status.html |    2 +-
 2 files changed, 6 insertions(+), 6 deletions(-)




More information about the freeside-commits mailing list