X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fpart_pkg%2Frecur_Common.pm;h=7197eaeee95b0a8de071730532ed82b27eb03a9e;hb=729a3c80385332bd26f62024e5d955d58d1eb9e3;hp=48e9307c41fbb3de23b6d585c6a9218015f31a64;hpb=90dfd05877a331fb13ba50389e3d8a3105465bc7;p=freeside.git diff --git a/FS/FS/part_pkg/recur_Common.pm b/FS/FS/part_pkg/recur_Common.pm index 48e9307c4..7197eaeee 100644 --- a/FS/FS/part_pkg/recur_Common.pm +++ b/FS/FS/part_pkg/recur_Common.pm @@ -1,7 +1,7 @@ package FS::part_pkg::recur_Common; +use base qw( FS::part_pkg::flat ); use strict; -use base qw( FS::part_pkg::flat ); use vars qw( %info %recur_method ); use Tie::IxHash; use Time::Local; @@ -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 {