[freeside-commits] freeside/FS/FS Record.pm, 1.203, 1.204 cdr.pm, 1.60, 1.61

Ivan,,, ivan at wavetail.420.am
Tue Jun 29 12:51:22 PDT 2010


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

Modified Files:
	Record.pm cdr.pm 
Log Message:
Taqua OM CDR format, RT#7518

Index: cdr.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/cdr.pm,v
retrieving revision 1.60
retrieving revision 1.61
diff -u -w -d -r1.60 -r1.61
--- cdr.pm	28 Jun 2010 08:12:01 -0000	1.60
+++ cdr.pm	29 Jun 2010 19:51:19 -0000	1.61
@@ -773,6 +773,9 @@
   } elsif ( $date  =~ /^\s*(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d+\.\d+)(\D|$)/ ) {
     # broadsoft: 20081223201938.314
     ($year, $mon, $day, $hour, $min, $sec) = ( $1, $2, $3, $4, $5, $6 );
+  } elsif ( $date  =~ /^\s*(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})\d+(\D|$)/ ) {
+    # Taqua OM:  20050422203450943
+    ($year, $mon, $day, $hour, $min, $sec) = ( $1, $2, $3, $4, $5, $6 );
   } elsif ( $date  =~ /^\s*(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})$/ ) {
     # WIP: 20100329121420
     ($year, $mon, $day, $hour, $min, $sec) = ( $1, $2, $3, $4, $5, $6 );
@@ -842,6 +845,10 @@
     { map { $_ => $cdr_info{$_}->{'fixedlength_format'}; }
           keys %cdr_info
     },
+
+  'format_row_callbacks' => { map { $_ => $cdr_info{$_}->{'row_callback'}; }
+                                  keys %cdr_info
+                            },
 );
 
 sub _import_options {

Index: Record.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/Record.pm,v
retrieving revision 1.203
retrieving revision 1.204
diff -u -w -d -r1.203 -r1.204
--- Record.pm	30 Mar 2010 03:28:14 -0000	1.203
+++ Record.pm	29 Jun 2010 19:51:19 -0000	1.204
@@ -1569,6 +1569,7 @@
     format_headers             => $opt->{format_headers},
     format_sep_chars           => $opt->{format_sep_chars},
     format_fixedlength_formats => $opt->{format_fixedlength_formats},
+    format_row_callbacks       => $opt->{format_row_callbacks},
     #per-import
     job                        => $job,
     file                       => $file,
@@ -1609,6 +1610,8 @@
 
 =item format_fixedlength_formats
 
+=item format_row_callbacks
+
 =item params
 
 =item job
@@ -1633,7 +1636,7 @@
   my $param = shift;
 
   warn "$me batch_import call with params: \n". Dumper($param)
-    if $DEBUG;
+  ;#  if $DEBUG;
 
   my $table   = $param->{table};
   my $formats = $param->{formats};
@@ -1674,6 +1677,11 @@
       ? $param->{'format_fixedlength_formats'}{ $param->{'format'} }
       : '';
 
+  my $row_callback =
+    $param->{'format_row_callbacks'}
+      ? $param->{'format_row_callbacks'}{ $param->{'format'} }
+      : '';
+
   my @fields = @{ $formats->{ $format } };
 
   my $row = 0;
@@ -1769,6 +1777,8 @@
 
       next if $line =~ /^\s*$/; #skip empty lines
 
+      $line = &{$row_callback}($line) if $row_callback;
+
       $parser->parse($line) or do {
         $dbh->rollback if $oldAutoCommit;
         return "can't parse: ". $parser->error_input();



More information about the freeside-commits mailing list