[freeside-commits] freeside/FS/FS/part_pkg recur_Common.pm, 1.12.2.1, 1.12.2.2

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


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

Modified Files:
      Tag: FREESIDE_2_3_BRANCH
	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.12.2.1
retrieving revision 1.12.2.2
diff -u -w -d -r1.12.2.1 -r1.12.2.2
--- recur_Common.pm	8 Sep 2011 22:10:58 -0000	1.12.2.1
+++ recur_Common.pm	24 Oct 2011 22:48:29 -0000	1.12.2.2
@@ -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