From: Jan Büren Date: Thu, 12 Jul 2018 13:35:16 +0000 (+0200) Subject: BankTransaction weniger Code ist mehr Wert X-Git-Tag: release-3.5.4~363 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=61e8db07e94535c4aabe8f10d312f3a8c58040c3;p=kivitendo-erp.git BankTransaction weniger Code ist mehr Wert Aufgrund des klarer formulierten PODs kann eine Routine und eine weitere zu "schwache" Bedingung entfernt werden. Fast alle kivi-Testfälle inkl. adaptierter odyn-Testfälle laufen sauber durch. --- diff --git a/SL/Controller/BankTransaction.pm b/SL/Controller/BankTransaction.pm index 6e5c5b4f0..60879a1e4 100644 --- a/SL/Controller/BankTransaction.pm +++ b/SL/Controller/BankTransaction.pm @@ -618,15 +618,6 @@ sub save_single_bank_transaction { $n_invoices++ ; - # Check if bank_transaction already has a link to the invoice, may only be linked once per invoice - # This might be caused by the user reloading a page and resending the form - if (_existing_record_link($bank_transaction, $invoice)) { - return { - %data, - result => 'error', - message => $::locale->text("Bank transaction with id #1 has already been linked to #2.", $bank_transaction->id, $invoice->displayable_name), - }; - } if (!$amount_of_transaction && $invoice->open_amount) { return { @@ -842,20 +833,6 @@ sub prepare_report { ); } -sub _existing_record_link { - my ($bt, $invoice) = @_; - - # check whether a record link from banktransaction $bt already exists to - # invoice $invoice, returns 1 if that is the case - - die unless $bt->isa("SL::DB::BankTransaction") && ( $invoice->isa("SL::DB::Invoice") || $invoice->isa("SL::DB::PurchaseInvoice") ); - - my $linked_record_to_table = $invoice->is_sales ? 'Invoice' : 'PurchaseInvoice'; - my $linked_records = $bt->linked_records( direction => 'to', to => $linked_record_to_table, query => [ id => $invoice->id ] ); - - return @$linked_records ? 1 : 0; -}; - sub init_problems { [] } sub init_models {