From 90e0cc0b89799a206063f9d095b328e13cc73025 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Thu, 19 Mar 2020 13:15:59 +0100 Subject: [PATCH] =?utf8?q?Skontovorschl=C3=A4ge:=20ung=C3=BCltige=20Steuer?= =?utf8?q?-Zeilen=20aus=20acc=5Ftrans=20ignorieren?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Buchungen in acc_trans, die das Steuer-Konto ansprechen (also eines, bei dem chart_link AR_tax oder AP_tax enthält), haben oftmals eine ungültige Kombination aus taxkey & tax_id (ungültig im Sinne von: diese Kombination gibt's in der Tabelle tax nicht). Für Skontoberechnung sind solche Zeilen aber irrelevant. Also sie einfach überspringen und nicht sterben. --- SL/DB/Helper/Payment.pm | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/SL/DB/Helper/Payment.pm b/SL/DB/Helper/Payment.pm index 2cf8db981..dfc5b797f 100644 --- a/SL/DB/Helper/Payment.pm +++ b/SL/DB/Helper/Payment.pm @@ -483,6 +483,12 @@ sub check_skonto_configuration { 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, id => $transaction->tax_id ]); + + # acc_trans entries for the taxes (chart_link == A[RP]_tax) often + # have combinations of taxkey & tax_id that don't exist in + # tax. Those must be skipped. + next if !$tax && ($transaction->chart_link !~ m{A[RP]_amount}); + croak "no tax for taxkey " . $transaction->{taxkey} unless ref $tax; $transaction->{chartlinks} = { map { $_ => 1 } split(m/:/, $transaction->chart_link) }; -- 2.20.1