BankTransaction: save_bt keinen bezahlten rechnungen akzeptieren
authorJan Büren <jan@kivitendo.de>
Sat, 23 Mar 2019 13:28:54 +0000 (14:28 +0100)
committerJan Büren <jan@kivitendo.de>
Sat, 23 Mar 2019 13:28:54 +0000 (14:28 +0100)
SL/Controller/BankTransaction.pm

index a937451..9793b33 100644 (file)
@@ -616,6 +616,9 @@ sub save_single_bank_transaction {
       my $memo   = ($data{memos}   // [])->[$n_invoices];
 
       $n_invoices++ ;
+      # safety check invoice open
+      croak("Invoice closed. Cannot proceed.") unless ($invoice->open_amount);
+
       if (   ($payment_sent     && $bank_transaction->not_assigned_amount >= 0)
           || ($payment_received && $bank_transaction->not_assigned_amount <= 0)) {
         return {