</select>
[% ELSE %]
<select name="branch" id="branch_[% bibitemloo.biblionumber %]">
- [% PROCESS options_for_libraries libraries => Branches.all( selected => branch ) %]
+ [% FOREACH library IN Branches.all( selected => branch) %]
+ [% SET pickup_available_at = bibitemloo.not_available_at.grep(library.branchcode).size ? 0 : 1 %]
+ [% IF library.selected AND pickup_available_at %]
+ <option value="[% library.branchcode %]" selected="selected" >[% library.branchname %]</option>
+ [% ELSIF pickup_available_at %]
+ <option value="[% library.branchcode %]">[% library.branchname %]</option>
+ [% ELSE %]
+ <option value="[% library.branchcode %]" disabled="disabled" title="At least one item is available at this library">[% library.branchname %]</option>
+ [% END %]
+ [% END %]
</select>
[% END # / UNLESS bibitemloo.holdable %]
</li>
$canreserve = 0;
}
+ unless ( C4::Context->preference('OPACHoldsIfAvailableAtPickup') ) {
+ $canreserve = 0 if Koha::Items->search({ biblionumber => $biblioNum, holdingbranch => $branch })->count;
+ }
+
my $itemtype = $query->param('itemtype') || undef;
$itemtype = undef if $itemNum;
foreach my $biblioNum (@biblionumbers) {
+ my @not_available_at = ();
my $record = GetMarcBiblio($biblioNum);
# Init the bib item with the choices for branch pickup
my %biblioLoopIter;
$biblioLoopIter{force_hold} = 1 if $hold_allowed eq 'F';
}
$numCopiesAvailable++;
+
+ if ( not C4::Context->preference('OPACHoldsIfAvailableAtPickup') ) {
+ push @not_available_at, $itemInfo->{holdingbranch};
+ }
}
$itemLoopIter->{imageurl} = getitemtypeimagelocation( 'opac', $itemTypes->{ $itemInfo->{itype} }{imageurl} );
$biblioLoopIter{already_patron_possession} = 1;
}
+ if ( $biblioLoopIter{holdable} ) {
+ @not_available_at = uniq @not_available_at;
+ $biblioLoopIter{not_available_at} = \@not_available_at ;
+ }
+
+ unless ( C4::Context->preference('OPACHoldsIfAvailableAtPickup') ) {
+ @not_available_at = uniq @not_available_at;
+ $biblioLoopIter{not_available_at} = \@not_available_at ;
+ # The record is not holdable is not available at any of the libraries
+ if ( Koha::Libraries->search->count == @not_available_at ) {
+ $biblioLoopIter{holdable} = 0;
+ }
+ }
+
$biblioLoopIter{holdable} &&= CanBookBeReserved($borrowernumber,$biblioNum) eq 'OK';
# For multiple holds per record, if a patron has previously placed a hold,