X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=FS%2FFS%2Fpart_pkg%2Fcdr_termination.pm;h=54bce2c1dbdd5a311696401d526fed28b52c8a7b;hp=d99903d7785aa4a1d17e35aa004b89a7ae72d55f;hb=d62206a94d9d49ef96640e0a8ec492679f8345e9;hpb=6a7c4ac2fafc9d722c3ee4c5b75f1f8ca83b6c1a diff --git a/FS/FS/part_pkg/cdr_termination.pm b/FS/FS/part_pkg/cdr_termination.pm index d99903d77..54bce2c1d 100644 --- a/FS/FS/part_pkg/cdr_termination.pm +++ b/FS/FS/part_pkg/cdr_termination.pm @@ -16,15 +16,8 @@ tie my %temporalities, 'Tie::IxHash', %info = ( 'name' => 'VoIP rating of CDR records for termination partners.', 'shortname' => 'VoIP/telco CDR termination', + 'inherit_fields' => [ 'prorate_Mixin', 'global_Mixin' ], 'fields' => { - - 'setup_fee' => { 'name' => 'Setup fee for this package', - 'default' => 0, - }, - 'recur_fee' => { 'name' => 'Base recurring fee for this package', - 'default' => 0, - }, - #'cdr_column' => { 'name' => 'Column from CDR records', # 'type' => 'select', # 'select_enum' => [qw( @@ -49,16 +42,10 @@ tie my %temporalities, 'Tie::IxHash', 'select_options' => \%temporalities, }, - 'unused_credit' => { 'name' => 'Credit the customer for the unused portion'. - ' of service at cancellation', - 'type' => 'checkbox', - }, - 'cutoff_day' => { 'name' => 'Billing Day (1 - 28) for prorating or '. 'subscription', 'default' => '1', }, - 'recur_method' => { 'name' => 'Recurring fee method', #'type' => 'radio', #'options' => \%recur_method, @@ -66,7 +53,7 @@ tie my %temporalities, 'Tie::IxHash', 'select_options' => \%FS::part_pkg::recur_Common::recur_method, }, - #false laziness w/cdr_termination.pm + #false laziness w/voip_cdr.pm 'output_format' => { 'name' => 'CDR invoice display format', 'type' => 'select', 'select_options' => { FS::cdr::invoice_formats() }, @@ -80,12 +67,17 @@ tie my %temporalities, 'Tie::IxHash', 'type' => 'checkbox', }, + 'usage_mandate' => { 'name' => 'Always put usage details in separate section', + 'type' => 'checkbox', + }, + #eofalse + }, #cdr_column - 'fieldorder' => [qw( - setup_fee recur_fee - recur_temporality unused_credit recur_method cutoff_day - output_format usage_section summarize_usage + 'fieldorder' => [qw( recur_temporality recur_method cutoff_day ), + FS::part_pkg::prorate_Mixin::fieldorder, + qw( + output_format usage_section summarize_usage usage_mandate ) ], @@ -93,11 +85,6 @@ tie my %temporalities, 'Tie::IxHash', ); -sub calc_setup { - my($self, $cust_pkg ) = @_; - $self->option('setup_fee'); -} - sub calc_recur { my $self = shift; my($cust_pkg, $sdate, $details, $param ) = @_; @@ -106,7 +93,7 @@ sub calc_recur { my $last_bill = $cust_pkg->get('last_bill'); #->last_bill falls back to setup return 0 - if $self->option('recur_temporality', 1) eq 'preceding' + if $self->recur_temporality eq 'preceding' && ( $last_bill eq '' || $last_bill == 0 ); # termination calculations @@ -195,7 +182,7 @@ sub calc_recur { # eotermiation calculation - $charges += $self->calc_recur_Common(@_); + $charges += ($cust_pkg->quantity || 1) * $self->calc_recur_Common(@_); $charges; }