From: Sven Schöling Date: Wed, 28 Mar 2018 09:31:22 +0000 (+0200) Subject: BankTransaction::get_agreement_with_invoice - sepa_export_items optional übergeben X-Git-Tag: release-3.5.4~382 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=ce4ec1a8be52421b7b3fed991ec9539523e482a3;p=kivitendo-erp.git BankTransaction::get_agreement_with_invoice - sepa_export_items optional übergeben --- diff --git a/SL/DB/BankTransaction.pm b/SL/DB/BankTransaction.pm index e4cf67cd3..511c15f07 100644 --- a/SL/DB/BankTransaction.pm +++ b/SL/DB/BankTransaction.pm @@ -53,7 +53,7 @@ sub is_batch_transaction { sub get_agreement_with_invoice { - my ($self, $invoice) = @_; + my ($self, $invoice, %params) = @_; carp "get_agreement_with_invoice needs an invoice object as its first argument" unless ref($invoice) eq 'SL::DB::Invoice' or ref($invoice) eq 'SL::DB::PurchaseInvoice'; @@ -221,7 +221,10 @@ 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 }) ) { + my $seis = $params{sepa_export_items} + ? [ grep { $invoice->id == ($invoice->is_sales ? $_->ar_id : $_->ap_id) } @{ $params{sepa_export_items} } ] + : $invoice->find_sepa_export_items({ executed => 0 }); + if ($seis) { if (scalar @$seis == 1) { my $sei = $seis->[0];