diff options
author | Jeremy Davis <jeremyd@freeside.biz> | 2015-10-06 13:39:20 -0400 |
---|---|---|
committer | Jeremy Davis <jeremyd@freeside.biz> | 2015-10-06 13:39:20 -0400 |
commit | 8b80447169366e4d586955abd8e72a7bcbad122d (patch) | |
tree | c04b8fa1cd4a2f03f60793dd0368c3def902b562 /FS/FS/cdr | |
parent | 15b40cdb23b1e3b0e3d8372ead91b8a5244bb0e2 (diff) |
cdr types for AMCom CDR's
Diffstat (limited to 'FS/FS/cdr')
-rw-r--r-- | FS/FS/cdr/amcom.pm | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/FS/FS/cdr/amcom.pm b/FS/FS/cdr/amcom.pm index 97ab402..43e6afd 100644 --- a/FS/FS/cdr/amcom.pm +++ b/FS/FS/cdr/amcom.pm @@ -4,6 +4,8 @@ use strict; use base qw( FS::cdr ); use vars qw( %info ); use DateTime; +use FS::Record qw( qsearchs ); +use FS::cdr_type; my ($tmp_mday, $tmp_mon, $tmp_year); @@ -29,7 +31,14 @@ my ($tmp_mday, $tmp_mon, $tmp_year); if $cdr->accountcode eq '' && $field =~ /^(1800|1300)/; }, 'uniqueid', # 4. Record ID - 'dcontext', # 5. Call Category (LOCAL, NATIONAL, FREECALL, MOBILE) + sub { # 5. Call Category (LOCAL, NATIONAL, FREECALL, MOBILE) + my ($cdr, $data) = @_; + $data ||= 'none'; + + my $cdr_type = qsearchs('cdr_type', { 'cdrtypename' => $data } ); + $cdr->set('cdrtypenum', $cdr_type->cdrtypenum) if $cdr_type; + $cdr->set('dcontext', $data); + }, sub { # 6. Start Date (DDMMYYYY my ($cdr, $date) = @_; $date =~ /^(\d{2})(\d{2})(\d{4})$/ |