summaryrefslogtreecommitdiff
path: root/FS
diff options
context:
space:
mode:
Diffstat (limited to 'FS')
-rw-r--r--FS/FS/ClientAPI/MyAccount.pm23
-rw-r--r--FS/FS/Conf.pm7
2 files changed, 26 insertions, 4 deletions
diff --git a/FS/FS/ClientAPI/MyAccount.pm b/FS/FS/ClientAPI/MyAccount.pm
index 505111e1a..5c86b7820 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
@@ -840,6 +843,7 @@ sub payment_info {
'show_paystate' => $conf->exists('show_bankstate'),
'save_unchecked' => $conf->exists('selfservice-save_unchecked'),
+ 'ach_read_only' => $conf->exists('selfservice-ACH_info_readonly'),
};
@@ -986,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' ) {
@@ -1738,8 +1748,13 @@ sub delete_payby {
})
or return { 'error' => 'unknown custpaybynum '. $p->{'custpaybynum'} };
- return { 'error' => $cust_payby->delete };
-
+ my $conf = new FS::Conf;
+ if (($cust_payby->payby eq "DCHK" || $cust_payby->payby eq "CHEK") && $conf->exists('selfservice-ACH_info_readonly')) {
+ return { 'error' => "Sorry you do not have permission to delete bank information." };
+ }
+ else {
+ return { 'error' => $cust_payby->delete };
+ }
}
sub cancel {
diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm
index 5ab9a3ff6..b5b5ec89e 100644
--- a/FS/FS/Conf.pm
+++ b/FS/FS/Conf.pm
@@ -5823,6 +5823,13 @@ and customer address. Include units.',
},
{
+ 'key' => 'selfservice-ACH_info_readonly',
+ 'section' => 'self-service',
+ 'description' => 'make ACH on self service portal read only',
+ 'type' => 'checkbox',
+ },
+
+ {
'key' => 'selfservice-announcement',
'section' => 'self-service',
'description' => 'HTML announcement to display to all authenticated users on account overview page',