From 6413921700f5b2929aff7de092dfb9d5523754df Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Wed, 2 Jun 2021 15:20:08 +0000 Subject: [PATCH] Bug 28503: Compare item homebranch to patron branch when hold policy set to 'from_home_library' This fixes an issue in the way we calculate the check for hold policy 'from_home_library' Currently we change the comparison based on ReservesControlBranch, however, that should only control the rule we fetch, not how we compare When ReservesControlBranch is set to "patron's home library" we compare the patron's branch to the patron's branch, this is useless and means we pass the check for all branches all of the time We should instead compare the patron's branch to the item's branch, and only fetch the rule using ReservesControlBranch To test: 1 - Have a record with an item from library A and library B 2 - Set the 'Default checkout, hold and return policy'->Hold policy->From home library for all libraries and ensure you have no branch specific/itemtype specific rules set 3 - Attempt to place a hold on the record for a patron from library B 4 - Note that only the library B item is holdable - place a title level hold (do not choose an item) 5 - Check in the item from library A 6 - It fills the hold - This is incorrect - ignore the hold 7 - Apply patch 8 - Restart all the things 9 - Check in the item from library A 10 - No hold found 11 - Check in the item from library B 12 - Hold found, correctly Signed-off-by: David Nind Signed-off-by: Tomas Cohen Arazi Bug 28503: Clarify what ReservesControlBranch controls Signed-off-by: David Nind Signed-off-by: Tomas Cohen Arazi Signed-off-by: Jonathan Druart Signed-off-by: Kyle M Hall (cherry picked from commit 19660a25fa9421373a41fb6aba71215d71c541be) Signed-off-by: Fridolin Somers --- C4/Reserves.pm | 2 +- .../prog/en/modules/admin/preferences/circulation.pref | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/C4/Reserves.pm b/C4/Reserves.pm index 0e20c77ae5..0d8f4aac7e 100644 --- a/C4/Reserves.pm +++ b/C4/Reserves.pm @@ -894,7 +894,7 @@ sub CheckReserves { my $branch = GetReservesControlBranch( $item->unblessed, $patron->unblessed ); my $branchitemrule = C4::Circulation::GetBranchItemRule($branch,$item->effective_itemtype); next if ($branchitemrule->{'holdallowed'} == 0); - next if (($branchitemrule->{'holdallowed'} == 1) && ($branch ne $patron->branchcode)); + next if (($branchitemrule->{'holdallowed'} == 1) && ($item->homebranch ne $patron->branchcode)); my $library = Koha::Libraries->find({branchcode=>$item->homebranch}); next if (($branchitemrule->{'holdallowed'} == 3) && (!$library->validate_hold_sibling({branchcode => $patron->branchcode}) )); my $hold_fulfillment_policy = $branchitemrule->{hold_fulfillment_policy}; diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref index d290cabfa4..9742cd468c 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref @@ -716,7 +716,7 @@ Circulation: class: integer - days from now) at checkin time. Note that this number of days will be used too in calculating the default end date for the Holds to pull-report. But it does not interfere with issuing, renewing or transferring items. - - - Check the + - Check the rule from the - pref: ReservesControlBranch choices: ItemHomeLibrary: "item's home library"