projects
/
freeside.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
074a4f1
)
third time's a charm - fix a small bug and make more analogous to HEAD - RT#8605
author
jeff
<jeff>
Wed, 14 Jul 2010 00:17:51 +0000
(
00:17
+0000)
committer
jeff
<jeff>
Wed, 14 Jul 2010 00:17:51 +0000
(
00:17
+0000)
FS/FS/part_pkg/voip_cdr.pm
patch
|
blob
|
history
diff --git
a/FS/FS/part_pkg/voip_cdr.pm
b/FS/FS/part_pkg/voip_cdr.pm
index
24f9fc8
..
e2408a3
100644
(file)
--- a/
FS/FS/part_pkg/voip_cdr.pm
+++ b/
FS/FS/part_pkg/voip_cdr.pm
@@
-538,18
+538,18
@@
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 $charge_sec = $seconds =
- $use_duration ? $cdr->duration : $cdr->billsec;
+ my $charge_sec = $use_duration ? $cdr->duration : $cdr->billsec;
+ $seconds = ( $charge_sec <= $rate_detail->conn_sec ) # min()
+ ? $charge_sec
+ : $rate_detail->conn_sec;
$charge_sec -= $rate_detail->conn_sec;
$charge_sec = 0 if $charge_sec < 0;
$charge_sec -= $rate_detail->conn_sec;
$charge_sec = 0 if $charge_sec < 0;
- if ( $seconds && $granularity ) {
- # don't granular-ize 0 billsec calls (bills them)
- # 0 granularity is per call
- $seconds += $granularity - ( $seconds % $granularity );
- $charge_sec += $granularity - ( $charge_sec % $granularity );
- }
+ $charge_sec += $granularity - ( $charge_sec % $granularity )
+ if $charge_sec # don't granular-ize 0 billsec calls (bills them)
+ && $granularity; # 0 is per call
+ $seconds += $charge_sec;
my $minutes = sprintf("%.1f", $charge_sec / 60);
$minutes =~ s/\.0$// if $granularity == 60;
my $minutes = sprintf("%.1f", $charge_sec / 60);
$minutes =~ s/\.0$// if $granularity == 60;