From cc3f8a5048cd504122768decc6d28c97b7374176 Mon Sep 17 00:00:00 2001 From: Agustin Moyano Date: Mon, 27 May 2019 23:30:05 -0300 Subject: [PATCH] Bug 22284: (follow-up) Remove HomeOrHolding from reserves Signed-off-by: Josef Moravec --- C4/Reserves.pm | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/C4/Reserves.pm b/C4/Reserves.pm index 59058e2a7c..482580f130 100644 --- a/C4/Reserves.pm +++ b/C4/Reserves.pm @@ -460,11 +460,9 @@ sub CanItemBeReserved { return { status => 'cannotReserveFromOtherBranches' }; } - my $branch_control = C4::Context->preference('HomeOrHoldingBranch'); - my $itembranchcode = $branch_control eq 'holdingbranch' ? $item->holdingbranch : $item->homebranch; - my $item_library = Koha::Libraries->find( {branchcode => $itembranchcode} ); + my $item_library = Koha::Libraries->find( {branchcode => $item->homebranch} ); if ( $branchitemrule->{holdallowed} == 3) { - if($borrower->{branchcode} ne $itembranchcode && !$item_library->validate_hold_sibling( {branchcode => $borrower->{branchcode}} )) { + if($borrower->{branchcode} ne $item->homebranch && !$item_library->validate_hold_sibling( {branchcode => $borrower->{branchcode}} )) { return { status => 'branchNotInHoldGroup' }; } } @@ -809,7 +807,7 @@ sub CheckReserves { my $branchitemrule = C4::Circulation::GetBranchItemRule($branch,$item->effective_itemtype); next if ($branchitemrule->{'holdallowed'} == 0); next if (($branchitemrule->{'holdallowed'} == 1) && ($branch ne $patron->branchcode)); - my $library = Koha::Libraries->find({branchcode=>$branch}); + 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}; next if ( ($hold_fulfillment_policy eq 'holdgroup') && (!$library->validate_hold_sibling({branchcode => $res->{branchcode}})) ); @@ -1221,9 +1219,7 @@ sub IsAvailableForItemLevelRequest { foreach my $i (@items) { my $reserves_control_branch = GetReservesControlBranch( $i->unblessed(), $patron->unblessed ); my $branchitemrule = C4::Circulation::GetBranchItemRule( $reserves_control_branch, $i->itype ); - my $branch_control = C4::Context->preference('HomeOrHoldingBranch'); - my $itembranchcode = $branch_control eq 'holdingbranch' ? $item->holdingbranch : $item->homebranch; - my $item_library = Koha::Libraries->find( {branchcode => $itembranchcode} ); + my $item_library = Koha::Libraries->find( {branchcode => $i->homebranch} ); $any_available = 1 @@ -1236,7 +1232,7 @@ sub IsAvailableForItemLevelRequest { && !C4::Context->preference('AllowHoldsOnDamagedItems') ) || Koha::ItemTypes->find( $i->effective_itemtype() )->notforloan || $branchitemrule->{holdallowed} == 1 && $patron->branchcode ne $i->homebranch - || $branchitemrule->{holdallowed} == 3 && !$item_library->validate_hold_sibling( {branchcode => $pickup_branchcode} ); + || $branchitemrule->{holdallowed} == 3 && !$item_library->validate_hold_sibling( {branchcode => $patron->branchcode} ); } return $any_available ? 0 : 1; -- 2.17.1