summaryrefslogtreecommitdiff
path: root/httemplate/edit/process/cust_main.cgi
diff options
context:
space:
mode:
authorIvan Kohler <ivan@freeside.biz>2012-08-10 13:54:14 -0700
committerIvan Kohler <ivan@freeside.biz>2012-08-10 13:54:14 -0700
commit5a204201503f8e0db6087db6e53b84297cbc739a (patch)
tree6f17419140a68f9a0c783d2bc4e4b2029a79574c /httemplate/edit/process/cust_main.cgi
parentd32459cf059ff29a5ddc4b83ca2bf50a7828454b (diff)
add national id # handling for my, RT#18543
Diffstat (limited to 'httemplate/edit/process/cust_main.cgi')
-rwxr-xr-xhttemplate/edit/process/cust_main.cgi30
1 files changed, 30 insertions, 0 deletions
diff --git a/httemplate/edit/process/cust_main.cgi b/httemplate/edit/process/cust_main.cgi
index 866452de1..622dd87c5 100755
--- a/httemplate/edit/process/cust_main.cgi
+++ b/httemplate/edit/process/cust_main.cgi
@@ -110,6 +110,36 @@ if ( $cgi->param('no_credit_limit') ) {
$new->tagnum( [ $cgi->param('tagnum') ] );
+if ( my $id_country = $conf->config('national_id-country') ) {
+ if ( $id_country eq 'MY' ) {
+
+ if ( $cgi->param('national_id1') =~ /\S/ ) {
+ my $nric = $cgi->param('national_id1');
+ $nric =~ s/\s//g;
+ if ( $nric =~ /^(\d{6})\-?(\d{2})\-?(\d{4})$/ ) {
+ $new->national_id( "$1-$2-$3" );
+ } else {
+ $error ||= "Illegal NRIC: ". $cgi->param('national_id1');
+ }
+ } elsif ( $cgi->param('national_id2') =~ /\S/ ) {
+ my $oldic = $cgi->param('national_id2');
+ $oldic =~ s/\s//g;
+ if ( $oldic =~ /^\w\d{9}$/ ) {
+ $new->national_id($oldic);
+ } else {
+ $error ||= "Illegal Old IC/Passport: ". $cgi->param('national_id2');
+ }
+ } else {
+ $error ||= 'Either NRIC or Old IC/Passport is required';
+ }
+
+ } else {
+ warn "unknown national_id-country $id_country";
+ }
+} elsif ( $cgi->param('national_id0') ) {
+ $new->national_id( $cgi->param('national_id0') );
+}
+
my %usedatetime = ( 'birthdate' => 1,
'spouse_birthdate' => 1,
'anniversary_date' => 1,