X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fpart_pkg%2Frecur_Common.pm;h=7197eaeee95b0a8de071730532ed82b27eb03a9e;hb=7f5e32275a5a2674fd1d220cd651b222b9831476;hp=07ade81dcfddad060cf94cd00fad89d5e39ff6ec;hpb=fe8914c3b55d747fc4c3559b17d8d0ef6ed1a0b3;p=freeside.git diff --git a/FS/FS/part_pkg/recur_Common.pm b/FS/FS/part_pkg/recur_Common.pm index 07ade81dc..7197eaeee 100644 --- a/FS/FS/part_pkg/recur_Common.pm +++ b/FS/FS/part_pkg/recur_Common.pm @@ -22,8 +22,19 @@ sub base_recur { 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 {