4.x style credit card payment
[freeside.git] / httemplate / misc / payment.cgi
index 02648a8..35f57e8 100644 (file)
@@ -1,6 +1,6 @@
-<& /elements/header.html, mt("Process [_1] payment",$type{$payby})  &>
-<& /elements/small_custview.html, $cust_main, '', '', popurl(2) . "view/cust_main.cgi" &>
-<BR>
+<& /elements/header-cust_main.html, view=>'payment_history', cust_main=>$cust_main &>
+
+<h2><% emt("Process [_1] payment",$type{$payby}) %></h2>
 
 <FORM NAME="OneTrueForm" ACTION="process/payment.cgi" METHOD="POST" onSubmit="document.OneTrueForm.process.disabled=true">
 <INPUT TYPE="hidden" NAME="custnum"   VALUE="<% $custnum %>">
@@ -21,7 +21,7 @@
        'num_payments'       => scalar($cust_main->cust_pay), 
        'surcharge_percentage' =>
          ( $payby eq 'CARD'
-             ? scalar($conf->config('credit-card-surcharge-percentage'))
+             ? scalar($conf->config('credit-card-surcharge-percentage', $cust_main->agentnum))
              : 0
          ),
   &>
     &>
 % }
 
+% 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>
+    <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
   </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; }">
 <INPUT TYPE="submit" NAME="process" VALUE="<% mt('Process payment') |h %>">
 </FORM>
 
-<& /elements/footer.html &>
+<& /elements/footer-cust_main.html &>
 <%once>
 
 my %weight = (