Bugzilla – Attachment 148918 Details for
Bug 33200
IndependentBranchesTransfers does not prevent holds from creating transfers
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 33200: (follow-up) Adding Unit test, renaming _Removereserve
Bug-33200-follow-up-Adding-Unit-test-renaming-Remo.patch (text/plain), 3.66 KB, created by
Hammat wele
on 2023-03-29 13:44:03 UTC
(
hide
)
Description:
Bug 33200: (follow-up) Adding Unit test, renaming _Removereserve
Filename:
MIME Type:
Creator:
Hammat wele
Created:
2023-03-29 13:44:03 UTC
Size:
3.66 KB
patch
obsolete
>From 0f6a59e9ac7384b2f05c6f3dd21cdfb8228016aa Mon Sep 17 00:00:00 2001 >From: Hammat Wele <hammat.wele@inlibro.com> >Date: Wed, 29 Mar 2023 13:43:28 +0000 >Subject: [PATCH] Bug 33200: (follow-up) Adding Unit test, renaming > _Removereserve > >--- > C4/Reserves.pm | 10 +++++----- > t/db_dependent/Reserves.t | 23 ++++++++++++++++++++++- > 2 files changed, 27 insertions(+), 6 deletions(-) > >diff --git a/C4/Reserves.pm b/C4/Reserves.pm >index e52ef0ab37..c751dd86b0 100644 >--- a/C4/Reserves.pm >+++ b/C4/Reserves.pm >@@ -910,7 +910,7 @@ sub CheckReserves { > # Find this item in the reserves > my @reserves = _Findgroupreserve( $bibitem, $biblio, $itemnumber, $lookahead_days, $ignore_borrowers); > # When IndependentBranchesTransfers is activate remove the reserve made from other branches >- @reserves = _Removereserve( @reserves ); >+ @reserves = _FilterHoldsForIndependentBranches( @reserves ); > > # $priority and $highest are used to find the most important item > # in the list returned by &_Findgroupreserve. (The lower $priority, >@@ -1845,19 +1845,19 @@ sub _Findgroupreserve { > return @results; > } > >-=head2 _Removereserve >+=head2 _FilterHoldsForIndependentBranches > >- @reserves = &_Removereserve( @reserves ); >+ @reserves = &_FilterHoldsForIndependentBranches( @reserves ); > > Check transfers is allowed from system preference and remove the reserves made from other branches > >-C<&_Removereserve> returns : >+C<&_FilterHoldsForIndependentBranches> returns : > C<@results> is an array of references-to-hash whose keys are mostly > fields from the reserves table of the Koha database, plus > > =cut > >-sub _Removereserve { >+sub _FilterHoldsForIndependentBranches { > my ( @reserves) = @_; > if ( C4::Context->preference("IndependentBranchesTransfers") && !C4::Context->IsSuperLibrarian() && scalar @reserves) { > my @results; >diff --git a/t/db_dependent/Reserves.t b/t/db_dependent/Reserves.t >index 3371c9539d..4ef8960ac8 100755 >--- a/t/db_dependent/Reserves.t >+++ b/t/db_dependent/Reserves.t >@@ -17,7 +17,7 @@ > > use Modern::Perl; > >-use Test::More tests => 77; >+use Test::More tests => 83; > use Test::MockModule; > use Test::Warn; > >@@ -131,6 +131,27 @@ is($status, "Reserved", "CheckReserves Test 2"); > ($status, $reserve, $all_reserves) = CheckReserves(undef, $barcode); > is($status, "Reserved", "CheckReserves Test 3"); > >+# Set the preference 'IndependentBranchesTransfers' is set to 'yes' >+# the userenv branch and the branche code are not the same holds should be filtered >+t::lib::Mocks::mock_preference( 'IndependentBranchesTransfers', 1 ); >+($status) = CheckReserves($item->itemnumber, $barcode); >+is( $status, "", 'Reserves is filtered'); >+($status, $reserve, $all_reserves) = CheckReserves($item->itemnumber); >+is( $status, "", 'Reserves is filtered'); >+($status, $reserve, $all_reserves) = CheckReserves(undef, $barcode); >+is( $status, "", 'Reserves is filtered'); >+ >+# Set the userenv branchcode to be the same to the item branchcode. >+t::lib::Mocks::mock_userenv({ branchcode => $branchcode }); >+($status) = CheckReserves($item->itemnumber, $barcode); >+is( $status, "Reserved", 'Reserves should not be filtered'); >+($status, $reserve, $all_reserves) = CheckReserves($item->itemnumber); >+is( $status, "Reserved", 'Reserves should not be filtered'); >+($status, $reserve, $all_reserves) = CheckReserves(undef, $barcode); >+is( $status, "Reserved", 'Reserves should not be filtered'); >+ >+t::lib::Mocks::mock_userenv({ branchcode => $branch_1 }); >+t::lib::Mocks::mock_preference( 'IndependentBranchesTransfers', 0 ); > my $ReservesControlBranch = C4::Context->preference('ReservesControlBranch'); > t::lib::Mocks::mock_preference( 'ReservesControlBranch', 'ItemHomeLibrary' ); > ok( >-- >2.34.1
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 33200
:
148212
|
148484
|
148918
|
151129
|
151130
|
151348
|
151349
|
154552
|
155482
|
155483
|
155484
|
158188
|
158189
|
158190
|
171434
|
171435
|
171436
|
172707
|
172708
|
172709