From: Jan Büren Date: Wed, 9 Dec 2020 10:42:06 +0000 (+0100) Subject: BankTransaction: Treffer für Kreditorengutschriften erhöhen X-Git-Tag: kivitendo-mebil_0.1-0~9^2~565 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=b6f8a6b0fe6dae88ce0189c4999d7c1aa96d32a2;p=kivitendo-erp.git BankTransaction: Treffer für Kreditorengutschriften erhöhen negativ_ap_transaction sollte keine Strafpunkte mehr fürs Vorzeichen erhalten. TODO: Verkaufs-Gutschriften prüfen --- 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 ]