From 9a527d7330881f4dc5330d0cf0e2dd0815fc7e97 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jan=20B=C3=BCren?= Date: Thu, 23 Mar 2017 14:54:19 +0100 Subject: [PATCH] =?utf8?q?Verbuchte=20Zahlungen=20auch=20in=20neuen=20F?= =?utf8?q?=C3=A4llen=20von=20Bankbewegegungen=20ber=C3=BCcksichtigen?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Ergänzend zu af131a46: Banktransaction: Kontoauszug verbuchen: Sonderfall für "credit_notes" --- SL/Controller/BankTransaction.pm | 8 ++++++++ 1 file changed, 8 insertions(+) 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, -- 2.20.1