summaryrefslogtreecommitdiff
path: root/FS/FS/ClientAPI
diff options
context:
space:
mode:
authorChristopher Burger <burgerc@freeside.biz>2017-07-26 10:53:18 -0400
committerChristopher Burger <burgerc@freeside.biz>2017-08-02 14:10:13 -0400
commit3c41e68629274c5ea6ff31c0d88e6d3fc6b9af8b (patch)
treed1815be02dd46910318ad378af77eaedfb95a2ca /FS/FS/ClientAPI
parent08d7466e4273dce948666c357b50ba4f39c97e02 (diff)
RT# 74537 - added checks in MyAccount.pm for config option ach read only
Diffstat (limited to 'FS/FS/ClientAPI')
-rw-r--r--FS/FS/ClientAPI/MyAccount.pm13
1 files changed, 11 insertions, 2 deletions
diff --git a/FS/FS/ClientAPI/MyAccount.pm b/FS/FS/ClientAPI/MyAccount.pm
index 49e61ab..2b4d52d 100644
--- a/FS/FS/ClientAPI/MyAccount.pm
+++ b/FS/FS/ClientAPI/MyAccount.pm
@@ -742,6 +742,11 @@ sub edit_info {
my $cust_main = qsearchs('cust_main', { 'custnum' => $custnum } )
or return { 'error' => "unknown custnum $custnum" };
+ my $conf = new FS::Conf;
+ if (($p->{payby} eq "CHEK" || $p->{payby} eq "DCHEK") && $conf->exists('selfservice-ACH_info_readonly')) {
+ return { 'error' => "You do not have authority to add a bank account" };
+ }
+
my $new = new FS::cust_main { $cust_main->hash };
$new->set( $_ => $p->{$_} )
@@ -769,8 +774,6 @@ sub edit_info {
# but if it hasn't been passed in at all, leave ship_location alone--
# DON'T change it to match bill_location.
- my $conf = new FS::Conf;
-
my @invoicing_list;
if ( exists $p->{'invoicing_list'} || exists $p->{'postal_invoicing'} ) {
#false laziness with httemplate/edit/process/cust_main.cgi
@@ -987,12 +990,18 @@ sub validate_payment {
my $payinfo2 = $1;
$payinfo = $payinfo1. '@'. $payinfo2;
+ my $achonfile = 0;
foreach my $cust_payby ($cust_main->cust_payby('CHEK','DCHK')) {
if ( $cust_payby->paymask eq $payinfo ) {
$payinfo = $cust_payby->payinfo;
+ $achonfile = 1;
last;
}
}
+
+ if ($conf->exists('selfservice-ACH_info_readonly') && !$achonfile) {
+ return { 'error' => "You are not allowed to change your payment information." };
+ }
} elsif ( $payby eq 'CARD' || $payby eq 'DCRD' ) {