[freeside-commits] freeside/FS/FS cdr.pm,1.38,1.39
Jeff Finucane,420,,
jeff at wavetail.420.am
Tue Apr 7 13:45:16 PDT 2009
Update of /home/cvs/cvsroot/freeside/FS/FS
In directory wavetail.420.am:/tmp/cvs-serv27890/FS/FS
Modified Files:
cdr.pm
Log Message:
quick option to allow importing gmt cdrs
Index: cdr.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/cdr.pm,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -d -r1.38 -r1.39
--- cdr.pm 7 Apr 2009 02:50:46 -0000 1.38
+++ cdr.pm 7 Apr 2009 20:45:14 -0000 1.39
@@ -681,10 +681,11 @@
sub _cdr_date_parser_maker {
my $field = shift;
+ my %options = @_;
my @fields = ref($field) ? @$field : ($field);
return sub {
my( $cdr, $datestring ) = @_;
- my $unixdate = eval { _cdr_date_parse($datestring) };
+ my $unixdate = eval { _cdr_date_parse($datestring, %options) };
die "error parsing date for @fields from $datestring: $@\n" if $@;
$cdr->$_($unixdate) foreach @fields;
};
@@ -692,6 +693,7 @@
sub _cdr_date_parse {
my $date = shift;
+ my %options = @_;
return '' unless length($date); #that's okay, it becomes NULL
@@ -711,7 +713,11 @@
return '' if $year == 1900 && $mon == 1 && $day == 1
&& $hour == 0 && $min == 0 && $sec == 0;
- timelocal($sec, $min, $hour, $day, $mon-1, $year);
+ if ($options{gmt}) {
+ timegm($sec, $min, $hour, $day, $mon-1, $year);
+ } else {
+ timelocal($sec, $min, $hour, $day, $mon-1, $year);
+ }
}
=item batch_import HASHREF
More information about the freeside-commits
mailing list