[freeside-commits] branch FREESIDE_3_BRANCH updated. 3aa784b1324ac14026eb900cf598ad9aec49179a

Jeremy Davis jeremyd at 420.am
Mon Nov 2 10:06:16 PST 2015


The branch, FREESIDE_3_BRANCH has been updated
       via  3aa784b1324ac14026eb900cf598ad9aec49179a (commit)
      from  a5464ff6f8f41685a3a325558805751c159b67e7 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 3aa784b1324ac14026eb900cf598ad9aec49179a
Author: Jeremy Davis <jeremyd at freeside.biz>
Date:   Sat Oct 31 04:07:34 2015 -0400

    36503 Scalability issues with amcom CDRs

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

-----------------------------------------------------------------------

Summary of changes:
 FS/FS/cdr/amcom.pm |   14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)




More information about the freeside-commits mailing list