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

(-)a/t/db_dependent/Accounts.t (-2 / +11 lines)
Lines 27-32 use t::lib::TestBuilder; Link Here
27
use Koha::Account;
27
use Koha::Account;
28
use Koha::Account::Lines;
28
use Koha::Account::Lines;
29
use Koha::Account::Line;
29
use Koha::Account::Line;
30
use Koha::Account::Offsets;
30
31
31
BEGIN {
32
BEGIN {
32
    use_ok('C4::Accounts');
33
    use_ok('C4::Accounts');
Lines 253-259 subtest "Koha::Account::pay tests" => sub { Link Here
253
254
254
subtest "More Koha::Account::pay tests" => sub {
255
subtest "More Koha::Account::pay tests" => sub {
255
256
256
    plan tests => 6;
257
    plan tests => 8;
257
258
258
    # Create a borrower
259
    # Create a borrower
259
    my $category   = $builder->build({ source => 'Category' })->{ categorycode };
260
    my $category   = $builder->build({ source => 'Category' })->{ categorycode };
Lines 283-288 subtest "More Koha::Account::pay tests" => sub { Link Here
283
    # make the full payment
284
    # make the full payment
284
    $account->pay({ lines => [$line], amount => $amount, library_id => $branch, note => 'A payment note' });
285
    $account->pay({ lines => [$line], amount => $amount, library_id => $branch, note => 'A payment note' });
285
286
287
    my $offset = Koha::Account::Offsets->search({ debit_id => $accountline->{accountlines_id} })->next();
288
    is( $offset->amount(), '-100.000000', 'Offset amount is -100.00' );
289
    is( $offset->type(), 'Payment', 'Offset type is Payment' );
290
286
    my $stat = $schema->resultset('Statistic')->search({
291
    my $stat = $schema->resultset('Statistic')->search({
287
        branch  => $branch,
292
        branch  => $branch,
288
        type    => 'payment'
293
        type    => 'payment'
Lines 302-308 subtest "More Koha::Account::pay tests" => sub { Link Here
302
307
303
subtest "Even more Koha::Account::pay tests" => sub {
308
subtest "Even more Koha::Account::pay tests" => sub {
304
309
305
    plan tests => 6;
310
    plan tests => 8;
306
311
307
    # Create a borrower
312
    # Create a borrower
308
    my $category   = $builder->build({ source => 'Category' })->{ categorycode };
313
    my $category   = $builder->build({ source => 'Category' })->{ categorycode };
Lines 333-338 subtest "Even more Koha::Account::pay tests" => sub { Link Here
333
    # make the full payment
338
    # make the full payment
334
    $account->pay({ lines => [$line], amount => $partialamount, library_id => $branch, note => 'A payment note' });
339
    $account->pay({ lines => [$line], amount => $partialamount, library_id => $branch, note => 'A payment note' });
335
340
341
    my $offset = Koha::Account::Offsets->search( { debit_id => $accountline->{ accountlines_id } } )->next();
342
    is( $offset->amount, '-60.000000', 'Offset amount is -60.00' );
343
    is( $offset->type, 'Payment', 'Offset type is payment' );
344
336
    my $stat = $schema->resultset('Statistic')->search({
345
    my $stat = $schema->resultset('Statistic')->search({
337
        branch  => $branch,
346
        branch  => $branch,
338
        type    => 'payment'
347
        type    => 'payment'
(-)a/t/db_dependent/Circulation.t (-1 / +14 lines)
Lines 27-36 use C4::Reserves; Link Here
27
use C4::Overdues qw(UpdateFine);
27
use C4::Overdues qw(UpdateFine);
28
use Koha::DateUtils;
28
use Koha::DateUtils;
29
use Koha::Database;
29
use Koha::Database;
30
use Koha::Account::Lines;
31
use Koha::Account::Offsets;
30
32
31
use t::lib::TestBuilder;
33
use t::lib::TestBuilder;
32
34
33
use Test::More tests => 86;
35
use Test::More tests => 93;
34
36
35
BEGIN {
37
BEGIN {
36
    use_ok('C4::Circulation');
38
    use_ok('C4::Circulation');
Lines 556-561 C4::Context->dbh->do("DELETE FROM accountlines"); Link Here
556
        }
558
        }
557
    );
559
    );
558
560
561
    my $line = Koha::Account::Lines->search({ borrowernumber => $renewing_borrower->{borrowernumber} })->next();
562
    is( $line->accounttype, 'FU', 'Account line type is FU' );
563
    is( $line->lastincrement, '15.000000', 'Account line last increment is 15.00' );
564
    is( $line->amountoutstanding, '15.000000', 'Account line amount outstanding is 15.00' );
565
    is( $line->amount, '15.000000', 'Account line amount is 15.00' );
566
    is( $line->issue_id, $issue->id, 'Account line issue id matches' );
567
568
    my $offset = Koha::Account::Offsets->search({ debit_id => $line->id })->next();
569
    is( $offset->type, 'Fine', 'Account offset type is Fine' );
570
    is( $offset->amount, '15.000000', 'Account offset amount is 15.00' );
571
559
    LostItem( $itemnumber, 1 );
572
    LostItem( $itemnumber, 1 );
560
573
561
    my $item = Koha::Database->new()->schema()->resultset('Item')->find($itemnumber);
574
    my $item = Koha::Database->new()->schema()->resultset('Item')->find($itemnumber);
(-)a/t/db_dependent/Circulation/NoIssuesChargeGuarantees.t (-2 / +11 lines)
Lines 17-28 Link Here
17
17
18
use Modern::Perl;
18
use Modern::Perl;
19
19
20
use Test::More tests => 2;
20
use Test::More tests => 6;
21
21
22
use t::lib::TestBuilder;
22
use t::lib::TestBuilder;
23
23
24
use C4::Accounts qw( manualinvoice );
24
use C4::Accounts qw( manualinvoice );
25
use C4::Circulation qw( CanBookBeIssued );
25
use C4::Circulation qw( CanBookBeIssued );
26
use Koha::Account::Lines;
27
use Koha::Account::Offsets;
26
28
27
my $schema = Koha::Database->new->schema;
29
my $schema = Koha::Database->new->schema;
28
$schema->storage->txn_begin;
30
$schema->storage->txn_begin;
Lines 62-67 manualinvoice( $guarantee->{borrowernumber}, undef, undef, 'L', 10.00 ); Link Here
62
( $issuingimpossible, $needsconfirmation ) = CanBookBeIssued( $patron, $item->{barcode} );
64
( $issuingimpossible, $needsconfirmation ) = CanBookBeIssued( $patron, $item->{barcode} );
63
is( $issuingimpossible->{DEBT_GUARANTEES} + 0, '10.00' + 0, "Patron cannot check out item due to debt for guarantee" );
65
is( $issuingimpossible->{DEBT_GUARANTEES} + 0, '10.00' + 0, "Patron cannot check out item due to debt for guarantee" );
64
66
67
my $accountline = Koha::Account::Lines->search({ borrowernumber => $guarantee->{borrowernumber} })->next();
68
is( $accountline->amountoutstanding, "10.000000", "Found 10.00 amount outstanding" );
69
is( $accountline->accounttype, "L", "Account type is L" );
70
71
my $offset = Koha::Account::Offsets->search({ debit_id => $accountline->id })->next();
72
is( $offset->type, 'Manual Debit', 'Got correct offset type' );
73
is( $offset->amount, '10.000000', 'Got amount of $10.00' );
74
65
$schema->storage->txn_rollback;
75
$schema->storage->txn_rollback;
66
76
67
1;
77
1;
68
- 

Return to bug 14826