FS::cdr::invoice_formats()
;
+tie my %accountcode_tollfree_field, 'Tie::IxHash',
+ 'dst' => 'Destination (dst)',
+ 'src' => 'Source (src)',
+;
+
%info = (
'name' => 'VoIP rating by plan of CDR records in an internal (or external) SQL table',
'shortname' => 'VoIP/telco CDR rating (standard)',
'empty_label' => '',
},
+ 'accountcode_tollfree_field' => {
+ 'name' => 'When using an alternate rate plan for toll-free accountcodes, the CDR field to use in rating calculations',
+ 'type' => 'select',
+ 'select_options' => \%accountcode_tollfree_field,
+ },
+
'skip_dst_length_less' => { 'name' => 'Do not charge for CDRs where the destination is less than this many digits:',
},
'type' => 'checkbox',
},
- 'usage_mandate' => { 'name' => 'Always put usage details in separate section',
+ 'usage_mandate' => { 'name' => 'Always put usage details in separate section. The section is defined in the next option.',
'type' => 'checkbox',
},
#eofalse
skip_dcontext skip_dst_prefix
skip_dstchannel_prefix skip_src_length_more
noskip_src_length_accountcode_tollfree
- accountcode_tollfree_ratenum
+ accountcode_tollfree_ratenum accountcode_tollfree_field
skip_dst_length_less
noskip_dst_length_accountcode_tollfree
skip_lastapp
411_rewrite
output_format
selfservice_format selfservice_inbound_format
- usage_mandate summarize_usage usage_section
- bill_every_call bill_inactive_svcs
+ usage_mandate usage_section summarize_usage
+ usage_nozero bill_every_call bill_inactive_svcs
count_available_phones suspend_bill
)
],
my($self, $cust_pkg ) = @_;
my $count = 0;
if ( $self->option('count_available_phones', 1)) {
- map { $count += ( $_->quantity || 0 ) }
- grep { $_->part_svc->svcdb eq 'svc_phone' }
- $cust_pkg->part_pkg->pkg_svc;
+ foreach my $pkg_svc ($cust_pkg->part_pkg->pkg_svc) {
+ if ($pkg_svc->part_svc->svcdb eq 'svc_phone') { # svc_pbx?
+ $count += $pkg_svc->quantity || 0;
+ }
+ }
+ $count *= $cust_pkg->quantity;
} else {
$count =
scalar(grep { $_->part_svc->svcdb eq 'svc_phone' } $cust_pkg->cust_svc);