my $branch = $query->param('branch') || $patron->branchcode || C4::Context->userenv->{branch} || '' ;
$template->param( branch => $branch );
-# Is the person allowed to choose their branch
-my $OPACChooseBranch = (C4::Context->preference("OPACAllowUserToChooseBranch")) ? 1 : 0;
-
-$template->param( choose_branch => $OPACChooseBranch);
-
#
#
# Build hashes of the requested biblio(item)s and items.
my $canreserve = 0;
my $singleBranchMode = Koha::Libraries->search->count == 1;
- if ( $singleBranchMode || !$OPACChooseBranch )
+ if ( $singleBranchMode || ! C4::Context->preference("OPACAllowUserToChooseBranch") )
{ # single branch mode or disabled user choosing
$branch = $patron->branchcode;
}
my $expiration_date = $query->param("expiration_date_$biblioNum");
- # If a specific item was selected and the pickup branch is the same as the
- # holdingbranch, force the value $rank and $found.
my $rank = $biblioData->{rank};
if ( $itemNum ne '' ) {
- $canreserve = 1 if CanItemBeReserved( $borrowernumber, $itemNum ) eq 'OK';
- $rank = '0' unless C4::Context->preference('ReservesNeedReturns');
- my $item = GetItem($itemNum);
- if ( $item->{'holdingbranch'} eq $branch ) {
- $found = 'W'
- unless C4::Context->preference('ReservesNeedReturns');
- }
+ $canreserve = 1 if CanItemBeReserved( $borrowernumber, $itemNum )->{status} eq 'OK';
}
else {
- $canreserve = 1 if CanBookBeReserved( $borrowernumber, $biblioNum ) eq 'OK';
+ $canreserve = 1 if CanBookBeReserved( $borrowernumber, $biblioNum )->{status} eq 'OK';
# Inserts a null into the 'itemnumber' field of 'reserves' table.
$itemNum = undef;
my $policy_holdallowed = !$itemLoopIter->{already_reserved};
$policy_holdallowed &&=
IsAvailableForItemLevelRequest($itemInfo,$patron_unblessed) &&
- CanItemBeReserved($borrowernumber,$itemNum) eq 'OK';
+ CanItemBeReserved( $borrowernumber, $itemNum )->{status} eq 'OK';
if ($policy_holdallowed) {
my $opac_hold_policy = Koha::IssuingRules->get_opacitemholds_policy( { item => $item, patron => $patron } );
}
}
- $biblioLoopIter{holdable} &&= CanBookBeReserved($borrowernumber,$biblioNum) eq 'OK';
+ $biblioLoopIter{holdable} &&= CanBookBeReserved( $borrowernumber, $biblioNum )->{status} eq 'OK';
# For multiple holds per record, if a patron has previously placed a hold,
# the patron can only place more holds of the same type. That is, if the