From 54ae2899252302bf9e5dff99f2327cc081a66cce Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jan=20B=C3=BCren?= Date: Sun, 23 Jul 2017 21:14:47 +0200 Subject: [PATCH] SEPA Agreement Regel wieder aktivieren MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Sehr präziser und gut kommentieren Geoffrey-Code sollte man prinzipiell fördern - Oder wenn man den wegwirft, auch einen ädequaten Ersatz schaffen und testen. Aber man kann auch das Bein amputieren wenn der Patient Schmerzen im dicken Zeh hat. Ich schraub das Bein erstmal wieder dran. --- SL/DB/BankTransaction.pm | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/SL/DB/BankTransaction.pm b/SL/DB/BankTransaction.pm index cabdc816d..5ad598326 100644 --- a/SL/DB/BankTransaction.pm +++ b/SL/DB/BankTransaction.pm @@ -210,26 +210,26 @@ sub get_agreement_with_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 ) { -# 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 -# ) { -# $agreement += $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 -# }; -# }; + if ( my $seis = $invoice->find_sepa_export_items({ executed => 0 }) ) { + 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 + ) { + $agreement += $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); }; -- 2.20.1