summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--FS/FS/Conf.pm18
-rw-r--r--FS/FS/Upgrade.pm10
-rw-r--r--FS/FS/cust_main.pm11
-rw-r--r--conf/echeck-country1
-rw-r--r--httemplate/edit/cust_main/billing.html18
-rwxr-xr-xhttemplate/edit/process/cust_main.cgi2
-rw-r--r--httemplate/misc/payment.cgi17
-rw-r--r--httemplate/misc/process/payment.cgi4
-rw-r--r--httemplate/view/cust_main/billing.html11
9 files changed, 64 insertions, 28 deletions
diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm
index e917fb5cd..951f820a8 100644
--- a/FS/FS/Conf.pm
+++ b/FS/FS/Conf.pm
@@ -3068,6 +3068,17 @@ and customer address. Include units.',
},
{
+ 'key' => 'echeck-country',
+ 'section' => 'billing',
+ 'description' => 'Format electronic check information for the specified country.',
+ 'type' => 'select',
+ 'select_hash' => [ 'US' => 'United States',
+ 'CA' => 'Canada (enables branch)',
+ 'XX' => 'Other',
+ ],
+ },
+
+ {
'key' => 'voip-cust_accountcode_cdr',
'section' => 'telephony',
'description' => 'Enable the per-customer option for CDR breakdown by accountcode.',
@@ -4732,13 +4743,6 @@ 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.',
diff --git a/FS/FS/Upgrade.pm b/FS/FS/Upgrade.pm
index 3134b8c61..cf6158031 100644
--- a/FS/FS/Upgrade.pm
+++ b/FS/FS/Upgrade.pm
@@ -50,6 +50,16 @@ sub upgrade_config {
$conf->touch('geocode-require_nw_coordinates')
if $conf->exists('svc_broadband-require-nw-coordinates');
+ unless ( $conf->config('echeck-country') ) {
+ if ( $conf->exists('cust_main-require-bank-branch') ) {
+ $conf->set('echeck-country', 'CA');
+ } elsif ( $conf->exists('echeck-nonus') ) {
+ $conf->set('echeck-country', 'XX');
+ } else {
+ $conf->set('echeck-country', 'US');
+ }
+ }
+
upgrade_overlimit_groups($conf);
map { upgrade_overlimit_groups($conf,$_->agentnum) } qsearch('agent', {});
diff --git a/FS/FS/cust_main.pm b/FS/FS/cust_main.pm
index 53ecf5b8e..da408246d 100644
--- a/FS/FS/cust_main.pm
+++ b/FS/FS/cust_main.pm
@@ -2032,14 +2032,15 @@ sub check {
my $payinfo = $self->payinfo;
$payinfo =~ s/[^\d\@\.]//g;
- if ( $conf->exists('cust_main-require-bank-branch') ) {
- $payinfo =~ /^(\d+)\@(\d+)\.(\d+)$/ or return 'invalid echeck account@branch.bank';
+ if ( $conf->config('echeck-country') eq 'CA' ) {
+ $payinfo =~ /^(\d+)\@(\d{5})\.(\d{3})$/
+ 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';
+ } elsif ( $conf->config('echeck-country') eq 'US' ) {
+ $payinfo =~ /^(\d+)\@(\d{9})$/ or return 'invalid echeck account@aba';
$payinfo = "$1\@$2";
} else {
- $payinfo =~ /^(\d+)\@(\d{9})$/ or return 'invalid echeck account@aba';
+ $payinfo =~ /^(\d+)\@(\d+)$/ or return 'invalid echeck account@routing';
$payinfo = "$1\@$2";
}
$self->payinfo($payinfo);
diff --git a/conf/echeck-country b/conf/echeck-country
new file mode 100644
index 000000000..f4cd62e01
--- /dev/null
+++ b/conf/echeck-country
@@ -0,0 +1 @@
+US
diff --git a/httemplate/edit/cust_main/billing.html b/httemplate/edit/cust_main/billing.html
index fd078c5da..78fac6c22 100644
--- a/httemplate/edit/cust_main/billing.html
+++ b/httemplate/edit/cust_main/billing.html
@@ -127,7 +127,7 @@
% my( $account, $aba ) = split('@', $payinfo);
% my $branch = '';
% ($branch,$aba) = split('\.',$aba)
-% if $conf->exists('cust_main-require-bank-branch');
+% if $conf->config('echeck-country') eq 'CA';
%
% my $disabled = 'DISABLED style="background-color: #dddddd"';
% my $text_disabled = 'style="color: #999999"';
@@ -161,6 +161,14 @@
% my $card_billday_select_disabled = $payby eq 'CARD' ? '' : 'DISABLED';
% my $chek_billday_select_disabled = $payby eq 'CHEK' ? '' : 'DISABLED';
%
+% #false laziness w/view/cust_main/billing.html and misc/payment.cgi
+% my $routing_label = $conf->config('echeck-country') eq 'US'
+% ? 'ABA/Routing number'
+% : 'Routing number';
+% my $routing_size = $conf->config('echeck-country') eq 'CA' ? 4 : 10;
+% my $routing_maxlength = $conf->config('echeck-country') eq 'CA' ? 3 : 9;
+%
+%
% my %payby = (
%
% 'CARD' =>
@@ -235,17 +243,17 @@
% join('', map { qq!<OPTION VALUE="$_" !.($paytype eq $_ ? 'SELECTED' : '').">$_</OPTION>" } @FS::cust_main::paytypes).
% qq!</SELECT></TD></TR>!.
%
-% qq!<TR><TD ALIGN="right" WIDTH="200">${r}!.emt('ABA/Routing number').qq! </TD>!.
-% qq!<TD COLSPAN="3" WIDTH="408"><INPUT TYPE="text" SIZE=10 MAXLENGTH=9 NAME="CHEK_payinfo2" VALUE="!. ( $payby =~ /^(CHEK|DCHK)$/ ? $aba : '' ). qq!" SIZE=10 MAXLENGTH=9> !.
+% qq!<TR><TD ALIGN="right" WIDTH="200">${r}!.emt($routing_label).qq! </TD>!.
+% qq!<TD COLSPAN="3" WIDTH="408"><INPUT TYPE="text" SIZE=$routing_size MAXLENGTH=$routing_maxlength NAME="CHEK_payinfo2" VALUE="!. ( $payby =~ /^(CHEK|DCHK)$/ ? $aba : '' ). qq!"> !.
% qq!(<A HREF="javascript:void(0);" onClick="overlib( OLiframeContent('../docs/ach.html', 380, 240, 'ach_popup' ), CAPTION, 'ACH Help', STICKY, AUTOSTATUSCAP, CLOSECLICK, DRAGGABLE ); return false;">!.emt('help').qq!</A>)!.
% qq!</TD></TR>!.
%
% 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') ?
+% ( $conf->config('echeck-country') eq 'CA' ?
% qq!<TR><TD ALIGN="right">$r !.emt('Branch number').qq!</TD><TD COLSPAN="3">
-% <INPUT TYPE="text" name="CHEK_payinfo3" VALUE=$branch></TD></TR>! : '' ).
+% <INPUT TYPE="text" name="CHEK_payinfo3" VALUE="$branch" SIZE=6 MAXLENGTH=5></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>!.
diff --git a/httemplate/edit/process/cust_main.cgi b/httemplate/edit/process/cust_main.cgi
index df6cec9df..f75e2a6ae 100755
--- a/httemplate/edit/process/cust_main.cgi
+++ b/httemplate/edit/process/cust_main.cgi
@@ -44,7 +44,7 @@ if ( $payby ) {
if ( $payby eq 'CHEK' || $payby eq 'DCHK' ) {
my $payinfo = $cgi->param('payinfo1'). '@';
$payinfo .= $cgi->param('payinfo3').'.'
- if $conf->exists('cust_main-require-bank-branch');
+ if $conf->config('echeck-country') eq 'CA';
$payinfo .= $cgi->param('payinfo2');
$cgi->param('payinfo',$payinfo);
}
diff --git a/httemplate/misc/payment.cgi b/httemplate/misc/payment.cgi
index 4a867d28d..093494a06 100644
--- a/httemplate/misc/payment.cgi
+++ b/httemplate/misc/payment.cgi
@@ -140,7 +140,7 @@
% or die "unparsable payinfo ". $cust_main->payinfo;
% ($account, $aba) = ($1, $2);
% ($branch,$aba) = split('\.',$aba)
-% if $conf->exists('cust_main-require-bank-branch');
+% if $conf->config('echeck-country') eq 'CA';
% $payname = $cust_main->payname;
% $ss = $cust_main->ss;
% $paytype = $cust_main->getfield('paytype');
@@ -148,6 +148,13 @@
% $stateid = $cust_main->getfield('stateid');
% $stateid_state = $cust_main->getfield('stateid_state');
% }
+%
+% #false laziness w/{edit,view}/cust_main/billing.html
+% my $routing_label = $conf->config('echeck-country') eq 'US'
+% ? 'ABA/Routing number'
+% : 'Routing number';
+% my $routing_size = $conf->config('echeck-country') eq 'CA' ? 4 : 10;
+% my $routing_maxlength = $conf->config('echeck-country') eq 'CA' ? 3 : 9;
<INPUT TYPE="hidden" NAME="month" VALUE="12">
<INPUT TYPE="hidden" NAME="year" VALUE="2037">
@@ -158,17 +165,17 @@
<TD><SELECT NAME="paytype"><% join('', map { qq!<OPTION VALUE="$_" !.($paytype eq $_ ? 'SELECTED' : '').">$_</OPTION>" } @FS::cust_main::paytypes) %></SELECT></TD>
</TR>
<TR>
- <TD ALIGN="right"><% mt('ABA/Routing number') |h %></TD>
+ <TD ALIGN="right"><% mt($routing_label) |h %></TD>
<TD>
- <INPUT TYPE="text" SIZE=10 MAXLENGTH=9 NAME="payinfo2" VALUE="<%$aba%>">
+ <INPUT TYPE="text" SIZE="<% $routing_size %>" MAXLENGTH="<% $routing_maxlength %>" NAME="payinfo2" VALUE="<%$aba%>">
(<A HREF="javascript:void(0);" onClick="overlib( OLiframeContent('../docs/ach.html', 380, 240, 'ach_popup' ), CAPTION, 'ACH Help', STICKY, AUTOSTATUSCAP, CLOSECLICK, DRAGGABLE ); return false;"><% mt('help') |h %></A>)
</TD>
</TR>
-% if ( $conf->exists('cust_main-require-bank-branch') ) {
+% if ( $conf->config('echeck-country') eq 'CA' ) {
<TR>
<TD ALIGN="right"><% mt('Branch number') |h %></TD>
<TD>
- <INPUT TYPE="text" NAME="payinfo3" VALUE="<%$branch%>">
+ <INPUT TYPE="text" NAME="payinfo3" VALUE="<%$branch%>" SIZE=6 MAXLENGTH=5>
</TD>
</TR>
% }
diff --git a/httemplate/misc/process/payment.cgi b/httemplate/misc/process/payment.cgi
index f4f9561dc..506e26684 100644
--- a/httemplate/misc/process/payment.cgi
+++ b/httemplate/misc/process/payment.cgi
@@ -86,8 +86,8 @@ if ( $payby eq 'CHEK' ) {
$cgi->param('payinfo2') =~ /^(\d+)$/
or errorpage("Illegal ABA/routing number ". $cgi->param('payinfo2'));
my $payinfo2 = $1;
- if ( $conf->exists('cust_main-require-bank-branch') ) {
- $cgi->param('payinfo3') =~ /^(\d+)$/
+ if ( $conf->config('echeck-country') eq 'CA' ) {
+ $cgi->param('payinfo3') =~ /^(\d{5})$/
or errorpage("Illegal branch number ". $cgi->param('payinfo2'));
$payinfo2 = "$1.$payinfo2";
}
diff --git a/httemplate/view/cust_main/billing.html b/httemplate/view/cust_main/billing.html
index 6e36e99e8..f1add6fcc 100644
--- a/httemplate/view/cust_main/billing.html
+++ b/httemplate/view/cust_main/billing.html
@@ -85,7 +85,7 @@
% } elsif ( $cust_main->payby eq 'CHEK' || $cust_main->payby eq 'DCHK') {
% my( $account, $aba ) = split('@', $cust_main->paymask );
% my $branch = '';
-% ($branch,$aba) = split('\.',$aba) if $conf->exists('cust_main-require-bank-branch');
+% ($branch,$aba) = split('\.',$aba) if $conf->config('echeck-country') eq 'CA';
% my $autodemand = $cust_main->payby eq 'CHEK' ? 'automatic' : 'on-demand';
@@ -93,12 +93,17 @@
</TD>
</TR>
+% #false laziness w/edit/cust_main/billing.html and misc/payment.cgi
+% my $routing_label = $conf->config('echeck-country') eq 'US'
+% ? 'ABA/Routing number'
+% : 'Routing number';
+
<TR>
- <TD ALIGN="right"><% mt('ABA/Routing code') |h %></TD>
+ <TD ALIGN="right"><% mt($routing_label) |h %></TD>
<TD BGCOLOR="#ffffff"><% $aba %></TD>
</TR>
-% if ( $conf->exists('cust_main-require-bank-branch') ) {
+% if ( $conf->config('echeck-country') eq 'CA' ) {
<TR>
<TD ALIGN="right"><% mt('Branch number') |h %></TD>
<TD BGCOLOR="#ffffff"><% $branch %></TD>