[freeside-commits] freeside/FS/FS/part_pkg voip_cdr.pm,1.92,1.93
Jeff Finucane,420,,
jeff at wavetail.420.am
Tue Jul 13 17:19:45 PDT 2010
Update of /home/cvs/cvsroot/freeside/FS/FS/part_pkg
In directory wavetail.420.am:/tmp/cvs-serv21071
Modified Files:
voip_cdr.pm
Log Message:
include rate_detail->conn_sec in displayed duration #RT8605
Index: voip_cdr.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/part_pkg/voip_cdr.pm,v
retrieving revision 1.92
retrieving revision 1.93
diff -u -w -d -r1.92 -r1.93
--- voip_cdr.pm 13 Jul 2010 22:55:07 -0000 1.92
+++ voip_cdr.pm 14 Jul 2010 00:19:43 -0000 1.93
@@ -609,6 +609,7 @@
$charge = sprintf("%.02f", $rate_detail->conn_charge);
my $total_minutes = 0;
+ my $whole_minutes = 1;
my $etime;
while($seconds_left) {
my $ratetimenum = $rate_detail->ratetimenum; # may be empty
@@ -647,12 +648,12 @@
my $charge_sec = min($seconds_left, $etime - $weektime);
$seconds_left -= $charge_sec;
- $seconds += $charge_sec;
$included_min{$regionnum}{$ratetimenum} = $rate_detail->min_included
unless exists $included_min{$regionnum}{$ratetimenum};
my $granularity = $rate_detail->sec_granularity;
+ $whole_minutes = 0 if $granularity;
# should this be done in every rate interval?
$charge_sec += $granularity - ( $charge_sec % $granularity )
@@ -661,6 +662,8 @@
my $minutes = sprintf("%.1f", $charge_sec / 60);
$minutes =~ s/\.0$// if $granularity == 60;
+ $seconds += $charge_sec;
+
# per call rather than per minute
$minutes = 1 unless $granularity;
$seconds_left = 0 unless $granularity;
@@ -673,7 +676,6 @@
$included_min{$regionnum}{$ratetimenum} = 0;
$charge += sprintf('%.2f', ($rate_detail->min_charge * $charge_min)
+ 0.00000001 ); #so 1.005 rounds to 1.01
- $total_minutes += $minutes;
}
# choose next rate_detail
@@ -688,6 +690,9 @@
# this is why we need regionnum/rate_region....
warn " (rate region $rate_region)\n" if $DEBUG;
+ $total_minutes = sprintf("%.1f", $seconds / 60);
+ $total_minutes =~ s/\.0$// if $whole_minutes;
+
$classnum = $rate_detail->classnum;
$charge = sprintf('%.2f', $charge);
@@ -695,6 +700,10 @@
$cdr->downstream_csv( 'format' => $output_format,
'granularity' => $rate_detail->sec_granularity,
'minutes' => $total_minutes,
+ # why do we go through this hocus-pocus?
+ # the cdr *will* show duration here
+ # if we forego the 'minutes' key
+ # duration vs billsec?
'charge' => $charge,
'pretty_dst' => $pretty_destnum,
'dst_regionname' => $regionname,
More information about the freeside-commits
mailing list