From 731991d49695123cea7a6de1d7c8b0e649d2dba2 Mon Sep 17 00:00:00 2001 From: "G. Richardson" Date: Thu, 23 Jul 2020 15:42:10 +0200 Subject: [PATCH] Deb-/Kred-/Dialogbuchungen - get_active_taxes_for_chart mit tax_id MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Durch die Konfiguration bei den Steuern, für welche Konten welche Steuerfälle in den Dropdowns bei Debitoren-, Kreditoren- und Dialogbuchungen auftauchen, kann es passieren, daß für bereits gebuchte Belege beim erneuten Öffnen die Steuer nicht mehr zur Verfügung steht und dadurch falsch angezeigt wird. Indem man die aktuelle tax_id an get_active_taxes_for_chart mit übergibt kann man sicherstellen, daß die ausgewählte Steuer immer im Dropdown auftaucht. Da der Code für die Erstellung der jeweiligen Dropdowns so umständlich ist, und mehrmals wiederholt wird, war es einfacher, dies als neuen Parameter in get_active_taxes_for_chart zu implementieren. --- bin/mozilla/ap.pl | 6 +++++- bin/mozilla/ar.pl | 6 +++++- bin/mozilla/gl.pl | 6 +++++- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/bin/mozilla/ap.pl b/bin/mozilla/ap.pl index e3a92675c..6b61d2c23 100644 --- a/bin/mozilla/ap.pl +++ b/bin/mozilla/ap.pl @@ -480,9 +480,13 @@ sub form_header { $form->{"tax_$i"} = $form->format_amount(\%myconfig, $form->{"tax_$i"}, 2); my ($default_taxchart, $taxchart_to_use); + my $used_tax_id; + if ( $form->{"taxchart_$i"} ) { + ($used_tax_id) = split(/--/, $form->{"taxchart_$i"}); + } my $amount_chart_id = $form->{"AP_amount_chart_id_$i"} || $default_ap_amount_chart_id; - my @taxcharts = GL->get_active_taxes_for_chart($amount_chart_id, $transdate); + my @taxcharts = GL->get_active_taxes_for_chart($amount_chart_id, $transdate, $used_tax_id); foreach my $item (@taxcharts) { my $key = $item->id . "--" . $item->rate; $first_taxchart //= $item; diff --git a/bin/mozilla/ar.pl b/bin/mozilla/ar.pl index bace42607..fa3c12704 100644 --- a/bin/mozilla/ar.pl +++ b/bin/mozilla/ar.pl @@ -428,7 +428,11 @@ sub form_header { my (%taxchart_labels, @taxchart_values, $default_taxchart, $taxchart_to_use); my $amount_chart_id = $form->{"AR_amount_chart_id_$i"} // $default_ar_amount_chart_id; - foreach my $item ( GL->get_active_taxes_for_chart($amount_chart_id, $transdate) ) { + my $used_tax_id; + if ( $form->{"taxchart_$i"} ) { + ($used_tax_id) = split(/--/, $form->{"taxchart_$i"}); + } + foreach my $item ( GL->get_active_taxes_for_chart($amount_chart_id, $transdate, $used_tax_id) ) { my $key = $item->id . "--" . $item->rate; $first_taxchart //= $item; $default_taxchart = $item if $item->{is_default}; diff --git a/bin/mozilla/gl.pl b/bin/mozilla/gl.pl index 1c29b832e..fe621122b 100644 --- a/bin/mozilla/gl.pl +++ b/bin/mozilla/gl.pl @@ -826,9 +826,13 @@ sub display_rows { $accno_id = $chart->{id}; my ($first_taxchart, $default_taxchart, $taxchart_to_use); + my $used_tax_id; + if ( $form->{"taxchart_$i"} ) { + ($used_tax_id) = split(/--/, $form->{"taxchart_$i"}); + } my $taxdate = $deliverydate ? $deliverydate : $transdate; - foreach my $item ( GL->get_active_taxes_for_chart($accno_id, $taxdate) ) { + foreach my $item ( GL->get_active_taxes_for_chart($accno_id, $taxdate, $used_tax_id) ) { my $key = $item->id . "--" . $item->rate; $first_taxchart //= $item; $default_taxchart = $item if $item->{is_default}; -- 2.20.1