quotations, RT#16996
[freeside.git] / FS / FS / cdr / simple.pm
1 package FS::cdr::simple;
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',
12   'weight'        => 20,
13   'header'        => 1,
14   'import_fields' => [
15
16     # Date (MM/DD/YY)
17     sub { my($cdr, $date) = @_;
18           $date =~ /^(\d{1,2})\/(\d{1,2})\/(\d\d(\d\d)?)$/
19             or die "unparsable date: $date"; #maybe we shouldn't die...
20           #$cdr->startdate( timelocal(0, 0, 0 ,$2, $1-1, $3) );
21           ($tmp_mday, $tmp_mon, $tmp_year) = ( $2, $1-1, $3 );
22         },
23
24     # Time
25     sub { my($cdr, $time) = @_;
26           #my($sec, $min, $hour, $mday, $mon, $year)= localtime($cdr->startdate);
27           $time =~ /^(\d{1,2}):(\d{1,2}):(\d{1,2})$/
28             or die "unparsable time: $time"; #maybe we shouldn't die...
29           #$cdr->startdate( timelocal($3, $2, $1 ,$mday, $mon, $year) );
30           $cdr->startdate(
31             timelocal($3, $2, $1 ,$tmp_mday, $tmp_mon, $tmp_year)
32           );
33         },
34
35     # Source_Number
36     'src',
37
38     # Terminating_Number
39     'dst',
40
41     # Duration
42     _cdr_min_parser_maker, #( [qw( billsec duration)] ),
43     #sub { my($cdr, $min) = @_;
44     #      my $sec = sprintf('%.0f', $min * 60 );
45     #      $cdr->billsec(  $sec );
46     #      $cdr->duration( $sec );
47     #    },
48
49   ],
50 );
51
52 1;