[freeside-commits] freeside/FS/FS/part_pkg bulk.pm, 1.11, 1.12 discount_Mixin.pm, 1.2, 1.3 flat_introrate.pm, 1.4, 1.5

Mark Wells mark at wavetail.420.am
Wed Jan 19 16:38:17 PST 2011


Update of /home/cvs/cvsroot/freeside/FS/FS/part_pkg
In directory wavetail.420.am:/tmp/cvs-serv20630/part_pkg

Modified Files:
	bulk.pm discount_Mixin.pm flat_introrate.pm 
Log Message:
intro periods and DST, RT#11018

Index: bulk.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/part_pkg/bulk.pm,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -w -d -r1.11 -r1.12
--- bulk.pm	24 Dec 2010 09:49:31 -0000	1.11
+++ bulk.pm	20 Jan 2011 00:38:14 -0000	1.12
@@ -45,7 +45,7 @@
 
   my $last_bill = $cust_pkg->last_bill;
 
-  return sprintf("%.2f", $self->base_recur($cust_pkg) )
+  return sprintf("%.2f", $self->base_recur($cust_pkg, $sdate) )
     unless $$sdate > $last_bill;
 
   my $total_svc_charge = 0;
@@ -113,7 +113,7 @@
     }
   }
 
-  sprintf('%.2f', $self->base_recur($cust_pkg) + $total_svc_charge );
+  sprintf('%.2f', $self->base_recur($cust_pkg, $sdate) + $total_svc_charge );
 }
 
 sub can_discount { 0; }

Index: flat_introrate.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/part_pkg/flat_introrate.pm,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -w -d -r1.4 -r1.5
--- flat_introrate.pm	24 Dec 2010 09:49:32 -0000	1.4
+++ flat_introrate.pm	20 Jan 2011 00:38:15 -0000	1.5
@@ -4,8 +4,6 @@
 use vars qw(@ISA %info $DEBUG $me);
 use FS::part_pkg::flat;
 
-use Date::Manip qw(DateCalc UnixDate ParseDate);
-
 @ISA = qw(FS::part_pkg::flat);
 $me = '[' . __PACKAGE__ . ']';
 $DEBUG = 0;
@@ -31,29 +29,21 @@
 sub base_recur {
   my($self, $cust_pkg, $time ) = @_;
 
+  warn "flat_introrate base_recur requires date!" if !$time;
   my $now = $time ? $$time : time;
 
   my ($duration) = ($self->option('intro_duration') =~ /^(\d+)$/);
   unless ($duration) {
     die "Invalid intro_duration: " . $self->option('intro_duration');
   }
+  my $intro_end = $self->add_freq($cust_pkg->setup, $duration);
 
-  my $setup = &ParseDate('epoch ' . $cust_pkg->getfield('setup'));
-  my $intro_end = &DateCalc($setup, "+${duration} month");
-  my $recur;
-
-  warn "$me: \$duration = ${duration}" if $DEBUG;
-  warn "$me: \$intro_end = ${intro_end}" if $DEBUG;
-  warn "$me: $now < " . &UnixDate($intro_end, '%s') if $DEBUG;
-
-  if ($now < &UnixDate($intro_end, '%s')) {
-    $recur = $self->option('intro_fee');
+  if ($now < $intro_end) {
+    return $self->option('intro_fee');
   } else {
-    $recur = $self->option('recur_fee');
+    return $self->option('recur_fee');
   }
 
-  $recur;
-
 }
 
 

Index: discount_Mixin.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/part_pkg/discount_Mixin.pm,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -w -d -r1.2 -r1.3
--- discount_Mixin.pm	18 Jan 2011 05:21:08 -0000	1.2
+++ discount_Mixin.pm	20 Jan 2011 00:38:15 -0000	1.3
@@ -41,7 +41,7 @@
 sub calc_discount {
   my($self, $cust_pkg, $sdate, $details, $param ) = @_;
 
-  my $br = $self->base_recur($cust_pkg);
+  my $br = $self->base_recur($cust_pkg, $sdate);
   $br += $param->{'override_charges'} if $param->{'override_charges'};
 
   my $tot_discount = 0;



More information about the freeside-commits mailing list