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

(-)a/C4/Reserves.pm (-1 / +8 lines)
Lines 395-400 sub CanItemBeReserved { Link Here
395
            found          => undef, # Found holds don't count against a patron's holds limit
395
            found          => undef, # Found holds don't count against a patron's holds limit
396
        }
396
        }
397
    );
397
    );
398
399
    if ( $holds_per_record == 0 ) {
400
        return { status => "noReservesAllowed" };
401
    }
398
    if ( $holds->count() >= $holds_per_record ) {
402
    if ( $holds->count() >= $holds_per_record ) {
399
        return { status => "tooManyHoldsForThisRecord", limit => $holds_per_record };
403
        return { status => "tooManyHoldsForThisRecord", limit => $holds_per_record };
400
    }
404
    }
Lines 438-443 sub CanItemBeReserved { Link Here
438
    }
442
    }
439
443
440
    # we check if it's ok or not
444
    # we check if it's ok or not
445
    if( $allowedreserves == 0 ){
446
        return { status => 'noReservesAllowed' };
447
    }
441
    if ( $reservecount >= $allowedreserves ) {
448
    if ( $reservecount >= $allowedreserves ) {
442
        return { status => 'tooManyReserves', limit => $allowedreserves };
449
        return { status => 'tooManyReserves', limit => $allowedreserves };
443
    }
450
    }
Lines 463-469 sub CanItemBeReserved { Link Here
463
    my $reserves_control_branch =
470
    my $reserves_control_branch =
464
      GetReservesControlBranch( $item->unblessed(), $borrower );
471
      GetReservesControlBranch( $item->unblessed(), $borrower );
465
    my $branchitemrule =
472
    my $branchitemrule =
466
      C4::Circulation::GetBranchItemRule( $reserves_control_branch, $item->itype ); # FIXME Should not be item->effective_itemtype?
473
      C4::Circulation::GetBranchItemRule( $reserves_control_branch, $item->effective_itemtype );
467
474
468
    if ( $branchitemrule->{holdallowed} == 0 ) {
475
    if ( $branchitemrule->{holdallowed} == 0 ) {
469
        return { status => 'notReservable' };
476
        return { status => 'notReservable' };
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt (-3 / +9 lines)
Lines 309-321 Link Here
309
                    </div>
309
                    </div>
310
                [% END %]
310
                [% END %]
311
311
312
                [% IF ( exceeded_maxreserves || exceeded_holds_per_record || alreadyreserved || none_available || alreadypossession || ageRestricted ) %]
312
                [% IF ( no_reserves_allowed || exceeded_maxreserves || exceeded_holds_per_record || alreadyreserved || none_available || alreadypossession || ageRestricted ) %]
313
                    <div class="dialog alert">
313
                    <div class="dialog alert">
314
314
315
                        [% UNLESS ( multi_hold ) %]
315
                        [% UNLESS ( multi_hold ) %]
316
                            <h3>Cannot place hold</h3>
316
                            <h3>Cannot place hold</h3>
317
                            <ul>
317
                            <ul>
318
                                [% IF ( exceeded_maxreserves ) %]
318
                                [% IF ( no_reserves_allowed ) %]
319
                                    <li><strong>No holds allowed: </strong> <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% patron.borrowernumber | uri %]">[% patron.firstname | html %] [% patron.surname | html %] </a> cannot place a hold on any of these items.</li>
320
                                [% ELSIF ( exceeded_maxreserves ) %]
319
                                    <li><strong>Too many holds: </strong> <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% patron.borrowernumber | uri %]">[% patron.firstname | html %] [% patron.surname | html %] </a> can only place a maximum of [% maxreserves | html %] total holds.</li>
321
                                    <li><strong>Too many holds: </strong> <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% patron.borrowernumber | uri %]">[% patron.firstname | html %] [% patron.surname | html %] </a> can only place a maximum of [% maxreserves | html %] total holds.</li>
