fix TeleAPI import (what kind of crack was Christopher smoking that he couldn't fix...
[freeside.git] / FS / FS / cdr / freeside_description_default.pm
index bc4e89f..fd91530 100644 (file)
@@ -10,6 +10,7 @@ use FS::cdr;
 %info = (
   'name'          => 'Freeside default with description field as destination',
   'weight'        => 25,
+  'type'          => 'csv',
   'header'        => 1,
   'import_fields' => [
     'charged_party',     # Billed number
@@ -27,7 +28,8 @@ use FS::cdr;
           $time =~ /^(\d{1,2}):(\d{1,2}):(\d{1,2}) (AM|PM)$/
             or die "unparsable time: $time"; #maybe we shouldn't die...
           my $hour = $1;
-          $hour += 12 if $4 eq 'PM';
+          $hour += 12 if $4 eq 'PM' && $hour != 12;
+          $hour = 0 if $4 eq 'AM' && $hour == 12;
           $cdr->startdate(
             timelocal($3, $2, $hour ,$tmp_mday, $tmp_mon, $tmp_year)
           );
@@ -36,9 +38,9 @@ use FS::cdr;
     # Number
     sub {
         my($cdr, $number) = @_;
-        $number =~ /(\d+)$/ 
+        $number =~ /(\+|)(\d+)\s([\d\*]+)$/ 
             or die "unparsable number: $number"; #maybe we shouldn't die...
-        $cdr->dst($1);
+        $cdr->dst("$1$2$3");
     },           
 
     'description',      # Destination (regionname)
@@ -46,7 +48,7 @@ use FS::cdr;
     # Duration
     sub {
         my($cdr, $duration) = @_;
-        $duration =~ /^(\d{1,2})m (\d{1,2})s$/
+        $duration =~ /^(\d{1,3})m (\d{1,2})s$/
             or die "unparsable duration: $duration"; #maybe we shouldn't die...
         my $sec = $1*60 + $2;
         $cdr->duration($sec);