projects
/
freeside.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
8b8d621
)
RT# 80514 Selfservice can update ssn/stateid payment info
author
Mitch Jackson
<mitch@freeside.biz>
Mon, 11 Jun 2018 23:37:13 +0000
(18:37 -0500)
committer
Mitch Jackson
<mitch@freeside.biz>
Mon, 11 Jun 2018 23:37:13 +0000
(18:37 -0500)
FS/FS/ClientAPI/MyAccount.pm
patch
|
blob
|
history
diff --git
a/FS/FS/ClientAPI/MyAccount.pm
b/FS/FS/ClientAPI/MyAccount.pm
index
f827874
..
60a70fd
100644
(file)
--- a/
FS/FS/ClientAPI/MyAccount.pm
+++ b/
FS/FS/ClientAPI/MyAccount.pm
@@
-1727,9
+1727,6
@@
sub update_payby {
$p->{'payinfo'} = $payinfo1. '@'. $payinfo2;
}
$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'},
my $cust_payby = qsearchs('cust_payby', {
'custnum' => $custnum,
'custpaybynum' => $p->{'custpaybynum'},
@@
-1746,26
+1743,23
@@
sub update_payby {
$cust_payby->set($field,$p->{$field});
}
$cust_payby->set($field,$p->{$field});
}
- my $error = $cust_payby->replace;
+ # Update column if given a value, and the given value wasn't
+ # the value generated by $cust_main->masked($column);
+ $cust_main->set( $_, $p->{$_} )
+ for grep{ $p->{$_} !~ /^x/i; }
+ grep{ exists $p->{$_} }
+ qw/ss stateid/;
- 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;
- }
+ # Perform updates within a transaction
+ local $FS::UID::AutoCommit = 0;
- if (
$error
) {
+ if (
my $error = $cust_payby->replace || $cust_main->replace
) {
dbh->rollback;
dbh->rollback;
- return { 'error' => $error };
- } else {
- dbh->commit;
- return { 'custpaybynum' => $cust_payby->custpaybynum };
+ return { error => $error };
}
}
-
+
+ dbh->commit;
+ return { custpaybynum => $cust_payby->custpaybynum };
}
sub verify_payby {
}
sub verify_payby {