use Modern::Perl;
use Carp;
use List::Util qw(sum0);
use Koha::Database;
=cut
sub total {
my ( $self ) = @_;
my ($self) = @_;
my $total = sum0( $self->get_column('amount') );
my $offsets = $self->search(
{},
return $total;
{
select => [ { sum => 'amount' } ],
as => ['total_amount'],
}
);
return $offsets->count
? $offsets->next->get_column('total_amount') + 0
: 0;
=head2 Internal methods
-