Revision e950c9ca
SL/DB/BankTransaction.pm | ||
---|---|---|
268 | 268 |
} |
269 | 269 |
} |
270 | 270 |
|
271 |
# if there is exactly one non-executed sepa_export_item for the invoice |
|
272 |
my $seis = $params{sepa_export_items} |
|
273 |
? [ grep { $invoice->id == ($invoice->is_sales ? $_->ar_id : $_->ap_id) } @{ $params{sepa_export_items} } ] |
|
274 |
: $invoice->find_sepa_export_items({ executed => 0 }); |
|
271 |
my $seis = $invoice->find_sepa_export_items({ executed => 0 }); |
|
275 | 272 |
if ($seis) { |
276 |
if (scalar @$seis == 1) { |
|
277 |
my $sei = $seis->[0]; |
|
278 |
# test for end to end id |
|
279 |
if ($self->end_to_end_id && $self->end_to_end_id eq $sei->end_to_end_id) { |
|
280 |
$agreement += $points{end_to_end_id}; |
|
281 |
$rule_matches .= 'end_to_end_id(' . $points{'end_to_end_id'} . ') '; |
|
282 |
} |
|
283 |
|
|
284 |
# test for amount and id matching only, sepa transfer date and bank |
|
285 |
# transaction date needn't match |
|
286 |
if (abs($self->amount) == ($sei->amount)) { |
|
287 |
$agreement += $points{sepa_export_item}; |
|
288 |
$rule_matches .= 'sepa_export_item(' . $points{'sepa_export_item'} . ') '; |
|
289 |
} |
|
290 |
} else { |
|
291 |
# zero or more than one sepa_export_item, do nothing for this invoice |
|
292 |
# zero: do nothing, no sepa_export_item exists, no match |
|
293 |
# more than one: does this ever apply? Currently you can't create sepa |
|
294 |
# exports for invoices that already have a non-executed sepa_export |
|
295 |
# TODO: Catch the more than one case. User is allowed to split |
|
296 |
# payments for one invoice item in one sepa export. |
|
273 |
|
|
274 |
# test if end to end id matches for any sepa export |
|
275 |
if ($self->end_to_end_id && |
|
276 |
grep { $self->end_to_end_id eq $_->end_to_end_id } @{ $seis }) { |
|
277 |
$agreement += $points{end_to_end_id}; |
|
278 |
$rule_matches .= 'end_to_end_id(' . $points{'end_to_end_id'} . ') '; |
|
297 | 279 |
} |
298 |
} |
|
299 | 280 |
|
281 |
# if there is exactly one non-executed sepa_export_item for the invoice |
|
282 |
# test for amount and id matching only, sepa transfer date and bank |
|
283 |
# transaction date needn't match |
|
284 |
if (scalar @{ $seis } == 1 && $invoice->id == $seis->[0]->arap_id |
|
285 |
&& abs($self->amount) == $seis->[0]->amount ) { |
|
286 |
$agreement += $points{sepa_export_item}; |
|
287 |
$rule_matches .= 'sepa_export_item(' . $points{'sepa_export_item'} . ') '; |
|
288 |
} |
|
289 |
} |
|
300 | 290 |
return ($agreement,$rule_matches); |
301 |
};
|
|
291 |
} |
|
302 | 292 |
|
303 | 293 |
sub _check_string { |
304 | 294 |
my $bankstring = shift; |
Auch abrufbar als: Unified diff
get_agreement: Geoff's alte Logik komplett wiederhergestellt und
end_to_end_id auf alle sepa export items angewandt