diff options
author | ivan <ivan> | 2008-09-10 07:30:56 +0000 |
---|---|---|
committer | ivan <ivan> | 2008-09-10 07:30:56 +0000 |
commit | f5651a3f5978a89f208a861844d014217d4c31e8 (patch) | |
tree | 43c0fd92b8e52cbc88bda1a91b88f53e125bfbd3 | |
parent | 6038fae04753f2b82ee17ed3ddb6dcdf8a1acf71 (diff) |
add upcoming/preceding option, RT#3851
-rw-r--r-- | FS/FS/part_pkg/voip_cdr.pm | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/FS/FS/part_pkg/voip_cdr.pm b/FS/FS/part_pkg/voip_cdr.pm index 21cd5ebc0..423127888 100644 --- a/FS/FS/part_pkg/voip_cdr.pm +++ b/FS/FS/part_pkg/voip_cdr.pm @@ -27,6 +27,11 @@ tie my %rating_method, 'Tie::IxHash', # 'Asterisk (or other?) CDR table', #; +tie my %temporalities, 'Tie::IxHash', + 'upcoming' => "Upcoming (future)", + 'preceding' => "Preceding (past)", +; + %info = ( 'name' => 'VoIP rating by plan of CDR records in an internal (or external) SQL table', 'fields' => { @@ -36,6 +41,13 @@ tie my %rating_method, 'Tie::IxHash', 'recur_flat' => { 'name' => 'Base recurring fee for this package', 'default' => 0, }, + + #probably useful for other usage-charging price plans + 'recur_temporality' => { 'name' => 'Charge recurring fee for period', + 'type' => 'select', + 'select_options' => \%temporalities, + }, + 'unused_credit' => { 'name' => 'Credit the customer for the unused portion'. ' of service at cancellation', 'type' => 'checkbox', @@ -109,7 +121,7 @@ tie my %rating_method, 'Tie::IxHash', }, 'fieldorder' => [qw( - setup_fee recur_flat unused_credit + setup_fee recur_flat recur_temporality unused_credit rating_method ratenum default_prefix disable_src @@ -129,7 +141,11 @@ sub calc_setup { sub calc_recur { my($self, $cust_pkg, $sdate, $details, $param ) = @_; - my $last_bill = $cust_pkg->last_bill; + #my $last_bill = $cust_pkg->last_bill; + my $last_bill = $cust_pkg->get('last_bill'); #->last_bill falls back to setup + + return 0 + if $self->option('recur_temporality') eq 'preceding' && $last_bill == 0; my $ratenum = $cust_pkg->part_pkg->option('ratenum'); |