diff options
author | ivan <ivan> | 2008-08-02 23:52:37 +0000 |
---|---|---|
committer | ivan <ivan> | 2008-08-02 23:52:37 +0000 |
commit | 1a3a050131502579e0a8e9c05eee2355a2e7cc3b (patch) | |
tree | 65f06af88105d68367b0df097ca939413ead3c07 /FS/FS/cdr/simple2.pm | |
parent | efc68f41987d007de5e792b88df1c63bf3dedf4c (diff) |
fix 'Can't call method "parse" on an undefined value' error from CDR format refactor
Diffstat (limited to 'FS/FS/cdr/simple2.pm')
-rw-r--r-- | FS/FS/cdr/simple2.pm | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/FS/FS/cdr/simple2.pm b/FS/FS/cdr/simple2.pm new file mode 100644 index 0000000..a4b5fdb --- /dev/null +++ b/FS/FS/cdr/simple2.pm @@ -0,0 +1,51 @@ +package FS::cdr::simple2; + +use strict; +use vars qw( @ISA %info $tmp_mon $tmp_mday $tmp_year ); +use Time::Local; +use FS::cdr qw(_cdr_min_parser_maker); + +@ISA = qw(FS::cdr); + +%info = ( + 'name' => 'Simple (Prerated)', + 'weight' => 25, + 'header' => 1, + 'import_fields' => [ + sub {}, #TEXT_TIME (redundant w/Time) + sub {}, #Blank + 'src', #Calling. + + #Date (YY/MM/DD) + sub { my($cdr, $date) = @_; + $date =~ /^(\d\d(\d\d)?)\/(\d{1,2})\/(\d{1,2})$/ + or die "unparsable date: $date"; #maybe we shouldn't die... + #$cdr->startdate( timelocal(0, 0, 0 ,$3, $2-1, $1) ); + ($tmp_mday, $tmp_mon, $tmp_year) = ( $3, $2-1, $1 ); + }, + + #Time + sub { my($cdr, $time) = @_; + $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->startdate( + timelocal($3, $2, $1 ,$tmp_mday, $tmp_mon, $tmp_year) + ); + }, + + 'dst', #Dest + 'userfield', #? #DestinationDesc + + #Min + _cdr_min_parser_maker, #( [qw( billsec duration)] ), + + sub {}, #Rate XXX do something w/this, informationally??? + 'upstream_price', #Total + + 'accountcode', #ServCode + 'description', #Service_Type + ], +); + + |