[freeside-commits] freeside/FS/FS Conf.pm, 1.369, 1.370 cdr.pm, 1.59, 1.60

Ivan,,, ivan at wavetail.420.am
Mon Jun 28 01:12:04 PDT 2010


Update of /home/cvs/cvsroot/freeside/FS/FS
In directory wavetail.420.am:/tmp/cvs-serv29805/FS/FS

Modified Files:
	Conf.pm cdr.pm 
Log Message:
matching CDRs to svc_pbx records by title, RT#8084

Index: cdr.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/cdr.pm,v
retrieving revision 1.59
retrieving revision 1.60
diff -u -w -d -r1.59 -r1.60
--- cdr.pm	23 Jun 2010 20:55:21 -0000	1.59
+++ cdr.pm	28 Jun 2010 08:12:01 -0000	1.60
@@ -324,15 +324,19 @@
   $self->SUPER::check;
 }
 
-=item is_tollfree
+=item is_tollfree [ COLUMN ]
 
   Returns true when the cdr represents a toll free number and false otherwise.
 
+By default, inspects the dst field, but an optional column name can be passed
+to inspect other field.
+
 =cut
 
 sub is_tollfree {
   my $self = shift;
-  ( $self->dst =~ /^(\+?1)?8(8|([02-7])\3)/ ) ? 1 : 0;
+  my $field = scalar(@_) ? shift : 'dst';
+  ( $self->$field() =~ /^(\+?1)?8(8|([02-7])\3)/ ) ? 1 : 0;
 }
 
 =item set_charged_party
@@ -361,6 +365,11 @@
         if $conf->exists('cdr-charged_party-accountcode-trim_leading_0s');
       $self->charged_party( $charged_party );
 
+    } elsif ( $conf->exists('cdr-charged_party-field') ) {
+
+      my $field = $conf->config('cdr-charged_party-field');
+      $self->charged_party( $self->$field() );
+
     } else {
 
       if ( $self->is_tollfree ) {

Index: Conf.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/Conf.pm,v
retrieving revision 1.369
retrieving revision 1.370
diff -u -w -d -r1.369 -r1.370
--- Conf.pm	26 Jun 2010 09:34:09 -0000	1.369
+++ Conf.pm	28 Jun 2010 08:12:01 -0000	1.370
@@ -3494,6 +3494,22 @@
   },
 
   {
+    'key'         => 'cdr-charged_party-field',
+    'section'     => '',
+    'description' => 'Set the charged_party field of CDRs to this field.',
+    'type'        => 'select-sub',
+    'options_sub' => sub { my $fields = FS::cdr->table_info->{'fields'};
+                           map { $_ => $fields->{$_}||$_ }
+                           grep { $_ !~ /^(acctid|charged_party)$/ }
+                           FS::Schema::dbdef->table('cdr')->columns;
+                         },
+    'option_sub'  => sub { my $f = shift;
+                           FS::cdr->table_info->{'fields'}{$f} || $f;
+                         },
+  },
+
+  #probably deprecate in favor of cdr-charged_party-field above
+  {
     'key'         => 'cdr-charged_party-accountcode',
     'section'     => '',
     'description' => 'Set the charged_party field of CDRs to the accountcode.',



More information about the freeside-commits mailing list