diff options
author | ivan <ivan> | 2011-10-24 22:48:22 +0000 |
---|---|---|
committer | ivan <ivan> | 2011-10-24 22:48:22 +0000 |
commit | 729a3c80385332bd26f62024e5d955d58d1eb9e3 (patch) | |
tree | 110d0e41778dcabcd106fc183a3821093ba125da /FS/FS/part_pkg | |
parent | 0793752e49801fd0742fde864bb1b392291b7a91 (diff) |
fix recur_Common packages with setup discounts
Diffstat (limited to 'FS/FS/part_pkg')
-rw-r--r-- | FS/FS/part_pkg/recur_Common.pm | 13 |
1 files changed, 12 insertions, 1 deletions
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 { |