Lines 331-339
subtest 'CanItemBeReserved' => sub {
Link Here
|
331 |
q{INSERT INTO issuingrules (categorycode, branchcode, itemtype, reservesallowed, holds_per_record) VALUES (?, ?, ?, ?, ?)}, {}, |
331 |
q{INSERT INTO issuingrules (categorycode, branchcode, itemtype, reservesallowed, holds_per_record) VALUES (?, ?, ?, ?, ?)}, {}, |
332 |
'*', '*', 'CAN', 2, 2 |
332 |
'*', '*', 'CAN', 2, 2 |
333 |
); |
333 |
); |
|
|
334 |
$dbh->do( |
335 |
q{INSERT INTO issuingrules (categorycode, branchcode, itemtype, reservesallowed, holds_per_record) VALUES (?, ?, ?, ?, ?)}, {}, |
336 |
'*', '*', 'CANNOT_RECORD', 0, 0 |
337 |
); |
334 |
|
338 |
|
335 |
subtest 'noReservesAllowed' => sub { |
339 |
subtest 'noReservesAllowed' => sub { |
336 |
plan tests => 4; |
340 |
plan tests => 5; |
337 |
|
341 |
|
338 |
my ( $biblionumber_cannot ) = create_helper_biblio('CANNOT'); |
342 |
my ( $biblionumber_cannot ) = create_helper_biblio('CANNOT'); |
339 |
my ( undef, undef, $itemnumber_1_can ) = AddItem({ homebranch => $branch_1, holdingbranch => $branch_1, itype => 'CAN' } , $biblionumber_cannot); |
343 |
my ( undef, undef, $itemnumber_1_can ) = AddItem({ homebranch => $branch_1, holdingbranch => $branch_1, itype => 'CAN' } , $biblionumber_cannot); |
Lines 343-348
subtest 'CanItemBeReserved' => sub {
Link Here
|
343 |
my ( undef, undef, $itemnumber_2_can ) = AddItem({ homebranch => $branch_1, holdingbranch => $branch_1, itype => 'CAN' } , $biblionumber_can); |
347 |
my ( undef, undef, $itemnumber_2_can ) = AddItem({ homebranch => $branch_1, holdingbranch => $branch_1, itype => 'CAN' } , $biblionumber_can); |
344 |
my ( undef, undef, $itemnumber_2_cannot ) = AddItem({ homebranch => $branch_1, holdingbranch => $branch_1, itype => 'CANNOT' } , $biblionumber_can); |
348 |
my ( undef, undef, $itemnumber_2_cannot ) = AddItem({ homebranch => $branch_1, holdingbranch => $branch_1, itype => 'CANNOT' } , $biblionumber_can); |
345 |
|
349 |
|
|
|
350 |
my ($biblionumber_record_cannot) = create_helper_biblio('CANNOT_RECORD'); |
351 |
my ( undef, undef, $itemnumber_3_cannot ) = AddItem({ homebranch => $branch_1, holdingbranch => $branch_1, itype => 'CANNOT_RECORD' } , $biblionumber_record_cannot); |
352 |
|
346 |
Koha::Holds->search({borrowernumber => $borrowernumbers[0]})->delete; |
353 |
Koha::Holds->search({borrowernumber => $borrowernumbers[0]})->delete; |
347 |
|
354 |
|
348 |
t::lib::Mocks::mock_preference('item-level_itypes', 1); |
355 |
t::lib::Mocks::mock_preference('item-level_itypes', 1); |
Lines 363-368
subtest 'CanItemBeReserved' => sub {
Link Here
|
363 |
CanItemBeReserved( $borrowernumbers[0], $itemnumber_2_cannot), 'OK', |
370 |
CanItemBeReserved( $borrowernumbers[0], $itemnumber_2_cannot), 'OK', |
364 |
"With biblio level set, rule from biblio must be picked (CAN)" |
371 |
"With biblio level set, rule from biblio must be picked (CAN)" |
365 |
); |
372 |
); |
|
|
373 |
is( |
374 |
CanItemBeReserved( $borrowernumbers[0], $itemnumber_3_cannot), 'noReservesAllowed', |
375 |
"When no holds allowed and no holds per record allowed should return noReservesAllowed" |
376 |
); |
366 |
}; |
377 |
}; |
367 |
|
378 |
|
368 |
subtest 'tooManyHoldsForThisRecord + tooManyReserves + itemAlreadyOnHold' => sub { |
379 |
subtest 'tooManyHoldsForThisRecord + tooManyReserves + itemAlreadyOnHold' => sub { |
369 |
- |
|
|