Bug 27071: Use GetReservesControlBranch to pick the branch
Pretty much like the opac-reserve.pl does, this patch makes the staff request.pl script get the branch from the specialized routine from C4::Reserves instead of falling back to userenv. To test: 1. Follow the original test plan: - Create two local hold groups containing distinct lists of libraries. - In default rules for all libraries, set Hold Policy = "From local hold group" and Hold pickup library match to "Patron's hold group" - Make sure AllowHoldPolicyOverride is set to Don't Allow - Make sure you're logged in at a library in Group 1 - Find a bib with only 1 item from Group 1. Confirm you can place a hold on this title for a patron in Group 1 (correct), but not for a patron in Group 2 (correct). - Find a bib with only 1 item from Group 2. Confirm you cannot place a hold for a patron from Group 1 (correct), BUT you also cannot place a hold for a patron from Group 2 (incorrect) -- Koha gives the erroneous message "pickupNotInHoldGroup" - Change your library to a something in Group 2 - Find a bib with only 1 item from Group 1. Confirm you cannot place a hold on this title for a patron in Group 1 (incorrect), and not for a patron in Group 2 (correct). - Find a bib with only 1 item from Group 2. Confirm you cannot place a hold for a patron from Group 1 (correct), but you can place a hold for a patron from Group 2 (correct) => FAIL: Things expected to fail on the plan, fail. 2. Apply this patches 3. Repeat 1 => SUCCESS: It now works! Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> 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>
This commit is contained in:
parent
1de7ec0697
commit
aa221e0c8b
|
|
@ -67,7 +67,7 @@ my ( $template, $borrowernumber, $cookie, $flags ) = get_template_and_user(
|
|||
);
|
||||
|
||||
my $showallitems = $input->param('showallitems');
|
||||
my $pickup = $input->param('pickup') || C4::Context->userenv->{'branch'};
|
||||
my $pickup = $input->param('pickup');
|
||||
|
||||
my $itemtypes = { map { $_->{itemtype} => $_ } @{ Koha::ItemTypes->search_with_localization->unblessed } };
|
||||
|
||||
|
|
@ -551,7 +551,8 @@ foreach my $biblionumber (@biblionumbers) {
|
|||
|
||||
$item->{'holdallowed'} = $branchitemrule->{'holdallowed'};
|
||||
|
||||
my $can_item_be_reserved = CanItemBeReserved( $patron->borrowernumber, $itemnumber, $pickup )->{status};
|
||||
my $reserves_control_branch = $pickup // C4::Reserves::GetReservesControlBranch( $item, $patron_unblessed );
|
||||
my $can_item_be_reserved = CanItemBeReserved( $patron->borrowernumber, $itemnumber, $reserves_control_branch )->{status};
|
||||
$item->{not_holdable} = $can_item_be_reserved unless ( $can_item_be_reserved eq 'OK' );
|
||||
|
||||
$item->{item_level_holds} = Koha::CirculationRules->get_opacitemholds_policy( { item => $item_object, patron => $patron } );
|
||||
|
|
|
|||
Loading…
Reference in New Issue