X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fcdr%2Famcom.pm;h=4fb94ee7fdaa9f02de49acdcd0e13c0ecca8fe0c;hb=57bb423fe457ba4e13726877f53bcdf944f828f8;hp=774d1e617d8344ca255e0a3c498471eca04c555d;hpb=9d745634f4d11c8a23117fb01d6e8aecdfd669ff;p=freeside.git diff --git a/FS/FS/cdr/amcom.pm b/FS/FS/cdr/amcom.pm index 774d1e617..4fb94ee7f 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); @@ -22,10 +24,24 @@ my ($tmp_mday, $tmp_mon, $tmp_year); my ($cdr, $field, $conf, $hashref) = @_; $hashref->{skiprow} = 1 unless $field eq 'DCR'; }, - '', # 2. BWGroupID (centrex group) - '', # 3. BWGroupNumber + 'accountcode',# 2. BWGroupID (centrex group) + sub { # 3. BWGroupNumber + my ($cdr, $field) = @_; #, $conf, $hashref) = @_; + + if ($cdr->accountcode eq '' && $field =~ /^(1800|1300)/){ + $cdr->charged_party($field); + $cdr->accountcode($field); + } + }, '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})$/ @@ -43,6 +59,7 @@ my ($tmp_mday, $tmp_mon, $tmp_year); hour => $1, minute => $2, second => $3, + time_zone => 'local', ); $cdr->set('startdate', $dt->epoch); },