From 3fe6ec981985f84f61721ba2e7ccd448617aca11 Mon Sep 17 00:00:00 2001 From: "Martin Helmling martin.helmling@octosoft.eu" Date: Wed, 31 Jan 2018 09:22:44 +0100 Subject: [PATCH] =?utf8?q?Bankimport:=20Pr=C3=BCfung=20des=20reinen=20Ziff?= =?utf8?q?ernanteils=20der=20Rechnung?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 --- SL/DB/BankTransaction.pm | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) 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 -- 2.20.1