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

(-)a/Koha/Account/Offsets.pm (-7 / +13 lines)
Lines 18-24 package Koha::Account::Offsets; Link Here
18
use Modern::Perl;
18
use Modern::Perl;
19
19
20
use Carp;
20
use Carp;
21
use List::Util qw(sum0);
22
21
23
use Koha::Database;
22
use Koha::Database;
24
23
Lines 41-51 Account offsets track the changes made to the balance of account lines Link Here
41
=cut
40
=cut
42
41
43
sub total {
42
sub total {
44
    my ( $self ) = @_;
43
    my ($self) = @_;
45
44
46
    my $total = sum0( $self->get_column('amount') );
45
    my $offsets = $self->search(
47
46
        {},
48
    return $total;
47
        {
48
            select => [ { sum => 'amount' } ],
49
            as     => ['total_amount'],
50
        }
51
    );
52
53
    return $offsets->count
54
      ? $offsets->next->get_column('total_amount') + 0
55
      : 0;
49
}
56
}
50
57
51
=head2 Internal methods
58
=head2 Internal methods
52
- 

Return to bug 13098