[freeside-commits] branch FREESIDE_4_BRANCH updated. 50e928d64530d5cc6a4cd675a584e581b4780c5c

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


The branch, FREESIDE_4_BRANCH has been updated
       via  50e928d64530d5cc6a4cd675a584e581b4780c5c (commit)
       via  f2f57f0db5fa105530db5d274eca3cb2725fdd19 (commit)
      from  796d991531fd0d630bf0db9e87447e0459c7e5d6 (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 50e928d64530d5cc6a4cd675a584e581b4780c5c
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 f2f57f0db5fa105530db5d274eca3cb2725fdd19
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