fix 477 reporting w/multiple classnums, RT#13922
[freeside.git] / httemplate / misc / process / payment.cgi
index 5fa57e4..acf066b 100644 (file)
@@ -21,6 +21,8 @@
 my $curuser = $FS::CurrentUser::CurrentUser;
 die "access denied" unless $curuser->access_right('Process payment');
 
+my $conf = new FS::Conf;
+
 #some false laziness w/MyAccount::process_payment
 
 $cgi->param('custnum') =~ /^(\d+)$/
@@ -81,8 +83,13 @@ if ( $payby eq 'CHEK' ) {
     $cgi->param('payinfo1') =~ /^(\d+)$/
       or errorpage("illegal account number ". $cgi->param('payinfo1'));
     my $payinfo1 = $1;
-    $cgi->param('payinfo2') =~ /^(\d+)$/
-      or errorpage("illegal ABA/routing number ". $cgi->param('payinfo2'));
+    if ( $conf->exists('echeck-no_routing') ) {
+      $cgi->param('payinfo2') =~ /^(\d*)$/
+        or errorpage("illegal ABA/routing number ". $cgi->param('payinfo2'));
+    } else {
+      $cgi->param('payinfo2') =~ /^(\d+)$/
+        or errorpage("illegal ABA/routing number ". $cgi->param('payinfo2'));
+    }
     my $payinfo2 = $1;
     $payinfo = $payinfo1. '@'. $payinfo2;
   }
@@ -196,7 +203,6 @@ if ( $cgi->param('save') ) {
 
   #false laziness w/FS:;cust_main::realtime_bop - check both to make sure
   # working correctly
-  my $conf = new FS::Conf;
   if ( $payby eq 'CARD' &&
        grep { $_ eq cardtype($payinfo) } $conf->config('cvv-save') ) {
     $new->set( 'paycvv' => $paycvv );