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 346-352 subtest "Koha::Account::pay writeoff tests" => sub { Link Here
346
347
347
subtest "More Koha::Account::pay tests" => sub {
348
subtest "More Koha::Account::pay tests" => sub {
348
349
349
    plan tests => 6;
350
    plan tests => 8;
350
351
351
    # Create a borrower
352
    # Create a borrower
352
    my $category   = $builder->build({ source => 'Category' })->{ categorycode };
353
    my $category   = $builder->build({ source => 'Category' })->{ categorycode };
Lines 376-381 subtest "More Koha::Account::pay tests" => sub { Link Here
376
    # make the full payment
377
    # make the full payment
377
    $account->pay({ lines => [$line], amount => $amount, library_id => $branch, note => 'A payment note' });
378
    $account->pay({ lines => [$line], amount => $amount, library_id => $branch, note => 'A payment note' });
378
379
380
    my $offset = Koha::Account::Offsets->search({ debit_id => $accountline->{accountlines_id} })->next();
381
    is( $offset->amount(), '-100.000000', 'Offset amount is -100.00' );
382
    is( $offset->type(), 'Payment', 'Offset type is Payment' );
383
379
    my $stat = $schema->resultset('Statistic')->search({
384
    my $stat = $schema->resultset('Statistic')->search({
380
        branch  => $branch,
385
        branch  => $branch,
381
        type    => 'payment'
386
        type    => 'payment'
Lines 395-401 subtest "More Koha::Account::pay tests" => sub { Link Here
395
400
396
subtest "Even more Koha::Account::pay tests" => sub {
401
subtest "Even more Koha::Account::pay tests" => sub {
397
402
398
    plan tests => 6;
403
    plan tests => 8;
399
404
400
    # Create a borrower
405
    # Create a borrower
401
    my $category   = $builder->build({ source => 'Category' })->{ categorycode };
406
    my $category   = $builder->build({ source => 'Category' })->{ categorycode };
Lines 426-431 subtest "Even more Koha::Account::pay tests" => sub { Link Here
426
    # make the full payment
431
    # make the full payment
427
    $account->pay({ lines => [$line], amount => $partialamount, library_id => $branch, note => 'A payment note' });
432
    $account->pay({ lines => [$line], amount => $partialamount, library_id => $branch, note => 'A payment note' });
428
433
434
    my $offset = Koha::Account::Offsets->search( { debit_id => $accountline->{ accountlines_id } } )->next();
435
    is( $offset->amount, '-60.000000', 'Offset amount is -60.00' );
436
    is( $offset->type, 'Payment', 'Offset type is payment' );
437
429
    my $stat = $schema->resultset('Statistic')->search({
438
    my $stat = $schema->resultset('Statistic')->search({
430
        branch  => $branch,
439
        branch  => $branch,
431
        type    => 'payment'
440
        type    => 'payment'
(-)a/t/db_dependent/Circulation.t (-1 / +14 lines)
Lines 17-23 Link Here
17
17
18
use Modern::Perl;
18
use Modern::Perl;
19
19
20
use Test::More tests => 91;
20
use Test::More tests => 98;
21
21
22
BEGIN {
22
BEGIN {
23
    require_ok('C4::Circulation');
23
    require_ok('C4::Circulation');
Lines 37-42 use C4::Overdues qw(UpdateFine CalcFine); Link Here
37
use Koha::DateUtils;
37
use Koha::DateUtils;
38
use Koha::Database;
38
use Koha::Database;
39
use Koha::Subscriptions;
39
use Koha::Subscriptions;
40
use Koha::Account::Lines;
41
use Koha::Account::Offsets;
40
42
41
my $schema = Koha::Database->schema;
43
my $schema = Koha::Database->schema;
42
$schema->storage->txn_begin;
44
$schema->storage->txn_begin;
Lines 664-669 C4::Context->dbh->do("DELETE FROM accountlines"); Link Here
664
        }
666
        }
665
    );
667
    );
666
668
669
    my $line = Koha::Account::Lines->search({ borrowernumber => $renewing_borrower->{borrowernumber} })->next();
670
    is( $line->accounttype, 'FU', 'Account line type is FU' );
671
    is( $line->lastincrement, '15.000000', 'Account line last increment is 15.00' );
672
    is( $line->amountoutstanding, '15.000000', 'Account line amount outstanding is 15.00' );
673
    is( $line->amount, '15.000000', 'Account line amount is 15.00' );
674
    is( $line->issue_id, $issue->id, 'Account line issue id matches' );
675
676
    my $offset = Koha::Account::Offsets->search({ debit_id => $line->id })->next();
677
    is( $offset->type, 'Fine', 'Account offset type is Fine' );
678
    is( $offset->amount, '15.000000', 'Account offset amount is 15.00' );
679
667
    LostItem( $itemnumber, 1 );
680
    LostItem( $itemnumber, 1 );
668
681
669
    my $item = Koha::Database->new()->schema()->resultset('Item')->find($itemnumber);
682
    my $item = Koha::Database->new()->schema()->resultset('Item')->find($itemnumber);
(-)a/t/db_dependent/Circulation/NoIssuesChargeGuarantees.t (-2 / +11 lines)
Lines 17-29 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
use t::lib::Mocks;
23
use t::lib::Mocks;
24
24
25
use C4::Accounts qw( manualinvoice );
25
use C4::Accounts qw( manualinvoice );
26
use C4::Circulation qw( CanBookBeIssued );
26
use C4::Circulation qw( CanBookBeIssued );
27
use Koha::Account::Lines;
28
use Koha::Account::Offsets;
27
29
28
my $schema = Koha::Database->new->schema;
30
my $schema = Koha::Database->new->schema;
29
$schema->storage->txn_begin;
31
$schema->storage->txn_begin;
Lines 63-68 manualinvoice( $guarantee->{borrowernumber}, undef, undef, 'L', 10.00 ); Link Here
63
( $issuingimpossible, $needsconfirmation ) = CanBookBeIssued( $patron, $item->{barcode} );
65
( $issuingimpossible, $needsconfirmation ) = CanBookBeIssued( $patron, $item->{barcode} );
64
is( $issuingimpossible->{DEBT_GUARANTEES} + 0, '10.00' + 0, "Patron cannot check out item due to debt for guarantee" );
66
is( $issuingimpossible->{DEBT_GUARANTEES} + 0, '10.00' + 0, "Patron cannot check out item due to debt for guarantee" );
65
67
68
my $accountline = Koha::Account::Lines->search({ borrowernumber => $guarantee->{borrowernumber} })->next();
69
is( $accountline->amountoutstanding, "10.000000", "Found 10.00 amount outstanding" );
70
is( $accountline->accounttype, "L", "Account type is L" );
71
72
my $offset = Koha::Account::Offsets->search({ debit_id => $accountline->id })->next();
73
is( $offset->type, 'Manual Debit', 'Got correct offset type' );
74
is( $offset->amount, '10.000000', 'Got amount of $10.00' );
75
66
$schema->storage->txn_rollback;
76
$schema->storage->txn_rollback;
67
77
68
1;
78
1;
69
- 

Return to bug 14826