From b6f8a6b0fe6dae88ce0189c4999d7c1aa96d32a2 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jan=20B=C3=BCren?= Date: Wed, 9 Dec 2020 11:42:06 +0100 Subject: [PATCH] =?utf8?q?BankTransaction:=20Treffer=20f=C3=BCr=20Kreditor?= =?utf8?q?engutschriften=20erh=C3=B6hen?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit negativ_ap_transaction sollte keine Strafpunkte mehr fürs Vorzeichen erhalten. TODO: Verkaufs-Gutschriften prüfen --- SL/DB/BankTransaction.pm | 5 +++-- t/bank/bank_transactions.t | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/SL/DB/BankTransaction.pm b/SL/DB/BankTransaction.pm index e2ddede4e..0d6895b23 100644 --- a/SL/DB/BankTransaction.pm +++ b/SL/DB/BankTransaction.pm @@ -162,11 +162,12 @@ sub get_agreement_with_invoice { } #check sign - if ( $invoice->is_sales && $self->amount < 0 ) { + if ( $invoice->is_sales && $self->amount < 0 ) { # TODO debit note $agreement += $points{wrong_sign}; $rule_matches .= 'wrong_sign(' . $points{'wrong_sign'} . ') '; } - if ( ! $invoice->is_sales && $self->amount > 0 ) { + if (( !$invoice->is_sales && $invoice->amount > 0 && $self->amount > 0) || + ( !$invoice->is_sales && $invoice->amount < 0 && $self->amount < 0) ) { # credit note $agreement += $points{wrong_sign}; $rule_matches .= 'wrong_sign(' . $points{'wrong_sign'} . ') '; } diff --git a/t/bank/bank_transactions.t b/t/bank/bank_transactions.t index 4930726b7..ff3a001ed 100644 --- a/t/bank/bank_transactions.t +++ b/t/bank/bank_transactions.t @@ -764,7 +764,7 @@ sub test_neg_ap_transaction { ); my ($agreement, $rule_matches) = $bt->get_agreement_with_invoice($invoice); - is($agreement, 15, "points for negative ap transaction ok"); + is($agreement, 16, "points for negative ap transaction ok"); $::form->{invoice_ids} = { $bt->id => [ $invoice->id ] -- 2.20.1