[freeside-commits] freeside/FS/FS cdr.pm, 1.5.2.2, 1.5.2.3 cust_bill_pkg.pm, 1.12.2.3, 1.12.2.4

Jeff Finucane,420,, jeff at wavetail.420.am
Wed Jun 4 10:57:51 PDT 2008


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

Modified Files:
      Tag: FREESIDE_1_7_BRANCH
	cdr.pm cust_bill_pkg.pm 
Log Message:
voxline invoice formatting

Index: cdr.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/cdr.pm,v
retrieving revision 1.5.2.2
retrieving revision 1.5.2.3
diff -u -d -r1.5.2.2 -r1.5.2.3
--- cdr.pm	19 May 2008 04:07:41 -0000	1.5.2.2
+++ cdr.pm	4 Jun 2008 17:57:40 -0000	1.5.2.3
@@ -392,6 +392,18 @@
 
 =cut
 
+my %export_names = (
+  'convergent'      => {},
+  'voxlinesystems'  => { 'name'           => 'VoxLineSystems',
+                         'invoice_header' =>
+                           "Date,Time,Name,Destination,Duration,Price",
+                       },
+  'voxlinesystems2' => { 'name'           => 'VoxLineSystems with source',
+                         'invoice_header' =>
+                           "Date,Time,Name,Destination,Called From,Duration,Price",
+                       },
+);
+
 my %export_formats = (
   'convergent' => [
     'carriername', #CARRIER
@@ -416,6 +428,15 @@
     sub { sprintf('%.2fm', shift->billsec / 60 ) },  #DURATION
     sub { sprintf('%.3f', shift->upstream_price ) }, #PRICE
   ],
+  'voxlinesystems2' => [
+    sub { time2str('%D', shift->calldate_unix ) },   #DATE
+    sub { time2str('%T', shift->calldate_unix ) },   #TIME
+    'userfield',                                     #USER
+    'dst',                                           #NUMBER_DIALED
+    'src',                                           #called from
+    sub { sprintf('%.2fm', shift->billsec / 60 ) },  #DURATION
+    sub { sprintf('%.3f', shift->upstream_price ) }, #PRICE
+  ],
 );
 
 sub downstream_csv {
@@ -448,6 +469,30 @@
 
 =over 4
 
+=item invoice_formats
+
+Returns an ordered list of key value pairs containing invoice format names
+as keys (for use with part_pkg::voip_cdr) and "pretty" format names as values.
+
+=cut
+
+sub invoice_formats {
+  map { ($_ => $export_names{$_}->{'name'}) }
+    grep { $export_names{$_}->{'invoice_header'} }
+    keys %export_names;
+}
+
+=item invoice_header FORMAT
+
+Returns a scalar containing the CSV column header for invoice format FORMAT.
+
+=cut
+
+sub invoice_header {
+  my $format = shift;
+  $export_names{$format}->{'invoice_header'};
+}
+
 =item import_formats
 
 Returns an ordered list of key value pairs containing import format names

Index: cust_bill_pkg.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/cust_bill_pkg.pm,v
retrieving revision 1.12.2.3
retrieving revision 1.12.2.4
diff -u -d -r1.12.2.3 -r1.12.2.4
--- cust_bill_pkg.pm	3 Jun 2008 21:06:33 -0000	1.12.2.3
+++ cust_bill_pkg.pm	4 Jun 2008 17:57:43 -0000	1.12.2.4
@@ -251,8 +251,21 @@
 
   $format_sub = sub { my $detail = shift;
                       $csv->parse($detail) or return "can't parse $detail";
-                      join(' & ', map { '\small{'. &$escape_function($_). '}' }
-                                  $csv->fields );
+                      #join(' & ', map { '\small{'. &$escape_function($_). '}' }
+                      #            $csv->fields );
+                      my $result = '';
+                      my $column = 1;
+                      foreach ($csv->fields) {
+                        $result .= ' & ' if $column > 1;
+                        if ($column > 6) {                     # KLUDGE ALERT!
+                          $result .= '\multicolumn{1}{l}{\small{'.
+                                     &$escape_function($_). '}}';
+                        }else{
+                          $result .= '\small{'.  &$escape_function($_). '}';
+                        }
+                        $column++;
+                      }
+                      $result;
                     }
     if $format eq 'latex';
 



More information about the freeside-commits mailing list