diff options
Diffstat (limited to 'httemplate')
-rw-r--r-- | httemplate/elements/customer-table.html | 10 | ||||
-rw-r--r-- | httemplate/misc/batch-cust_pay.html | 5 | ||||
-rw-r--r-- | httemplate/misc/xmlhttp-cust_main-search.cgi | 4 |
3 files changed, 15 insertions, 4 deletions
diff --git a/httemplate/elements/customer-table.html b/httemplate/elements/customer-table.html index b49bf0290..fc1af69c6 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 45459f14d..887b92489 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 436501e8b..86983e462 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; []; } |