summaryrefslogtreecommitdiff
path: root/FS/FS/cdr/cia_callblast.pm
diff options
context:
space:
mode:
authorJeremy Davis <jeremyd@freeside.biz>2015-02-11 12:14:34 -0500
committerJeremy Davis <jeremyd@freeside.biz>2015-02-11 12:14:34 -0500
commitff9eaa5810c2ddb8688ae573b372d760679272ed (patch)
tree56732ba267371614203ac6dda11fa1ec17365f23 /FS/FS/cdr/cia_callblast.pm
parent73d97ad71884ce66b435f0e8d85e5bf99cda3712 (diff)
Ticket #33144 New format, not a change to the existing one
Diffstat (limited to 'FS/FS/cdr/cia_callblast.pm')
-rw-r--r--FS/FS/cdr/cia_callblast.pm54
1 files changed, 54 insertions, 0 deletions
diff --git a/FS/FS/cdr/cia_callblast.pm b/FS/FS/cdr/cia_callblast.pm
new file mode 100644
index 0000000..d59cd78
--- /dev/null
+++ b/FS/FS/cdr/cia_callblast.pm
@@ -0,0 +1,54 @@
+package FS::cdr::cia_callblast;
+
+use strict;
+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);
+
+%info = (
+ 'name' => 'Client Instant Access Callblast',
+ 'weight' => 510,
+ 'header' => 1,
+ 'type' => 'csv',
+ 'sep_char' => "|",
+ 'import_fields' => [
+ '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
+ ],
+
+);
+
+sub skip { map {''} (1..$_[0]) }
+
+1;