[freeside-commits] branch master updated. 8b8d621a1bb4e9abaa1f0edab5190d302e6a6e99
Mitch Jackson
mitch at freeside.biz
Mon Jun 11 13:09:23 PDT 2018
The branch, master has been updated
via 8b8d621a1bb4e9abaa1f0edab5190d302e6a6e99 (commit)
from f04d95852fef6dfaf1813ceacd94f68a528796cd (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 8b8d621a1bb4e9abaa1f0edab5190d302e6a6e99
Author: Mitch Jackson <mitch at freeside.biz>
Date: Mon Jun 11 15:06:50 2018 -0500
RT# 80514 Selfservice can update ssn/stateid payment info
diff --git a/FS/FS/ClientAPI/MyAccount.pm b/FS/FS/ClientAPI/MyAccount.pm
index a30dde568..f82787482 100644
--- a/FS/FS/ClientAPI/MyAccount.pm
+++ b/FS/FS/ClientAPI/MyAccount.pm
@@ -1727,12 +1727,18 @@ sub update_payby {
$p->{'payinfo'} = $payinfo1. '@'. $payinfo2;
}
+ # Perform update within a transaction
+ local $FS::UID::AutoCommit = 0;
+
my $cust_payby = qsearchs('cust_payby', {
'custnum' => $custnum,
'custpaybynum' => $p->{'custpaybynum'},
})
or return { 'error' => 'unknown custpaybynum '. $p->{'custpaybynum'} };
+ my $cust_main = qsearchs( 'cust_main', {custnum => $cust_payby->custnum} )
+ or return { 'error' => 'unknown custnum '.$cust_payby->custnum };
+
foreach my $field (
qw( weight payby payinfo paycvv paydate payname paystate paytype payip )
) {
@@ -1741,9 +1747,22 @@ sub update_payby {
}
my $error = $cust_payby->replace;
+
+ if (!$error) {
+ my $is_changed = 0;
+ for my $field ( qw/ss stateid/ ) {
+ next if !exists $p->{$field} || $p->{$field} =~ /^x/i;
+ $cust_main->set( $field, $p->{$field} );
+ $is_changed = 1;
+ }
+ $error = $cust_main->replace if $is_changed;
+ }
+
if ( $error ) {
+ dbh->rollback;
return { 'error' => $error };
} else {
+ dbh->commit;
return { 'custpaybynum' => $cust_payby->custpaybynum };
}
-----------------------------------------------------------------------
Summary of changes:
FS/FS/ClientAPI/MyAccount.pm | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
More information about the freeside-commits
mailing list