From a363413a4e49cf80136a806fac424a7c8e9ebe3a Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Mon, 25 Jan 2021 15:34:31 +0000 Subject: [PATCH] Bug 27529: Choose patron's branch or item's homebranch if following group rules and patron cannot choose branch This patch defaults the holds pickup location to the items homebranch or the patron's branch when a group option is selected for the hold fulfillment policy and the patron is not allowed to choose the branch on the OPAC To test: 1 - Set 'Default checkout, hold and return policy' -> 'Hold pickup library match' to item's hold group or patron's hold group 2 - Set OPACAllowUserToChooseBranch to 'Don't allow' 3 - Try to place an item level hold on the opac 4 - Ka-boom, etiher: The method Koha::Item->patrongroup is not covered by tests! The method Koha::Item->itemgroup is not covered by tests! 5 - Apply patch 6 - Repeat 7 - Note the pickup location is set to either the patron's branch or the items homebranch 8 - Repeat plan with the other group setting Signed-off-by: David Nind Signed-off-by: Martin Renvoize Signed-off-by: Jonathan Druart (cherry picked from commit 99c3b9ae1f55066f4fd2bd0e37ba336f18592780) Signed-off-by: Fridolin Somers (cherry picked from commit b78ccb3e479919be83dc027eaf23fc1c44f62fba) Signed-off-by: Andrew Fuerste-Henry --- opac/opac-reserve.pl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/opac/opac-reserve.pl b/opac/opac-reserve.pl index eb9aeaf8bd..bda8f5cbb3 100755 --- a/opac/opac-reserve.pl +++ b/opac/opac-reserve.pl @@ -246,8 +246,10 @@ if ( $query->param('place_reserve') ) { my $type = $item->effective_itemtype; my $rule = GetBranchItemRule( $patron->branchcode, $type ); - if ( $rule->{hold_fulfillment_policy} eq 'any' ) { + if ( $rule->{hold_fulfillment_policy} eq 'any' || $rule->{hold_fulfillment_policy} eq 'patrongroup' ) { $branch = $patron->branchcode; + } elsif ( $rule->{hold_fulfillment_policy} eq 'holdgroup' ){ + $branch = $item->homebranch; } else { my $policy = $rule->{hold_fulfillment_policy}; $branch = $item->$policy; -- 2.39.5