[freeside-commits] freeside/FS/FS/part_pkg recur_Common.pm, 1.13, 1.14

Ivan,,, ivan at wavetail.420.am
Mon Oct 24 15:48:24 PDT 2011


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

Modified Files:
	recur_Common.pm 
Log Message:
fix recur_Common packages with setup discounts

Index: recur_Common.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/part_pkg/recur_Common.pm,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -w -d -r1.13 -r1.14
--- recur_Common.pm	8 Sep 2011 22:10:49 -0000	1.13
+++ recur_Common.pm	24 Oct 2011 22:48:22 -0000	1.14
@@ -22,8 +22,19 @@
 sub calc_setup {
   # moved from all descendant packages which just had $self->option('setup_fee')
   my($self, $cust_pkg, $sdate, $details, $param) = @_;
+
   return 0 if $self->prorate_setup($cust_pkg, $sdate);
-  $self->option('setup_fee');
+
+  my $charge = $self->option('setup_fee');
+
+  my $discount = 0;
+  if ( $charge > 0 ) {
+      $param->{'setup_charge'} = $charge;
+      $discount = $self->calc_discount($cust_pkg, $sdate, $details, $param);
+      delete $param->{'setup_charge'};
+  }
+
+  sprintf('%.2f', $charge - $discount);
 }
 
 sub cutoff_day {



More information about the freeside-commits mailing list