package FS::part_pkg::cdr_termination;
+use base qw( FS::part_pkg::recur_Common );
use strict;
-use base qw( FS::part_pkg::recur_Common );
use vars qw( $DEBUG %info );
use Tie::IxHash;
use FS::Record qw( qsearch ); #qsearchs );
%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(
'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,
'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() },
'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
+ ),
],
'weight' => 48,
);
-sub calc_setup {
- my($self, $cust_pkg ) = @_;
- $self->option('setup_fee');
-}
-
sub calc_recur {
my $self = shift;
my($cust_pkg, $sdate, $details, $param ) = @_;
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
my $charges = 0;
#find an svc_external record
- my @svc_external = map { $_->svc_x }
- grep { $_->part_svc->svcdb eq 'svc_external' }
- $cust_pkg->cust_svc;
+ my @svc_external = map { $_->svc_x }
+ $cust_pkg->cust_svc_unsorted( svcdb=>'svc_external' );
die "cdr_termination package has no svc_external service"
unless @svc_external;
# eotermiation calculation
- $charges += $self->calc_recur_Common(@_);
+ $charges += ($cust_pkg->quantity || 1) * $self->calc_recur_Common(@_);
$charges;
}
-sub is_free {
- 0;
-}
+sub is_free { 0; }
+
+sub can_usageprice { 0; }
1;