Bug 22837: Update apply to accept an arrayref
authorMartin Renvoize <martin.renvoize@ptfs-europe.com>
Fri, 3 May 2019 11:59:16 +0000 (12:59 +0100)
committerMartin Renvoize <martin.renvoize@ptfs-europe.com>
Mon, 23 Sep 2019 09:51:14 +0000 (10:51 +0100)
This patch update the signature of Koha::Account::Line->apply to accept
an arrayref of debits to apply against a credit instead of requireing a
Koha::Objects set.

Signed-off-by: Liz Rea <wizzyrea@gmail.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Koha/Account/Line.pm

index f4f9498..f745dc1 100644 (file)
@@ -204,7 +204,7 @@ sub apply {
     my $schema = Koha::Database->new->schema;
 
     $schema->txn_do( sub {
-        while ( my $debit = $debits->next ) {
+        for my $debit ( @{$debits} ) {
 
             unless ( $debit->is_debit ) {
                 Koha::Exceptions::Account::IsNotDebit->throw(