From: Martin Helmling martin.helmling@octosoft.eu Date: Wed, 31 Jan 2018 08:22:44 +0000 (+0100) Subject: Bankimport: Prüfung des reinen Ziffernanteils der Rechnung X-Git-Tag: release-3.5.4~374 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=3fe6ec981985f84f61721ba2e7ccd448617aca11;p=kivitendo-erp.git Bankimport: Prüfung des reinen Ziffernanteils der Rechnung Falls Rechnungen in der Rechnungsnummer ein Prefix vor der Nummer haben und dies nicht exakt im Verwendungszweck der Kontobewegung aufgeführt ist, wurde dies nicht als Bewertungskriterium herangezogen. Nun wird dies mit etwas wenig Punkte bewertet. In diesem einfachen Verfahren wird bei einer Rechnungsnummer 'RE12345' auch ein 'Blabala 12 nix 34 ddd 5' erkannt, was aber recht unwahrscheinlich ist. behebt auch Issue #201 --- diff --git a/SL/DB/BankTransaction.pm b/SL/DB/BankTransaction.pm index 511c15f07..b41660645 100644 --- a/SL/DB/BankTransaction.pm +++ b/SL/DB/BankTransaction.pm @@ -69,8 +69,10 @@ sub get_agreement_with_invoice { depositor_matches => 2, exact_amount => 4, exact_open_amount => 4, - invnumber_in_purpose => 2, - own_invnumber_in_purpose => 5, + invoice_in_purpose => 2, + own_invoice_in_purpose => 5, + invnumber_in_purpose => 1, + own_invnumber_in_purpose => 4, # overpayment => -1, # either other invoice is more likely, or several invoices paid at once payment_before_invoice => -2, payment_within_30_days => 1, @@ -132,11 +134,21 @@ sub get_agreement_with_invoice { my $squashed_purpose = $self->purpose; $squashed_purpose =~ s/ //g; if (length($invnumber) > 4 && $squashed_purpose =~ /$invnumber/ && $invoice->is_sales){ - $agreement += $points{own_invnumber_in_purpose}; - $rule_matches .= 'own_invnumber_in_purpose(' . $points{'own_invnumber_in_purpose'} . ') '; + $agreement += $points{own_invoice_in_purpose}; + $rule_matches .= 'own_invoice_in_purpose(' . $points{'own_invoice_in_purpose'} . ') '; } elsif (length($invnumber) > 3 && $squashed_purpose =~ /$invnumber/ ) { - $agreement += $points{invnumber_in_purpose}; - $rule_matches .= 'invnumber_in_purpose(' . $points{'invnumber_in_purpose'} . ') '; + $agreement += $points{invoice_in_purpose}; + $rule_matches .= 'invoice_in_purpose(' . $points{'invoice_in_purpose'} . ') '; + } else { + # only check number part of invoice number + $invnumber =~ s/[A-Za-z_]+//g; + if (length($invnumber) > 4 && $squashed_purpose =~ /$invnumber/ && $invoice->is_sales){ + $agreement += $points{own_invnumber_in_purpose}; + $rule_matches .= 'own_invnumber_in_purpose(' . $points{'own_invnumber_in_purpose'} . ') '; + } elsif (length($invnumber) > 3 && $squashed_purpose =~ /$invnumber/ ) { + $agreement += $points{invnumber_in_purpose}; + $rule_matches .= 'invnumber_in_purpose(' . $points{'invnumber_in_purpose'} . ') '; + } } #check sign