[freeside-commits] branch master updated. ac2ec4c0ce8ea098009340dd7e9756dad7219a5b
Ivan
ivan at 420.am
Sun Feb 9 14:59:11 PST 2014
The branch, master has been updated
via ac2ec4c0ce8ea098009340dd7e9756dad7219a5b (commit)
from 8e307f751bd744e784465e114437978c81a3c000 (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 ac2ec4c0ce8ea098009340dd7e9756dad7219a5b
Author: Ivan Kohler <ivan at freeside.biz>
Date: Sun Feb 9 14:59:10 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 ff8a0cc..a47cc8b 100644
--- a/FS/FS/Record.pm
+++ b/FS/FS/Record.pm
@@ -1847,6 +1847,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,
$parser_opt, $row_callback, @fields );
@@ -2131,6 +2134,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 b7189a8..63d7c48 100644
--- a/FS/FS/cust_pay.pm
+++ b/FS/FS/cust_pay.pm
@@ -1100,6 +1100,9 @@ sub batch_import {
$_date = parse_datetime($_date) if $_date && $_date =~ /\D/;
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;
@@ -1186,6 +1189,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