[freeside-commits] freeside/FS/FS/part_pkg voip_cdr.pm, 1.79.2.8, 1.79.2.9

Jeff Finucane,420,, jeff at wavetail.420.am
Tue Jul 13 16:06:12 PDT 2010


Update of /home/cvs/cvsroot/freeside/FS/FS/part_pkg
In directory wavetail.420.am:/tmp/cvs-serv15520

Modified Files:
      Tag: FREESIDE_1_9_BRANCH
	voip_cdr.pm 
Log Message:
without screwing up usage summaries RT#8605

Index: voip_cdr.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/part_pkg/voip_cdr.pm,v
retrieving revision 1.79.2.8
retrieving revision 1.79.2.9
diff -u -w -d -r1.79.2.8 -r1.79.2.9
--- voip_cdr.pm	13 Jul 2010 20:32:20 -0000	1.79.2.8
+++ voip_cdr.pm	13 Jul 2010 23:06:10 -0000	1.79.2.9
@@ -538,19 +538,24 @@
           my $granularity = $rate_detail->sec_granularity;
 
                       # length($cdr->billsec) ? $cdr->billsec : $cdr->duration;
-          $seconds = $use_duration ? $cdr->duration : $cdr->billsec;
+          my $charge_sec = $seconds =
+            $use_duration ? $cdr->duration : $cdr->billsec;
 
-          $seconds -= $rate_detail->conn_sec;
-          $seconds = 0 if $seconds < 0;
+          $charge_sec -= $rate_detail->conn_sec;
+          $charge_sec = 0 if $charge_sec < 0;
 
-          $seconds += $granularity - ( $seconds % $granularity )
-            if $seconds      # don't granular-ize 0 billsec calls (bills them)
-            && $granularity; # 0 is per call
-          my $minutes = sprintf("%.1f", $seconds / 60);
+          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 );
+          }
+
+          my $minutes = sprintf("%.1f", $charge_sec / 60);
           $minutes =~ s/\.0$// if $granularity == 60;
 
           my $duration_minutes =  #for invoice display purposes
-            sprintf("%.1f", ($seconds + $rate_detail->conn_sec)/ 60);
+            sprintf("%.1f", $seconds / 60);
           $duration_minutes =~ s/\.0$// if $granularity == 60;
 
           # per call rather than per minute



More information about the freeside-commits mailing list