From: Moritz Bunkus Date: Tue, 6 Mar 2007 14:27:21 +0000 (+0000) Subject: Dialogbuchen, Debitorenbuchungen: Wird das transdate verändert, so wird eventuell... X-Git-Tag: release-2.4.3^2~622 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=6aefd19def6a7d2f205e5401451e4c0bf3cebc46;p=kivitendo-erp.git Dialogbuchen, Debitorenbuchungen: Wird das transdate verändert, so wird eventuell auch der Steuerschlüssel geändert. Auch in diesem Fall müssen die ausgewählten Konten beibehalten werden. Die Steuerkonten werden in so einem Fall aber auf das mit dem ausgewählten Konto verknüpften Steuerkonto gesetzt. Fix für Bug 577. --- diff --git a/bin/mozilla/ar.pl b/bin/mozilla/ar.pl index 5b3e3b2a1..9f003d324 100644 --- a/bin/mozilla/ar.pl +++ b/bin/mozilla/ar.pl @@ -428,6 +428,7 @@ sub form_header { my (%AR_amount_labels, @AR_amount_values); my (%AR_labels, @AR_values); my (%AR_paid_labels, @AR_paid_values); + my %charts; my $taxchart_init; foreach my $item (@{ $form->{ALL_CHARTS} }) { @@ -447,16 +448,20 @@ sub form_header { $AR_paid_labels{$item->{accno}} = "$item->{accno}--$item->{description}"; } + + $charts{$item->{accno}} = $item; } my %taxchart_labels = (); my @taxchart_values = (); + my %taxcharts = (); foreach my $item (@{ $form->{ALL_TAXCHARTS} }) { my $key = "$item->{id}--$item->{rate}"; $taxchart_init = $key if ($taxchart_init eq $item->{id}); push(@taxchart_values, $key); $taxchart_labels{$key} = "$item->{taxdescription} " . ($item->{rate} * 100) . ' %'; + $taxcharts{$item->{id}} = $item; } $form->{fokus} = "arledger.customer"; @@ -610,6 +615,25 @@ $jsscript $form->format_amount(\%myconfig, $form->{"amount_$i"}, 2); $form->{"tax_$i"} = $form->format_amount(\%myconfig, $form->{"tax_$i"}, 2); + my $selected_accno_full; + my ($accno_row) = split(/--/, $form->{"AR_amount_$i"}); + my $item = $charts{$accno_row}; + $selected_accno_full = "$item->{accno}--$item->{tax_id}"; + + my $selected_taxchart = $form->{"taxchart_$i"}; + my ($selected_accno, $selected_tax_id) = split(/--/, $selected_accno_full); + my ($previous_accno, $previous_tax_id) = split(/--/, $form->{"previous_AR_amount_$i"}); + + if ($previous_accno && + ($previous_accno eq $selected_accno) && + ($previous_tax_id ne $selected_tax_id)) { + $lxdebug->message(0, "yeah"); + my $item = $taxcharts{$selected_tax_id}; + $selected_taxchart = "$item->{id}--$item->{rate}"; + } + + $selected_taxchart = $taxchart_init unless ($form->{"taxchart_$i"}); + $selectAR_amount = NTI($cgi->popup_menu('-name' => "AR_amount_$i", '-id' => "AR_amount_$i", @@ -617,7 +641,9 @@ $jsscript '-onChange' => "setTaxkey(this, $i)", '-values' => \@AR_amount_values, '-labels' => \%AR_amount_labels, - '-default' => $form->{"AR_amount_$i"})); + '-default' => $selected_accno_full)) + . $cgi->hidden('-name' => "previous_AR_amount_$i", + '-default' => $selected_accno_full); $tax = qq|| . NTI($cgi->popup_menu('-name' => "taxchart_$i", @@ -625,8 +651,7 @@ $jsscript '-style' => 'width:200px', '-values' => \@taxchart_values, '-labels' => \%taxchart_labels, - '-default' => $form->{"taxchart_$i"} eq "" ? - $taxchart_init : $form->{"taxchart_$i"})) + '-default' => $selected_taxchart)) . qq||; $korrektur_checked = ($form->{"korrektur_$i"} ? 'checked' : ''); diff --git a/bin/mozilla/gl.pl b/bin/mozilla/gl.pl index d0616ab1a..7c7fa843e 100644 --- a/bin/mozilla/gl.pl +++ b/bin/mozilla/gl.pl @@ -1086,22 +1086,26 @@ sub display_rows { my %chart_labels = (); my @chart_values = (); + my %charts = (); my $taxchart_init; foreach my $item (@{ $form->{ALL_CHARTS} }) { my $key = Q($item->{accno}) . "--" . Q($item->{tax_id}); $taxchart_init = $item->{taxkey_id} unless (@chart_values); push(@chart_values, $key); $chart_labels{$key} = H($item->{accno}) . "--" . H($item->{description}); + $charts{$item->{accno}} = $item; } my %taxchart_labels = (); my @taxchart_values = (); + my %taxcharts = (); foreach my $item (@{ $form->{ALL_TAXCHARTS} }) { my $key = Q($item->{id}) . "--" . Q($item->{rate}); $taxchart_init = $key if ($taxchart_init eq $item->{taxkey}); push(@taxchart_values, $key); $taxchart_labels{$key} = H($item->{taxdescription}) . " " . H($item->{rate} * 100) . ' %'; + $taxcharts{$item->{id}} = $item; } for $i (1 .. $form->{rowcount}) { @@ -1113,6 +1117,28 @@ sub display_rows { |; + my $selected_accno_full; + my ($accno_row) = split(/--/, $form->{"accno_$i"}); + my $item = $charts{$accno_row}; + $selected_accno_full = "$item->{accno}--$item->{tax_id}"; + + my $selected_taxchart = $form->{"taxchart_$i"}; + my ($selected_accno, $selected_tax_id) = split(/--/, $selected_accno_full); + my ($previous_accno, $previous_tax_id) = split(/--/, $form->{"previous_accno_$i"}); + + if ($previous_accno && + ($previous_accno eq $selected_accno) && + ($previous_tax_id ne $selected_tax_id)) { + $lxdebug->message(0, "yeah"); + my $item = $taxcharts{$selected_tax_id}; + $selected_taxchart = "$item->{id}--$item->{rate}"; + } + + if ($init) { + $selected_accno = ''; + $selected_taxchart = $taxchart_init; + } + $accno = qq|| . $cgi->popup_menu('-name' => "accno_$i", '-id' => "accno_$i", @@ -1121,7 +1147,9 @@ sub display_rows { '-tabindex' => ($i + 5 + (($i - 1) * 8)), '-values' => \@chart_values, '-labels' => \%chart_labels, - '-default' => $init ? '' : $form->{"accno_$i"}) + '-default' => $selected_accno_full) + . $cgi->hidden('-name' => "previous_accno_$i", + '-default' => $selected_accno_full) . qq||; $tax = qq|| . $cgi->popup_menu('-name' => "taxchart_$i", @@ -1130,7 +1158,7 @@ sub display_rows { '-tabindex' => ($i + 10 + (($i - 1) * 8)), '-values' => \@taxchart_values, '-labels' => \%taxchart_labels, - '-default' => $init ? $taxchart_init : $form->{"taxchart_$i"}) + '-default' => $selected_taxchart) . qq||; if ($init) {