diff options
author | ivan <ivan> | 2008-09-10 07:24:57 +0000 |
---|---|---|
committer | ivan <ivan> | 2008-09-10 07:24:57 +0000 |
commit | 6038fae04753f2b82ee17ed3ddb6dcdf8a1acf71 (patch) | |
tree | 34deb77b69784d763e5939c52ef88da642975077 | |
parent | 9c34be9ec304d9c3f936bdf4dd6d6c23a847c34f (diff) |
add upcoming/preceding option, RT#3851
-rw-r--r-- | FS/FS/cust_main.pm | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/FS/FS/cust_main.pm b/FS/FS/cust_main.pm index 939888ee1..a1dfddc1f 100644 --- a/FS/FS/cust_main.pm +++ b/FS/FS/cust_main.pm @@ -2020,6 +2020,7 @@ sub bill { # only for figuring next bill date, nothing else, so, reset $sdate again # here $sdate = $cust_pkg->bill || $cust_pkg->setup || $time; + #no need, its in $hash{last_bill}# my $last_bill = $cust_pkg->last_bill; $cust_pkg->last_bill($sdate); if ( $part_pkg->freq =~ /^\d+$/ ) { @@ -2100,10 +2101,17 @@ sub bill { 'recur' => $recur, 'unitrecur' => $unitrecur, 'quantity' => $cust_pkg->quantity, - 'sdate' => $sdate, - 'edate' => $cust_pkg->bill, 'details' => \@details, }); + + if ( $part_pkg->option('recur_temporality') eq 'preceding' ) { + $cust_bill_pkg->sdate( $hash{last_bill} ); + $cust_bill_pkg->edate( $sdate - 86399 );2#60s*60m*24h-1 + } else { #if ( $part_pkg->option('recur_temporality') eq 'upcoming' ) { + $cust_bill_pkg->sdate( $sdate ); + $cust_bill_pkg->edate( $cust_pkg->bill ); + } + $error = $cust_bill_pkg->insert; if ( $error ) { $dbh->rollback if $oldAutoCommit; |