From 0c31c55d2a8ff03f2d6252d7a6cd1f4fded5ec12 Mon Sep 17 00:00:00 2001 From: "G. Richardson" Date: Sat, 4 Jan 2014 20:47:51 +0100 Subject: [PATCH] Dialogbuchen: Bug in updateTaxes behoben und Code vereinfacht MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit im Javascript hieß die Variable selected_index, im Template select_index. Beide wurden umbenannt in default_tax_id. Der Value des Konto-Dropdowns enthält Daten in der Form "accno--tax_id". Diese beiden Information werden per JS geparsed, und reichen schon aus, damit der der ajax-Aufruf bei Wechsel des Kontos das entsprechende Steuerdropdown austauschen und mit der Defaultsteuer des neuen Kontos vorbelegen kann. --- templates/webpages/gl/form_header.html | 11 ++++------- templates/webpages/gl/update_tax_accounts.html | 3 ++- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/templates/webpages/gl/form_header.html b/templates/webpages/gl/form_header.html index ec175696d..98bb8f067 100644 --- a/templates/webpages/gl/form_header.html +++ b/templates/webpages/gl/form_header.html @@ -8,18 +8,15 @@ function updateTaxes(row) { var accno = document.getElementById('accno_' + row); var taxkey = accno.options[accno.selectedIndex].value; - var reg = /--([0-9]*)/; + var reg = /^(.*?)--(\d*)$/; var found = reg.exec(taxkey); - var index = found[1]; - index = parseInt(index); - var tax = 'taxchart_' + row; - var taxkeyposition = taxkey.lastIndexOf(found[0]); - var account = taxkey.substr(0, taxkeyposition); + var account = found[1]; + var default_tax_id = found[2]; $.ajax({ url: 'gl.pl?action=get_tax_dropdown', data: { accno: account, - selected_index: index}, + selected_tax_id: default_tax_id}, dataType: 'html', success: function (new_html) { $("#taxchart_" + row).html(new_html); diff --git a/templates/webpages/gl/update_tax_accounts.html b/templates/webpages/gl/update_tax_accounts.html index 940d34dfe..d3c9586b2 100644 --- a/templates/webpages/gl/update_tax_accounts.html +++ b/templates/webpages/gl/update_tax_accounts.html @@ -1,3 +1,4 @@ +[% USE L %] [% FOR row = TAX_ACCOUNTS %] - + [% END %] -- 2.20.1