[freeside-commits] branch FREESIDE_4_BRANCH updated. 9610c36df328850c679da7c6181d1c0f219c912d

Ivan Kohler ivan at freeside.biz
Tue Sep 3 10:01:50 PDT 2019


The branch, FREESIDE_4_BRANCH has been updated
       via  9610c36df328850c679da7c6181d1c0f219c912d (commit)
      from  124cdb9f0189f66f0054371f841132afa1832338 (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 9610c36df328850c679da7c6181d1c0f219c912d
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Tue Sep 3 10:01:14 2019 -0700

    CDR efficiency

diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm
index 1ad339f7f..a84d1c089 100644
--- a/FS/FS/Conf.pm
+++ b/FS/FS/Conf.pm
@@ -5167,7 +5167,7 @@ and customer address. Include units.',
   {
     'key'         => 'cdr-charged_party-field',
     'section'     => 'telephony',
-    'description' => 'Set the charged_party field of CDRs to this field.',
+    'description' => 'Set the charged_party field of CDRs to this field.  Restart Apache and Freeside daemons after changing.',
     'type'        => 'select-sub',
     'options_sub' => sub { my $fields = FS::cdr->table_info->{'fields'};
                            map { $_ => $fields->{$_}||$_ }
@@ -5183,14 +5183,14 @@ and customer address. Include units.',
   {
     'key'         => 'cdr-charged_party-accountcode',
     'section'     => 'telephony',
-    'description' => 'Set the charged_party field of CDRs to the accountcode.',
+    'description' => 'Set the charged_party field of CDRs to the accountcode.  Restart Apache and Freeside daemons after changing.',
     'type'        => 'checkbox',
   },
 
   {
     'key'         => 'cdr-charged_party-accountcode-trim_leading_0s',
     'section'     => 'telephony',
-    'description' => 'When setting the charged_party field of CDRs to the accountcode, trim any leading zeros.',
+    'description' => 'When setting the charged_party field of CDRs to the accountcode, trim any leading zeros.  Restart Apache and Freeside daemons after changing.',
     'type'        => 'checkbox',
   },
 
@@ -5288,7 +5288,7 @@ and customer address. Include units.',
   {
     'key'         => 'cdr-max_duration',
     'section'     => 'telephony',
-    'description' => 'If set, defines a global maximum billsec/duration for (prefix-based) call rating, in seconds.  Used with questionable/dirty CDR data that may contain bad records with long billsecs/durations.',
+    'description' => 'If set, defines a global maximum billsec/duration for (prefix-based) call rating, in seconds.  Used with questionable/dirty CDR data that may contain bad records with long billsecs/durations.  Restart Apache and Freeside daemons after changing.',
     'type'        => 'text',
   },
 
@@ -5838,14 +5838,14 @@ and customer address. Include units.',
   {
     'key'         => 'cdr-prerate',
     'section'     => 'telephony',
-    'description' => 'Experimental feature to rate CDRs immediately, rather than waiting until invoice generation time.  Can reduce invoice generation time when processing lots of CDRs.  Currently works with "VoIP/telco CDR rating (standard)" price plans using "Phone numbers (svc_phone.phonenum)" CDR service matching, without any included minutes.',
+    'description' => 'Experimental feature to rate CDRs immediately, rather than waiting until invoice generation time.  Can reduce invoice generation time when processing lots of CDRs.  Currently works with "VoIP/telco CDR rating (standard)" price plans using "Phone numbers (svc_phone.phonenum)" CDR service matching, without any included minutes.  Restart Apache and Freeside daemons after changing.',
     'type'        => 'checkbox',
   },
 
   {
     'key'         => 'cdr-prerate-cdrtypenums',
     'section'     => 'telephony',
-    'description' => 'When using cdr-prerate to rate CDRs immediately, limit processing to these CDR types.',
+    'description' => 'When using cdr-prerate to rate CDRs immediately, limit processing to these CDR types.  Restart Apache and Freeside daemons after changing.',
     'type'        => 'select-sub',
     'multiple'    => 1,
     'options_sub' => sub { require FS::Record;
@@ -5879,7 +5879,7 @@ and customer address. Include units.',
   {
     'key'         => 'cdr-lrn_lookup',
     'section'     => 'telephony',
-    'description' => 'Look up LRNs of destination numbers for exact matching to the terminating carrier.  This feature requires a Freeside support contract for paid access to the central NPAC database; see <a href ="#support-key">support-key</a>.',
+    'description' => 'Look up LRNs of destination numbers for exact matching to the terminating carrier.  This feature requires a Freeside support contract for paid access to the central NPAC database; see <a href ="#support-key">support-key</a>.  Restart Apache and Freeside daemons after changing.',
     'type'        => 'checkbox',
   },
   
@@ -6079,7 +6079,7 @@ and customer address. Include units.',
   {
     'key'         => 'tollfree-country',
     'section'     => 'telephony',
-    'description' => 'Country / region for toll-free recognition',
+    'description' => 'Country / region for toll-free recognition.  Restart Apache and Freeside daemons after changing.',
     'type'        => 'select',
     'select_hash' => [ ''   => 'NANPA (US/Canada)',
                        'AU' => 'Australia',
diff --git a/FS/FS/cdr.pm b/FS/FS/cdr.pm
index 37cb30d9a..7d5194826 100644
--- a/FS/FS/cdr.pm
+++ b/FS/FS/cdr.pm
@@ -4,6 +4,8 @@ use strict;
 use vars qw( @ISA @EXPORT_OK $DEBUG $me
              $conf $cdr_prerate %cdr_prerate_cdrtypenums
              $use_lrn $support_key $max_duration
+             $cp_accountcode $cp_accountcode_trim0s $cp_field
+             $tollfree_country
            );
 use Exporter;
 use List::Util qw(first min);
@@ -52,6 +54,13 @@ FS::UID->install_callback( sub {
 
   $max_duration = $conf->config('cdr-max_duration') || 0;
 
+  $cp_accountcode = $conf->exists('cdr-charged_party-accountcode');
+  $cp_accountcode_trim0s = $conf->exists('cdr-charged_party-accountcode-trim_leading_0s');
+
+  $cp_field = $conf->config('cdr-charged_party-field');
+
+  $tollfree_country = $conf->config('tollfree-country') || '';
+
 });
 
 =head1 NAME
@@ -389,10 +398,9 @@ to inspect other field.
 sub is_tollfree {
   my $self = shift;
   my $field = scalar(@_) ? shift : 'dst';
-  my $country = $conf->config('tollfree-country') || '';
-  if ( $country eq 'AU' ) { 
+  if ( $tollfree_country eq 'AU' ) { 
     ( $self->$field() =~ /^(\+?61)?(1800|1300)/ ) ? 1 : 0;
-  } elsif ( $country eq 'NZ' ) { 
+  } elsif ( $tollfree_country eq 'NZ' ) { 
     ( $self->$field() =~ /^(\+?64)?(800|508)/ ) ? 1 : 0;
   } else { #NANPA (US/Canaada)
     ( $self->$field() =~ /^(\+?1)?8(8|([02-7])\3)/ ) ? 1 : 0;
@@ -418,17 +426,16 @@ sub set_charged_party {
 
   unless ( $self->charged_party ) {
 
-    if ( $conf->exists('cdr-charged_party-accountcode') && $self->accountcode ){
+    if ( $cp_accountcode && $self->accountcode ) {
 
       my $charged_party = $self->accountcode;
       $charged_party =~ s/^0+//
-        if $conf->exists('cdr-charged_party-accountcode-trim_leading_0s');
+        if $cp_accountcode_trim0s;
       $self->charged_party( $charged_party );
 
-    } elsif ( $conf->exists('cdr-charged_party-field') ) {
+    } elsif ( $cp_field ) {
 
-      my $field = $conf->config('cdr-charged_party-field');
-      $self->charged_party( $self->$field() );
+      $self->charged_party( $self->$cp_field() );
 
     } else {
 

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

Summary of changes:
 FS/FS/Conf.pm | 16 ++++++++--------
 FS/FS/cdr.pm  | 23 +++++++++++++++--------
 2 files changed, 23 insertions(+), 16 deletions(-)




More information about the freeside-commits mailing list