summaryrefslogtreecommitdiff
path: root/FS/FS/cdr
diff options
context:
space:
mode:
authorJeremy Davis <jeremyd@freeside.biz>2015-10-31 04:07:00 -0400
committerJeremy Davis <jeremyd@freeside.biz>2015-10-31 04:07:00 -0400
commit3f2b717c4abf4131991bd13524c060fe18465377 (patch)
tree43046c4fa02609f1954089df7d573317831b3c70 /FS/FS/cdr
parentcfbcb8867b15c66c279816bce91a69c5ee9b2710 (diff)
36503 Scalability issues with amcom CDRs
Diffstat (limited to 'FS/FS/cdr')
-rw-r--r--FS/FS/cdr/amcom.pm14
1 files changed, 9 insertions, 5 deletions
diff --git a/FS/FS/cdr/amcom.pm b/FS/FS/cdr/amcom.pm
index fee81f7..697a682 100644
--- a/FS/FS/cdr/amcom.pm
+++ b/FS/FS/cdr/amcom.pm
@@ -2,9 +2,9 @@ package FS::cdr::amcom;
use strict;
use base qw( FS::cdr );
-use vars qw( %info );
+use vars qw( %info %cdrtypes);
use DateTime;
-use FS::Record qw( qsearchs );
+use FS::Record qw( qsearch );
use FS::cdr_type;
my ($tmp_mday, $tmp_mon, $tmp_year);
@@ -16,6 +16,12 @@ my ($tmp_mday, $tmp_mon, $tmp_year);
'type' => 'csv',
'sep_char' => ',',
'disabled' => 0,
+ 'header_buffer' => sub {
+
+ %cdrtypes = ( map { $_->cdrtypename => $_->cdrtypenum }
+ qsearch('cdr_type', {})
+ );
+ },
#listref of what to do with each field from the CDR, in order
'import_fields' => [
@@ -37,9 +43,7 @@ my ($tmp_mday, $tmp_mon, $tmp_year);
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->cdrtypenum($cdrtypes{$data} || '');
$cdr->set('dcontext', $data);
},
sub { # 6. Start Date (DDMMYYYY