[freeside-commits] branch master updated. bb6b1e9ed5209a5e28e55c6a7b3a1034575d49b9

Mark Wells mark at 420.am
Sat Mar 24 16:36:10 PDT 2012


The branch, master has been updated
       via  bb6b1e9ed5209a5e28e55c6a7b3a1034575d49b9 (commit)
       via  98550895c14615062ba0b03199a58144796829de (commit)
      from  df1375c1ce6c844dd81afb0001bd0a4c1e96ca2f (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 bb6b1e9ed5209a5e28e55c6a7b3a1034575d49b9
Author: Mark Wells <mark at freeside.biz>
Date:   Sat Mar 24 16:35:59 2012 -0700

    better sync behavior near the end of the month, #17043

diff --git a/FS/FS/part_pkg/prorate_Mixin.pm b/FS/FS/part_pkg/prorate_Mixin.pm
index 0f40576..a01b5c4 100644
--- a/FS/FS/part_pkg/prorate_Mixin.pm
+++ b/FS/FS/part_pkg/prorate_Mixin.pm
@@ -2,7 +2,7 @@ package FS::part_pkg::prorate_Mixin;
 
 use strict;
 use vars qw( %info );
-use Time::Local qw( timelocal );
+use Time::Local qw( timelocal timelocal_nocheck );
 use Date::Format qw( time2str );
 
 %info = ( 
@@ -202,28 +202,17 @@ sub _endpoints {
   }
   my $mend;
   my $mstart;
-  # if cutoff day > 28, force it to the 1st of next month
-  if ( $cutoff_day > 28 ) {
-    $cutoff_day = 1;
-    # and if we are currently after the 28th, roll the current day 
-    # forward to that day
-    if ( $mday > 28 ) {
-      $mday = 1;
-      #set $mnow = $mend so the amount billed will be zero
-      $mnow = timelocal(0,0,0,1,$mon == 11 ? 0 : $mon + 1,$year+($mon==11));
-    }
-  }
   if ( $mday >= $cutoff_day ) {
     $mend = 
-      timelocal(0,0,0,$cutoff_day,$mon == 11 ? 0 : $mon + 1,$year+($mon==11));
+      timelocal_nocheck(0,0,0,$cutoff_day,$mon == 11 ? 0 : $mon + 1,$year+($mon==11));
     $mstart =
-      timelocal(0,0,0,$cutoff_day,$mon,$year);
+      timelocal_nocheck(0,0,0,$cutoff_day,$mon,$year);
   }
   else {
     $mend = 
-      timelocal(0,0,0,$cutoff_day,$mon,$year);
+      timelocal_nocheck(0,0,0,$cutoff_day,$mon,$year);
     $mstart = 
-      timelocal(0,0,0,$cutoff_day,$mon == 0 ? 11 : $mon - 1,$year-($mon==0));
+      timelocal_nocheck(0,0,0,$cutoff_day,$mon == 0 ? 11 : $mon - 1,$year-($mon==0));
   }
   return ($mnow, $mend, $mstart);
 }

commit 98550895c14615062ba0b03199a58144796829de
Author: Mark Wells <mark at freeside.biz>
Date:   Sat Mar 24 16:35:26 2012 -0700

    fix flat-rate discounts when charging zero months, #17043

diff --git a/FS/FS/part_pkg/discount_Mixin.pm b/FS/FS/part_pkg/discount_Mixin.pm
index 335ff6d..1edf258 100644
--- a/FS/FS/part_pkg/discount_Mixin.pm
+++ b/FS/FS/part_pkg/discount_Mixin.pm
@@ -84,7 +84,9 @@ sub calc_discount {
     $amount += $discount->amount
         if $cust_pkg->pkgpart == $param->{'real_pkgpart'};
     $amount += sprintf('%.2f', $discount->percent * $br / 100 );
-    my $chg_months = $param->{'months'} || $cust_pkg->part_pkg->freq;
+    my $chg_months = defined($param->{'months'}) ?
+                      $param->{'months'} :
+                      $cust_pkg->part_pkg->freq;
 
     my $months = $discount->months
     ? min( $chg_months,

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

Summary of changes:
 FS/FS/part_pkg/discount_Mixin.pm |    4 +++-
 FS/FS/part_pkg/prorate_Mixin.pm  |   21 +++++----------------
 2 files changed, 8 insertions(+), 17 deletions(-)




More information about the freeside-commits mailing list