From: Christopher Burger Date: Wed, 2 Aug 2017 18:59:59 +0000 (-0400) Subject: Merge branch 'FREESIDE_4_BRANCH' of freeside.biz:/home/git/freeside into FREESIDE_4_B... X-Git-Url: http://git.freeside.biz/gitweb/?a=commitdiff_plain;h=2c1dc1b870d4a01b3797797ac27640f0579c86c4;hp=95ad3a9ababb36a79c4425c54192659075819ca5;p=freeside.git Merge branch 'FREESIDE_4_BRANCH' of freeside.biz:/home/git/freeside into FREESIDE_4_BRANCH --- 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', diff --git a/fs_selfservice/FS-SelfService/cgi/change_pay.html b/fs_selfservice/FS-SelfService/cgi/change_pay.html index 6898dc7f8..e38ba762d 100644 --- a/fs_selfservice/FS-SelfService/cgi/change_pay.html +++ b/fs_selfservice/FS-SelfService/cgi/change_pay.html @@ -37,6 +37,11 @@ 'PREP' => qq/Prepaid Card/, 'PREPAY' => qq/Prepaid Card/, ); + + ## Don't show CHEK or DCHK option if ACH is read only + delete( $payby_index{'CHEK'} ) unless !$ach_read_only; + delete( $payby_index{'DCHK'} ) unless !$ach_read_only; + tie my %options, 'Tie::IxHash', (); foreach my $payby_option ( grep { exists( $payby_index{$_} ) } @paybys ) { $options{$payby_option} = $payby_index{$payby_option}; @@ -55,6 +60,9 @@ delete $options{'DCRD'} unless $payby eq 'DCRD' || ! exists $options{'CARD'}; delete $options{'DCHK'} unless $payby eq 'DCHK' || ! exists $options{'CHEK'}; + ## setting payby to default to layer if only one. should we always display first layer? + if (keys %options == 1) { @p = keys %options; $payby = $p[0]; } + HTML::Widgets::SelectLayers->new( options => \%options, selected_layer => $payby, diff --git a/fs_selfservice/FS-SelfService/cgi/check.html b/fs_selfservice/FS-SelfService/cgi/check.html index 68753fe08..17635c306 100644 --- a/fs_selfservice/FS-SelfService/cgi/check.html +++ b/fs_selfservice/FS-SelfService/cgi/check.html @@ -1,54 +1,97 @@ Account type - - + > + <%= + if ($ach_read_only) { + $OUT = $paytype . ''; + } else { + $OUT .= ''; + } + %> - + Account number - - + > + <%= if ($ach_read_only) { + $OUT = qq! $payinfo1 !; + } else { + $OUT = qq! !; + } + %> + + ABA/Routing number - + > + <%= + if ($ach_read_only) { + $OUT = qq! $payinfo2 !; + } else { + $OUT = qq! !; + } + %> + Bank name - - + > + <%= + if ($ach_read_only) { + $OUT = qq! $payname !; + } else { + $OUT = qq! !; + } + %> + + <%= $OUT = ''; if ($show_paystate) { - $OUT .= qq!Bank state !; + } else { + $OUT .= ''; } - $OUT .= ''; + $OUT .= ''; } %> <%= $OUT = ''; if ($show_ss) { - $OUT .= 'Account holder
Social '; - $OUT .= 'security or tax ID #'; - $OUT .= qq!!; - $OUT .= ''; + $OUT .= 'Account holder
Social '; + $OUT .= 'security or tax ID #'; + if ($ach_read_only) { + $OUT .= qq! $ss !; + } else { + $OUT .= qq!!; + } + $OUT .= ''; } %> <%= $OUT = ''; if ($show_stateid) { - $OUT .= ''; - $OUT .= qq!Account holder
$stateid_label!; - $OUT .= qq!!; - $OUT .= qq!$stateid_state_label!; - $OUT .= '!; + } else { + $OUT .= qq!!; + $OUT .= qq!$stateid_state_label!; + $OUT .= ''; } - $OUT .=''; + $OUT .=''; } %> - diff --git a/fs_selfservice/FS-SelfService/cgi/make_ach_payment.html b/fs_selfservice/FS-SelfService/cgi/make_ach_payment.html index 8c2dfe305..1183b2ba0 100644 --- a/fs_selfservice/FS-SelfService/cgi/make_ach_payment.html +++ b/fs_selfservice/FS-SelfService/cgi/make_ach_payment.html @@ -20,24 +20,28 @@ EOF Payment amount - <%= include('discount_term') %> <%= include('check') %> - - - - - + +<%= + $OUT = ''; + if ($ach_read_only) { + if ($payby eq 'CHEK') { + $OUT .= ''; + } + } else { + $OUT .= ''; + $OUT .= ''; + } +%> +
+
<%= $money_char %>
- NAME="save" VALUE="1"> - Remember this information -
- NAME="auto" VALUE="1" onClick="if (this.checked) { document.OneTrueForm.save.checked=true; }"> - Charge future payments to this account automatically -
'; + $OUT .= 'Remember this information
'; + $OUT .= 'Charge future payments to this account automatically

diff --git a/ng_selfservice/elements/check.php b/ng_selfservice/elements/check.php index b026c92e4..fd0cd6d91 100644 --- a/ng_selfservice/elements/check.php +++ b/ng_selfservice/elements/check.php @@ -1,50 +1,88 @@ + Account type - - + + + + Account number - - + > + + + + + + + ABA/Routing number - + > + + + + + Bank name - + > + + + + + - Bank state - - - - + + Bank state + > + + + + + + - Account holder
Social security or tax ID # - - + + Account holder
Social security or tax ID # + > + + + + + + - - Account holder
- - - + > + + + + + - + - diff --git a/ng_selfservice/payment_accounts.php b/ng_selfservice/payment_accounts.php new file mode 100644 index 000000000..e70142a0a --- /dev/null +++ b/ng_selfservice/payment_accounts.php @@ -0,0 +1,78 @@ + + +

My Payment Accounts

+
+ +delete_payby( array( + 'session_id' => $_COOKIE['session_id'], + 'custpaybynum' => $paybynum, + ) ); + } + else { + $error['error'] = 'Bad Payby Number'; + } + } + + if ( isset($error['error']) && $error['error'] ) { + $error = $error['error']; + } + else { + $error = "Account " . $paybynum . " Deleted"; + } + +?> + +

+list_payby( array( + 'session_id' => $_COOKIE['session_id'], + ) ); + + if ( isset($payment_info['error']) && $payment_info['error'] ) { + $error = $payment_info['error']; + header('Location:index.php?error='. urlencode($error)); + die(); + } + + extract($payment_info); +?> + + + + + + + + + + + + + + + + + + + + +
 TypeAccount TypeAccount MaskBank Name
delete
+ + + diff --git a/ng_selfservice/payment_ach.php b/ng_selfservice/payment_ach.php index ecbd9c749..a3dce76c4 100644 --- a/ng_selfservice/payment_ach.php +++ b/ng_selfservice/payment_ach.php @@ -54,7 +54,7 @@ if ( $receipt_html ) { ?> $error = $payment_error; - ?> +?> @@ -82,6 +82,12 @@ if ( $receipt_html ) { ?> + + + + + + NAME="save" VALUE="1"> @@ -93,6 +99,8 @@ if ( $receipt_html ) { ?> Charge future payments to this account automatically + +