[freeside-commits] branch FREESIDE_4_BRANCH updated. 2134c57999b90936f5d92d068e67e39c9fe60b35

Christopher Burger burgerc at freeside.biz
Tue Jun 19 10:29:37 PDT 2018


The branch, FREESIDE_4_BRANCH has been updated
       via  2134c57999b90936f5d92d068e67e39c9fe60b35 (commit)
       via  701415fd9948ad8b3a8fb8468b7fcc573a5b65ea (commit)
       via  c6df39fee9ee1403743e60f86d2773808eeb119d (commit)
       via  79858b72262cccb76d6ec9804a28911c45de1239 (commit)
       via  72d85b9d8d072344f8e68487cf285ed98960d563 (commit)
       via  2d99d3bc66423a833a67e42f88283d240e91fb7a (commit)
       via  dcb7068e87e2130f939f6e83c3d40187ad39863a (commit)
       via  929f727a3d09b7f4d4918fc6b15aade1a0e43ce6 (commit)
       via  c187712be2bdaf85586bfcf6b4070dbe165a33dd (commit)
      from  697a391b0449e62b593a6cd4931aa457d9a0c45d (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 2134c57999b90936f5d92d068e67e39c9fe60b35
Author: Christopher Burger <burgerc at freeside.biz>
Date:   Tue Jun 19 13:08:59 2018 -0400

    RT# 34134 - readded config option and move to deprecated section

diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm
index 50c0a5d83..9bdd67f7a 100644
--- a/FS/FS/Conf.pm
+++ b/FS/FS/Conf.pm
@@ -2805,6 +2805,13 @@ and customer address. Include units.',
   },
 
   {
+    'key'         => 'manual_process-single_invoice_amount',
+    'section'     => 'deprecated',
+    'description' => 'When entering manual credit card and ACH payments, amount will not autofill if the customer has more than one open invoice',
+    'type'        => 'checkbox',
+  },
+
+  {
     'key'         => 'manual_process-pkgpart',
     'section'     => 'payments',
     'description' => 'Package to add to each manual credit card and ACH payment entered by employees from the backend.  WARNING: Although recently permitted to US merchants in general, specific consumer protection laws may prohibit or restrict this practice in California, Colorado, Connecticut, Florda, Kansas, Maine, Massachusetts, New York, Oklahome, and Texas. Surcharging is also generally prohibited in most countries outside the US, AU and UK.',

commit 701415fd9948ad8b3a8fb8468b7fcc573a5b65ea
Author: Christopher Burger <burgerc at freeside.biz>
Date:   Wed May 16 09:15:39 2018 -0400

    RT# 34134 - fixed initial display of surcharge amount

diff --git a/httemplate/elements/tr-amount_fee.html b/httemplate/elements/tr-amount_fee.html
index 3ad2cdf06..1c78d7ec1 100644
--- a/httemplate/elements/tr-amount_fee.html
+++ b/httemplate/elements/tr-amount_fee.html
@@ -32,7 +32,7 @@
            <INPUT TYPE="hidden" NAME="surcharge_percentage" ID="surcharge_percentage" VALUE="<% $surcharge_percentage %>">
            <INPUT TYPE="hidden" NAME="surcharge_flatfee" ID="surcharge_flatfee" VALUE="<% $surcharge_flatfee %>">
       </TD><TD ID="ajax_surcharge_cell" BGCOLOR="#dddddd" STYLE="border:1px solid blue">
-           <FONT SIZE="+1">A credit card surcharge of <% $money_char. sprintf('%.2f', ($amount * $surcharge_percentage) + $surcharge_flatfee) %> is included in this payment</FONT>
+           <FONT SIZE="+1">A credit card surcharge of <% $money_char. sprintf('%.2f', $surcharge) %> is included in this payment</FONT>
 %        }
       </TD></TR></TABLE>
     </TD>

commit c6df39fee9ee1403743e60f86d2773808eeb119d
Author: Christopher Burger <burgerc at freeside.biz>
Date:   Tue May 15 14:53:38 2018 -0400

    RT# 34134 - Fixed error with amount not being sent when field disabled.

