projects
/
freeside.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fix perf edge case with multiple large packages not just one, RT#26097
[freeside.git]
/
FS
/
FS
/
part_pkg
/
voip_cdr.pm
diff --git
a/FS/FS/part_pkg/voip_cdr.pm
b/FS/FS/part_pkg/voip_cdr.pm
index
4200f33
..
1a99bd7
100644
(file)
--- a/
FS/FS/part_pkg/voip_cdr.pm
+++ b/
FS/FS/part_pkg/voip_cdr.pm
@@
-61,6
+61,11
@@
tie my %detail_formats, 'Tie::IxHash',
FS::cdr::invoice_formats()
;
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)',
%info = (
'name' => 'VoIP rating by plan of CDR records in an internal (or external) SQL table',
'shortname' => 'VoIP/telco CDR rating (standard)',
@@
-211,6
+216,12
@@
tie my %detail_formats, 'Tie::IxHash',
'empty_label' => '',
},
'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:',
},
'skip_dst_length_less' => { 'name' => 'Do not charge for CDRs where the destination is less than this many digits:',
},
@@
-263,7
+274,7
@@
tie my %detail_formats, 'Tie::IxHash',
'type' => 'checkbox',
},
'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
'type' => 'checkbox',
},
#eofalse
@@
-330,7
+341,7
@@
tie my %detail_formats, 'Tie::IxHash',
skip_dcontext skip_dst_prefix
skip_dstchannel_prefix skip_src_length_more
noskip_src_length_accountcode_tollfree
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
skip_dst_length_less
noskip_dst_length_accountcode_tollfree
skip_lastapp
@@
-340,8
+351,8
@@
tie my %detail_formats, 'Tie::IxHash',
411_rewrite
output_format
selfservice_format selfservice_inbound_format
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
)
],
count_available_phones suspend_bill
)
],
@@
-611,9
+622,12
@@
sub calc_units {
my($self, $cust_pkg ) = @_;
my $count = 0;
if ( $self->option('count_available_phones', 1)) {
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);
} else {
$count =
scalar(grep { $_->part_svc->svcdb eq 'svc_phone' } $cust_pkg->cust_svc);