[freeside-commits] branch FREESIDE_4_BRANCH updated. c43a82b640f8c4ec8a43debf7b6e11379aef53e4

Mark Wells mark at 420.am
Fri Jun 3 23:00:29 PDT 2016


The branch, FREESIDE_4_BRANCH has been updated
       via  c43a82b640f8c4ec8a43debf7b6e11379aef53e4 (commit)
      from  c66e2ded844dbf3d0f23a70db96f0535e111400d (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 c43a82b640f8c4ec8a43debf7b6e11379aef53e4
Author: Mark Wells <mark at freeside.biz>
Date:   Fri Jun 3 22:58:35 2016 -0700

    ignore weight when editing DCRD/DCHK payment methods, #71176

diff --git a/FS/FS/cust_payby.pm b/FS/FS/cust_payby.pm
index 623a44e..62fa9be 100644
--- a/FS/FS/cust_payby.pm
+++ b/FS/FS/cust_payby.pm
@@ -715,6 +715,9 @@ sub cgi_hash_callback {
     'CARD' => 'DCRD',
     'CHEK' => 'DCHK',
   );
+  # the payby selector gives the choice of CARD or CHEK (or others, but
+  # those are the ones with auto and on-demand versions). if the user didn't
+  # choose a weight, then they mean DCRD/DCHK.
   $hashref->{payby} = $noauto{$hashref->{payby}}
     if ! $hashref->{weight} && exists $noauto{$hashref->{payby}};
 
diff --git a/httemplate/elements/cust_payby.html b/httemplate/elements/cust_payby.html
index 60e6eb8..f30d185 100644
--- a/httemplate/elements/cust_payby.html
+++ b/httemplate/elements/cust_payby.html
@@ -298,8 +298,17 @@ if ( $curr_value ) {
   $cust_payby = new FS::cust_payby {};
 }
 my $sel_payby = $cgi->param($name.'_payby') || $cust_payby->payby;
-$sel_payby = 'CARD' if $sel_payby eq 'DCRD' || $sel_payby eq '';
-$sel_payby = 'CHEK' if $sel_payby eq 'DCHK';
+# convert DCRD to CARD + no weight, and the same for DCHK/CHEK
+if ($sel_payby eq 'DCRD') {
+  $sel_payby = 'CARD';
+  $cust_payby->weight('');
+} elsif ($sel_payby eq 'DCHK') {
+  $sel_payby = 'CHEK';
+  $cust_payby->weight('');
+} elsif (!$sel_payby) {
+  # default
+  $sel_payby = 'CARD';
+}
 
 my @payby = FS::payby->cust_payby;
 my %conf_payby = map { $_=>1 } $conf->config('payby');

-----------------------------------------------------------------------

Summary of changes:
 FS/FS/cust_payby.pm                 |    3 +++
 httemplate/elements/cust_payby.html |   13 +++++++++++--
 2 files changed, 14 insertions(+), 2 deletions(-)




More information about the freeside-commits mailing list