add (new?) troop CDR format, RT#17666
[freeside.git] / FS / FS / cdr / troop2.pm
1 package FS::cdr::troop2;
2
3 use strict;
4 use base qw( FS::cdr );
5 use vars qw( %info $tmp_date $tmp_src_city $tmp_dst_city );
6 use Date::Parse;
7 #use Time::Local;
8 ##use FS::cdr qw( _cdr_date_parser_maker _cdr_min_parser_maker );
9
10 %info = (
11   'name' => 'Troop',
12   'weight' => 219,
13   'header' => 1,
14   'type'   => 'xls',
15
16   'import_fields' => [
17
18     'userfield', #account_num  (userfield?)
19
20     #call_date
21     sub { my($cdr, $date) = @_;
22           #is this an excel date?  or just text?
23           $tmp_date = $date;
24         },
25
26     #call_time
27     sub { my($cdr, $time) = @_;
28           #is this an excel time?  or just text?
29           $cdr->startdate( str2time("$tmp_date $time") );
30         },
31
32     'src', #orig_tn
33     'dst', #term_tn
34
35      #call_dur
36     sub { my($cdr, $duration) = @_;
37           $cdr->duration($duration);
38           $cdr->billsec($duration);
39         },
40
41     'clid', #auth_code_ani (clid?)
42
43     'accountcode', #account_code
44
45     #ovs_type
46     # OVS Type / Maybe / add "011" to international calls
47     # N = DOM LD / normal
48     # Z = INTL LD
49     # O = INTL LD
50     # others...?
51     sub { my($cdr, $ovs) = @_;
52           my $pre = ( $ovs =~ /^\s*[OZ]\s*$/i ) ? '011' : '1';
53           $cdr->dst( $pre. $cdr->dst ) unless $cdr->dst =~ /^$pre/;
54         },
55
56     #orig_city
57     sub { (my $cdr, $tmp_src_city) = @_; },
58
59     #orig_prov_state
60     sub { my($cdr, $state) = @_;
61           $cdr->upstream_src_regionname("$tmp_src_city, $state");
62         },
63
64     #term_city
65     sub { (my $cdr, $tmp_dst_city) = @_; },
66
67     #term_prov_state
68     sub { my($cdr, $state) = @_;
69           $cdr->upstream_dst_regionname("$tmp_dst_city, $state");
70         },
71
72     #term_ovs
73     '', #CANADA / UNITED STATES / BELL.  huh.  country or terminating provider?
74
75     '', #cc_ind (what's this?)
76
77     'upstream_price', #call_charge
78
79     #important?
80     '', #creation_date
81     '', #creation_time
82
83     #additional upstream pricing details we don't need?
84     '', #net_charge
85     '', #surcharge
86     '', #gst
87     '', #pst
88     '', #hst
89
90   ],
91
92 );
93
94 1;