projects
/
freeside.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
move sql_external to use recur_Common, RT#7212
[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
f851b41
..
0c87581
100644
(file)
--- a/
FS/FS/part_pkg/voip_cdr.pm
+++ b/
FS/FS/part_pkg/voip_cdr.pm
@@
-163,12
+163,16
@@
tie my %granularity, 'Tie::IxHash', FS::rate_detail::granularities();
'default' => 'default', #XXX test
},
'default' => 'default', #XXX test
},
- 'usage_section' => { 'name' => 'Section in which to place
separate usage charges
',
+ 'usage_section' => { 'name' => 'Section in which to place
usage charges (whether separated or not)
',
},
'summarize_usage' => { 'name' => 'Include usage summary with recurring charges when usage is in separate section',
'type' => 'checkbox',
},
},
'summarize_usage' => { 'name' => 'Include usage summary with recurring charges when usage is in separate section',
'type' => 'checkbox',
},
+
+ 'usage_mandate' => { 'name' => 'Always put usage details in separate section',
+ 'type' => 'checkbox',
+ },
#eofalse
'bill_every_call' => { 'name' => 'Generate an invoice immediately for every call. Useful for prepaid.',
#eofalse
'bill_every_call' => { 'name' => 'Generate an invoice immediately for every call. Useful for prepaid.',
@@
-218,7
+222,7
@@
tie my %granularity, 'Tie::IxHash', FS::rate_detail::granularities();
skip_dst_length_less skip_lastapp
use_duration
411_rewrite
skip_dst_length_less skip_lastapp
use_duration
411_rewrite
- output_format summarize_usage usage_section
+ output_format
usage_mandate
summarize_usage usage_section
bill_every_call
count_available_phones
)
bill_every_call
count_available_phones
)
@@
-320,6
+324,8
@@
sub calc_usage {
my( $rate_region, $regionnum );
my $pretty_destnum;
my $charge = '';
my( $rate_region, $regionnum );
my $pretty_destnum;
my $charge = '';
+ my $seconds = '';
+ my $regionname = '';
my $classnum = '';
my @call_details = ();
if ( $rating_method eq 'prefix' ) {
my $classnum = '';
my @call_details = ();
if ( $rating_method eq 'prefix' ) {
@@
-405,6
+411,7
@@
sub calc_usage {
$rate_region = $rate_detail->dest_region;
$regionnum = $rate_region->regionnum;
$rate_region = $rate_detail->dest_region;
$regionnum = $rate_region->regionnum;
+ $regionname = $rate_region->regionname;
warn " found rate for regionnum $regionnum ".
"and rate detail $rate_detail\n"
if $DEBUG;
warn " found rate for regionnum $regionnum ".
"and rate detail $rate_detail\n"
if $DEBUG;
@@
-477,7
+484,7
@@
sub calc_usage {
: 60;
# length($cdr->billsec) ? $cdr->billsec : $cdr->duration;
: 60;
# length($cdr->billsec) ? $cdr->billsec : $cdr->duration;
-
my
$seconds = $use_duration ? $cdr->duration : $cdr->billsec;
+ $seconds = $use_duration ? $cdr->duration : $cdr->billsec;
$seconds += $granularity - ( $seconds % $granularity )
if $seconds # don't granular-ize 0 billsec calls (bills them)
$seconds += $granularity - ( $seconds % $granularity )
if $seconds # don't granular-ize 0 billsec calls (bills them)
@@
-526,7
+533,7
@@
sub calc_usage {
my $granularity = $rate_detail->sec_granularity;
# length($cdr->billsec) ? $cdr->billsec : $cdr->duration;
my $granularity = $rate_detail->sec_granularity;
# length($cdr->billsec) ? $cdr->billsec : $cdr->duration;
-
my
$seconds = $use_duration ? $cdr->duration : $cdr->billsec;
+ $seconds = $use_duration ? $cdr->duration : $cdr->billsec;
$seconds += $granularity - ( $seconds % $granularity )
if $seconds # don't granular-ize 0 billsec calls (bills them)
$seconds += $granularity - ( $seconds % $granularity )
if $seconds # don't granular-ize 0 billsec calls (bills them)
@@
-557,7
+564,7
@@
sub calc_usage {
'minutes' => $minutes,
'charge' => $charge,
'pretty_dst' => $pretty_destnum,
'minutes' => $minutes,
'charge' => $charge,
'pretty_dst' => $pretty_destnum,
- 'dst_regionname' => $r
ate_region->r
egionname,
+ 'dst_regionname' => $regionname,
)
);
)
);
@@
-573,11
+580,25
@@
sub calc_usage {
#if ( $self->option('rating_method') eq 'upstream_simple' ) {
if ( scalar(@call_details) == 1 ) {
$call_details =
#if ( $self->option('rating_method') eq 'upstream_simple' ) {
if ( scalar(@call_details) == 1 ) {
$call_details =
- [ 'C', $call_details[0], $charge, $classnum, $phonenum ];
+ [ 'C',
+ $call_details[0],
+ $charge,
+ $classnum,
+ $phonenum,
+ $seconds,
+ $regionname,
+ ];
} else { #only used for $rating_method eq 'upstream' now
$csv->combine(@call_details);
$call_details =
} else { #only used for $rating_method eq 'upstream' now
$csv->combine(@call_details);
$call_details =
- [ 'C', $csv->string, $charge, $classnum, $phonenum ];
+ [ 'C',
+ $csv->string,
+ $charge,
+ $classnum,
+ $phonenum,
+ $seconds,
+ $regionname,
+ ];
}
warn " adding details on charge to invoice: [ ".
join(', ', @{$call_details} ). " ]"
}
warn " adding details on charge to invoice: [ ".
join(', ', @{$call_details} ). " ]"
@@
-603,7
+624,14
@@
sub calc_usage {
} # $cust_svc
} # $cust_svc
- unshift @$details, [ 'C', FS::cdr::invoice_header($output_format) ]
+ unshift @$details, [ 'C',
+ FS::cdr::invoice_header($output_format),
+ '',
+ '',
+ '',
+ '',
+ '',
+ ]
if @$details && $rating_method ne 'upstream';
# if ( $spool_cdr && length($downstream_cdr) ) {
if @$details && $rating_method ne 'upstream';
# if ( $spool_cdr && length($downstream_cdr) ) {