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 <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 99c3b9ae1f)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit b78ccb3e47)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
This commit is contained in:
Nick Clemens 2021-01-25 15:34:31 +00:00 committed by Andrew Fuerste-Henry
parent d52969810f
commit a363413a4e
1 changed files with 3 additions and 1 deletions

View File

@ -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;