projects
/
freeside.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fix sansay CDR import to ignore "NA" in dates, RT#5495
[freeside.git]
/
FS
/
FS
/
cdr.pm
diff --git
a/FS/FS/cdr.pm
b/FS/FS/cdr.pm
index
96132ec
..
723123a
100644
(file)
--- a/
FS/FS/cdr.pm
+++ b/
FS/FS/cdr.pm
@@
-752,6
+752,12
@@
sub _cdr_date_parse {
my %options = @_;
return '' unless length($date); #that's okay, it becomes NULL
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);
my($year, $mon, $day, $hour, $min, $sec);
@@
-766,8
+772,8
@@
sub _cdr_date_parse {
die "unparsable date: $date"; #maybe we shouldn't die...
}
die "unparsable date: $date"; #maybe we shouldn't die...
}
- return '' if
$year == 1900
&& $mon == 1 && $day == 1
- && $hour == 0
&& $min == 0 && $sec == 0;
+ return '' if
( $year == 1900 || $year == 1970 )
&& $mon == 1 && $day == 1
+ && $hour == 0 && $min == 0 && $sec == 0;
if ($options{gmt}) {
timegm($sec, $min, $hour, $day, $mon-1, $year);
if ($options{gmt}) {
timegm($sec, $min, $hour, $day, $mon-1, $year);