Vorschläge für Kontoauszüge verbessern, fall: remote_account_number
authorJan Büren <jan@kivitendo.de>
Thu, 7 Apr 2022 08:31:14 +0000 (10:31 +0200)
committerJan Büren <jan@kivitendo.de>
Thu, 7 Apr 2022 09:09:23 +0000 (11:09 +0200)
Treffer sauberer setzen, ist überhaupt eine nicht leere Kontonummer vorhanden?

SL/DB/BankTransaction.pm

index e8c98cb..8617a81 100644 (file)
@@ -99,6 +99,17 @@ sub get_agreement_with_invoice {
   $bank_code      = $invoice->vendor->bank_code        if ! $invoice->is_sales;
   $iban           = $invoice->vendor->iban             if ! $invoice->is_sales;
   $account_number = $invoice->vendor->account_number   if ! $invoice->is_sales;
+
+  # check only valid remote_account_number (with some content)
+  if ($self->remote_account_number) {
+    if ($bank_code eq $self->remote_bank_code && $account_number eq $self->remote_account_number) {
+      $agreement += $points{remote_account_number};
+      $rule_matches .= 'remote_account_number(' . $points{'remote_account_number'} . ') ';
+    } elsif ($iban eq $self->remote_account_number) { # elsif -> do not add twice
+      $agreement += $points{remote_account_number};
+      $rule_matches .= 'remote_account_number(' . $points{'remote_account_number'} . ') ';
+    }
+  }
   if ( $bank_code eq $self->remote_bank_code && $account_number eq $self->remote_account_number ) {
     $agreement += $points{remote_account_number};
     $rule_matches .= 'remote_account_number(' . $points{'remote_account_number'} . ') ';