summaryrefslogtreecommitdiff
path: root/FS/FS/cdr
diff options
context:
space:
mode:
authorJeremy Davis <jeremyd@freeside.biz>2015-01-25 17:16:21 -0500
committerJeremy Davis <jeremyd@freeside.biz>2015-01-25 17:16:21 -0500
commit4b251740b79cf9d711c126fed0d611ed9fd1ecf5 (patch)
tree0334d610ef52e6bad458ba2167e0bf6c2a1297ad /FS/FS/cdr
parent3ece1c396f23e04cd659f1085f6eeee8bdfd846f (diff)
Ticket #33144 changes to cia cdr fromat
Diffstat (limited to 'FS/FS/cdr')
-rw-r--r--FS/FS/cdr/cia.pm54
1 files changed, 34 insertions, 20 deletions
diff --git a/FS/FS/cdr/cia.pm b/FS/FS/cdr/cia.pm
index ca44c0f..0471e9b 100644
--- a/FS/FS/cdr/cia.pm
+++ b/FS/FS/cdr/cia.pm
@@ -1,8 +1,9 @@
package FS::cdr::cia;
use strict;
-use vars qw( @ISA %info );
+use vars qw( @ISA %info $date $tmp_mday $tmp_mon $tmp_year);
use FS::cdr qw(_cdr_date_parser_maker);
+use Time::Local;
@ISA = qw(FS::cdr);
@@ -11,26 +12,39 @@ use FS::cdr qw(_cdr_date_parser_maker);
'weight' => 510,
'header' => 1,
'type' => 'csv',
- 'sep_char' => "\t",
+ 'sep_char' => "|",
'import_fields' => [
- skip(2), # Reseller Account Number, Confirmation Number
- 'description', # Conference Name
- skip(3), # Organization Name, Bill Code, Q&A Active
- 'userfield', # Chairperson Name
- skip(2), # Conference Start Time, Conference End Time
- _cdr_date_parser_maker('startdate'), # Connect Time
- _cdr_date_parser_maker('enddate'), # Disconnect Time
- skip(1), # Duration
- sub { my($cdr, $data, $conf, $param) = @_;
- $cdr->duration($data);
- $cdr->billsec( $data);
- }, # Roundup Duration
- skip(1), # User Name
- 'dst', # DNIS
- 'src', # ANI
- skip(2), # Call Type, Toll Free,
- 'accountcode', # Chair Conference Entry Code
- skip(1), # Participant Conference Entry Code,
+ 'accountcode',
+ skip(2), # First and last name
+
+ sub { my($cdr, $date) = @_;
+ $date =~ /^(\d{1,2})\/(\d{1,2})\/(\d\d(\d\d)?)$/
+ or die "unparsable date: $date"; #maybe we shouldn't die...
+ ($tmp_mday, $tmp_mon, $tmp_year) = ( $2, $1-1, $3 );
+ }, #Date
+
+ sub { my($cdr, $time) = @_;
+ #my($sec, $min, $hour, $mday, $mon, $year)= localtime($cdr->startdate);
+ $time =~ /^(\d{1,2}):(\d{1,2}):(\d{1,2})$/
+ or die "unparsable time: $time"; #maybe we shouldn't die...
+ $cdr->startdate( timelocal($3, $2, $1 ,$tmp_mday, $tmp_mon, $tmp_year));
+ $cdr->answerdate( timelocal($3, $2, $1 ,$tmp_mday, $tmp_mon, $tmp_year));
+
+ }, # Start time
+
+ sub { my($cdr, $time) = @_;
+ #my($sec, $min, $hour, $mday, $mon, $year)= localtime($cdr->startdate);
+ $time =~ /^(\d{1,2}):(\d{1,2}):(\d{1,2})$/
+ or die "unparsable time: $time"; #maybe we shouldn't die...
+ #$cdr->startdate( timelocal($3, $2, $1 ,$mday, $mon, $year) );
+ $cdr->enddate(
+ timelocal($3, $2, $1 ,$tmp_mday, $tmp_mon, $tmp_year) );
+ }, # End time
+
+ 'disposition', # Disposition
+ 'dst', # PhoneNumber
+ skip(3), # Extension, Service Type, Filler
+ 'src', # ClientContactID
],
);