summaryrefslogtreecommitdiff
path: root/httemplate/misc/payment.cgi
diff options
context:
space:
mode:
authorJonathan Prykop <jonathan@freeside.biz>2016-02-25 09:14:26 -0600
committerJonathan Prykop <jonathan@freeside.biz>2016-02-25 09:14:26 -0600
commit05dee44cdb4e93df6963ae396f916705c4086f86 (patch)
treeb36b08ab2dc85027be2800e225498ae0c78f9f2e /httemplate/misc/payment.cgi
parent82947aebf5bd25d69cf3da8b658b22df76629c9b (diff)
RT#30600: Auto Apply for CC payments
Diffstat (limited to 'httemplate/misc/payment.cgi')
-rw-r--r--httemplate/misc/payment.cgi71
1 files changed, 51 insertions, 20 deletions
diff --git a/httemplate/misc/payment.cgi b/httemplate/misc/payment.cgi
index 02648a821..f30e4098e 100644
--- a/httemplate/misc/payment.cgi
+++ b/httemplate/misc/payment.cgi
@@ -33,6 +33,57 @@
&>
% }
+% 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">
+
+% } else {
+
+ <TR>
+ <TH ALIGN="right">&nbsp;&nbsp;&nbsp;<% mt('Add to current batch') |h %></TH>
+ <TD>
+ <INPUT TYPE="checkbox" NAME="batch" VALUE="1" ID="batch_checkbox" ONCHANGE="change_batch_checkbox()">
+ </TD>
+ </TR>
+
+% }
+% }
+
+% unless ($disallow_no_auto_apply) {
+% # false laziness with edit/cust_pay.cgi
+
+<TR ID="apply_box_row">
+ <TH ALIGN="right"><% mt('Auto-apply to invoices') |h %></TH>
+ <TD COLSPAN=2>
+ <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>
+
+% }
+
<SCRIPT TYPE="text/javascript">
function cust_payby_changed (what) {
var custpaybynum = what.options[what.selectedIndex].value
@@ -234,26 +285,6 @@
</TD>
</TR>
-% if ( $conf->exists("batch-enable")
-% || grep $payby eq $_, $conf->config('batch-enable_payby')
-% ) {
-%
-% if ( grep $payby eq $_, $conf->config('realtime-disable_payby') ) {
-
- <INPUT TYPE="hidden" NAME="batch" VALUE="1">
-
-% } else {
-
- <TR>
- <TD COLSPAN=2>
- <INPUT TYPE="checkbox" NAME="batch" VALUE="1">
- <% mt('Add to current batch') |h %>
- </TD>
- </TR>
-
-% }
-% }
-
<TR>
<TD COLSPAN=8>
<INPUT TYPE="checkbox"<% $auto ? ' CHECKED' : '' %> NAME="auto" VALUE="1" onClick="if (this.checked) { document.OneTrueForm.save.checked=true; }">