fix TeleAPI import (what kind of crack was Christopher smoking that he couldn't fix...
[freeside.git] / FS / FS / cdr / bell_west.pm
index 9608513..f745bb1 100644 (file)
@@ -4,13 +4,13 @@ use strict;
 use base qw( FS::cdr );
 use vars qw( %info $tmp_mon $tmp_mday $tmp_year );
 use Time::Local;
-use FS::cdr qw( _cdr_date_parser_maker _cdr_min_parser_maker );
+#use FS::cdr qw( _cdr_date_parser_maker _cdr_min_parser_maker );
 
 %info = (
   'name'          => 'Bell West',
   'weight'        => 210,
-  'header'        => 1,     #0 default, set to 1 to ignore the first line
-  'type'          => 'xls', #csv (default), fixedlength or xls
+  'header'        => 1,
+  'type'          => 'xls',
 
   'import_fields' => [
 
@@ -23,11 +23,13 @@ use FS::cdr qw( _cdr_date_parser_maker _cdr_min_parser_maker );
     sub {},
 
     # DATE / Yes / "DATE"   Excel date format MM/DD/YYYY
+    # XXX false laziness w/troop.pm
     sub { my($cdr, $date) = @_;
-          $date =~ /^(\d{1,2})\/(\d{1,2})\/(\d\d(\d\d)?)$/
-            or die "unparsable date: $date"; #maybe we shouldn't die...
-          #$cdr->startdate( timelocal(0, 0, 0 ,$2, $1-1, $3) );
-          ($tmp_mday, $tmp_mon, $tmp_year) = ( $2, $1-1, $3 );
+
+          my $datetime = DateTime::Format::Excel->parse_datetime( $date );
+          $tmp_mon  = $datetime->mon_0;
+          $tmp_mday = $datetime->mday;
+          $tmp_year = $datetime->year;
         },
 
     # CUST NO / Yes / "TIME"    "075959" Text based time
@@ -35,7 +37,7 @@ use FS::cdr qw( _cdr_date_parser_maker _cdr_min_parser_maker );
     #       is wrong
     sub { my($cdr, $time) = @_;
           #my($sec, $min, $hour, $mday, $mon, $year)= localtime($cdr->startdate);
-          $time =~ /^(\d{1,2}):(\d{1,2}):(\d{1,2})$/
+          $time =~ /^(\d{2})(\d{2})(\d{2})$/
             or die "unparsable time: $time"; #maybe we shouldn't die...
           #$cdr->startdate( timelocal($3, $2, $1 ,$mday, $mon, $year) );
           $cdr->startdate(
@@ -43,22 +45,24 @@ use FS::cdr qw( _cdr_date_parser_maker _cdr_min_parser_maker );
           );
         },
 
-    # BTN / Yes / Main billing number but not DID or real number (I guess put in SRC field)
+    # BTN / Yes / Main billing number but not DID or real number
+    # (put in SRC field)
     'src',
 
     # ORIG CITY / No / We will use your Freeside rating and description name
     'channel',
 
-    # TERM / YES / All calls should be billed, however all calls are missing "1+" and "011+" & DIR ASST = "411"
+    # TERM / YES / All calls should be billed, however all calls are
+    #              missing "1+" and "011+" & DIR ASST = "411"
     'dst',
 
     # TERM CITY / No / We will use your Freeside rating and description name
     'dstchannel',
 
-    # WTN / Yes / Bill to number (I guess put in "charged_party")
+    # WTN / Yes / Bill to number (put in "charged_party")
     'charged_party',
 
-    # CODE / Yes / Account Code (security) and we need on invoice (suggestions ?)
+    # CODE / Yes / Account Code (security) and we need on invoice
     'accountcode',
 
     # PROV/COUNTRY / No / We will use your Freeside rating and description name
@@ -68,7 +72,8 @@ use FS::cdr qw( _cdr_date_parser_maker _cdr_min_parser_maker );
           $cdr->dst( $pre. $cdr->dst ) unless $cdr->dst =~ /^$pre/;
         },
 
-    # CALL TYPE / Possibly / Not sure if you need this to determine correct billing method ?
+    # CALL TYPE / Possibly / Not sure if you need this to determine correct
+    #                        billing method ?
     # DDD normal call (Direct Dial Dsomething? ="LD"?)
     # TF  Toll Free
     #     (toll free dst# should be sufficient to rate)