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

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

Return to bug 20990