diff options
author | Ivan Kohler <ivan@freeside.biz> | 2016-01-20 04:46:18 -0800 |
---|---|---|
committer | Ivan Kohler <ivan@freeside.biz> | 2016-01-20 04:46:18 -0800 |
commit | 5d5ed9e94c8c9520f8d36ef23bbe47a135c35639 (patch) | |
tree | 5e7895abe02a8e800caf74fe0a3442d2264db8bc /FS | |
parent | c2a09342f58d6a6bb78594c388ededc681416d89 (diff) | |
parent | 4324774d690f418e1c6ddfcdf12f5c222a073144 (diff) |
Merge branch 'master' of git.freeside.biz:/home/git/freeside
Diffstat (limited to 'FS')
-rw-r--r-- | FS/FS/cust_payby.pm | 15 | ||||
-rw-r--r-- | FS/FS/o2m_Common.pm | 2 |
2 files changed, 15 insertions, 2 deletions
diff --git a/FS/FS/cust_payby.pm b/FS/FS/cust_payby.pm index b9e79a2be..83b951eda 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 diff --git a/FS/FS/o2m_Common.pm b/FS/FS/o2m_Common.pm index 430f00bbb..915393ae9 100644 --- a/FS/FS/o2m_Common.pm +++ b/FS/FS/o2m_Common.pm @@ -111,7 +111,7 @@ sub process_o2m { map { $_ => $opt{'params'}->{$add_param."_$_"} } @{ $opt{'fields'} } ); - &{ $opt{'hash_callback'} }( \%hash ) if $opt{'hash_callback'}; + &{ $opt{'hash_callback'} }( \%hash, $old_obj ) if $opt{'hash_callback'}; #next unless grep { $_ =~ /\S/ } values %hash; my $new_obj = "FS::$table"->new( { %$hashref, %hash } ); |