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

(-)a/Koha/Checkout.pm (+14 lines)
Lines 78-83 sub item { Link Here
78
    return Koha::Item->_new_from_dbic( $item_rs );
78
    return Koha::Item->_new_from_dbic( $item_rs );
79
}
79
}
80
80
81
=head3 accountlines
82
83
my $accountlines = $checkout->accountlines;
84
85
Return the checked out accountlines
86
87
=cut
88
89
sub accountlines {
90
    my ( $self ) = @_;
91
    my $accountlines_rs = $self->_result->accountlines;
92
    return Koha::Account::Lines->_new_from_dbic( $accountlines_rs );
93
}
94
81
=head3 library
95
=head3 library
82
96
83
my $library = $checkout->library;
97
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/Koha/Schema/Result/Issue.pm (+7 lines)
Lines 388-393 __PACKAGE__->might_have( Link Here
388
    { cascade_copy       => 0, cascade_delete => 0 },
388
    { cascade_copy       => 0, cascade_delete => 0 },
389
);
389
);
390
390
391
__PACKAGE__->has_many(
392
    "accountlines",
393
    "Koha::Schema::Result::Accountline",
394
    { "foreign.issue_id" => "self.issue_id" },
395
    { cascade_copy       => 0, cascade_delete => 0 },
396
);
397
391
sub koha_object_class {
398
sub koha_object_class {
392
    'Koha::Checkout';
399
    'Koha::Checkout';
393
}
400
}
(-)a/Koha/Schema/Result/OldIssue.pm (+7 lines)
Lines 351-356 Related object: L<Koha::Schema::Result::ReturnClaim> Link Here
351
351
352
=cut
352
=cut
353
353
354
__PACKAGE__->has_many(
355
    "accountlines",
356
    "Koha::Schema::Result::Accountline",
357
    { "foreign.issue_id" => "self.issue_id" },
358
    { cascade_copy       => 0, cascade_delete => 0 },
359
);
360
354
__PACKAGE__->might_have(
361
__PACKAGE__->might_have(
355
    "return_claim",
362
    "return_claim",
356
    "Koha::Schema::Result::ReturnClaim",
363
    "Koha::Schema::Result::ReturnClaim",
(-)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