Lines 326-332
ok(
Link Here
|
326 |
} |
326 |
} |
327 |
|
327 |
|
328 |
subtest 'AllowHoldsOnDamagedItems' => sub { |
328 |
subtest 'AllowHoldsOnDamagedItems' => sub { |
329 |
plan tests => 5; |
329 |
plan tests => 7; |
330 |
|
330 |
|
331 |
my $library = $builder->build_object( { class => 'Koha::Libraries' } ); |
331 |
my $library = $builder->build_object( { class => 'Koha::Libraries' } ); |
332 |
my $biblio = $builder->build_sample_biblio; |
332 |
my $biblio = $builder->build_sample_biblio; |
Lines 340-352
subtest 'AllowHoldsOnDamagedItems' => sub {
Link Here
|
340 |
} |
340 |
} |
341 |
); |
341 |
); |
342 |
|
342 |
|
343 |
my $itemnumber = $builder->build_sample_item( |
343 |
my $item = $builder->build_sample_item( |
344 |
{ |
344 |
{ |
345 |
library => $library->branchcode, |
345 |
library => $library->branchcode, |
346 |
biblionumber => $biblio->biblionumber, |
346 |
biblionumber => $biblio->biblionumber, |
347 |
damaged => 1 |
347 |
damaged => 1 |
348 |
} |
348 |
} |
349 |
)->itemnumber; |
349 |
); |
|
|
350 |
my $itemnumber = $item->itemnumber; |
350 |
t::lib::Mocks::mock_preference( 'AllowHoldsOnDamagedItems', 1 ); |
351 |
t::lib::Mocks::mock_preference( 'AllowHoldsOnDamagedItems', 1 ); |
351 |
is( |
352 |
is( |
352 |
CanItemBeReserved( $patron->borrowernumber, $itemnumber )->{status}, |
353 |
CanItemBeReserved( $patron->borrowernumber, $itemnumber )->{status}, |
Lines 381-386
subtest 'AllowHoldsOnDamagedItems' => sub {
Link Here
|
381 |
!defined( ( CheckReserves($itemnumber) )[1] ), "Hold cannot be trapped for damaged item with AllowHoldsOnDamagedItems disabled" |
382 |
!defined( ( CheckReserves($itemnumber) )[1] ), "Hold cannot be trapped for damaged item with AllowHoldsOnDamagedItems disabled" |
382 |
); |
383 |
); |
383 |
|
384 |
|
|
|
385 |
|
386 |
|
387 |
t::lib::Mocks::mock_preference( 'AllowHoldsOnDamagedItems', 0 ); |
388 |
$hold = Koha::Hold->new( |
389 |
{ |
390 |
borrowernumber => $patron->borrowernumber, |
391 |
itemnumber => $itemnumber, |
392 |
biblionumber => $biblio->biblionumber, |
393 |
} |
394 |
)->store(); |
395 |
|
396 |
t::lib::Mocks::mock_userenv({ branchcode => $library->branchcode }); |
397 |
my $checkout = AddIssue( $patron->unblessed, $item->barcode ); |
398 |
ok( $checkout, 'AddIssue should have checkout the item' ); |
399 |
is( Koha::Holds->find($hold->reserve_id), undef, 'AddIssue should have filled the hold' ); |
400 |
|
384 |
}; |
401 |
}; |
385 |
|
402 |
|
386 |
# Items that are not for loan, but holdable should not be trapped until they are available for loan |
403 |
# Items that are not for loan, but holdable should not be trapped until they are available for loan |
387 |
- |
|
|