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

(-)a/t/db_dependent/Circulation.t (-2 / +109 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 => 92;
21
21
22
BEGIN {
22
BEGIN {
23
    require_ok('C4::Circulation');
23
    require_ok('C4::Circulation');
Lines 1249-1254 subtest 'CanBookBeIssued + Koha::Patron->is_debarred|has_overdues' => sub { Link Here
1249
    is( $error->{USERBLOCKEDNOENDDATE},    '9999-12-31' );
1249
    is( $error->{USERBLOCKEDNOENDDATE},    '9999-12-31' );
1250
};
1250
};
1251
1251
1252
subtest 'MultipleReserves' => sub {
1253
    plan tests => 3;
1254
1255
    my $biblio = MARC::Record->new();
1256
    my $title = 'Silence in the library';
1257
    $biblio->append_fields(
1258
        MARC::Field->new('100', ' ', ' ', a => 'Moffat, Steven'),
1259
        MARC::Field->new('245', ' ', ' ', a => $title),
1260
    );
1261
1262
    my ($biblionumber, $biblioitemnumber) = AddBiblio($biblio, '');
1263
1264
    my $branch = $library2->{branchcode};
1265
1266
    my $barcode1 = 'R00110001';
1267
    my ( $item_bibnum1, $item_bibitemnum1, $itemnumber1 ) = AddItem(
1268
        {
1269
            homebranch       => $branch,
1270
            holdingbranch    => $branch,
1271
            barcode          => $barcode1,
1272
            replacementprice => 12.00,
1273
            itype            => $itemtype
1274
        },
1275
        $biblionumber
1276
    );
1277
1278
    my $barcode2 = 'R00110002';
1279
    my ( $item_bibnum2, $item_bibitemnum2, $itemnumber2 ) = AddItem(
1280
        {
1281
            homebranch       => $branch,
1282
            holdingbranch    => $branch,
1283
            barcode          => $barcode2,
1284
            replacementprice => 12.00,
1285
            itype            => $itemtype
1286
        },
1287
        $biblionumber
1288
    );
1289
1290
    my $bibitems       = '';
1291
    my $priority       = '1';
1292
    my $resdate        = undef;
1293
    my $expdate        = undef;
1294
    my $notes          = '';
1295
    my $checkitem      = undef;
1296
    my $found          = undef;
1297
1298
    my %renewing_borrower_data = (
1299
        firstname =>  'John',
1300
        surname => 'Renewal',
1301
        categorycode => 'S',
1302
        branchcode => $branch,
1303
    );
1304
    my $renewing_borrowernumber = AddMember(%renewing_borrower_data);
1305
    my $renewing_borrower = GetMember( borrowernumber => $renewing_borrowernumber );
1306
    my $issue = AddIssue( $renewing_borrower, $barcode1);
1307
    my $datedue = dt_from_string( $issue->date_due() );
1308
    is (defined $issue->date_due(), 1, "item 1 checked out");
1309
    my $borrowing_borrowernumber = GetItemIssue($itemnumber1)->{borrowernumber};
1310
1311
    my %reserving_borrower_data1 = (
1312
        firstname =>  'Katrin',
1313
        surname => 'Reservation',
1314
        categorycode => 'S',
1315
        branchcode => $branch,
1316
    );
1317
    my $reserving_borrowernumber1 = AddMember(%reserving_borrower_data1);
1318
    AddReserve(
1319
        $branch, $reserving_borrowernumber1, $biblionumber,
1320
        $bibitems,  $priority, $resdate, $expdate, $notes,
1321
        $title, $checkitem, $found
1322
    );
1323
1324
    my %reserving_borrower_data2 = (
1325
        firstname =>  'Kirk',
1326
        surname => 'Reservation',
1327
        categorycode => 'S',
1328
        branchcode => $branch,
1329
    );
1330
    my $reserving_borrowernumber2 = AddMember(%reserving_borrower_data2);
1331
    AddReserve(
1332
        $branch, $reserving_borrowernumber2, $biblionumber,
1333
        $bibitems,  $priority, $resdate, $expdate, $notes,
1334
        $title, $checkitem, $found
1335
    );
1336
1337
    {
1338
        my ( $renewokay, $error ) = CanBookBeRenewed($renewing_borrowernumber, $itemnumber1, 1);
1339
        is($renewokay, 0, 'Bug 17641 - should cover the case where 2 books are both reserved, so failing');
1340
    }
1341
1342
    my $barcode3 = 'R00110003';
1343
    my ( $item_bibnum3, $item_bibitemnum3, $itemnumber3 ) = AddItem(
1344
        {
1345
            homebranch       => $branch,
1346
            holdingbranch    => $branch,
1347
            barcode          => $barcode3,
1348
            replacementprice => 12.00,
1349
            itype            => $itemtype
1350
        },
1351
        $biblionumber
1352
    );
1353
1354
    {
1355
        my ( $renewokay, $error ) = CanBookBeRenewed($renewing_borrowernumber, $itemnumber1, 1);
1356
        is($renewokay, 1, 'Bug 17641 - should cover the case where 2 books are reserved, but a third one is available');
1357
    }
1358
};
1359
1252
subtest 'CanBookBeIssued + AllowMultipleIssuesOnABiblio' => sub {
1360
subtest 'CanBookBeIssued + AllowMultipleIssuesOnABiblio' => sub {
1253
    plan tests => 5;
1361
    plan tests => 5;
1254
1362
1255
- 

Return to bug 17941