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

(-)a/Koha/Account/Line.pm (+1 lines)
Lines 28-33 use Koha::Account::Offsets; Link Here
28
use Koha::Database;
28
use Koha::Database;
29
use Koha::Exceptions::Account;
29
use Koha::Exceptions::Account;
30
use Koha::Items;
30
use Koha::Items;
31
use Koha::Checkouts;
31
32
32
use base qw(Koha::Object);
33
use base qw(Koha::Object);
33
34
(-)a/Koha/Old/Checkout.pm (-1 / +1 lines)
Lines 19-25 use Modern::Perl; Link Here
19
19
20
use Koha::Database;
20
use Koha::Database;
21
21
22
use base qw(Koha::Object);
22
use base qw(Koha::Checkout);
23
23
24
=head1 NAME
24
=head1 NAME
25
25
(-)a/Koha/Old/Checkouts.pm (-1 / +1 lines)
Lines 20-26 use Modern::Perl; Link Here
20
use Koha::Database;
20
use Koha::Database;
21
use Koha::Old::Checkout;
21
use Koha::Old::Checkout;
22
22
23
use base qw(Koha::Objects);
23
use base qw(Koha::Checkouts);
24
24
25
sub _type {
25
sub _type {
26
    return 'OldIssue';
26
    return 'OldIssue';
(-)a/Koha/Schema/Result/OldIssue.pm (+10 lines)
Lines 233-238 __PACKAGE__->belongs_to( Link Here
233
  },
233
  },
234
);
234
);
235
235
236
__PACKAGE__->belongs_to(
237
  "branch",
238
  "Koha::Schema::Result::Branch",
239
  { branchcode => "branchcode" },
240
  {
241
    is_deferrable => 1,
242
    join_type     => "LEFT",
243
  },
244
);
245
236
246
237
# Created by DBIx::Class::Schema::Loader v0.07046 @ 2019-04-10 19:55:44
247
# Created by DBIx::Class::Schema::Loader v0.07046 @ 2019-04-10 19:55:44
238
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:E2N2paWcCHg916100ry+2A
248
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:E2N2paWcCHg916100ry+2A
(-)a/t/db_dependent/Koha/Account/Lines.t (-2 / +45 lines)
Lines 19-25 Link Here
19
19
20
use Modern::Perl;
20
use Modern::Perl;
21
21
22
use Test::More tests => 15;
22
use Test::More tests => 16;
23
use Test::Exception;
23
use Test::Exception;
24
24
25
use C4::Circulation qw/AddIssue AddReturn/;
25
use C4::Circulation qw/AddIssue AddReturn/;
Lines 1208-1211 subtest "reduce() tests" => sub { Link Here
1208
    $schema->storage->txn_rollback;
1208
    $schema->storage->txn_rollback;
1209
};
1209
};
1210
1210
1211
subtest 'checkout' => sub {
1212
    plan tests => 1;
1213
1214
    $schema->storage->txn_begin;
1215
1216
    my $library    = $builder->build( { source => 'Branch' } );
1217
    my $biblioitem = $builder->build( { source => 'Biblioitem' } );
1218
    my $patron     = $builder->build( { source => 'Borrower' } );
1219
    my $item       = Koha::Item->new(
1220
        {
1221
            biblionumber     => $biblioitem->{biblionumber},
1222
            biblioitemnumber => $biblioitem->{biblioitemnumber},
1223
            homebranch       => $library->{branchcode},
1224
            holdingbranch    => $library->{branchcode},
1225
            barcode          => 'some_barcode_13',
1226
            itype            => 'BK',
1227
        }
1228
    )->store;
1229
1230
    my $checkout = Koha::Checkout->new(
1231
        {
1232
            borrowernumber => $patron->{borrowernumber},
1233
            itemnumber     => $item->itemnumber,
1234
            branchcode     => $library->{branchcode},
1235
        }
1236
    )->store;
1237
1238
    my $line = Koha::Account::Line->new(
1239
        {
1240
            borrowernumber => $patron->{borrowernumber},
1241
            itemnumber     => $item->itemnumber,
1242
            issue_id       => $checkout->id,
1243
            accounttype    => "F",
1244
            amount         => 10,
1245
            interface      => 'commandline',
1246
        }
1247
    )->store;
1248
1249
    is( $line->checkout->id, $checkout->id,
1250
        'Koha::Account::Line->checkout should return the correct checkout' );
1251
1252
    $schema->storage->txn_rollback;
1253
};
1254
1211
1;
1255
1;
1212
- 

Return to bug 15985