[freeside-commits] branch FREESIDE_3_BRANCH updated. 7f5568b5d0b1f37b0a82f4a9809070a33381f8e8
Jeremy Davis
jeremyd at 420.am
Wed Aug 12 11:31:07 PDT 2015
The branch, FREESIDE_3_BRANCH has been updated
via 7f5568b5d0b1f37b0a82f4a9809070a33381f8e8 (commit)
from 56cfb20bc9c9771b66007fabe1e15cbaa153624c (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 7f5568b5d0b1f37b0a82f4a9809070a33381f8e8
Author: Jeremy Davis <jeremyd at freeside.biz>
Date: Wed Aug 12 14:28:27 2015 -0400
#31495 Date changes for Earthlink
diff --git a/FS/FS/cdr/earthlink.pm b/FS/FS/cdr/earthlink.pm
index 5042f6f..c6c4e15 100644
--- a/FS/FS/cdr/earthlink.pm
+++ b/FS/FS/cdr/earthlink.pm
@@ -3,11 +3,13 @@ package FS::cdr::earthlink;
use strict;
use vars qw( @ISA %info $date);
use Time::Local;
-use FS::cdr qw(_cdr_date_parser_maker _cdr_min_parser_maker);
+use FS::cdr qw(_cdr_min_parser_maker);
use Date::Parse;
@ISA = qw(FS::cdr);
+my ($tmp_mday, $tmp_mon, $tmp_year);
+
%info = (
'name' => 'Earthlink',
'weight' => 120,
@@ -15,14 +17,30 @@ use Date::Parse;
'import_fields' => [
skip(3), #Account number/ SERVICE LOC / BILL NUMBER
- sub { my($cdr, $date) = @_;
- $date;
- }, #date
+ sub { my($cdr, $date) = @_;
+ $date =~ /^(\d{1,2})\/(\d{1,2})\/(\d{4})$/
+ or die "unparseable date: $date";
+ ($tmp_mon, $tmp_mday, $tmp_year) = ($1, $2, $3);
+ }, #date
sub { my($cdr, $time) = @_;
+ $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;
+ $hour = 0 if $4 eq 'AM' && $hour == 12;
+
+ my $dt = DateTime->new(
+ year => $tmp_year,
+ month => $tmp_mon,
+ day => $tmp_mday,
+ hour => $hour,
+ minute => $2,
+ second => $3,
+ time_zone => 'local',
+ );
+ $cdr->set('startdate', $dt->epoch);
- my $datetime = $date. " ". $time;
- $cdr->set('startdate', $datetime );
- }, #time
+ },
skip(1), #TollFreeNumber
sub { my($cdr, $src) = @_;
$src =~ s/\D//g;
-----------------------------------------------------------------------
Summary of changes:
FS/FS/cdr/earthlink.pm | 32 +++++++++++++++++++++++++-------
1 file changed, 25 insertions(+), 7 deletions(-)
More information about the freeside-commits
mailing list