|
Lines 299-305
ok(
Link Here
|
| 299 |
is( $hold3->discard_changes->priority, 1, "After ModReserve, the 3rd reserve becomes the first on the waiting list" ); |
299 |
is( $hold3->discard_changes->priority, 1, "After ModReserve, the 3rd reserve becomes the first on the waiting list" ); |
| 300 |
} |
300 |
} |
| 301 |
|
301 |
|
|
|
302 |
ok( defined( ( CheckReserves($itemnumber) )[1] ), "Hold can be trapped for damaged item with AllowHoldsOnDamagedItems enabled" ); |
| 303 |
|
| 302 |
ModItem({ damaged => 1 }, $item_bibnum, $itemnumber); |
304 |
ModItem({ damaged => 1 }, $item_bibnum, $itemnumber); |
|
|
305 |
CancelReserve({reserve_id => $reserveid3}); |
| 303 |
t::lib::Mocks::mock_preference( 'AllowHoldsOnDamagedItems', 1 ); |
306 |
t::lib::Mocks::mock_preference( 'AllowHoldsOnDamagedItems', 1 ); |
| 304 |
is( CanItemBeReserved( $borrowernumbers[0], $itemnumber)->{status}, 'OK', "Patron can reserve damaged item with AllowHoldsOnDamagedItems enabled" ); |
307 |
is( CanItemBeReserved( $borrowernumbers[0], $itemnumber)->{status}, 'OK', "Patron can reserve damaged item with AllowHoldsOnDamagedItems enabled" ); |
| 305 |
ok( defined( ( CheckReserves($itemnumber) )[1] ), "Hold can be trapped for damaged item with AllowHoldsOnDamagedItems enabled" ); |
308 |
ok( defined( ( CheckReserves($itemnumber) )[1] ), "Hold can be trapped for damaged item with AllowHoldsOnDamagedItems enabled" ); |
|
Lines 330-352
AddReserve(
Link Here
|
| 330 |
'', |
333 |
'', |
| 331 |
1, |
334 |
1, |
| 332 |
); |
335 |
); |
|
|
336 |
my ($bibnum2, $title2, $bibitemnum2) = create_helper_biblio('CANNOT'); |
| 337 |
my ($item_bibnum2, $item_bibitemnum2, $itemnumber2) = AddItem({ homebranch => $branch_1, holdingbranch => $branch_1, itype => 'CANNOT' } , $bibnum2); |
| 333 |
is( |
338 |
is( |
|
|
339 |
<<<<<<< HEAD |
| 334 |
CanItemBeReserved( $borrowernumbers[0], $itemnumber)->{status}, 'tooManyReserves', |
340 |
CanItemBeReserved( $borrowernumbers[0], $itemnumber)->{status}, 'tooManyReserves', |
|
|
341 |
======= |
| 342 |
CanItemBeReserved( $borrowernumbers[0], $itemnumber2), 'tooManyReserves', |
| 343 |
>>>>>>> Bug 11999: Add two checks in CanBookBeReserved and CanItemBeReserved |
| 335 |
"cannot request item if policy that matches on item-level item type forbids it" |
344 |
"cannot request item if policy that matches on item-level item type forbids it" |
| 336 |
); |
345 |
); |
| 337 |
ModItem({ itype => 'CAN' }, $item_bibnum, $itemnumber); |
346 |
ModItem({ itype => 'CAN' }, $item_bibnum2, $itemnumber2); |
| 338 |
ok( |
347 |
ok( |
|
|
348 |
<<<<<<< HEAD |
| 339 |
CanItemBeReserved( $borrowernumbers[0], $itemnumber)->{status} eq 'OK', |
349 |
CanItemBeReserved( $borrowernumbers[0], $itemnumber)->{status} eq 'OK', |
|
|
350 |
======= |
| 351 |
CanItemBeReserved( $borrowernumbers[0], $itemnumber2) eq 'OK', |
| 352 |
>>>>>>> Bug 11999: Add two checks in CanBookBeReserved and CanItemBeReserved |
| 340 |
"can request item if policy that matches on item type allows it" |
353 |
"can request item if policy that matches on item type allows it" |
| 341 |
); |
354 |
); |
| 342 |
|
355 |
|
| 343 |
t::lib::Mocks::mock_preference('item-level_itypes', 0); |
356 |
t::lib::Mocks::mock_preference('item-level_itypes', 0); |
|
|
357 |
<<<<<<< HEAD |
| 344 |
ModItem({ itype => undef }, $item_bibnum, $itemnumber); |
358 |
ModItem({ itype => undef }, $item_bibnum, $itemnumber); |
| 345 |
ok( |
359 |
ok( |
| 346 |
CanItemBeReserved( $borrowernumbers[0], $itemnumber)->{status} eq 'tooManyReserves', |
360 |
CanItemBeReserved( $borrowernumbers[0], $itemnumber)->{status} eq 'tooManyReserves', |
|
|
361 |
======= |
| 362 |
ModItem({ itype => undef }, $item_bibnum2, $itemnumber2); |
| 363 |
is( |
| 364 |
CanItemBeReserved( $borrowernumbers[0], $itemnumber2), 'tooManyReserves', |
| 365 |
>>>>>>> Bug 11999: Add two checks in CanBookBeReserved and CanItemBeReserved |
| 347 |
"cannot request item if policy that matches on bib-level item type forbids it (bug 9532)" |
366 |
"cannot request item if policy that matches on bib-level item type forbids it (bug 9532)" |
| 348 |
); |
367 |
); |
| 349 |
|
368 |
|
|
|
369 |
is(CanBookBeReserved($borrowernumbers[0], $bibnum), 'OK'); |
| 370 |
|
| 371 |
C4::Context->set_preference('maxreserves', 1); |
| 372 |
ok(CanBookBeReserved($borrowernumbers[0], $biblionumber) eq 'tooManyReserves'); |
| 373 |
|
| 374 |
C4::Context->set_preference('maxreserves', 0); |
| 375 |
t::lib::Mocks::mock_preference('IndependentBranches', 1); |
| 376 |
t::lib::Mocks::mock_preference('canreservefromotherbranches', 0); |
| 377 |
ok(CanBookBeReserved($borrowernumbers[0], $foreign_bibnum) eq 'none_available'); |
| 350 |
|
378 |
|
| 351 |
# Test branch item rules |
379 |
# Test branch item rules |
| 352 |
|
380 |
|
|
Lines 415-422
is( CanItemBeReserved( $borrowernumbers[0], $itemnumber )->{status},
Link Here
|
| 415 |
|
443 |
|
| 416 |
my $res_id = AddReserve( $branch_1, $borrowernumbers[0], $biblio->biblionumber, '', 1, ); |
444 |
my $res_id = AddReserve( $branch_1, $borrowernumbers[0], $biblio->biblionumber, '', 1, ); |
| 417 |
|
445 |
|
|
|
446 |
<<<<<<< HEAD |
| 418 |
is( CanItemBeReserved( $borrowernumbers[0], $itemnumber )->{status}, |
447 |
is( CanItemBeReserved( $borrowernumbers[0], $itemnumber )->{status}, |
| 419 |
'tooManyReserves', 'Patron cannot reserve item with hold limit of 1, 1 bib level hold placed' ); |
448 |
'tooManyReserves', 'Patron cannot reserve item with hold limit of 1, 1 bib level hold placed' ); |
|
|
449 |
======= |
| 450 |
is( CanItemBeReserved( $borrowernumbers[0], $itemnumber ), |
| 451 |
'tooManyHoldsForThisRecord', 'Patron cannot reserve item with hold limit of 1, 1 bib level hold placed' ); |
| 452 |
>>>>>>> Bug 11999: Add two checks in CanBookBeReserved and CanItemBeReserved |
| 420 |
|
453 |
|
| 421 |
#results should be the same for both ReservesControlBranch settings |
454 |
#results should be the same for both ReservesControlBranch settings |
| 422 |
t::lib::Mocks::mock_preference( 'ReservesControlBranch', 'ItemHomeLibrary' ); |
455 |
t::lib::Mocks::mock_preference( 'ReservesControlBranch', 'ItemHomeLibrary' ); |
|
Lines 425-430
is( CanItemBeReserved( $borrowernumbers[0], $itemnumber )->{status},
Link Here
|
| 425 |
#reset for further tests |
458 |
#reset for further tests |
| 426 |
t::lib::Mocks::mock_preference( 'ReservesControlBranch', 'PatronLibrary' ); |
459 |
t::lib::Mocks::mock_preference( 'ReservesControlBranch', 'PatronLibrary' ); |
| 427 |
|
460 |
|
|
|
461 |
<<<<<<< HEAD |
| 428 |
subtest 'Test max_holds per library/patron category' => sub { |
462 |
subtest 'Test max_holds per library/patron category' => sub { |
| 429 |
plan tests => 6; |
463 |
plan tests => 6; |
| 430 |
|
464 |
|
|
Lines 675-677
subtest 'CanItemBeReserved / holds_per_day tests' => sub {
Link Here
|
| 675 |
|
709 |
|
| 676 |
$schema->storage->txn_rollback; |
710 |
$schema->storage->txn_rollback; |
| 677 |
}; |
711 |
}; |
| 678 |
- |
712 |
======= |
|
|
713 |
# Helper method to set up a Biblio. |
| 714 |
sub create_helper_biblio { |
| 715 |
my $itemtype = shift; |
| 716 |
my $bib = MARC::Record->new(); |
| 717 |
my $title = 'Silence in the library'; |
| 718 |
if (C4::Context->preference('marcflavour') eq 'UNIMARC') { |
| 719 |
$bib->append_fields( |
| 720 |
MARC::Field->new('700', ' ', '0', a => 'Moffat, Steven'), |
| 721 |
MARC::Field->new('200', ' ', ' ', a => $title), |
| 722 |
MARC::Field->new('099', ' ', ' ', t => $itemtype), |
| 723 |
); |
| 724 |
} else { |
| 725 |
$bib->append_fields( |
| 726 |
MARC::Field->new('100', ' ', ' ', a => 'Moffat, Steven'), |
| 727 |
MARC::Field->new('245', ' ', ' ', a => $title), |
| 728 |
MARC::Field->new('942', ' ', ' ', c => $itemtype), |
| 729 |
); |
| 730 |
} |
| 731 |
|
| 732 |
return AddBiblio($bib, ''); |
| 733 |
} |
| 734 |
>>>>>>> Bug 11999: Add two checks in CanBookBeReserved and CanItemBeReserved |