From 8dfafa71b083f9953e06784f81a5f1609e58b429 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jan=20B=C3=BCren?= Date: Mon, 4 Jun 2018 10:57:03 +0200 Subject: [PATCH] Payment::pay_invoice with skonto -> Steuersatz ist eindeutig MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit tax_id in acc_trans definiert sicherer den Steuersatz als der taxkey (Steuerschlüssel von DATEV), s.a. FK-Constraint: "acc_trans_tax_id_fkey" FOREIGN KEY (tax_id) REFERENCES tax(id) --- SL/DB/Helper/Payment.pm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/SL/DB/Helper/Payment.pm b/SL/DB/Helper/Payment.pm index a034fcfef..9555f001a 100644 --- a/SL/DB/Helper/Payment.pm +++ b/SL/DB/Helper/Payment.pm @@ -461,7 +461,7 @@ sub check_skonto_configuration { # my $transactions = $self->transactions; foreach my $transaction (@{ $self->transactions }) { # find all transactions with an AR_amount or AP_amount link - my $tax = SL::DB::Manager::Tax->get_first( where => [taxkey => $transaction->taxkey]); + my $tax = SL::DB::Manager::Tax->get_first( where => [taxkey => $transaction->taxkey, id => $transaction->tax_id ]); croak "no tax for taxkey " . $transaction->{taxkey} unless ref $tax; $transaction->{chartlinks} = { map { $_ => 1 } split(m/:/, $transaction->chart_link) }; @@ -542,7 +542,8 @@ sub skonto_charts { # $reference_ARAP_amount += $transaction->{amount} * $mult; # quick hack that works around problem of non-unique tax keys in SKR04 - my $tax = SL::DB::Manager::Tax->get_first( where => [taxkey => $transaction->{taxkey}]); + # ? use tax_id in acc_trans + my $tax = SL::DB::Manager::Tax->get_first( where => [id => $transaction->{tax_id}]); croak "no tax for taxkey " . $transaction->{taxkey} unless ref $tax; if ( $is_sales ) { -- 2.20.1