From 61e8db07e94535c4aabe8f10d312f3a8c58040c3 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jan=20B=C3=BCren?= Date: Thu, 12 Jul 2018 15:35:16 +0200 Subject: [PATCH] BankTransaction weniger Code ist mehr Wert MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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. --- SL/Controller/BankTransaction.pm | 23 ----------------------- 1 file changed, 23 deletions(-) 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 { -- 2.20.1