[freeside-commits] branch master updated. 527b92c4f125282e267863cb102664da57f94ebd

Mark Wells mark at 420.am
Thu Apr 26 11:41:33 PDT 2012


The branch, master has been updated
       via  527b92c4f125282e267863cb102664da57f94ebd (commit)
      from  580dd345b7616365903b9fbedc162f77e5c8b91f (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 527b92c4f125282e267863cb102664da57f94ebd
Author: Mark Wells <mark at freeside.biz>
Date:   Thu Apr 26 11:41:05 2012 -0700

    allocate quick payment only when customer has multiple open invoices, #15861

diff --git a/httemplate/elements/customer-table.html b/httemplate/elements/customer-table.html
index b49bf02..fc1af69 100644
--- a/httemplate/elements/customer-table.html
+++ b/httemplate/elements/customer-table.html
@@ -41,6 +41,8 @@ Example:
 
 <SCRIPT TYPE="text/javascript">
 
+  var num_open_invoices = new Array;
+
   function clearhint_invnum() {
 
     if ( this.value == 'Not found' || this.value == 'Multiple' ) {
@@ -90,7 +92,7 @@ Example:
           customer_select.style.display = 'none';
           return false;
 
-      } else if ( customerArray.length == 5 ) {
+      } else if ( customerArray.length == 6 ) {
 
           custnum_obj.value = customerArray[0];
           custnum_obj.style.color = '#000000';
@@ -99,6 +101,7 @@ Example:
           update_balance_text(searchrow, customerArray[2]);
           update_status_text( searchrow, customerArray[3]);
           update_status_color(searchrow, '#'+customerArray[4]);
+          update_num_open(searchrow, customerArray[5]);
 
           customer.style.display = '';
           customer_select.style.display = 'none';
@@ -140,6 +143,7 @@ Example:
     update_balance_text(searchrow, '');
     update_status_text(searchrow, '');
     update_status_color(searchrow, '#000000');
+    update_num_open(searchrow, 0);
 
     function search_invnum_update(customers) {
       
@@ -192,6 +196,7 @@ Example:
     update_balance_text(searchrow, '');
     update_status_text( searchrow, '');
     update_status_color(searchrow, '#000000');    
+    update_num_open(searchrow, 0);
 
     function search_custnum_update(customers) {
 
@@ -337,6 +342,9 @@ Example:
     document.getElementById('balance'+rownum+'_text').innerHTML = newval;
   }
 
+  function update_num_open(rownum, newval) {
+    num_open_invoices[rownum] = newval;
+  }
 
 
 </SCRIPT>
diff --git a/httemplate/misc/batch-cust_pay.html b/httemplate/misc/batch-cust_pay.html
index 45459f1..887b924 100644
--- a/httemplate/misc/batch-cust_pay.html
+++ b/httemplate/misc/batch-cust_pay.html
@@ -23,7 +23,10 @@ function add_row_callback(rownum, prefix) {
 
 function custnum_update_callback(rownum, prefix) {
   var custnum = document.getElementById('custnum'+rownum).value;
-  document.getElementById('enable_app'+rownum).disabled = (custnum == 0);
+  document.getElementById('enable_app'+rownum).disabled = (
+    custnum == 0 || 
+    num_open_invoices[rownum] < 2
+  );
 % if ( $use_discounts ) {
   select_discount_term(rownum, prefix);
 % }
diff --git a/httemplate/misc/xmlhttp-cust_main-search.cgi b/httemplate/misc/xmlhttp-cust_main-search.cgi
index 436501e..86983e4 100644
--- a/httemplate/misc/xmlhttp-cust_main-search.cgi
+++ b/httemplate/misc/xmlhttp-cust_main-search.cgi
@@ -12,7 +12,7 @@
 %   my @cust_main = smart_search( 'search' => $string,
 %                                 'no_fuzzy_on_exact' => 1, #pref?
 %                               );
-%   my $return = [ map [ $_->custnum, $_->name, $_->balance, $_->ucfirst_status, $_->statuscolor ], @cust_main ];
+%   my $return = [ map [ $_->custnum, $_->name, $_->balance, $_->ucfirst_status, $_->statuscolor, scalar($_->open_cust_bill) ], @cust_main ];
 %     
 <% objToJson($return) %>
 % } elsif ( $sub eq 'invnum_search' ) {
@@ -57,7 +57,7 @@ sub findbycustnum{
        	'hashref' => $hashref,
        	'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql,
      		});
-   return [ $c->custnum, $c->name, $c->balance, $c->ucfirst_status, $c->statuscolor ] 
+   return [ $c->custnum, $c->name, $c->balance, $c->ucfirst_status, $c->statuscolor, scalar($c->open_cust_bill) ] 
 	if $c;
    [];
 }

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

Summary of changes:
 httemplate/elements/customer-table.html      |   10 +++++++++-
 httemplate/misc/batch-cust_pay.html          |    5 ++++-
 httemplate/misc/xmlhttp-cust_main-search.cgi |    4 ++--
 3 files changed, 15 insertions(+), 4 deletions(-)




More information about the freeside-commits mailing list