if $self->recur_temporality eq 'preceding' && !$last_bill;
my $charge = $self->base_recur($cust_pkg, $sdate);
- if ( my $cutoff_day = $self->cutoff_day($cust_pkg) ) {
- $charge = $self->calc_prorate(@_, $cutoff_day);
+ # always treat cutoff_day as a list
+ if ( my @cutoff_day = $self->cutoff_day($cust_pkg) ) {
+ $charge = $self->calc_prorate(@_, @cutoff_day);
}
elsif ( $param->{freq_override} ) {
# XXX not sure if this should be mutually exclusive with sync_bill_date.
return (localtime($next_bill))[3];
}
}
- return 0;
+ return ();
}
sub base_recur {
if ( $recur_method eq 'prorate' or $recur_method eq 'subscription' ) {
return $self->option('cutoff_day',1) || 1;
} else {
- return 0;
+ return ();
}
}
if ( $param->{'increment_next_bill'} ) {
my $recur_method = $self->option('recur_method', 1) || 'anniversary';
- my $cutoff_day = $self->cutoff_day($cust_pkg);
+ my @cutoff_day = $self->cutoff_day($cust_pkg);
$charges = $self->base_recur($cust_pkg);
$charges += $param->{'override_charges'} if $param->{'override_charges'};
if ( $recur_method eq 'prorate' ) {
- $charges = $self->calc_prorate(@_, $cutoff_day);
+ $charges = $self->calc_prorate(@_, @cutoff_day);
$charges += $param->{'override_charges'} if $param->{'override_charges'};
} elsif ( $recur_method eq 'subscription' ) {
my ($day, $mon, $year) = ( localtime($$sdate) )[ 3..5 ];
- if ( $day < $cutoff_day ) {
+ if ( $day < $cutoff_day[0] ) {
if ( $mon == 0 ) { $mon=11; $year--; }
else { $mon--; }
}
- $$sdate = timelocal(0, 0, 0, $cutoff_day, $mon, $year);
+ $$sdate = timelocal(0, 0, 0, $cutoff_day[0], $mon, $year);
}#$recur_method