]> wagnertech.de Git - kivitendo-erp.git/commitdiff
Deb-/Kred-/Dialogbuchungen - get_active_taxes_for_chart mit tax_id
authorG. Richardson <grichardson@kivitec.de>
Thu, 23 Jul 2020 13:42:10 +0000 (15:42 +0200)
committerG. Richardson <grichardson@kivitec.de>
Tue, 28 Jul 2020 08:13:59 +0000 (10:13 +0200)
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
bin/mozilla/ar.pl
bin/mozilla/gl.pl

index e3a92675cbb944f5642fb08525a0c75cd3dc865f..6b61d2c23ce2f573ccb9408204a361b368aa71dc 100644 (file)
@@ -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;
index bace426071b4353576583a17ea1d4e7134c3aa51..fa3c12704c0ac2e6c0854acc221c22a79f33d2b3 100644 (file)
@@ -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};
index 1c29b832e57fcd9b0d5242449f4bae3189bf4464..fe621122b72051b40b920f34e9022daf809921e5 100644 (file)
@@ -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};