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

(-)a/Koha/Patron.pm (+12 lines)
Lines 519-524 sub get_overdues { Link Here
519
    return $issues;
519
    return $issues;
520
}
520
}
521
521
522
=head3 get_account_lines
523
524
my $fines = $patron->get_account_lines
525
526
=cut
527
528
sub get_account_lines {
529
    my ($self) = @_;
530
    my $account_lines = $self->_result->accountlines;
531
    return Koha::Account::Lines->_new_from_dbic($account_lines);
532
}
533
522
=head3 type
534
=head3 type
523
535
524
=cut
536
=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 => 14;
22
use Test::More tests => 16;
23
use Test::Warn;
23
use Test::Warn;
24
use DateTime;
24
use DateTime;
25
25
Lines 471-476 subtest 'get_overdues' => sub { Link Here
471
    $patron->delete;
471
    $patron->delete;
472
};
472
};
473
473
474
subtest 'get_account_lines' => sub {
475
    plan tests => 2;
476
477
    my $patron = $builder->build({source => 'Borrower'});
478
479
    my $accountline_1 = $builder->build({ source => 'Accountline',
480
        value  => { borrowernumber => $patron->{borrowernumber},
481
                    amount => 42,
482
                    amountoutstanding => 42 }
483
    });
484
    my $accountline_2 = $builder->build({ source => 'Accountline',
485
        value  => { borrowernumber => $patron->{borrowernumber},
486
                    amount => -13,
487
                    amountoutstanding => -13 }
488
    });
489
490
    $patron = Koha::Patrons->find( $patron->{borrowernumber} );
491
    my $account_lines = $patron->get_account_lines;
492
    is( $account_lines->count, 2, 'There should have 2 account lines for that patron' );
493
    is( ref($account_lines),   'Koha::Account::Lines', 'get_account_lines should return a Koha::Account::Lines object' );
494
495
    $patron->delete;
496
};
497
474
$retrieved_patron_1->delete;
498
$retrieved_patron_1->delete;
475
is( Koha::Patrons->search->count, $nb_of_patrons + 1, 'Delete should have deleted the patron' );
499
is( Koha::Patrons->search->count, $nb_of_patrons + 1, 'Delete should have deleted the patron' );
476
500
477
- 

Return to bug 17585