Lines 2358-2364
subtest 'search_ordered' => sub {
Link Here
|
2358 |
|
2358 |
|
2359 |
subtest 'filter_by_for_hold' => sub { |
2359 |
subtest 'filter_by_for_hold' => sub { |
2360 |
|
2360 |
|
2361 |
plan tests => 10; |
2361 |
plan tests => 11; |
2362 |
|
2362 |
|
2363 |
$schema->storage->txn_begin; |
2363 |
$schema->storage->txn_begin; |
2364 |
|
2364 |
|
Lines 2523-2529
subtest 'filter_by_for_hold' => sub {
Link Here
|
2523 |
my $mock_context = Test::MockModule->new('C4::Context'); |
2523 |
my $mock_context = Test::MockModule->new('C4::Context'); |
2524 |
$mock_context->mock( 'only_my_library', 1 ); |
2524 |
$mock_context->mock( 'only_my_library', 1 ); |
2525 |
$mock_context->mock( 'mybranch', $library->id ); |
2525 |
$mock_context->mock( 'mybranch', $library->id ); |
2526 |
is( $biblio->items->filter_by_for_hold->count, 2, '2 items for hold, filtered by IndependentBranches' ); |
2526 |
|
|
|
2527 |
# Legacy behavior: when branches are independent AND cross-branch holds are disabled, |
2528 |
# restrict to the staff member's home branch |
2529 |
t::lib::Mocks::mock_preference( 'canreservefromotherbranches', 0 ); |
2530 |
is( |
2531 |
$biblio->items->filter_by_for_hold->count, 2, |
2532 |
'2 items for hold, filtered by IndependentBranches (canreservefromotherbranches=0)' |
2533 |
); |
2534 |
|
2535 |
# New behavior: when cross-branch holds are enabled, do NOT restrict by homebranch |
2536 |
t::lib::Mocks::mock_preference( 'canreservefromotherbranches', 1 ); |
2537 |
is( |
2538 |
$biblio->items->filter_by_for_hold->count, 6, |
2539 |
'6 items for hold, IndependentBranches but canreservefromotherbranches=1' |
2540 |
); |
2527 |
} |
2541 |
} |
2528 |
|
2542 |
|
2529 |
t::lib::Mocks::mock_preference( 'item-level_itypes', 0 ); |
2543 |
t::lib::Mocks::mock_preference( 'item-level_itypes', 0 ); |
2530 |
- |
|
|