[freeside-commits] branch FREESIDE_2_3_BRANCH updated. 0ebd67ba94d633456c79afc2ca5902dd6245d365

Ivan ivan at 420.am
Thu Aug 16 01:27:05 PDT 2012


The branch, FREESIDE_2_3_BRANCH has been updated
       via  0ebd67ba94d633456c79afc2ca5902dd6245d365 (commit)
      from  43b107634433d8ced7b557ffb9fb82743553db1d (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 0ebd67ba94d633456c79afc2ca5902dd6245d365
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Thu Aug 16 01:27:04 2012 -0700

    FS/FS/cust_main/NationalID.pm

diff --git a/FS/FS/cust_main.pm b/FS/FS/cust_main.pm
index 5e9fe61..5b37605 100644
--- a/FS/FS/cust_main.pm
+++ b/FS/FS/cust_main.pm
@@ -4,6 +4,7 @@ require 5.006;
 use strict;
              #FS::cust_main:_Marketgear when they're ready to move to 2.1
 use base qw( FS::cust_main::Packages FS::cust_main::Status
+             FS::cust_main::NationalID
              FS::cust_main::Billing FS::cust_main::Billing_Realtime
              FS::cust_main::Billing_Discount
              FS::otaker_Mixin FS::payinfo_Mixin FS::cust_main_Mixin
diff --git a/httemplate/edit/cust_main.cgi b/httemplate/edit/cust_main.cgi
index b0a926b..91419af 100755
--- a/httemplate/edit/cust_main.cgi
+++ b/httemplate/edit/cust_main.cgi
@@ -253,6 +253,8 @@ if ( $cgi->param('error') ) {
   $stateid = $cust_main->stateid; # don't mask an entered value on errors
   $payinfo = $cust_main->payinfo; # don't mask an entered value on errors
 
+  $cust_main->national_id( $cgi->param('national_id1') || $cgi->param('national_id2') );
+
   $prospectnum = $cgi->param('prospectnum') || '';
 
   $pkgpart_svcpart = $cgi->param('pkgpart_svcpart') || '';
diff --git a/httemplate/edit/process/cust_main.cgi b/httemplate/edit/process/cust_main.cgi
index 90b55ca..1ac78fe 100755
--- a/httemplate/edit/process/cust_main.cgi
+++ b/httemplate/edit/process/cust_main.cgi
@@ -91,35 +91,7 @@ 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') );
-}
+$error ||= $new->set_national_id_from_cgi( $cgi );
 
 my %usedatetime = ( 'birthdate'        => 1,
                     'spouse_birthdate' => 1,

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

Summary of changes:
 FS/FS/cust_main.pm                    |    1 +
 httemplate/edit/cust_main.cgi         |    2 ++
 httemplate/edit/process/cust_main.cgi |   30 +-----------------------------
 3 files changed, 4 insertions(+), 29 deletions(-)




More information about the freeside-commits mailing list