[freeside-commits] branch FREESIDE_2_3_BRANCH updated. 290e2ceb90c997d04125c2d55d9a590e4c1d4e76

Mark Wells mark at 420.am
Wed Jun 27 16:56:38 PDT 2012


The branch, FREESIDE_2_3_BRANCH has been updated
       via  290e2ceb90c997d04125c2d55d9a590e4c1d4e76 (commit)
      from  56a460e7b84119b0986bcb7e3db8dde9210dfc47 (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 290e2ceb90c997d04125c2d55d9a590e4c1d4e76
Author: Mark Wells <mark at freeside.biz>
Date:   Wed Jun 27 16:53:58 2012 -0700

    ignore prorate_defer_bill on packages that aren't prorated, fallout from #17618

diff --git a/FS/FS/part_pkg/flat.pm b/FS/FS/part_pkg/flat.pm
index f793d9c..ee5e847 100644
--- a/FS/FS/part_pkg/flat.pm
+++ b/FS/FS/part_pkg/flat.pm
@@ -142,8 +142,9 @@ sub calc_recur {
     if $self->recur_temporality eq 'preceding' && $last_bill == 0;
 
   my $charge = $self->base_recur($cust_pkg, $sdate);
-  if ( my $cutoff_day = $self->cutoff_day($cust_pkg) ) {
-    $charge = $self->calc_prorate(@_, $cutoff_day);
+  # always treat cutoff_day as a list
+  if ( my @cutoff_day = $self->cutoff_day($cust_pkg) ) {
+    $charge = $self->calc_prorate(@_, @cutoff_day);
   }
   elsif ( $param->{freq_override} ) {
     # XXX not sure if this should be mutually exclusive with sync_bill_date.
@@ -165,7 +166,7 @@ sub cutoff_day {
       return (localtime($next_bill))[3];
     }
   }
-  return 0;
+  return ();
 }
 
 sub base_recur {
diff --git a/FS/FS/part_pkg/recur_Common.pm b/FS/FS/part_pkg/recur_Common.pm
index 7233cc6..9d7341b 100644
--- a/FS/FS/part_pkg/recur_Common.pm
+++ b/FS/FS/part_pkg/recur_Common.pm
@@ -45,7 +45,7 @@ sub cutoff_day {
   if ( $recur_method eq 'prorate' or $recur_method eq 'subscription' ) {
     return $self->option('cutoff_day',1) || 1;
   } else {
-    return 0;
+    return ();
   }
 }
 
@@ -58,26 +58,26 @@ sub calc_recur_Common {
   if ( $param->{'increment_next_bill'} ) {
 
     my $recur_method = $self->option('recur_method', 1) || 'anniversary';
-    my $cutoff_day = $self->cutoff_day($cust_pkg);
+    my @cutoff_day = $self->cutoff_day($cust_pkg);
 
     $charges = $self->base_recur($cust_pkg);
     $charges += $param->{'override_charges'} if $param->{'override_charges'};
 
     if ( $recur_method eq 'prorate' ) {
 
-      $charges = $self->calc_prorate(@_, $cutoff_day);
+      $charges = $self->calc_prorate(@_, @cutoff_day);
       $charges += $param->{'override_charges'} if $param->{'override_charges'};
 
     } elsif ( $recur_method eq 'subscription' ) {
 
       my ($day, $mon, $year) = ( localtime($$sdate) )[ 3..5 ];
 
-      if ( $day < $cutoff_day ) {
+      if ( $day < $cutoff_day[0] ) {
         if ( $mon == 0 ) { $mon=11; $year--; }
         else { $mon--; }
       }
 
-      $$sdate = timelocal(0, 0, 0, $cutoff_day, $mon, $year);
+      $$sdate = timelocal(0, 0, 0, $cutoff_day[0], $mon, $year);
 
     }#$recur_method
 

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

Summary of changes:
 FS/FS/part_pkg/flat.pm         |    7 ++++---
 FS/FS/part_pkg/recur_Common.pm |   10 +++++-----
 2 files changed, 9 insertions(+), 8 deletions(-)




More information about the freeside-commits mailing list