diff options
author | Mark Wells <mark@freeside.biz> | 2013-04-05 16:15:56 -0700 |
---|---|---|
committer | Mark Wells <mark@freeside.biz> | 2013-04-05 16:15:56 -0700 |
commit | 6b36f36dbf2cc6ae381827db1f1cdff394a3d334 (patch) | |
tree | fa5c6c7974a62202ca7224a4d879318c5930eb58 /httemplate/misc/batch-cust_pay.html | |
parent | fd67c768f2f59f7883197889ef02bb3e1fb2b0c7 (diff) |
tolerate custnum errors in quick payment entry, #22369
Diffstat (limited to 'httemplate/misc/batch-cust_pay.html')
-rw-r--r-- | httemplate/misc/batch-cust_pay.html | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/httemplate/misc/batch-cust_pay.html b/httemplate/misc/batch-cust_pay.html index ef06441c8..0b2f1f18c 100644 --- a/httemplate/misc/batch-cust_pay.html +++ b/httemplate/misc/batch-cust_pay.html @@ -23,10 +23,12 @@ 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 || - num_open_invoices[rownum] < 2 - ); + // if there is a custnum and more than one open invoice, enable + // (and check) the box + var show_applications = (custnum > 0 && num_open_invoices[rownum] > 1); + var enable_app_checkbox = document.getElementById('enable_app'+rownum); + enable_app_checkbox.disabled = show_applications; + % if ( $use_discounts ) { select_discount_term(rownum, prefix); % } @@ -34,9 +36,6 @@ function custnum_update_callback(rownum, prefix) { function invnum_update_callback(rownum, prefix) { custnum_update_callback(rownum, prefix); - var enable = document.getElementById('enable_app'+rownum); - enable.checked = true; - toggle_application_row.call(enable); } function select_discount_term(row, prefix) { @@ -96,6 +95,17 @@ function toggle_application_row(ev, next) { next.call(this, rownum); } ); + } else { + var row = document.getElementById('row'+rownum); + var table_rows = row.parentNode.rows; + for (i = row.sectionRowIndex; i < table_rows.count; i++) { + if ( table_rows[i].id.indexof('row'+rownum+'.') > -1 ) { + table_rows.removeChild(table_rows[i]); + } else { + break; + } + } + lock_payment_row(rownum, false); } } |