diff options
author | Jonathan Prykop <jonathan@freeside.biz> | 2016-02-25 09:14:26 -0600 |
---|---|---|
committer | Jonathan Prykop <jonathan@freeside.biz> | 2016-02-25 11:53:43 -0600 |
commit | fbba36b298b90d72884e8a46b74e9fd7b67b4d34 (patch) | |
tree | 2580b356e9fc0fd6ef36d1e6dcf84167c95f5631 /httemplate/misc | |
parent | 1694050ffbdb5c4e214bc0d13294d3b262d33129 (diff) |
RT#30600: Auto Apply for CC payments [v3 merge]
Diffstat (limited to 'httemplate/misc')
-rw-r--r-- | httemplate/misc/payment.cgi | 33 | ||||
-rw-r--r-- | httemplate/misc/process/payment.cgi | 3 |
2 files changed, 34 insertions, 2 deletions
diff --git a/httemplate/misc/payment.cgi b/httemplate/misc/payment.cgi index a48aa0120..2f76b85f1 100644 --- a/httemplate/misc/payment.cgi +++ b/httemplate/misc/payment.cgi @@ -204,11 +204,13 @@ </TD> </TR> +% my $disallow_no_auto_apply = 0; % if ( $conf->exists("batch-enable") % || grep $payby eq $_, $conf->config('batch-enable_payby') % ) { % % if ( grep $payby eq $_, $conf->config('realtime-disable_payby') ) { +% $disallow_no_auto_apply = 1; <INPUT TYPE="hidden" NAME="batch" VALUE="1"> @@ -216,7 +218,7 @@ <TR> <TD COLSPAN=2> - <INPUT TYPE="checkbox" NAME="batch" VALUE="1"> + <INPUT TYPE="checkbox" NAME="batch" VALUE="1" ID="batch_checkbox" ONCHANGE="change_batch_checkbox()"> <% mt('Add to current batch') |h %> </TD> </TR> @@ -231,6 +233,35 @@ </TD> </TR> +% unless ($disallow_no_auto_apply) { +% # false laziness with edit/cust_pay.cgi + +<TR ID="apply_box_row"> + <TD COLSPAN=2> + <% mt('Auto-apply to invoices') |h %> + <SELECT NAME="apply" ID="apply_box"> + <OPTION VALUE="yes" SELECTED><% mt('yes') |h %></OPTION> + <OPTION VALUE=""><% mt('not now') |h %></OPTION> + <OPTION VALUE="never"><% mt('never') |h %></OPTION> + </SELECT> + </TD> +</TR> + +% # this can go away if no_auto_apply handling gets added to batch payment processing +<SCRIPT> +function change_batch_checkbox () { + if (document.getElementById('batch_checkbox').checked) { + document.getElementById('apply_box').disabled = true; + document.getElementById('apply_box_row').style.display = 'none'; + } else { + document.getElementById('apply_box').disabled = false; + document.getElementById('apply_box_row').style.display = ''; + } +} +</SCRIPT> + +% } + </TABLE> <BR> diff --git a/httemplate/misc/process/payment.cgi b/httemplate/misc/process/payment.cgi index 78038f86b..7da7beff0 100644 --- a/httemplate/misc/process/payment.cgi +++ b/httemplate/misc/process/payment.cgi @@ -218,6 +218,7 @@ if ( $cgi->param('batch') ) { 'paycvv' => $paycvv, 'paynum_ref' => \$paynum, 'discount_term' => $discount_term, + 'no_auto_apply' => ($cgi->param('apply') eq 'never') ? 'Y' : '', map { $_ => scalar($cgi->param($_)) } @{$payby2fields{$payby}} ); errorpage($error) if $error; @@ -238,7 +239,7 @@ if ( $cgi->param('batch') ) { } - $cust_main->apply_payments; + $cust_main->apply_payments if ($cgi->param('apply') eq 'yes'); } |