fix TeleAPI import (what kind of crack was Christopher smoking that he couldn't fix...
[freeside.git] / FS / FS / cdr / simple2.pm
1 package FS::cdr::simple2;
2
3 use strict;
4 use vars qw( @ISA %info $tmp_mon $tmp_mday $tmp_year );
5 use Time::Local;
6 use FS::cdr qw(_cdr_min_parser_maker);
7
8 @ISA = qw(FS::cdr);
9
10 %info = (
11   'name'          => 'Simple (Prerated)',
12   'weight'        => 25,
13   'header'        => 1,
14   'import_fields' => [
15     sub {},           #TEXT_TIME (redundant w/Time)
16     sub {},           #Blank
17     'src',            #Calling.
18
19     #Date (YY/MM/DD)
20     sub { my($cdr, $date) = @_;
21           $date =~ /^(\d\d(\d\d)?)\/(\d{1,2})\/(\d{1,2})$/
22             or die "unparsable date: $date"; #maybe we shouldn't die...
23           #$cdr->startdate( timelocal(0, 0, 0 ,$3, $2-1, $1) );
24           ($tmp_mday, $tmp_mon, $tmp_year) = ( $4, $3-1, $1 );
25         },
26
27     #Time
28     sub { my($cdr, $time) = @_;
29           $time =~ /^(\d{1,2}):(\d{1,2}):(\d{1,2})$/
30             or die "unparsable time: $time"; #maybe we shouldn't die...
31           #$cdr->startdate( timelocal($3, $2, $1 ,$mday, $mon, $year) );
32           $cdr->startdate(
33             timelocal($3, $2, $1 ,$tmp_mday, $tmp_mon, $tmp_year)
34           );
35         },
36
37     'dst',            #Dest
38     'userfield', #?   #DestinationDesc
39
40     #Min
41     _cdr_min_parser_maker, #( [qw( billsec duration)] ),
42     
43     sub {},           #Rate  XXX do something w/this, informationally???
44     'upstream_price', #Total
45
46     'accountcode',    #ServCode
47     'description',    #Service_Type
48   ],
49 );
50
51