Revision 0c31c55d
Von Kivitendo Admin vor etwa 11 Jahren hinzugefügt
templates/webpages/gl/form_header.html | ||
---|---|---|
{
|
||
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);
|
templates/webpages/gl/update_tax_accounts.html | ||
---|---|---|
[% USE L %]
|
||
[% FOR row = TAX_ACCOUNTS %]
|
||
<option value='[% row.id %]--[% row.rate %]' [% IF row.id == select_index %]selected[% END %]>[% row.taxdescription %] %</option>
|
||
<option value='[% row.id %]--[% row.rate %]'[% IF row.id == selected_tax_id%] selected[% END %]>[% row.taxdescription %] %</option>
|
||
[% END %]
|
Auch abrufbar als: Unified diff
Dialogbuchen: Bug in updateTaxes behoben und Code vereinfacht
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.