View | Details | Raw Unified | Return to bug 21896
Collapse All | Expand All

(-)a/Koha/Account.pm (-1 / +27 lines)
Lines 492-497 sub non_issues_charges { Link Here
492
      : 0;
492
      : 0;
493
}
493
}
494
494
495
=head3 normalize_balance
496
497
$account->normalize_balance();
498
499
Find outstanding credits and use them to pay outstanding debits
500
501
=cut
502
503
sub normalize_balance {
504
    my ($self) = @_;
505
506
    my $outstanding_debits  = $self->outstanding_debits;
507
    my $outstanding_credits = $self->outstanding_credits;
508
509
    while (     $outstanding_debits->total_outstanding > 0
510
            and my $credit = $outstanding_credits->next )
511
    {
512
        # there's both outstanding debits and credits
513
        $credit->apply( { debits => $outstanding_debits } );    # applying credit, no special offset
514
515
        $outstanding_debits = $self->outstanding_debits;
516
517
    }
518
519
    return $self;
520
}
521
495
1;
522
1;
496
523
497
=head2 Name mappings
524
=head2 Name mappings
498
- 

Return to bug 21896