projects
/
freeside.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
RT# 81249 - added ability to validate price plan option fields
[freeside.git]
/
FS
/
FS
/
part_pkg
/
voip_inbound.pm
diff --git
a/FS/FS/part_pkg/voip_inbound.pm
b/FS/FS/part_pkg/voip_inbound.pm
index
373701e
..
22ca796
100644
(file)
--- a/
FS/FS/part_pkg/voip_inbound.pm
+++ b/
FS/FS/part_pkg/voip_inbound.pm
@@
-64,9
+64,13
@@
tie my %granularity, 'Tie::IxHash', FS::rate_detail::granularities();
},
'use_cdrtypenum' => { 'name' => 'Only charge for CDRs where the CDR Type is set to this cdrtypenum: ',
},
'use_cdrtypenum' => { 'name' => 'Only charge for CDRs where the CDR Type is set to this cdrtypenum: ',
+ 'validate' => \&FS::part_pkg::validate_number,
+ 'js_validate' => 'digits',
},
'ignore_cdrtypenum' => { 'name' => 'Do not charge for CDRs where the CDR Type is set to this cdrtypenum: ',
},
'ignore_cdrtypenum' => { 'name' => 'Do not charge for CDRs where the CDR Type is set to this cdrtypenum: ',
+ 'validate' => \&FS::part_pkg::validate_number,
+ 'js_validate' => 'digits',
},
'use_calltypenum' => { 'name' => 'Only charge for CDRs where the CDR Call Type is set to this cdrtypenum: ',
},
'use_calltypenum' => { 'name' => 'Only charge for CDRs where the CDR Call Type is set to this cdrtypenum: ',
@@
-120,6
+124,10
@@
tie my %granularity, 'Tie::IxHash', FS::rate_detail::granularities();
'type' => 'checkbox',
},
'type' => 'checkbox',
},
+ 'bill_only_pkg_dates' => { 'name' => 'Only bill CDRs with a date during the package billing period',
+ 'type' => 'checkbox',
+ },
+
#XXX also have option for an external db
# 'cdr_location' => { 'name' => 'CDR database location'
# 'type' => 'select',
#XXX also have option for an external db
# 'cdr_location' => { 'name' => 'CDR database location'
# 'type' => 'select',
@@
-160,6
+168,7
@@
tie my %granularity, 'Tie::IxHash', FS::rate_detail::granularities();
use_duration
output_format usage_mandate summarize_usage usage_section
bill_every_call
use_duration
output_format usage_mandate summarize_usage usage_section
bill_every_call
+ bill_only_pkg_dates
)
],
'weight' => 42,
)
],
'weight' => 42,
@@
-214,6
+223,7
@@
sub calc_usage {
# my $downstream_cdr = '';
my $included_min = $self->option('min_included', 1) || 0;
# my $downstream_cdr = '';
my $included_min = $self->option('min_included', 1) || 0;
+ $included_min *= ($cust_pkg->quantity || 1);
my $use_duration = $self->option('use_duration');
my $output_format = $self->option('output_format', 1) || 'default';
my $use_duration = $self->option('use_duration');
my $output_format = $self->option('output_format', 1) || 'default';
@@
-238,12
+248,18
@@
sub calc_usage {
) {
my $svc_phone = $cust_svc->svc_x;
) {
my $svc_phone = $cust_svc->svc_x;
- my
$cdr_search = $svc_phone->psearch_cdrs
(
+ my
%options =
(
'inbound' => 1,
'default_prefix' => $self->option('default_prefix'),
'status' => '', # unprocessed only
'for_update' => 1,
);
'inbound' => 1,
'default_prefix' => $self->option('default_prefix'),
'status' => '', # unprocessed only
'for_update' => 1,
);
+ if ( $self->option('bill_only_pkg_dates') ) {
+ $options{'begin'} = $last_bill;
+ $options{'end'} = $$sdate;
+ }
+
+ my $cdr_search = $svc_phone->psearch_cdrs(%options);
$cdr_search->limit(1000);
$cdr_search->increment(0);
while ( my $cdr = $cdr_search->fetch ) {
$cdr_search->limit(1000);
$cdr_search->increment(0);
while ( my $cdr = $cdr_search->fetch ) {
@@
-291,10
+307,7
@@
sub calc_usage {
my @call_details = (
$cdr->downstream_csv( 'format' => $output_format,
'charge' => $charge,
my @call_details = (
$cdr->downstream_csv( 'format' => $output_format,
'charge' => $charge,
- 'seconds' => ($use_duration
- ? $cdr->duration
- : $cdr->billsec
- ),
+ 'seconds' => $seconds,
'granularity' => $granularity,
)
);
'granularity' => $granularity,
)
);
@@
-316,10
+329,10
@@
sub calc_usage {
'done',
$charge,
$cust_svc->svcnum,
'done',
$charge,
$cust_svc->svcnum,
- 'rated_seconds' => $
use_duration ? $cdr->duration : $cdr->billsec
,
+ 'rated_seconds' => $
seconds
,
'rated_granularity' => $granularity,
'rated_classnum' => $cdr->calltypenum,
'rated_granularity' => $granularity,
'rated_classnum' => $cdr->calltypenum,
- 'inbound' => 1,
+ 'inbound' => 1,
# to update cdr_termination, not cdr
);
die $error if $error;
$formatter->append($cdr);
);
die $error if $error;
$formatter->append($cdr);