From: Jan Büren Date: Thu, 23 Mar 2017 13:54:19 +0000 (+0100) Subject: Verbuchte Zahlungen auch in neuen Fällen von Bankbewegegungen berücksichtigen X-Git-Tag: release-3.5.4~1178 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=9a527d7330881f4dc5330d0cf0e2dd0815fc7e97;p=kivitendo-erp.git Verbuchte Zahlungen auch in neuen Fällen von Bankbewegegungen berücksichtigen Ergänzend zu af131a46: Banktransaction: Kontoauszug verbuchen: Sonderfall für "credit_notes" --- diff --git a/SL/Controller/BankTransaction.pm b/SL/Controller/BankTransaction.pm index d154667d5..dbb278632 100644 --- a/SL/Controller/BankTransaction.pm +++ b/SL/Controller/BankTransaction.pm @@ -667,6 +667,14 @@ sub save_single_bank_transaction { } elsif (( $invoice->is_sales && $invoice->invoice_type eq 'credit_note' ) || (!$invoice->is_sales && $invoice->invoice_type eq 'ap_transaction' )) { # no check for overpayment/multiple payments + + # 1. $invoice->open_amount is arap.amount - ararp.paid (always positive!) + # 2. $bank_transaction->amount is negative for outgoing transactions and positive for + # incoming transactions. + # 1. and 2. => we have to turn the sign for invoice_amount in bank_transactions + # for verifying expected data, check t/bank/bank_transactions.t + $bank_transaction->invoice_amount($invoice->open_amount * -1); + $invoice->pay_invoice(chart_id => $bank_transaction->local_bank_account->chart_id, trans_id => $invoice->id, amount => $invoice->open_amount,