320
                                [% ELSIF ( exceeded_holds_per_record ) %]
322
                                [% ELSIF ( exceeded_holds_per_record ) %]
321
                                    <li><strong>Too many holds for this record: </strong> <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% patron.borrowernumber | uri %]">[% patron.firstname | html %] [% patron.surname | html %] </a> can only place a maximum of [% max_holds_for_record | html %] hold(s) on this record.</li>
323
                                    <li><strong>Too many holds for this record: </strong> <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% patron.borrowernumber | uri %]">[% patron.firstname | html %] [% patron.surname | html %] </a> can only place a maximum of [% max_holds_for_record | html %] hold(s) on this record.</li>
Lines 333-339 Link Here
333
                            </ul>
335
                            </ul>
334
                        [% ELSE # UNLESS multi_hold %]
336
                        [% ELSE # UNLESS multi_hold %]
335
                            <h3>Cannot place hold on some items</h3>
337
                            <h3>Cannot place hold on some items</h3>
336
                            [% IF ( exceeded_maxreserves ) %]
338
                            [% IF (no_reserves_allowed ) %]
339
                                <li><strong>No holds allowed: </strong> <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% patron.borrowernumber | uri %]">[% patron.firstname | html %] [% patron.surname | html %] </a> cannot place holds on some of these title's items.</li>
340
                            [% ELSIF ( exceeded_maxreserves ) %]
337
                                <li><strong>Too many holds: </strong> <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% patron.borrowernumber | uri %]">[% patron.firstname | html %] [% patron.surname | html %] </a> can place [% new_reserves_allowed | html %] of the requested [% new_reserves_count | html %] holds for a maximum of [% maxreserves | html %] total holds.</li>
341
                                <li><strong>Too many holds: </strong> <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% patron.borrowernumber | uri %]">[% patron.firstname | html %] [% patron.surname | html %] </a> can place [% new_reserves_allowed | html %] of the requested [% new_reserves_count | html %] holds for a maximum of [% maxreserves | html %] total holds.</li>
338
                            [% ELSIF ( exceeded_holds_per_record ) %]
342
                            [% ELSIF ( exceeded_holds_per_record ) %]
339
                                [% FOREACH biblioloo IN biblioloop %]
343
                                [% FOREACH biblioloo IN biblioloop %]
Lines 587-592 Link Here
587
                                                                        Patron already has hold for this item
591
                                                                        Patron already has hold for this item
588
                                                                    [% ELSIF itemloo.not_holdable == 'cannotBeTransferred' %]
592
                                                                    [% ELSIF itemloo.not_holdable == 'cannotBeTransferred' %]
589
                                                                        Cannot be transferred to pickup library
593
                                                                        Cannot be transferred to pickup library
594
                                                                    [% ELSIF itemloo.not_holdable == 'noReservesAllowed' %]
595
                                                                        No reserves are allowed on this item
590
                                                                    [% ELSE %]
596
                                                                    [% ELSE %]
591
                                                                        [% itemloo.not_holdable | html %]
597
                                                                        [% itemloo.not_holdable | html %]
592
                                                                    [% END %]
598
                                                                    [% END %]
