[freeside-commits] branch FREESIDE_3_BRANCH updated. f9e0349e73332e1dc7951c30f2a7cbf683e9b594

Ivan ivan at 420.am
Sun Feb 9 14:59:12 PST 2014


The branch, FREESIDE_3_BRANCH has been updated
       via  f9e0349e73332e1dc7951c30f2a7cbf683e9b594 (commit)
      from  a8928b2caf2be7a3f052edc88f4031501e8217ad (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 f9e0349e73332e1dc7951c30f2a7cbf683e9b594
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Sun Feb 9 14:59:11 2014 -0800

    with cust_main-custnum-display_prefix, use prefixed customer numbers on batch import, RT#26319

diff --git a/FS/FS/Record.pm b/FS/FS/Record.pm
index 053c441..ecd3e95 100644
--- a/FS/FS/Record.pm
+++ b/FS/FS/Record.pm
@@ -1750,6 +1750,9 @@ sub batch_import {
   my $file    = $param->{file};
   my $params  = $param->{params} || {};
 
+  my $custnum_prefix = $conf->config('cust_main-custnum-display_prefix');
+  my $custnum_length = $conf->config('cust_main-custnum-display_length') || 8;
+
   my( $type, $header, $sep_char,
       $fixedlength_format, $xml_format, $asn_format,
       $row_callback, @fields );
@@ -2030,6 +2033,11 @@ sub batch_import {
 
     }
 
+    if ( $custnum_prefix && $hash{custnum} =~ /^$custnum_prefix(0*([1-9]\d*))$/
+                         && length($1) == $custnum_length ) {
+      $hash{custnum} = $2;
+    }
+
     #my $table   = $param->{table};
     my $class = "FS::$table";
 
diff --git a/FS/FS/cust_pay.pm b/FS/FS/cust_pay.pm
index b3737c0..a1286e3 100644
--- a/FS/FS/cust_pay.pm
+++ b/FS/FS/cust_pay.pm
@@ -1130,6 +1130,9 @@ sub batch_import {
   my $format = $param->{'format'};
   my $paybatch = $param->{'paybatch'};
 
+  my $custnum_prefix = $conf->config('cust_main-custnum-display_prefix');
+  my $custnum_length = $conf->config('cust_main-custnum-display_length') || 8;
+
   # here is the agent virtualization
   my $extra_sql = ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql;
 
@@ -1215,6 +1218,11 @@ sub batch_import {
       $cust_pay{$field} = shift @columns; 
     }
 
+    if ( $custnum_prefix && $cust_pay{custnum} =~ /^$custnum_prefix(0*([1-9]\d*))$/
+                         && length($1) == $custnum_length ) {
+      $cust_pay{custnum} = $2;
+    }
+
     my $cust_pay = new FS::cust_pay( \%cust_pay );
     my $error = $cust_pay->insert;
 

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

Summary of changes:
 FS/FS/Record.pm   |    8 ++++++++
 FS/FS/cust_pay.pm |    8 ++++++++
 2 files changed, 16 insertions(+), 0 deletions(-)




More information about the freeside-commits mailing list