Bugzilla – Attachment 185993 Details for
Bug 36502
Independent branches should not prevent holds if canreservefromotherbranches is enabled
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 36502: Unit tests
Bug-36502-Unit-tests.patch (text/plain), 2.68 KB, created by
Laura Escamilla
on 2025-08-30 01:31:29 UTC
(
hide
)
Description:
Bug 36502: Unit tests
Filename:
MIME Type:
Creator:
Laura Escamilla
Created:
2025-08-30 01:31:29 UTC
Size:
2.68 KB
patch
obsolete
>From df47355ef92aae96776c1896a8cf5b6bdcebe272 Mon Sep 17 00:00:00 2001 >From: Laura_Escamilla <laura.escamilla@bywatersolutions.com> >Date: Sat, 30 Aug 2025 01:28:57 +0000 >Subject: [PATCH] Bug 36502: Unit tests >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >To test: > >1. Enable both the IndependentBranches and canreservefromotherbranches system preferences. >2. Log in to the staff interface with a non-super librarian staff user that has permissions to place holds. >3. Search the catalog for an item. > 1. The non-super librarian user should be able to place holds on item from their branch. > 2. They should see a âNo holds allowedâ on items from other branches. >4. Apply the patch and restart_all >5. Repeat step 3 or refresh the page. > 1. The non-super librarian can now place holds on items from their branch and other branches. >6. Turn off canreservefromotherbranches > 1. The non-super librarian cannot place holds on items from other branches again. >7. prove t/db_dependent/Koha/Items.t >8. Sign off and have a great day! :D >--- > t/db_dependent/Koha/Items.t | 18 ++++++++++++++++-- > 1 file changed, 16 insertions(+), 2 deletions(-) > >diff --git a/t/db_dependent/Koha/Items.t b/t/db_dependent/Koha/Items.t >index 9e8cc90768..86b940f501 100755 >--- a/t/db_dependent/Koha/Items.t >+++ b/t/db_dependent/Koha/Items.t >@@ -2358,7 +2358,7 @@ subtest 'search_ordered' => sub { > > subtest 'filter_by_for_hold' => sub { > >- plan tests => 10; >+ plan tests => 11; > > $schema->storage->txn_begin; > >@@ -2523,7 +2523,21 @@ subtest 'filter_by_for_hold' => sub { > my $mock_context = Test::MockModule->new('C4::Context'); > $mock_context->mock( 'only_my_library', 1 ); > $mock_context->mock( 'mybranch', $library->id ); >- is( $biblio->items->filter_by_for_hold->count, 2, '2 items for hold, filtered by IndependentBranches' ); >+ >+ # Legacy behavior: when branches are independent AND cross-branch holds are disabled, >+ # restrict to the staff member's home branch >+ t::lib::Mocks::mock_preference( 'canreservefromotherbranches', 0 ); >+ is( >+ $biblio->items->filter_by_for_hold->count, 2, >+ '2 items for hold, filtered by IndependentBranches (canreservefromotherbranches=0)' >+ ); >+ >+ # New behavior: when cross-branch holds are enabled, do NOT restrict by homebranch >+ t::lib::Mocks::mock_preference( 'canreservefromotherbranches', 1 ); >+ is( >+ $biblio->items->filter_by_for_hold->count, 6, >+ '6 items for hold, IndependentBranches but canreservefromotherbranches=1' >+ ); > } > > t::lib::Mocks::mock_preference( 'item-level_itypes', 0 ); >-- >2.39.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 36502
:
164376
|
164388
|
185992
| 185993