X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fpart_pkg%2Fflat.pm;h=eb70253bb312fc124ff3c4938152d43d27725f19;hb=5b193ee2c5fae0743699adb1a28591f2a1735eb7;hp=d9d458809cbf870919b6cbe2b16011cc3242ceb0;hpb=3a8fa4f27ef08792e3d653cee167979a411f89d1;p=freeside.git diff --git a/FS/FS/part_pkg/flat.pm b/FS/FS/part_pkg/flat.pm index d9d458809..eb70253bb 100644 --- a/FS/FS/part_pkg/flat.pm +++ b/FS/FS/part_pkg/flat.pm @@ -179,6 +179,12 @@ sub cutoff_day { if ( $self->option('sync_bill_date',1) ) { my $next_bill = $cust_pkg->cust_main->next_bill_date; if ( defined($next_bill) ) { + # careful here. if the prorate calculation is going to round to + # the nearest day, this needs to always return the same result + if ( $self->option('prorate_round_day', 1) ) { + my $hour = (localtime($next_bill))[2]; + $next_bill += 64800 if $hour >= 12; + } return (localtime($next_bill))[3]; } } @@ -214,13 +220,13 @@ sub calc_cancel { and $self->option('bill_recur_on_cancel', 1) ) { # run another recurring cycle return $self->calc_recur(@_); - } - elsif ( $conf->exists('bill_usage_on_cancel') # should be a package option? + } elsif ( $conf->exists('bill_usage_on_cancel') # should be a package option? and $self->can('calc_usage') ) { # bill for outstanding usage return $self->calc_usage(@_); + } else { + return 'NOTHING'; # numerically zero, but has special meaning } - 0; } sub calc_remain {