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 => 63; |
11 |
use MARC::Record; |
11 |
use MARC::Record; |
12 |
|
12 |
|
13 |
use C4::Biblio; |
13 |
use C4::Biblio; |
Lines 344-349
t::lib::Mocks::mock_preference( 'AllowHoldsOnDamagedItems', 0 );
Link Here
|
344 |
ok( CanItemBeReserved( $borrowernumbers[0], $itemnumber)->{status} eq 'damaged', "Patron cannot reserve damaged item with AllowHoldsOnDamagedItems disabled" ); |
344 |
ok( CanItemBeReserved( $borrowernumbers[0], $itemnumber)->{status} eq 'damaged', "Patron cannot reserve damaged item with AllowHoldsOnDamagedItems disabled" ); |
345 |
ok( !defined( ( CheckReserves($itemnumber) )[1] ), "Hold cannot be trapped for damaged item with AllowHoldsOnDamagedItems disabled" ); |
345 |
ok( !defined( ( CheckReserves($itemnumber) )[1] ), "Hold cannot be trapped for damaged item with AllowHoldsOnDamagedItems disabled" ); |
346 |
|
346 |
|
|
|
347 |
# Items that are not for loan, but holdable should not be trapped until they are available for loan |
348 |
Koha::Items->find($itemnumber)->damaged(0)->notforloan(-1)->store; |
349 |
Koha::Holds->search({ biblionumber => $biblio->id })->delete(); |
350 |
is( CanItemBeReserved( $borrowernumbers[0], $itemnumber)->{status}, 'OK', "Patron can place hold on item that is not for loan but holdable ( notforloan < 0 )" ); |
351 |
$hold = Koha::Hold->new( |
352 |
{ |
353 |
borrowernumber => $borrowernumbers[0], |
354 |
itemnumber => $itemnumber, |
355 |
biblionumber => $biblio->biblionumber, |
356 |
} |
357 |
)->store(); |
358 |
ok( !defined( ( CheckReserves($itemnumber) )[1] ), "Hold cannot be trapped for item that is not for loan but holdable ( notforloan < 0 )" ); |
359 |
$hold->delete(); |
360 |
|
347 |
# Regression test for bug 9532 |
361 |
# Regression test for bug 9532 |
348 |
$biblio = $builder->build_sample_biblio({ itemtype => 'CANNOT' }); |
362 |
$biblio = $builder->build_sample_biblio({ itemtype => 'CANNOT' }); |
349 |
$item = $builder->build_sample_item({ library => $branch_1, itype => 'CANNOT', biblionumber => $biblio->biblionumber}); |
363 |
$item = $builder->build_sample_item({ library => $branch_1, itype => 'CANNOT', biblionumber => $biblio->biblionumber}); |
350 |
- |
|
|