Lines 210-216
t::lib::Mocks::mock_preference('item-level_itypes', 1);
Link Here
|
210 |
# if IndependentBranches is OFF, a CPL patron can reserve an MPL item |
210 |
# if IndependentBranches is OFF, a CPL patron can reserve an MPL item |
211 |
t::lib::Mocks::mock_preference('IndependentBranches', 0); |
211 |
t::lib::Mocks::mock_preference('IndependentBranches', 0); |
212 |
ok( |
212 |
ok( |
213 |
CanItemBeReserved($borrowernumbers[0], $foreign_itemnumber), |
213 |
CanItemBeReserved($borrowernumbers[0], $foreign_itemnumber) eq 'OK', |
214 |
'CPL patron allowed to reserve MPL item with IndependentBranches OFF (bug 2394)' |
214 |
'CPL patron allowed to reserve MPL item with IndependentBranches OFF (bug 2394)' |
215 |
); |
215 |
); |
216 |
|
216 |
|
Lines 218-231
ok(
Link Here
|
218 |
t::lib::Mocks::mock_preference('IndependentBranches', 1); |
218 |
t::lib::Mocks::mock_preference('IndependentBranches', 1); |
219 |
t::lib::Mocks::mock_preference('canreservefromotherbranches', 0); |
219 |
t::lib::Mocks::mock_preference('canreservefromotherbranches', 0); |
220 |
ok( |
220 |
ok( |
221 |
! CanItemBeReserved($borrowernumbers[0], $foreign_itemnumber), |
221 |
CanItemBeReserved($borrowernumbers[0], $foreign_itemnumber) eq 'cannotReserveFromOtherBranches', |
222 |
'CPL patron NOT allowed to reserve MPL item with IndependentBranches ON ... (bug 2394)' |
222 |
'CPL patron NOT allowed to reserve MPL item with IndependentBranches ON ... (bug 2394)' |
223 |
); |
223 |
); |
224 |
|
224 |
|
225 |
# ... unless canreservefromotherbranches is ON |
225 |
# ... unless canreservefromotherbranches is ON |
226 |
t::lib::Mocks::mock_preference('canreservefromotherbranches', 1); |
226 |
t::lib::Mocks::mock_preference('canreservefromotherbranches', 1); |
227 |
ok( |
227 |
ok( |
228 |
CanItemBeReserved($borrowernumbers[0], $foreign_itemnumber), |
228 |
CanItemBeReserved($borrowernumbers[0], $foreign_itemnumber) eq 'OK', |
229 |
'... unless canreservefromotherbranches is ON (bug 2394)' |
229 |
'... unless canreservefromotherbranches is ON (bug 2394)' |
230 |
); |
230 |
); |
231 |
|
231 |
|
Lines 294-303
is( $reserve3->{priority}, 1, "After ModReserve, the 3rd reserve becomes the fir
Link Here
|
294 |
|
294 |
|
295 |
ModItem({ damaged => 1 }, $item_bibnum, $itemnumber); |
295 |
ModItem({ damaged => 1 }, $item_bibnum, $itemnumber); |
296 |
C4::Context->set_preference( 'AllowHoldsOnDamagedItems', 1 ); |
296 |
C4::Context->set_preference( 'AllowHoldsOnDamagedItems', 1 ); |
297 |
ok( CanItemBeReserved( $borrowernumbers[0], $itemnumber), "Patron can reserve damaged item with AllowHoldsOnDamagedItems enabled" ); |
297 |
ok( CanItemBeReserved( $borrowernumbers[0], $itemnumber) eq 'OK', "Patron can reserve damaged item with AllowHoldsOnDamagedItems enabled" ); |
298 |
ok( defined( ( CheckReserves($itemnumber) )[1] ), "Hold can be trapped for damaged item with AllowHoldsOnDamagedItems enabled" ); |
298 |
ok( defined( ( CheckReserves($itemnumber) )[1] ), "Hold can be trapped for damaged item with AllowHoldsOnDamagedItems enabled" ); |
299 |
C4::Context->set_preference( 'AllowHoldsOnDamagedItems', 0 ); |
299 |
C4::Context->set_preference( 'AllowHoldsOnDamagedItems', 0 ); |
300 |
ok( !CanItemBeReserved( $borrowernumbers[0], $itemnumber), "Patron cannot reserve damaged item with AllowHoldsOnDamagedItems disabled" ); |
300 |
ok( CanItemBeReserved( $borrowernumbers[0], $itemnumber) eq 'damaged', "Patron cannot reserve damaged item with AllowHoldsOnDamagedItems disabled" ); |
301 |
ok( !defined( ( CheckReserves($itemnumber) )[1] ), "Hold cannot be trapped for damaged item with AllowHoldsOnDamagedItems disabled" ); |
301 |
ok( !defined( ( CheckReserves($itemnumber) )[1] ), "Hold cannot be trapped for damaged item with AllowHoldsOnDamagedItems disabled" ); |
302 |
|
302 |
|
303 |
# Regression test for bug 9532 |
303 |
# Regression test for bug 9532 |
Lines 312-330
AddReserve(
Link Here
|
312 |
1, |
312 |
1, |
313 |
); |
313 |
); |
314 |
ok( |
314 |
ok( |
315 |
!CanItemBeReserved( $borrowernumbers[0], $itemnumber), |
315 |
CanItemBeReserved( $borrowernumbers[0], $itemnumber) eq 'tooManyReserves', |
316 |
"cannot request item if policy that matches on item-level item type forbids it" |
316 |
"cannot request item if policy that matches on item-level item type forbids it" |
317 |
); |
317 |
); |
318 |
ModItem({ itype => 'CAN' }, $item_bibnum, $itemnumber); |
318 |
ModItem({ itype => 'CAN' }, $item_bibnum, $itemnumber); |
319 |
ok( |
319 |
ok( |
320 |
CanItemBeReserved( $borrowernumbers[0], $itemnumber), |
320 |
CanItemBeReserved( $borrowernumbers[0], $itemnumber) eq 'OK', |
321 |
"can request item if policy that matches on item type allows it" |
321 |
"can request item if policy that matches on item type allows it" |
322 |
); |
322 |
); |
323 |
|
323 |
|
324 |
t::lib::Mocks::mock_preference('item-level_itypes', 0); |
324 |
t::lib::Mocks::mock_preference('item-level_itypes', 0); |
325 |
ModItem({ itype => undef }, $item_bibnum, $itemnumber); |
325 |
ModItem({ itype => undef }, $item_bibnum, $itemnumber); |
326 |
ok( |
326 |
ok( |
327 |
!CanItemBeReserved( $borrowernumbers[0], $itemnumber), |
327 |
CanItemBeReserved( $borrowernumbers[0], $itemnumber) eq 'tooManyReserves', |
328 |
"cannot request item if policy that matches on bib-level item type forbids it (bug 9532)" |
328 |
"cannot request item if policy that matches on bib-level item type forbids it (bug 9532)" |
329 |
); |
329 |
); |
330 |
|
330 |
|