echeck: add optional bank branch format, RT13360
authorlevinse <levinse>
Thu, 23 Jun 2011 04:09:48 +0000 (04:09 +0000)
committerlevinse <levinse>
Thu, 23 Jun 2011 04:09:48 +0000 (04:09 +0000)
FS/FS/Conf.pm
FS/FS/cust_main.pm
httemplate/edit/cust_main.cgi
httemplate/edit/cust_main/billing.html
httemplate/edit/cust_main/bottomfixup.js
httemplate/edit/process/cust_main.cgi

index 8d1f875..ac0f94c 100644 (file)
@@ -4455,6 +4455,13 @@ and customer address. Include units.',
   },
   
   {
+    'key'         => 'cust_main-require-bank-branch',
+    'section'     => 'UI',
+    'description' => 'An alternate DCHK/CHEK format; require entry of bank branch number.',
+    'type'        => 'checkbox',
+  },
+  
+  {
     'key'         => 'cust-edit-alt-field-order',
     'section'     => 'UI',
     'description' => 'An alternate ordering of fields for the New Customer and Edit Customer screens.',
index b2bcbdc..4a7ad2e 100644 (file)
@@ -1910,8 +1910,12 @@ sub check {
   } elsif ( $check_payinfo && $self->payby =~ /^(CHEK|DCHK)$/ ) {
 
     my $payinfo = $self->payinfo;
-    $payinfo =~ s/[^\d\@]//g;
-    if ( $conf->exists('echeck-nonus') ) {
+    $payinfo =~ s/[^\d\@\.]//g;
+    if ( $conf->exists('cust_main-require-bank-branch') ) {
+      $payinfo =~ /^(\d+)\@(\d+)\.(\d+)$/ or return 'invalid echeck account@branch.bank';
+      $payinfo = "$1\@$2.$3";
+    }
+    elsif ( $conf->exists('echeck-nonus') ) {
       $payinfo =~ /^(\d+)\@(\d+)$/ or return 'invalid echeck account@aba';
       $payinfo = "$1\@$2";
     } else {
index 5164238..2ba40d2 100755 (executable)
@@ -194,7 +194,7 @@ function samechanged(what) {
 %# cust_main/bottomfixup.js
 % foreach my $hidden (
 %    'payauto',
-%    'payinfo', 'payinfo1', 'payinfo2', 'paytype',
+%    'payinfo', 'payinfo1', 'payinfo2', 'payinfo3', 'paytype',
 %    'payname', 'paystate', 'exp_month', 'exp_year', 'paycvv',
 %    'paystart_month', 'paystart_year', 'payissue',
 %    'payip',
index 049e7ed..8a90204 100644 (file)
 %  my $payby = $cust_main->payby;
 %  my $paytype = $cust_main->paytype;
 %  my( $account, $aba ) = split('@', $payinfo);
+%  my $branch = '';
+%  ($branch,$aba) = split('\.',$aba) if $conf->exists('cust_main-require-bank-branch');
 %
 %  my $disabled = 'DISABLED style="background-color: #dddddd"';
 %  my $text_disabled = 'style="color: #999999"';
 %        qq!<INPUT TYPE="hidden" NAME="CHEK_exp_month" VALUE="12">!.
 %        qq!<INPUT TYPE="hidden" NAME="CHEK_exp_year" VALUE="2037">!.
 %
+%        ( $conf->exists('cust_main-require-bank-branch') ? 
+%               qq!<TR><TD ALIGN="right">$r Branch number</TD><TD COLSPAN="3">
+%                   <INPUT TYPE="text" name="CHEK_payinfo3" VALUE=$branch></TD></TR>! : '' ).
+%   
 %        qq!<TR><TD ALIGN="right" WIDTH="200">${r}!.emt('Bank name').qq! </TD>!.
 %          qq!<TD COLSPAN="3" WIDTH="408"><INPUT TYPE="text" NAME="CHEK_payname" VALUE="!. ( $payby =~ /^(CHEK|DCHK)$/ ? $cust_main->payname : '' ). qq!"></TD></TR>!.
 %      ( $conf->exists('show_bankstate') ?
index 942fc0e..24156f7 100644 (file)
@@ -3,7 +3,7 @@ function bottomfixup(what) {
 %# ../cust_main.cgi
   var layervars = new Array(
     'payauto',
-    'payinfo', 'payinfo1', 'payinfo2', 'paytype',
+    'payinfo', 'payinfo1', 'payinfo2', 'payinfo3', 'paytype',
     'payname', 'paystate', 'exp_month', 'exp_year', 'paycvv',
     'paystart_month', 'paystart_year', 'payissue',
     'payip',
index 3d56a82..df6cec9 100755 (executable)
@@ -42,8 +42,11 @@ $cgi->param('payby', $payby);
 
 if ( $payby ) {
   if ( $payby eq 'CHEK' || $payby eq 'DCHK' ) {
-    $cgi->param('payinfo',
-      $cgi->param('payinfo1'). '@'. $cgi->param('payinfo2') );
+      my $payinfo = $cgi->param('payinfo1'). '@';
+      $payinfo .= $cgi->param('payinfo3').'.' 
+            if $conf->exists('cust_main-require-bank-branch');
+      $payinfo .= $cgi->param('payinfo2');
+      $cgi->param('payinfo',$payinfo);
   }
   $cgi->param('paydate',
     $cgi->param( 'exp_month' ). '-'. $cgi->param( 'exp_year' ) );