diff --git a/httemplate/elements/tr-select-payment_options.html b/httemplate/elements/tr-select-payment_options.html
index 15f92775a..a59963a91 100644
--- a/httemplate/elements/tr-select-payment_options.html
+++ b/httemplate/elements/tr-select-payment_options.html
@@ -91,6 +91,7 @@ Example:
         	document.getElementById('invoice_row').style.display = 'none';
           document.getElementById('<% $opt{prefix} %>invoice').value = 'select';
           document.getElementById('amount').value = amount.toFixed(2);
+          document.getElementById('amount').disabled = false;
           if (document.getElementById('ajax_surcharge_cell')) {
             document.getElementById('ajax_surcharge_cell').innerHTML = '<FONT SIZE="+1">A credit card surcharge of <% $money_char %>' + surcharge.toFixed(2) + ' is included in this payment</FONT>';
           }
@@ -115,6 +116,7 @@ Example:
         else {
         	document.getElementById('payment_amount_row').style.display = 'block';
           document.getElementById('amount').value = amount.toFixed(2);
+          document.getElementById('amount').disabled = false;
           if (document.getElementById('ajax_surcharge_cell')) {
             document.getElementById('ajax_surcharge_cell').innerHTML = '<FONT SIZE="+1">A credit card surcharge of <% $money_char %>' + surcharge.toFixed(2) + ' is included in this payment</FONT>';
           }

commit 79858b72262cccb76d6ec9804a28911c45de1239
Author: Christopher Burger <burgerc at freeside.biz>
Date:   Mon May 14 10:21:15 2018 -0400

    RT# 34134 - fixed error with credit surchage not attached to total

diff --git a/httemplate/elements/tr-amount_fee.html b/httemplate/elements/tr-amount_fee.html
index 9e6d9e96d..3ad2cdf06 100644
--- a/httemplate/elements/tr-amount_fee.html
+++ b/httemplate/elements/tr-amount_fee.html
@@ -8,7 +8,7 @@
                                 VALUE    = "<% $amount %>"
                                 SIZE     = 8
                                 STYLE    = "text-align:right;"
-%                               if ( $fee ) {
+%                               if ( $fee || $surcharge ) {
                                   onChange   = "amount_changed(this)"
                                   onKeyDown  = "amount_changed(this)"
                                   onKeyUp    = "amount_changed(this)"
@@ -28,17 +28,23 @@
            <FONT SIZE="+1"><% length($amount) ? $money_char. sprintf('%.2f', ($fee_display eq 'add') ? $amount + $fee : $amount - $fee ) : '' %> <% $fee_display eq 'add' ? 'TOTAL' : 'AVAILABLE' %></FONT>
   
 %        }
+%        if ( $surcharge ) {
+           <INPUT TYPE="hidden" NAME="surcharge_percentage" ID="surcharge_percentage" VALUE="<% $surcharge_percentage %>">
+           <INPUT TYPE="hidden" NAME="surcharge_flatfee" ID="surcharge_flatfee" VALUE="<% $surcharge_flatfee %>">
+      </TD><TD ID="ajax_surcharge_cell" BGCOLOR="#dddddd" STYLE="border:1px solid blue">
+           <FONT SIZE="+1">A credit card surcharge of <% $money_char. sprintf('%.2f', ($amount * $surcharge_percentage) + $surcharge_flatfee) %> is included in this payment</FONT>
+%        }
       </TD></TR></TABLE>
     </TD>
   </TR>
 
-% if ( $fee ) {
+% if ($fee || $surcharge) {
 
     <SCRIPT TYPE="text/javascript">
 
       function amount_changed(what) {
 
-
+% if ( $fee ) {
         var total = '';
         if ( what.value.length ) {
           total = parseFloat(what.value) <% $fee_op %> <% $fee %>;
@@ -48,6 +54,13 @@
 
         var total_cell = document.getElementById('ajax_total_cell');
         total_cell.innerHTML = '<FONT SIZE="+1">' + total + ' <% $fee_display eq 'add' ? 'TOTAL' : 'AVAILABLE' %></FONT>';
+% }
+
+% if ( $surcharge ) {
+        var surcharge_cell = document.getElementById('ajax_surcharge_cell');
+        var surcharge = ((what.value - <% $surcharge_flatfee %>) * <% $surcharge_percentage %>) + <% $surcharge_flatfee %>;
+        surcharge_cell.innerHTML = '<FONT SIZE="+1">A credit card surcharge of ' + surcharge.toFixed(2) + ' is included in this payment</FONT>';
+% }
 
       }
 
@@ -66,6 +79,9 @@ my $fee = '';
 my $fee_pkg = '';
 my $fee_display = '';
 my $fee_op = '';
+my $surcharge = '';
+my $surcharge_percentage = 0;
+my $surcharge_flatfee = 0;
 
 if ( $opt{'process-pkgpart'}
      and ! $opt{'process-skip_first'} || $opt{'num_payments'}
@@ -91,11 +107,13 @@ if ( $amount > 0 ) {
     if $fee && $fee_display eq 'subtract';
 
   #&{ $opt{post_fee_callback} }( \$amount ) if $opt{post_fee_callback};
-  $amount += $amount * $opt{'surcharge_percentage'}/100
-    if $opt{'surcharge_percentage'} > 0;
 
-  $amount += $opt{'surcharge_flatfee'}
-    if $opt{'surcharge_flatfee'} > 0;
+  $surcharge_percentage = $opt{'surcharge_percentage'}/100 if $opt{'surcharge_percentage'} > 0;
+  $surcharge_flatfee = $opt{'surcharge_flatfee'} if $opt{'surcharge_flatfee'} > 0;
+  $surcharge = $amount * $surcharge_percentage if $surcharge_percentage > 0;
+  $surcharge += $surcharge_flatfee if $surcharge_flatfee > 0;
+
+  $amount += $surcharge;
 
   $amount = sprintf("%.2f", $amount);
 }
diff --git a/httemplate/elements/tr-select-payment_options.html b/httemplate/elements/tr-select-payment_options.html
index 8859b9b36..15f92775a 100644
--- a/httemplate/elements/tr-select-payment_options.html
+++ b/httemplate/elements/tr-select-payment_options.html
@@ -38,7 +38,7 @@ Example:
   		<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>
+      <OPTION VALUE="specific">Pay specific amount</OPTION>
 	</SELECT>	
     </TD>
   </TR>
@@ -57,6 +57,14 @@ Example:
 
       function <% $opt{prefix} %>payment_option_changed(what) {
 
+        var surcharge;
+        if (document.getElementById('surcharge_percentage') || document.getElementById('surcharge_percentage')) {
+          surcharge = (+what.value * +document.getElementById('surcharge_percentage').value) + +document.getElementById('surcharge_flatfee').value;
+        }
+        else { surcharge = 0; }
+        var amount = +what.value + +surcharge;
+        document.getElementById('amount').disabled = true;
+
         if ( what.value == 'select' ) {
         	document.getElementById('payment_amount_row').style.display = 'none';
         	document.getElementById('invoice_row').style.display = 'none';
@@ -68,24 +76,48 @@ Example:
         	document.getElementById('invoice_row').style.display = 'block';
         	document.getElementById('amount').value = '';
         }
+        else if ( what.value == 'specific' ) {
+          document.getElementById('payment_amount_row').style.display = 'block';
+          document.getElementById('invoice_row').style.display = 'none';
+          document.getElementById('<% $opt{prefix} %>invoice').value = 'select';
+          document.getElementById('amount').value = '0.00';
+          document.getElementById('amount').disabled = false;
+          if (document.getElementById('ajax_surcharge_cell')) {
+            document.getElementById('ajax_surcharge_cell').innerHTML = '<FONT SIZE="+1">A credit card surcharge of <% $money_char %>0.00 is included in this payment</FONT>';
+          }
+        }
         else {
         	document.getElementById('payment_amount_row').style.display = 'block';
         	document.getElementById('invoice_row').style.display = 'none';
           document.getElementById('<% $opt{prefix} %>invoice').value = 'select';
-        	document.getElementById('amount').value = what.value;
+          document.getElementById('amount').value = amount.toFixed(2);
+          if (document.getElementById('ajax_surcharge_cell')) {
+            document.getElementById('ajax_surcharge_cell').innerHTML = '<FONT SIZE="+1">A credit card surcharge of <% $money_char %>' + surcharge.toFixed(2) + ' is included in this payment</FONT>';
+          }
         }
 
       }
 
       function <% $opt{prefix} %>invoice_select_changed(what) {
 
+        var surcharge;
+        if (document.getElementById('surcharge_percentage') || document.getElementById('surcharge_percentage')) {
+          surcharge = (+what.value * +document.getElementById('surcharge_percentage').value) + +document.getElementById('surcharge_flatfee').value;
+        }
+        else { surcharge = 0; }
+        var amount = +what.value + +surcharge;
+
         if ( what.value == 'select' ) {
+          alert("we have 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;
+          document.getElementById('amount').value = amount.toFixed(2);
+          if (document.getElementById('ajax_surcharge_cell')) {
+            document.getElementById('ajax_surcharge_cell').innerHTML = '<FONT SIZE="+1">A credit card surcharge of <% $money_char %>' + surcharge.toFixed(2) + ' is included in this payment</FONT>';
+          }
         }
 
       }
@@ -96,4 +128,7 @@ Example:
 
 my %opt = @_;
 
+my $conf = new FS::Conf;
+my $money_char = $conf->config('money_char') || '$';
+
 </%init>
\ No newline at end of file

commit 72d85b9d8d072344f8e68487cf285ed98960d563
Author: Christopher Burger <burgerc at freeside.biz>
Date:   Wed Jan 3 14:09:38 2018 -0500

    RT# 34134 - fixed error where payment amount field is hidden in self service.

diff --git a/httemplate/elements/tr-amount_fee.html b/httemplate/elements/tr-amount_fee.html
index f174cf5cc..9e6d9e96d 100644
--- a/httemplate/elements/tr-amount_fee.html
+++ b/httemplate/elements/tr-amount_fee.html
@@ -1,4 +1,4 @@
-  <TR ID="payment_amount_row" STYLE="display:none;">
+  <TR ID="payment_amount_row" <% $opt{'row_style'} %>>
     <TH ALIGN="right"><% mt('Payment amount') |h %></TH>
     <TD COLSPAN=7>
       <TABLE><TR><TD BGCOLOR="#ffffff">

commit 2d99d3bc66423a833a67e42f88283d240e91fb7a
Author: Christopher Burger <burgerc at freeside.biz>
Date:   Wed Jan 3 10:43:28 2018 -0500

    RT# 34134 - added documentation for new feature
    
    Conflicts:
            httemplate/elements/tr-select-payment_options.html

diff --git a/httemplate/elements/tr-select-invoice.html b/httemplate/elements/tr-select-invoice.html
index 70923b633..3728d348d 100644
--- a/httemplate/elements/tr-select-invoice.html
+++ b/httemplate/elements/tr-select-invoice.html
@@ -1,3 +1,15 @@
+<%doc>
+
+Example:
+
+  include( '/elements/tr-select-invoice.html',
+
+    #opt - most get used in /elements/tr-amount-fee
+    'custnum'              => 4,     # customer number,
+    'prefix'               => 'pre', # prefix to fields and row ID's
+  )
+
+</%doc>
 
   <TR ID="invoice_row" STYLE="display:none;">
     <TH ALIGN="right"><% mt('Open invoices') |h %></TH>
@@ -6,7 +18,6 @@
   	  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) {

commit dcb7068e87e2130f939f6e83c3d40187ad39863a
Author: Christopher Burger <burgerc at freeside.biz>
Date:   Wed Jan 3 09:49:58 2018 -0500

    RT# 34134 - removed config option manual_process-single_invoice_amount from config and payment page that used it.
    
    Conflicts:
            httemplate/misc/payment.cgi

diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm
index 36b330c91..50c0a5d83 100644
--- a/FS/FS/Conf.pm
+++ b/FS/FS/Conf.pm
@@ -2805,13 +2805,6 @@ and customer address. Include units.',
   },
 
   {
-    'key'         => 'manual_process-single_invoice_amount',
-    'section'     => 'payments',
-    'description' => 'When entering manual credit card and ACH payments, amount will not autofill if the customer has more than one open invoice',
-    'type'        => 'checkbox',
-  },
-
-  {
     'key'         => 'manual_process-pkgpart',
     'section'     => 'payments',
     'description' => 'Package to add to each manual credit card and ACH payment entered by employees from the backend.  WARNING: Although recently permitted to US merchants in general, specific consumer protection laws may prohibit or restrict this practice in California, Colorado, Connecticut, Florda, Kansas, Maine, Massachusetts, New York, Oklahome, and Texas. Surcharging is also generally prohibited in most countries outside the US, AU and UK.',
diff --git a/httemplate/misc/payment.cgi b/httemplate/misc/payment.cgi
index f754f5a32..80cb15d79 100644
--- a/httemplate/misc/payment.cgi
+++ b/httemplate/misc/payment.cgi
@@ -14,7 +14,7 @@
 
   <& /elements/tr-select-payment_options.html,
        'custnum'            => $cust_main->custnum,
-       'amount'             => $amount,
+       'amount'             => $balance,
        'process-pkgpart'    => 
           scalar($conf->config('manual_process-pkgpart', $cust_main->agentnum)),
        'process-display'    => scalar($conf->config('manual_process-display')),
@@ -187,15 +187,6 @@ my $payinfo = '';
 
 my $conf = new FS::Conf;
 
-my $amount = '';
-if ( $balance > 0 ) {
-  # when configured to do so, amount will only auto-fill with balance
-  # if balance represents a single invoice
-  $amount = $balance
-    unless $conf->exists('manual_process-single_invoice_amount')
-      && ($cust_main->open_cust_bill != 1);
-}
-
 my $payunique = "webui-payment-". time. "-$$-". rand() * 2**32;
 
 </%init>

commit 929f727a3d09b7f4d4918fc6b15aade1a0e43ce6
Author: Christopher Burger <burgerc at freeside.biz>
Date:   Tue Jan 2 19:52:46 2018 -0500

    RT# 34134 - added open invoices selection when selecting pay specific invoice

diff --git a/httemplate/elements/tr-select-invoice.html b/httemplate/elements/tr-select-invoice.html
index 03625b659..70923b633 100644
--- a/httemplate/elements/tr-select-invoice.html
+++ b/httemplate/elements/tr-select-invoice.html
@@ -22,4 +22,11 @@
 
 my %opt = @_;
 
+my @records = qsearch( {
+    'select'    => '*',
+    'table'     => 'cust_bill',
+    'hashref'   => { 'custnum' => $opt{custnum} },
+    'order_by'  => 'ORDER BY _date',
+});
+
 </%init>

commit c187712be2bdaf85586bfcf6b4070dbe165a33dd
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.
    
    Conflicts:
            httemplate/elements/tr-select-payment_options.html

diff --git a/httemplate/elements/tr-amount_fee.html b/httemplate/elements/tr-amount_fee.html
index e3b8d7800..f174cf5cc 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/misc/payment.cgi b/httemplate/misc/payment.cgi
index b170da27b..f754f5a32 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:
 FS/FS/Conf.pm                                      |  2 +-
 httemplate/elements/tr-amount_fee.html             | 36 +++++++++++++-----
 httemplate/elements/tr-select-invoice.html         | 43 ++++++++++++++++++++++
 httemplate/elements/tr-select-payment_options.html | 43 ++++++++++++++++++++--
 httemplate/misc/payment.cgi                        | 14 ++-----
 5 files changed, 114 insertions(+), 24 deletions(-)
 create mode 100644 httemplate/elements/tr-select-invoice.html




More information about the freeside-commits mailing list