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

(-)a/Koha/Patron.pm (+12 lines)
Lines 507-512 sub get_overdues { Link Here
507
    return $issues;
507
    return $issues;
508
}
508
}
509
509
510
=head3 get_account_lines
511
512
my $fines = $patron->get_account_lines
513
514
=cut
515
516
sub get_account_lines {
517
    my ($self) = @_;
518
    my $account_lines = $self->_result->accountlines;
519
    return Koha::Account::Lines->_new_from_dbic($account_lines);
520
}
521
510
=head3 type
522
=head3 type
511
523
512
=cut
524
=cut
(-)a/t/db_dependent/Koha/Patrons.t (-2 / +25 lines)
Lines 19-25 Link Here
19
19
20
use Modern::Perl;
20
use Modern::Perl;
21
21
22
use Test::More tests => 15;
22
use Test::More tests => 16;
23
use Test::Warn;
23
use Test::Warn;
24
use DateTime;
24
use DateTime;
25
25
Lines 636-641 subtest 'get_overdues' => sub { Link Here
636
    $patron->delete;
636
    $patron->delete;
637
};
637
};
638
638
639
subtest 'get_account_lines' => sub {
640
    plan tests => 2;
641
642
    my $patron = $builder->build({source => 'Borrower'});
643
644
    my $accountline_1 = $builder->build({ source => 'Accountline',
645
        value  => { borrowernumber => $patron->{borrowernumber},
646
                    amount => 42,
647
                    amountoutstanding => 42 }
648
    });
649
    my $accountline_2 = $builder->build({ source => 'Accountline',
650
        value  => { borrowernumber => $patron->{borrowernumber},
651
                    amount => -13,
652
                    amountoutstanding => -13 }
653
    });
654
655
    $patron = Koha::Patrons->find( $patron->{borrowernumber} );
656
    my $account_lines = $patron->get_account_lines;
657
    is( $account_lines->count, 2, 'There should have 2 account lines for that patron' );
658
    is( ref($account_lines),   'Koha::Account::Lines', 'get_account_lines should return a Koha::Account::Lines object' );
659
660
    $patron->delete;
661
};
662
639
$retrieved_patron_1->delete;
663
$retrieved_patron_1->delete;
640
is( Koha::Patrons->search->count, $nb_of_patrons + 1, 'Delete should have deleted the patron' );
664
is( Koha::Patrons->search->count, $nb_of_patrons + 1, 'Delete should have deleted the patron' );
641
665
642
- 

Return to bug 17585