From: Jan Büren Date: Mon, 4 Jun 2018 08:57:03 +0000 (+0200) Subject: Payment::pay_invoice with skonto -> Steuersatz ist eindeutig X-Git-Tag: release-3.5.4~399 X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/kivitendo-erp.git/commitdiff_plain/8dfafa71b083f9953e06784f81a5f1609e58b429 Payment::pay_invoice with skonto -> Steuersatz ist eindeutig 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) --- 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 ) {