[freeside-commits] freeside/FS/FS cdr.pm,1.34,1.35

Ivan,,, ivan at wavetail.420.am
Tue Mar 31 21:27:27 PDT 2009


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

Modified Files:
	cdr.pm 
Log Message:
show post-granularity duration if available for all export formats

Index: cdr.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/cdr.pm,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -d -r1.34 -r1.35
--- cdr.pm	25 Mar 2009 08:45:21 -0000	1.34
+++ cdr.pm	1 Apr 2009 04:27:25 -0000	1.35
@@ -470,6 +470,15 @@
   },
 );
 
+my $duration_sub = sub {
+  my($cdr, %opt) = @_;
+  if ( $opt{minutes} ) {
+    $opt{minutes}. ( $opt{granularity} ? 'm' : ' call' );
+  } else {
+    sprintf('%.2fm', $cdr->billsec / 60 );
+  }
+};
+
 my %export_formats = (
   'convergent' => [
     'carriername', #CARRIER
@@ -491,7 +500,7 @@
     sub { time2str('%r', shift->calldate_unix ) },   #TIME
     'userfield',                                     #USER
     'dst',                                           #NUMBER_DIALED
-    sub { sprintf('%.2fm', shift->billsec / 60 ) },  #DURATION
+    $duration_sub,                                   #DURATION
     #sub { sprintf('%.3f', shift->upstream_price ) }, #PRICE
     sub { my($cdr, %opt) = @_; $opt{money_char}. $opt{charge}; }, #PRICE
   ],
@@ -501,7 +510,7 @@
     #'userfield',                                     #USER
     'dst',                                           #NUMBER_DIALED
     'src',                                           #called from
-    sub { sprintf('%.2fm', shift->billsec / 60 ) },  #DURATION
+    $duration_sub,                                   #DURATION
     #sub { sprintf('%.3f', shift->upstream_price ) }, #PRICE
     sub { my($cdr, %opt) = @_; $opt{money_char}. $opt{charge}; }, #PRICE
   ],
@@ -522,9 +531,7 @@
     sub { my($cdr, %opt) = @_; $opt{dst_regionname}; },
 
     #DURATION
-    sub { my($cdr, %opt) = @_;
-          $opt{minutes}. ( $opt{granularity} ? 'm' : ' call' );
-        },
+    $duration_sub,
 
     #PRICE
     sub { my($cdr, %opt) = @_; $opt{money_char}. $opt{charge}; },



More information about the freeside-commits mailing list