X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/68ccd089c525fd41d00266fe493cd52a9dbb6513..69bfa40a001bfd0ca75d60babdb63f9199d4e45c:/SL/DB/BankTransaction.pm diff --git a/SL/DB/BankTransaction.pm b/SL/DB/BankTransaction.pm index 053abb410..26c38e51b 100644 --- a/SL/DB/BankTransaction.pm +++ b/SL/DB/BankTransaction.pm @@ -112,6 +112,7 @@ sub get_agreement_with_invoice { if ( $invoice->skonto_date && abs(abs($invoice->amount_less_skonto) - abs($self->amount)) < 0.01) { $agreement += $points{skonto_exact_amount}; $rule_matches .= 'skonto_exact_amount(' . $points{'skonto_exact_amount'} . ') '; + $invoice->{skonto_type} = 'with_skonto_pt'; }; #search invoice number in purpose @@ -150,7 +151,7 @@ sub get_agreement_with_invoice { my $cvname; $cvname = $invoice->customer->name if $invoice->is_sales; $cvname = $invoice->vendor->name if ! $invoice->is_sales; - if ( $cvname && $self->purpose =~ /\b$cvname\b/i ) { + if ( $cvname && $self->purpose =~ /\b\Q$cvname\E\b/i ) { $agreement += $points{cust_vend_name_in_purpose}; $rule_matches .= 'cust_vend_name_in_purpose(' . $points{'cust_vend_name_in_purpose'} . ') '; }; @@ -208,27 +209,26 @@ sub get_agreement_with_invoice { }; }; - # if there is exactly one non-executed sepa_export_item for the invoice +# # if there is exactly one non-executed sepa_export_item for the invoice if ( my $seis = $invoice->find_sepa_export_items({ executed => 0 }) ) { - if ( scalar @$seis == 1 ) { + if (scalar @$seis == 1) { my $sei = $seis->[0]; # test for amount and id matching only, sepa transfer date and bank # transaction date needn't match my $arap = $invoice->is_sales ? 'ar' : 'ap'; - if ( abs($self->amount) == ($sei->amount) - && $invoice->id == $sei->arap_id - ) { + + if (abs($self->amount) == ($sei->amount) && $invoice->id == $sei->arap_id) { $agreement += $points{sepa_export_item}; - $rule_matches .= 'sepa_export_item(' . $points{'sepa_export_item'} . ') '; - }; + $rule_matches .= 'sepa_export_item(' . $points{'sepa_export_item'} . ') '; + } } else { # zero or more than one sepa_export_item, do nothing for this invoice # zero: do nothing, no sepa_export_item exists, no match # more than one: does this ever apply? Currently you can't create sepa # exports for invoices that already have a non-executed sepa_export - }; - }; + } + } return ($agreement,$rule_matches); };