(-)a/reserve/request.pl (-1 / +8 lines)
Lines 186-191 if ($borrowernumber_hold && !$action) { Link Here
186
    my $new_reserves_count = scalar( @biblionumbers );
186
    my $new_reserves_count = scalar( @biblionumbers );
187
187
188
    my $maxreserves = C4::Context->preference('maxreserves');
188
    my $maxreserves = C4::Context->preference('maxreserves');
189
    $template->param( maxreserves => $maxreserves );
190
189
    if ( $maxreserves
191
    if ( $maxreserves
190
        && ( $reserves_count + $new_reserves_count > $maxreserves ) )
192
        && ( $reserves_count + $new_reserves_count > $maxreserves ) )
191
    {
193
    {
Lines 288-293 if ($patron) { Link Here
288
my $itemdata_enumchron = 0;
290
my $itemdata_enumchron = 0;
289
my $itemdata_ccode = 0;
291
my $itemdata_ccode = 0;
290
my @biblioloop = ();
292
my @biblioloop = ();
293
my $no_reserves_allowed = 0;
291
foreach my $biblionumber (@biblionumbers) {
294
foreach my $biblionumber (@biblionumbers) {
292
    next unless $biblionumber =~ m|^\d+$|;
295
    next unless $biblionumber =~ m|^\d+$|;
293
296
Lines 303-309 foreach my $biblionumber (@biblionumbers) { Link Here
303
306
304
                #All is OK and we can continue
307
                #All is OK and we can continue
305
            }
308
            }
306
            elsif ( $canReserve->{status} eq 'tooManyReserves' ) {
309
            elsif ( $canReserve eq 'noReservesAllowed') {
310
                $no_reserves_allowed = 1;
311
            }
312
            elsif ( $canReserve eq 'tooManyReserves' ) {
307
                $exceeded_maxreserves = 1;
313
                $exceeded_maxreserves = 1;
308
                $template->param( maxreserves => $canReserve->{limit} );
314
                $template->param( maxreserves => $canReserve->{limit} );
309
            }
315
            }
Lines 732-737 foreach my $biblionumber (@biblionumbers) { Link Here
732
738
733
$template->param( biblioloop => \@biblioloop );
739
$template->param( biblioloop => \@biblioloop );
734
$template->param( biblionumbers => $biblionumbers );
740
$template->param( biblionumbers => $biblionumbers );
741
$template->param( no_reserves_allowed => $no_reserves_allowed );
735
$template->param( exceeded_maxreserves => $exceeded_maxreserves );
742
$template->param( exceeded_maxreserves => $exceeded_maxreserves );
736
$template->param( exceeded_holds_per_record => $exceeded_holds_per_record );
743
$template->param( exceeded_holds_per_record => $exceeded_holds_per_record );
737
$template->param( subscriptionsnumber => CountSubscriptionFromBiblionumber($biblionumber));
744
$template->param( subscriptionsnumber => CountSubscriptionFromBiblionumber($biblionumber));
(-)a/t/db_dependent/Holds.t (-41 / +170 lines)
Lines 7-13 use t::lib::TestBuilder; Link Here
7
7
8
use C4::Context;
8
use C4::Context;
9
9
10
use Test::More tests => 61;
10
use Test::More tests => 59;
11
use MARC::Record;
11
use MARC::Record;
12
12
13
use C4::Biblio;
13
use C4::Biblio;
Lines 244-262 is( $hold->priority, '6', "Test AlterPriority(), move to bottom" ); Link Here
244
my $foreign_biblio = $builder->build_sample_biblio({ itemtype => 'DUMMY' });
244
my $foreign_biblio = $builder->build_sample_biblio({ itemtype => 'DUMMY' });
245
my ($foreign_item_bibnum, $foreign_item_bibitemnum, $foreign_itemnumber)
245
my ($foreign_item_bibnum, $foreign_item_bibitemnum, $foreign_itemnumber)
246
  = AddItem({ homebranch => $branch_2, holdingbranch => $branch_2 } , $foreign_biblio->biblionumber);
246
  = AddItem({ homebranch => $branch_2, holdingbranch => $branch_2 } , $foreign_biblio->biblionumber);
247
# Cleanup circulation rules
247
delete_all_rules();
248
$dbh->do('DELETE FROM circulation_rules');
249
# $dbh->do(
250
#     q{INSERT INTO issuingrules (categorycode, branchcode, itemtype, reservesallowed, holds_per_record)
251
#       VALUES (?, ?, ?, ?, ?)},
252
#     {},
253
#     '*', '*', '*', 25, 99
254
# );
255
$dbh->do(
248
$dbh->do(
256
    q{INSERT INTO issuingrules (categorycode, branchcode, itemtype, reservesallowed, holds_per_record)
249
    q{INSERT INTO issuingrules (categorycode, branchcode, itemtype, reservesallowed, holds_per_record)
257
      VALUES (?, ?, ?, ?, ?)},
250
      VALUES (?, ?, ?, ?, ?)},
258
    {},
251
    {},
259
    '*', '*', 'CANNOT', 0, 99
252
    '*', '*', '*', 25, 99
260
);
253
);
261
254
262
# make sure some basic sysprefs are set
255
# make sure some basic sysprefs are set
Lines 324-361 t::lib::Mocks::mock_preference( 'AllowHoldsOnDamagedItems', 0 ); Link Here
324
ok( CanItemBeReserved( $borrowernumbers[0], $itemnumber)->{status} eq 'damaged', "Patron cannot reserve damaged item with AllowHoldsOnDamagedItems disabled" );
317
ok( CanItemBeReserved( $borrowernumbers[0], $itemnumber)->{status} eq 'damaged', "Patron cannot reserve damaged item with AllowHoldsOnDamagedItems disabled" );
325
ok( !defined( ( CheckReserves($itemnumber) )[1] ), "Hold cannot be trapped for damaged item with AllowHoldsOnDamagedItems disabled" );
318
ok( !defined( ( CheckReserves($itemnumber) )[1] ), "Hold cannot be trapped for damaged item with AllowHoldsOnDamagedItems disabled" );
326
319
327
# Regression test for bug 9532
320
subtest 'CanItemBeReserved' => sub {
328
$biblio = $builder->build_sample_biblio({ itemtype => 'CANNOT' });
321
    plan tests => 2;
329
($item_bibnum, $item_bibitemnum, $itemnumber) = AddItem({ homebranch => $branch_1, holdingbranch => $branch_1, itype => 'CANNOT' } , $biblio->biblionumber);
330
AddReserve(
331
    $branch_1,
332
    $borrowernumbers[0],
333
    $biblio->biblionumber,
334
    '',
335
    1,
336
);
337
is(
338
    CanItemBeReserved( $borrowernumbers[0], $itemnumber)->{status}, 'tooManyReserves',
339
    "cannot request item if policy that matches on item-level item type forbids it"
340
);
341
ModItem({ itype => 'CAN' }, $item_bibnum, $itemnumber);
342
ok(
343
    CanItemBeReserved( $borrowernumbers[0], $itemnumber)->{status} eq 'OK',
344
    "can request item if policy that matches on item type allows it"
345
);
346
322
347
t::lib::Mocks::mock_preference('item-level_itypes', 0);
323
    delete_all_rules();
348
ModItem({ itype => undef }, $item_bibnum, $itemnumber);
324
349
ok(
325
    my $itemtype_can         = $builder->build({source => "Itemtype"})->{itemtype};
350
    CanItemBeReserved( $borrowernumbers[0], $itemnumber)->{status} eq 'tooManyReserves',
326
    my $itemtype_cant        = $builder->build({source => "Itemtype"})->{itemtype};
351
    "cannot request item if policy that matches on bib-level item type forbids it (bug 9532)"
327
    my $itemtype_cant_record = $builder->build({source => "Itemtype"})->{itemtype};
352
);
328
329
    $dbh->do(
330
        q{INSERT INTO issuingrules (categorycode, branchcode, itemtype, reservesallowed, holds_per_record) VALUES (?, ?, ?, ?, ?)}, {},
331
        '*', '*', $itemtype_cant, 0, 99
332
    );
333
    $dbh->do(
334
        q{INSERT INTO issuingrules (categorycode, branchcode, itemtype, reservesallowed, holds_per_record) VALUES (?, ?, ?, ?, ?)}, {},
335
        '*', '*', $itemtype_can, 2, 2
336
    );
337
    $dbh->do(
338
        q{INSERT INTO issuingrules (categorycode, branchcode, itemtype, reservesallowed, holds_per_record) VALUES (?, ?, ?, ?, ?)}, {},
339
        '*', '*', $itemtype_cant_record, 0, 0
340
    );
341
    Koha::CirculationRules->set_rules(
342
        {
343
            branchcode => $branch_1,
344
            itemtype   => $itemtype_cant,
345
            categorycode => undef,
346
            rules => {
347
                holdallowed => 0,
348
                returnbranch => 'homebranch',
349
            }
350
        }
351
    );
352
    Koha::CirculationRules->set_rules(
353
        {
354
            branchcode => $branch_1,
355
            itemtype   => $itemtype_can,
356
            categorycode => undef,
357
            rules => {
358
                holdallowed => 1,
359
                returnbranch => 'homebranch',
360
            }
361
        }
362
    );
363
364
    subtest 'noReservesAllowed' => sub {
365
        plan tests => 5;
366
367
        my $biblionumber_cannot = $builder->build_sample_biblio({ itemtype => $itemtype_cant })->biblionumber;
368
        my $biblionumber_can = $builder->build_sample_biblio({ itemtype => $itemtype_can })->biblionumber;
369
        my $biblionumber_record_cannot = $builder->build_sample_biblio({ itemtype => $itemtype_cant_record })->biblionumber;
370
        my ( undef, undef, $itemnumber_1_can ) = AddItem({ homebranch => $branch_1, holdingbranch => $branch_1, itype => $itemtype_can } , $biblionumber_cannot);
371
        my ( undef, undef, $itemnumber_1_cannot ) = AddItem({ homebranch => $branch_1, holdingbranch => $branch_1, itype => $itemtype_cant } , $biblionumber_cannot);
372
373
        my ( undef, undef, $itemnumber_2_can ) = AddItem({ homebranch => $branch_1, holdingbranch => $branch_1, itype => $itemtype_can } , $biblionumber_can);
374
        my ( undef, undef, $itemnumber_2_cannot ) = AddItem({ homebranch => $branch_1, holdingbranch => $branch_1, itype => $itemtype_cant } , $biblionumber_can);
375
376
        my ( undef, undef, $itemnumber_3_cannot ) = AddItem({ homebranch => $branch_1, holdingbranch => $branch_1, itype => $itemtype_cant_record } , $biblionumber_record_cannot);
377
378
        Koha::Holds->search({borrowernumber => $borrowernumbers[0]})->delete;
379
380
        t::lib::Mocks::mock_preference('item-level_itypes', 1);
381
        is(
382
            CanItemBeReserved( $borrowernumbers[0], $itemnumber_2_cannot)->{status}, 'noReservesAllowed',
383
            "With item level set, rule from item must be picked (CANNOT)"
384
        );
385
        is(
386
            CanItemBeReserved( $borrowernumbers[0], $itemnumber_1_can)->{status}, 'OK',
387
            "With item level set, rule from item must be picked (CAN)"
388
        );
389
        t::lib::Mocks::mock_preference('item-level_itypes', 0);
390
        is(
391
            CanItemBeReserved( $borrowernumbers[0], $itemnumber_1_can)->{status}, 'noReservesAllowed',
392
            "With biblio level set, rule from biblio must be picked (CANNOT)"
393
        );
394
        is(
395
            CanItemBeReserved( $borrowernumbers[0], $itemnumber_2_cannot)->{status}, 'OK',
396
            "With biblio level set, rule from biblio must be picked (CAN)"
397
        );
398
        is(
399
            CanItemBeReserved( $borrowernumbers[0], $itemnumber_3_cannot)->{status}, 'noReservesAllowed',
400
            "When no holds allowed and no holds per record allowed should return noReservesAllowed"
401
        );
402
    };
403
404
    subtest 'tooManyHoldsForThisRecord + tooManyReserves + itemAlreadyOnHold' => sub {
405
        plan tests => 7;
406
407
        my $biblionumber_1 = $builder->build_sample_biblio({ itemtype => $itemtype_can })->biblionumber;
408
        my ( undef, undef, $itemnumber_11) = AddItem({ homebranch => $branch_1, holdingbranch => $branch_1, itype => $itemtype_can } , $biblionumber_1);
409
        my ( undef, undef, $itemnumber_12) = AddItem({ homebranch => $branch_1, holdingbranch => $branch_1, itype => $itemtype_can } , $biblionumber_1);
410
        my $biblionumber_2 = $builder->build_sample_biblio({ itemtype => $itemtype_can })->biblionumber;
411
        my ( undef, undef, $itemnumber_21) = AddItem({ homebranch => $branch_1, holdingbranch => $branch_1, itype => $itemtype_can } , $biblionumber_2);
412
        my ( undef, undef, $itemnumber_22) = AddItem({ homebranch => $branch_1, holdingbranch => $branch_1, itype => $itemtype_can } , $biblionumber_2);
413
414
        Koha::Holds->search({borrowernumber => $borrowernumbers[0]})->delete;
415
416
        # Biblio-level hold
417
        AddReserve(
418
            $branch_1,
419
            $borrowernumbers[0],
420
            $biblionumber_1,
421
            '',
422
            1,
423
        );
424
        for my $item_level ( 0..1 ) {
425
            t::lib::Mocks::mock_preference('item-level_itypes', $item_level);
426
            is(
427
                # FIXME This is not really correct, but CanItemBeReserved does not check if biblio-level holds already exist
428
                CanItemBeReserved( $borrowernumbers[0], $itemnumber_11)->{status}, 'OK',
429
                "A biblio-level hold already exists - another hold can be placed on a specific item item"
430
            );
431
        }
432
433
        Koha::Holds->search({borrowernumber => $borrowernumbers[0]})->delete;
434
        # Item-level hold
435
        AddReserve(
436
            $branch_1,
437
            $borrowernumbers[0],
438
            $biblionumber_1,
439
            '',
440
            1,
441
            undef, undef, undef, undef, $itemnumber_11
442
        );
443
        $dbh->do(q{UPDATE issuingrules set reservesallowed=5, holds_per_record=1});
444
        is(
445
            CanItemBeReserved( $borrowernumbers[0], $itemnumber_12)->{status}, 'tooManyHoldsForThisRecord',
446
            "A item-level hold already exists and holds_per_record=1, another hold cannot be placed on this record"
447
        );
448
        $dbh->do(q{UPDATE issuingrules set reservesallowed=1, holds_per_record=1});
449
        is(
450
            CanItemBeReserved( $borrowernumbers[0], $itemnumber_12)->{status}, 'tooManyHoldsForThisRecord',
451
            "A item-level hold already exists and holds_per_record=1 - tooManyHoldsForThisRecord has priority over tooManyReserves"
452
        );
453
        $dbh->do(q{UPDATE issuingrules set reservesallowed=5, holds_per_record=2});
454
        is(
455
            CanItemBeReserved( $borrowernumbers[0], $itemnumber_12)->{status}, 'OK',
456
            "A item-level hold already exists but holds_per_record=2- another item-level hold can be placed on this record"
457
        );
458
459
        AddReserve(
460
            $branch_1,
461
            $borrowernumbers[0],
462
            $biblionumber_2,
463
            '',
464
            1,
465
            undef, undef, undef, undef, $itemnumber_21
466
        );
467
        $dbh->do(q{UPDATE issuingrules set reservesallowed=2, holds_per_record=2});
468
        is(
469
            CanItemBeReserved( $borrowernumbers[0], $itemnumber_21)->{status}, 'itemAlreadyOnHold',
470
            "A item-level holds already exists on this item, itemAlreadyOnHold should be raised"
471
        );
472
        is(
473
            CanItemBeReserved( $borrowernumbers[0], $itemnumber_22)->{status}, 'tooManyReserves',
474
            "This patron has already placed reservesallowed holds, tooManyReserves should be raised"
475
        );
476
    };
477
};
353
478
354
479
355
# Test branch item rules
480
# Test branch item rules
356
481
357
$dbh->do('DELETE FROM issuingrules');
482
delete_all_rules();
358
$dbh->do('DELETE FROM circulation_rules');
359
$dbh->do(
483
$dbh->do(
360
    q{INSERT INTO issuingrules (categorycode, branchcode, itemtype, reservesallowed)
484
    q{INSERT INTO issuingrules (categorycode, branchcode, itemtype, reservesallowed)
361
      VALUES (?, ?, ?, ?)},
485
      VALUES (?, ?, ?, ?)},
Lines 701-707 subtest 'CanItemBeReserved / branch_not_in_hold_group' => sub { Link Here
701
    # Cleanup database
825
    # Cleanup database
702
    Koha::Holds->search->delete;
826
    Koha::Holds->search->delete;
703
    $dbh->do('DELETE FROM issues');
827
    $dbh->do('DELETE FROM issues');
704
    $dbh->do('DELETE FROM issuingrules');
828
    delete_all_rules();
705
    $dbh->do(
829
    $dbh->do(
706
        q{INSERT INTO issuingrules (categorycode, branchcode, itemtype, reservesallowed)
830
        q{INSERT INTO issuingrules (categorycode, branchcode, itemtype, reservesallowed)
707
        VALUES (?, ?, ?, ?)},
831
        VALUES (?, ?, ?, ?)},
Lines 789-795 subtest 'CanItemBeReserved / branch_not_in_hold_group' => sub { Link Here
789
        'Patron cannot place hold because patron\'s home library is not part of hold group'
913
        'Patron cannot place hold because patron\'s home library is not part of hold group'
790
    );
914
    );
791
915
792
    # Cleanup default_cirt_rules
916
    # Cleanup default_circ_rules
793
    $dbh->do('DELETE FROM circulation_rules');
917
    $dbh->do('DELETE FROM circulation_rules');
794
918
795
    # Insert default circ rule to "any" for library 2
919
    # Insert default circ rule to "any" for library 2
Lines 845-850 subtest 'CanItemBeReserved / branch_not_in_hold_group' => sub { Link Here
845
            categorycode => undef,
969
            categorycode => undef,
846
            rules => {
970
            rules => {
847
                holdallowed => 2,
971
                holdallowed => 2,
972
                holdsperrecord => 1,
848
                hold_fulfillment_policy => 'any',
973
                hold_fulfillment_policy => 'any',
849
                returnbranch => 'any'
974
                returnbranch => 'any'
850
            }
975
            }
Lines 1114-1120 subtest 'CanItemBeReserved / pickup_not_in_hold_group' => sub { Link Here
1114
        'Patron cannot place hold if hold_fulfillment_policy is set to "hold group" for itemtype 2'
1239
        'Patron cannot place hold if hold_fulfillment_policy is set to "hold group" for itemtype 2'
1115
    );
1240
    );
1116
1241
1117
    # Cleanup default_branch_item_rules
1118
    $dbh->do('DELETE FROM circulation_rules');
1242
    $dbh->do('DELETE FROM circulation_rules');
1119
1243
1120
    # Insert branch item rule to "any" for itemtype 2 and library 2
1244
    # Insert branch item rule to "any" for itemtype 2 and library 2
Lines 1161-1163 subtest 'CanItemBeReserved / pickup_not_in_hold_group' => sub { Link Here
1161
1285
1162
    $schema->storage->txn_rollback;
1286
    $schema->storage->txn_rollback;
1163
};
1287
};
1164
- 
1288
1289
sub delete_all_rules {
1290
    my $dbh = C4::Context->dbh;
1291
    $dbh->do('DELETE FROM issuingrules');
1292
    $dbh->do('DELETE FROM circulation_rules');
1293
}

Return to bug 16787