summaryrefslogtreecommitdiff
path: root/FS
diff options
context:
space:
mode:
authorivan <ivan>2012-01-14 07:05:15 +0000
committerivan <ivan>2012-01-14 07:05:15 +0000
commitfa33561ed20c57b0f63221d6a0f9c0cf5ebbef14 (patch)
tree4228f84cbe9ec763598097aa86aecdd3b275a407 /FS
parent679fbd2023aa5d87308c2f3d7d5360cfd3c8354a (diff)
improve echeck validation for canada, deprecate echeck-nonus and cust_main-require-bank-branch config in favor of echeck-country, RT#15982
Diffstat (limited to 'FS')
-rw-r--r--FS/FS/Conf.pm18
-rw-r--r--FS/FS/Upgrade.pm10
-rw-r--r--FS/FS/cust_main.pm11
3 files changed, 27 insertions, 12 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);