[freeside-commits] branch FREESIDE_3_BRANCH updated. 52d332b9d4ce7a9aa27ba1da57fefb03275ba9ae

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


The branch, FREESIDE_3_BRANCH has been updated
       via  52d332b9d4ce7a9aa27ba1da57fefb03275ba9ae (commit)
       via  6d0ece61c680a00af35bbf9db6337e32b899257a (commit)
      from  d72d57ec3b5c9f8d0115f84c02943994d93436ca (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 52d332b9d4ce7a9aa27ba1da57fefb03275ba9ae
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 e411c84..5b3f100 100644
--- a/FS/FS/part_pkg/discount_Mixin.pm
+++ b/FS/FS/part_pkg/discount_Mixin.pm
@@ -134,11 +134,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);
 
@@ -218,7 +219,7 @@ sub calc_discount {
       'pkgdiscountnum' => $cust_pkg_discount->pkgdiscountnum,
       'amount'         => $amount,
       'months'         => $months,
-      # XXX should have a 'setuprecur'
+      # XXX should have a 'setuprecur' (and on 4.x, it does)
     };
     push @{ $param->{'discounts'} }, $cust_bill_pkg_discount;
     $tot_discount += $amount;

commit 6d0ece61c680a00af35bbf9db6337e32b899257a
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 19249bf..7c4b270 100644
--- a/httemplate/view/cust_main/packages/status.html
+++ b/httemplate/view/cust_main/packages/status.html
@@ -527,7 +527,7 @@ sub pkg_status_row_discount {
     if ( $discount->months ) {
       my $remaining = $discount->months - $cust_pkg_discount->months_used;
       $remaining = sprintf('%.2f', $remaining) if $remaining =~ /\./;
-      $label .= emt("([_1] months remaining)",$remaining);
+      $label .= emt(" ([quant,_1,month,months] remaining)",$remaining);
     }
 
     $label .= ' <FONT SIZE="-1">('.

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

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




More information about the freeside-commits mailing list