[freeside-commits] branch master updated. ca2f12276eb88b2e71762c76974ae564f008b8c1

Christopher Burger burgerc at freeside.biz
Tue Jan 2 16:48:24 PST 2018


The branch, master has been updated
       via  ca2f12276eb88b2e71762c76974ae564f008b8c1 (commit)
      from  4d873df8a99f87a6427a58ccd3e69b1c9474f44a (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 ca2f12276eb88b2e71762c76974ae564f008b8c1
Author: Christopher Burger <burgerc at freeside.biz>
Date:   Tue Jan 2 19:47:44 2018 -0500

    RT# 34134 - removed payment amount field from payment screen, added 3 payment options (pay full balance, pay specific invoice, pay another amount) which will prefill the payment amount field.

diff --git a/httemplate/elements/tr-amount_fee.html b/httemplate/elements/tr-amount_fee.html
index 12488521a..426957a80 100644
--- a/httemplate/elements/tr-amount_fee.html
+++ b/httemplate/elements/tr-amount_fee.html
@@ -1,4 +1,4 @@
-  <TR>
+  <TR ID="payment_amount_row" STYLE="display:none;">
     <TH ALIGN="right"><% mt('Payment amount') |h %></TH>
     <TD COLSPAN=7>
       <TABLE><TR><TD BGCOLOR="#ffffff">
@@ -15,7 +15,7 @@
                                   onKeyPress = "amount_changed(this)"
 %                               }
                          >
-      </TD><TD BGCOLOR="#cccccc">
+      </TD><TD BGCOLOR="<% length($fee) ? '#cccccc' : '#ffffff' %>">
 %        if ( $fee ) {
            <INPUT TYPE="hidden" NAME="fee_pkgpart" VALUE="<% $fee_pkg->pkgpart %>">
            <INPUT TYPE="hidden" NAME="fee" VALUE="<% $fee_display eq 'add' ? $fee : '' %>">
diff --git a/httemplate/elements/tr-select-invoice.html b/httemplate/elements/tr-select-invoice.html
new file mode 100644
index 000000000..03625b659
--- /dev/null
+++ b/httemplate/elements/tr-select-invoice.html
@@ -0,0 +1,25 @@
+
+  <TR ID="invoice_row" STYLE="display:none;">
+    <TH ALIGN="right"><% mt('Open invoices') |h %></TH>
+    <TD COLSPAN=7>
+     <SELECT
+  	  ID       = "<% $opt{prefix} %>invoice"
+  	  NAME     = "<% $opt{prefix} %>invoice"
+  	  onChange = "<% $opt{prefix} %>invoice_select_changed(this)"
+  	  <% $opt{disabled} %>
+	>
+  		<OPTION VALUE="select">Select an invoice to pay</OPTION>
+%         foreach my $record (@records) {
+%            my $read_date = time2str("%b %o, %Y", $record->_date);
+            <OPTION VALUE="<% $record->charged %>"><% $record->invnum %> (<% $read_date %>) - <% $record->charged %></OPTION>	
+%         }
+
+	</SELECT>	
+    </TD>
+  </TR>
+
+<%init>
+
+my %opt = @_;
+
+</%init>
diff --git a/httemplate/elements/tr-select-payment_options.html b/httemplate/elements/tr-select-payment_options.html
new file mode 100644
index 000000000..5197c3706
--- /dev/null
+++ b/httemplate/elements/tr-select-payment_options.html
@@ -0,0 +1,68 @@
+
+  <TR STYLE="display:block">
+    <TH ALIGN="right"><% mt('Payment options') |h %></TH>
+    <TD COLSPAN=7>
+     <SELECT
+  	  ID       = "<% $opt{prefix} %>payment_option"
+  	  NAME     = "<% $opt{prefix} %>payment_option"
+  	  onChange = "<% $opt{prefix} %>payment_option_changed(this)"
+  	  <% $opt{disabled} %>
+	>
+  		<OPTION VALUE="select">Select payment option</OPTION>
+  		<OPTION VALUE="<% $opt{amount} %>">Pay full balance</OPTION>
+  		<OPTION VALUE="invoice">Pay specific invoice</OPTION>
+  		<OPTION VALUE="">Pay specific amount</OPTION>
+	</SELECT>	
+    </TD>
+  </TR>
+
+  <& /elements/tr-select-invoice.html,
+       %opt
+  &>
+
+  <& /elements/tr-amount_fee.html,
+       %opt
+  &>
+
+  <SCRIPT TYPE="text/javascript">
+
+      function <% $opt{prefix} %>payment_option_changed(what) {
+
+        if ( what.value == 'select' ) {
+        	document.getElementById('payment_amount_row').style.display = 'none';
+        	document.getElementById('invoice_row').style.display = 'none';
+        	document.getElementById('amount').value = '';
+        }
+        else if ( what.value == 'invoice' ) {
+        	document.getElementById('payment_amount_row').style.display = 'none';
+        	document.getElementById('invoice_row').style.display = 'block';
+        	document.getElementById('amount').value = '';
+        }
+        else {
+        	document.getElementById('payment_amount_row').style.display = 'block';
+        	document.getElementById('invoice_row').style.display = 'none';
+        	document.getElementById('amount').value = what.value;
+        }
+
+      }
+
+      function <% $opt{prefix} %>invoice_select_changed(what) {
+
+        if ( what.value == 'select' ) {
+        	document.getElementById('payment_amount_row').style.display = 'none';
+        	document.getElementById('amount').value = '';
+        }
+        else {
+        	document.getElementById('payment_amount_row').style.display = 'block';
+        	document.getElementById('amount').value = what.value;
+        }
+
+      }
+
+</SCRIPT>
+
+<%init>
+
+my %opt = @_;
+
+</%init>
\ No newline at end of file
diff --git a/httemplate/misc/payment.cgi b/httemplate/misc/payment.cgi
index 35f57e8d6..7bf1713ff 100644
--- a/httemplate/misc/payment.cgi
+++ b/httemplate/misc/payment.cgi
@@ -12,7 +12,8 @@
 
 <TABLE class="fsinnerbox">
 
-  <& /elements/tr-amount_fee.html,
+  <& /elements/tr-select-payment_options.html,
+       'custnum'            => $cust_main->custnum,
        'amount'             => $amount,
        'process-pkgpart'    => 
           scalar($conf->config('manual_process-pkgpart', $cust_main->agentnum)),

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

Summary of changes:
 httemplate/elements/tr-amount_fee.html             |  4 +-
 httemplate/elements/tr-select-invoice.html         | 25 ++++++++
 httemplate/elements/tr-select-payment_options.html | 68 ++++++++++++++++++++++
 httemplate/misc/payment.cgi                        |  3 +-
 4 files changed, 97 insertions(+), 3 deletions(-)
 create mode 100644 httemplate/elements/tr-select-invoice.html
 create mode 100644 httemplate/elements/tr-select-payment_options.html




More information about the freeside-commits mailing list