fix sansay CDR import to ignore "NA" in dates, RT#5495
[freeside.git] / FS / FS / cdr.pm
index 418519e..723123a 100644 (file)
@@ -752,6 +752,12 @@ sub _cdr_date_parse {
   my %options = @_;
 
   return '' unless length($date); #that's okay, it becomes NULL
+  return '' if $date eq 'NA'; #sansay
+
+  if ( $date =~ /^([a-z]{3})\s+([a-z]{3})\s+(\d{1,2})\s+(\d{1,2}):(\d{1,2}):(\d{1,2})\s+(\d{4})$/i && $7 > 1970 ) {
+    my $time = str2time($date);
+    return $time if $time > 100000; #just in case
+  }
 
   my($year, $mon, $day, $hour, $min, $sec);