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

(-)a/Koha/Checkout.pm (+14 lines)
Lines 79-84 sub item { Link Here
79
    return Koha::Item->_new_from_dbic( $item_rs );
79
    return Koha::Item->_new_from_dbic( $item_rs );
80
}
80
}
81
81
82
=head3 accountlines
83
84
my $accountlines = $checkout->accountlines;
85
86
Return the checked out accountlines
87
88
=cut
89
90
sub accountlines {
91
    my ( $self ) = @_;
92
    my $accountlines_rs = $self->_result->accountlines;
93
    return Koha::Account::Lines->_new_from_dbic( $accountlines_rs );
94
}
95
82
=head3 library
96
=head3 library
83
97
84
my $library = $checkout->library;
98
my $library = $checkout->library;
(-)a/Koha/Old/Checkout.pm (+14 lines)
Lines 45-50 sub item { Link Here
45
    return Koha::Item->_new_from_dbic( $item_rs );
45
    return Koha::Item->_new_from_dbic( $item_rs );
46
}
46
}
47
47
48
=head3 accountlines
49
50
my $accountlines = $checkout->accountlines;
51
52
Return the checked out accountlines
53
54
=cut
55
56
sub accountlines {
57
    my ( $self ) = @_;
58
    my $accountlines_rs = $self->_result->accountlines;
59
    return Koha::Account::Lines->_new_from_dbic( $accountlines_rs );
60
}
61
48
=head3 library
62
=head3 library
49
63
50
my $library = $checkout->library;
64
my $library = $checkout->library;
(-)a/t/db_dependent/Koha/Account/Line.t (-1 / +4 lines)
Lines 203-209 subtest 'is_credit() and is_debit() tests' => sub { Link Here
203
203
204
subtest 'apply() tests' => sub {
204
subtest 'apply() tests' => sub {
205
205
206
    plan tests => 31;
206
    plan tests => 32;
207
207
208
    $schema->storage->txn_begin;
208
    $schema->storage->txn_begin;
209
209
Lines 346-351 subtest 'apply() tests' => sub { Link Here
346
        }
346
        }
347
    )->store();
347
    )->store();
348
348
349
    my $a = $checkout->accountlines->next;
350
    is( $a->id, $accountline->id, "Koha::Checkout::accountlines returns the related acountline" );
351
349
    # Enable renewing upon fine payment
352
    # Enable renewing upon fine payment
350
    t::lib::Mocks::mock_preference( 'RenewAccruingItemWhenPaid', 1 );
353
    t::lib::Mocks::mock_preference( 'RenewAccruingItemWhenPaid', 1 );
351
    my $called = 0;
354
    my $called = 0;
(-)a/t/db_dependent/Koha/Checkouts.t (-2 / +34 lines)
Lines 19-25 Link Here
19
19
20
use Modern::Perl;
20
use Modern::Perl;
21
21
22
use Test::More tests => 10;
22
use Test::More tests => 11;
23
23
24
use C4::Circulation qw( MarkIssueReturned AddReturn );
24
use C4::Circulation qw( MarkIssueReturned AddReturn );
25
use Koha::Checkouts;
25
use Koha::Checkouts;
Lines 110-115 subtest 'item' => sub { Link Here
110
        'Koha::Checkout->item should return the correct item' );
110
        'Koha::Checkout->item should return the correct item' );
111
};
111
};
112
112
113
subtest 'accountlines' => sub {
114
    plan tests => 3;
115
116
    my $accountline = Koha::Account::Line->new(
117
        {
118
            issue_id          => $retrieved_checkout_1->id,
119
            borrowernumber    => $retrieved_checkout_1->borrowernumber,
120
            itemnumber        => $retrieved_checkout_1->itemnumber,
121
            branchcode        => $retrieved_checkout_1->branchcode,
122
            date              => \'NOW()',
123
            debit_type_code   => 'OVERDUE',
124
            status            => 'UNRETURNED',
125
            interface         => 'cli',
126
            amount            => '1',
127
            amountoutstanding => '1',
128
        }
129
    )->store();
130
131
    my $accountlines = $retrieved_checkout_1->accountlines;
132
    is( ref($accountlines), 'Koha::Account::Lines',
133
        'Koha::Checkout->accountlines should return a Koha::Item' );
134
135
    my $line = $accountlines->next;
136
    is( ref($line), 'Koha::Account::Line',
137
        'next returns a Koha::Account::Line' );
138
139
    is(
140
        $accountline->id,
141
        $line->id,
142
        'Koha::Checkout->accountlines should return the correct accountlines'
143
    );
144
};
145
113
subtest 'patron' => sub {
146
subtest 'patron' => sub {
114
    plan tests => 3;
147
    plan tests => 3;
115
    my $patron = $builder->build_object(
148
    my $patron = $builder->build_object(
116
- 

Return to bug 30612