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

(-)a/Koha/Account.pm (-1 / +32 lines)
Lines 421-426 sub outstanding_debits { Link Here
421
    return ( $total, $lines );
421
    return ( $total, $lines );
422
}
422
}
423
423
424
=head3 outstanding_credits
425
426
my ( $total, $lines ) = Koha::Account->new({ patron_id => $patron_id })->outstanding_credits;
427
428
=cut
429
430
sub outstanding_credits {
431
    my ($self) = @_;
432
433
    my $outstanding_credits = Koha::Account::Lines->search(
434
        {   borrowernumber    => $self->{patron_id},
435
            amountoutstanding => { '<' => 0 }
436
        },
437
        {   select => [ { sum => 'amountoutstanding' } ],
438
            as     => ['outstanding_credits_total'],
439
        }
440
    );
441
    my $total
442
        = ( $outstanding_credits->count )
443
        ? $outstanding_credits->next->get_column('outstanding_credits_total') + 0
444
        : 0;
445
446
    my $lines = Koha::Account::Lines->search(
447
        {
448
            borrowernumber    => $self->{patron_id},
449
            amountoutstanding => { '<' => 0 }
450
        }
451
    );
452
453
    return ( $total, $lines );
454
}
455
424
=head3 non_issues_charges
456
=head3 non_issues_charges
425
457
426
my $non_issues_charges = $self->non_issues_charges
458
my $non_issues_charges = $self->non_issues_charges
427
- 

Return to bug 20990