From 5d02d52104d470736dc1ec73b6da8eeac4ad58c8 Mon Sep 17 00:00:00 2001 From: root Date: Tue, 14 Jun 2016 14:15:06 +0200 Subject: [PATCH] =?utf8?q?Nur=20die=20eigene=20Rechnungsnummer=20mit=20h?= =?utf8?q?=C3=B6heren=20Punkten=20versehen=20...?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit ... bei Lieferantenrechnungen weniger Punkte vergeben, aber mit derselben Unschärfe wie bei Verkaufsrechnungen arbeiten. Conflicts: SL/DB/BankTransaction.pm --- SL/DB/BankTransaction.pm | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/SL/DB/BankTransaction.pm b/SL/DB/BankTransaction.pm index d5d7c5526..051245682 100644 --- a/SL/DB/BankTransaction.pm +++ b/SL/DB/BankTransaction.pm @@ -64,6 +64,7 @@ sub get_agreement_with_invoice { exact_amount => 4, exact_open_amount => 4, invnumber_in_purpose => 2, + own_invnumber_in_purpose => 5, # overpayment => -1, # either other invoice is more likely, or several invoices paid at once payment_before_invoice => -2, payment_within_30_days => 1, @@ -114,10 +115,15 @@ sub get_agreement_with_invoice { #search invoice number in purpose my $invnumber = $invoice->invnumber; # invnumbernhas to have at least 3 characters - if ( length($invnumber) > 2 && $self->purpose =~ /\b$invnumber\b/i ) { + 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'} . ') '; + } elsif (length($invnumber) > 3 && $squashed_purpose =~ /$invnumber/ ) { $agreement += $points{invnumber_in_purpose}; $rule_matches .= 'invnumber_in_purpose(' . $points{'invnumber_in_purpose'} . ') '; - }; + } #check sign if ( $invoice->is_sales && $self->amount < 0 ) { -- 2.20.1