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 $biblioLoop = [];
my $numBibsAvailable = 0;
my $itemdata_enumchron = 0;
+my $itemdata_ccode = 0;
my $anyholdable = 0;
my $itemLevelTypes = C4::Context->preference('item-level_itypes');
$template->param('item_level_itypes' => $itemLevelTypes);
$itemLoopIter->{homeBranchName} = $itemInfo->{homebranch};
$itemLoopIter->{callNumber} = $itemInfo->{itemcallnumber};
$itemLoopIter->{enumchron} = $itemInfo->{enumchron};
+ $itemLoopIter->{ccode} = $itemInfo->{ccode};
$itemLoopIter->{copynumber} = $itemInfo->{copynumber};
if ($itemLevelTypes) {
$itemLoopIter->{translated_description} = $itemInfo->{translated_description};
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 } );
if ($itemLoopIter->{enumchron}) {
$itemdata_enumchron = 1;
}
+ # Show collection when needed
+ if ($itemLoopIter->{ccode}) {
+ $itemdata_ccode = 1;
+ }
push @{$biblioLoopIter{itemLoop}}, $itemLoopIter;
}
- $template->param( itemdata_enumchron => $itemdata_enumchron );
+ $template->param(
+ itemdata_enumchron => $itemdata_enumchron,
+ itemdata_ccode => $itemdata_ccode,
+ );
if ($numCopiesAvailable > 0) {
$numBibsAvailable++;
}
}
- $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