diff options
author | Ivan Kohler <ivan@freeside.biz> | 2014-02-09 14:59:11 -0800 |
---|---|---|
committer | Ivan Kohler <ivan@freeside.biz> | 2014-02-09 14:59:11 -0800 |
commit | f9e0349e73332e1dc7951c30f2a7cbf683e9b594 (patch) | |
tree | 7ba78bf95c5a39a296c7309801d8ed9efb35b36d | |
parent | a8928b2caf2be7a3f052edc88f4031501e8217ad (diff) |
with cust_main-custnum-display_prefix, use prefixed customer numbers on batch import, RT#26319
-rw-r--r-- | FS/FS/Record.pm | 8 | ||||
-rw-r--r-- | FS/FS/cust_pay.pm | 8 |
2 files changed, 16 insertions, 0 deletions
diff --git a/FS/FS/Record.pm b/FS/FS/Record.pm index 053c441f6..ecd3e9565 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 b3737c0f1..a1286e36f 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; |