From 19c89dfd42c7766b14de78718066270ad09e20de Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jan=20B=C3=BCren?= Date: Thu, 12 Jul 2018 15:20:10 +0200 Subject: [PATCH] =?utf8?q?POD=20Erg=C3=A4nzungen?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit BankTransaction::save_single_bank_transaction kann nur 1 noch niemals vorher verbuchte Bankbewegung mit n Belegen verbuchen. Sollte etwas klarer im POD und später in der Methode deutlich gemacht werden. --- SL/Controller/BankTransaction.pm | 13 +++++++++++++ SL/DB/BankTransaction.pm | 10 ++++++++++ 2 files changed, 23 insertions(+) diff --git a/SL/Controller/BankTransaction.pm b/SL/Controller/BankTransaction.pm index 370ac954c..591ee7c9e 100644 --- a/SL/Controller/BankTransaction.pm +++ b/SL/Controller/BankTransaction.pm @@ -959,6 +959,19 @@ tries to post its amount to a certain number of invoices (parameter C, an array ref of database IDs to purchase or sales invoice objects). +This method cannot handle already partly assigned bank transactions, i.e. +a bank transaction that has a invoice_amount <> 0 but not the fully +transaction amount (invoice_amount == amount). +Currently this state is impossible from the point of the user interface, +but for double safety and further reliance posting an bank_transaction +where some invoice_amount is already assigned or a RecordLink from +bank to document exists will not be accepted. + +If the amount of the bank transaction is higher than the sum of +the assigned invoices (1 .. n) the last invoice will be overpayed. + +Therefore this function implements not all valid uses cases. + The whole function is wrapped in a database transaction. If an exception occurs the bank transaction is not posted at all. The same is true if the code detects an error during the execution, e.g. a bank diff --git a/SL/DB/BankTransaction.pm b/SL/DB/BankTransaction.pm index 6259d41e3..06302bb01 100644 --- a/SL/DB/BankTransaction.pm +++ b/SL/DB/BankTransaction.pm @@ -329,6 +329,16 @@ Example: my $invoice = SL::DB::Manager::Invoice->find_by(invnumber => '198'); my ($agreement,rule_matches) = $bt->get_agreement_with_invoice($invoice); +=item C + +Returns an array of record names (invoice number or gl reference) +which are linked for this bank transaction. + +Returns an empty array ref if no links are found. +Usage: + croak("No linked records at all") unless @{ $bt->linked_invoices() }; + + =back =head1 AUTHOR -- 2.20.1