summaryrefslogtreecommitdiff
path: root/FS/FS/cust_payby.pm
diff options
context:
space:
mode:
authorJonathan Prykop <jonathan@freeside.biz>2016-01-19 15:07:15 -0600
committerJonathan Prykop <jonathan@freeside.biz>2016-01-26 14:49:28 -0600
commit5a78e56cf10aea5374cf86cf9b6f1d1f75fcbba5 (patch)
treea8d632df5174c130cd7ec7988a8f54c2f98acf38 /FS/FS/cust_payby.pm
parent59ca431c6fcc1bd01ed5c2227b490681f18ef6f3 (diff)
RT#38363: use cust_payby when saving cards during payments [editing from cust_main]
Diffstat (limited to 'FS/FS/cust_payby.pm')
-rw-r--r--FS/FS/cust_payby.pm15
1 files changed, 14 insertions, 1 deletions
diff --git a/FS/FS/cust_payby.pm b/FS/FS/cust_payby.pm
index b9e79a2..83b951e 100644
--- a/FS/FS/cust_payby.pm
+++ b/FS/FS/cust_payby.pm
@@ -577,15 +577,20 @@ sub cgi_cust_payby_fields {
payinfo1 payinfo2 payinfo3 paytype paystate payname_CHEK )];
}
-=item cgi_hash_callback HASHREF
+=item cgi_hash_callback HASHREF OLD
Subroutine (not a class or object method). Processes a hash reference
of web interface contet (transfers the data from pseudo-fields to real fields).
+If OLD object is passed, also preserves locationnum, paystart_month, paystart_year,
+payissue and payip. If the new field is blank but the old is not, the old field
+will be preserved.
+
=cut
sub cgi_hash_callback {
my $hashref = shift;
+ my $old = shift;
my %noauto = (
'CARD' => 'DCRD',
@@ -619,6 +624,14 @@ sub cgi_hash_callback {
$hashref->{paydate}= $hashref->{paydate_month}. '-'. $hashref->{paydate_year};
+ if ($old) {
+ foreach my $field ( qw(locationnum paystart_month paystart_year payissue payip) ) {
+ next if $hashref->{$field};
+ next unless $old->get($field);
+ $hashref->{$field} = $old->get($field);
+ }
+ }
+
}
=item search_sql