From e271f064e683178749424171b29d04204b92e48d Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jan=20B=C3=BCren?= Date: Thu, 12 Jul 2018 15:25:51 +0200 Subject: [PATCH] save_single_bank_transaction dem caller weniger erlauben Als Konsequenz zum beschriebenem Verhalten im POD --- SL/Controller/BankTransaction.pm | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/SL/Controller/BankTransaction.pm b/SL/Controller/BankTransaction.pm index 591ee7c9e..6e5c5b4f0 100644 --- a/SL/Controller/BankTransaction.pm +++ b/SL/Controller/BankTransaction.pm @@ -555,11 +555,20 @@ sub save_single_bank_transaction { }; } + my $bank_transaction = $data{bank_transaction}; + + # see pod + if (@{ $bank_transaction->linked_invoices } || $bank_transaction->invoice_amount != 0) { + return { + %data, + result => 'error', + message => $::locale->text("Bank transaction with id #1 has already been linked to one or more record and/or some amount is already assigned.", $bank_transaction->id), + }; + } my (@warnings); my $worker = sub { my $bt_id = $data{bank_transaction_id}; - my $bank_transaction = $data{bank_transaction}; my $sign = $bank_transaction->amount < 0 ? -1 : 1; my $amount_of_transaction = $sign * $bank_transaction->amount; my $payment_received = $bank_transaction->amount > 0; -- 2.20.1