}
# pass the pickup branch along....
-my $branch = $query->param('branch') || C4::Context->userenv->{branch} || '' ;
+my $branch = $query->param('branch') || $borr->{'branchcode'} || C4::Context->userenv->{branch} || '' ;
($branches->{$branch}) or $branch = ""; # Confirm branch is real
$template->param( branch => $branch );
my $CGIbranchloop = GetBranchesLoop($branch);
$template->param( CGIbranch => $CGIbranchloop );
+# 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 $branch = shift(@selectedItems); # i.e., branch code, not name
my $singleBranchMode = $template->param('singleBranchMode');
- if ($singleBranchMode) {
+ if ($singleBranchMode || ! $OPACChooseBranch) { # single branch mode or disabled user choosing
$branch = $borr->{'branchcode'};
}
my $biblioLoop = [];
my $numBibsAvailable = 0;
my $itemdata_enumchron = 0;
+my $anyholdable;
my $itemLevelTypes = C4::Context->preference('item-level_itypes');
-$template->param('item-level_itypes' => $itemLevelTypes);
+$template->param('item_level_itypes' => $itemLevelTypes);
foreach my $biblioNum (@biblionumbers) {
}
}
- $biblioLoopIter{itemTypeDescription} = $itemTypes->{$biblioData->{itemtype}}{description};
-
$biblioLoopIter{itemLoop} = [];
my $numCopiesAvailable = 0;
foreach my $itemInfo (@{$biblioData->{itemInfos}}) {
$numBibsAvailable++;
$biblioLoopIter{bib_available} = 1;
$biblioLoopIter{holdable} = 1;
+ $anyholdable = 1;
}
if ($biblioLoopIter{already_reserved}) {
$biblioLoopIter{holdable} = undef;
+ $anyholdable = undef;
}
if(not CanBookBeReserved($borrowernumber,$biblioNum)){
$biblioLoopIter{holdable} = undef;
+ $anyholdable = undef;
}
push @$biblioLoop, \%biblioLoopIter;
}
-if ( $numBibsAvailable == 0 ) {
- $template->param( none_available => 1, message => 1 );
+if ( $numBibsAvailable == 0 || !$anyholdable) {
+ $template->param( none_available => 1 );
}
-my $itemTableColspan = 5;
-if (!$template->param('OPACItemHolds')) {
+my $itemTableColspan = 7;
+if (! $template->{VARS}->{'OPACItemHolds'}) {
$itemTableColspan--;
}
-if ($template->param('singleBranchMode')) {
+if (! $template->{VARS}->{'singleBranchMode'}) {
$itemTableColspan--;
}
$template->param(itemtable_colspan => $itemTableColspan);