diff options
author | Ivan Kohler <ivan@freeside.biz> | 2012-08-10 13:54:14 -0700 |
---|---|---|
committer | Ivan Kohler <ivan@freeside.biz> | 2012-08-10 13:54:14 -0700 |
commit | 5a204201503f8e0db6087db6e53b84297cbc739a (patch) | |
tree | 6f17419140a68f9a0c783d2bc4e4b2029a79574c /httemplate/edit/process/cust_main.cgi | |
parent | d32459cf059ff29a5ddc4b83ca2bf50a7828454b (diff) |
add national id # handling for my, RT#18543
Diffstat (limited to 'httemplate/edit/process/cust_main.cgi')
-rwxr-xr-x | httemplate/edit/process/cust_main.cgi | 30 |
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, |