X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fpart_pkg%2Fprorate_Mixin.pm;h=7eac2af5be411cb06138cf09116fcdd43cbdfcf2;hb=57bb423fe457ba4e13726877f53bcdf944f828f8;hp=a89b54d2cd506470803dca1914337f13807e19af;hpb=4b05b20576ddb14577d59c87c8257c6804449410;p=freeside.git diff --git a/FS/FS/part_pkg/prorate_Mixin.pm b/FS/FS/part_pkg/prorate_Mixin.pm index a89b54d2c..7eac2af5b 100644 --- a/FS/FS/part_pkg/prorate_Mixin.pm +++ b/FS/FS/part_pkg/prorate_Mixin.pm @@ -30,7 +30,7 @@ tie our %prorate_round_day_opts, 'Tie::IxHash', }, 'prorate_defer_bill' => { 'name' => 'When prorating, defer the first bill until the '. - 'billing day', + 'billing day or customers next bill date if synchronizing.', 'type' => 'checkbox', }, 'prorate_verbose' => { @@ -108,7 +108,8 @@ sub calc_prorate { ) { #warn "[calc_prorate] #".$cust_pkg->pkgnum.": running deferred setup\n"; - $param->{'setup_fee'} = $self->calc_setup($cust_pkg, $$sdate, $details); + $param->{'setup_fee'} = $self->calc_setup($cust_pkg, $$sdate, $details) + unless $cust_pkg->{'Hash'}->{'waive_setup'}; $mnow = $cust_pkg->setup; $add_period = 1; } @@ -189,8 +190,7 @@ set, in which case it postpones the next bill to the cutoff day. =cut sub prorate_setup { - my $self = shift; - my ($cust_pkg, $sdate) = @_; + my ($self, $cust_pkg, $time) = @_; my @cutoff_days = $self->cutoff_day($cust_pkg); if ( @cutoff_days and $self->option('prorate_defer_bill', 1) ) { if ( $cust_pkg->setup ) { @@ -204,11 +204,11 @@ sub prorate_setup { # For some reason (probably user override), the bill date has been set even # though the package isn't billing yet. Start billing as though that was the # start date. - $sdate = $cust_pkg->bill; + $time = $cust_pkg->bill; $cust_pkg->setup($cust_pkg->bill); } # Now figure the start and end of the period that contains the start date. - my ($mnow, $mend, $mstart) = $self->_endpoints($sdate, @cutoff_days); + my ($mnow, $mend, $mstart) = $self->_endpoints($time, @cutoff_days); # If today is the cutoff day, set the next bill and setup both to # midnight today, so that the customer will be billed normally for a # month starting today.