+ if ( $biblioLoopIter{holdable} ) {
+ @not_available_at = uniq @not_available_at;
+ $biblioLoopIter{not_available_at} = \@not_available_at ;
+ }
+
+ unless ( $can_place_hold_if_available_at_pickup ) {
+ @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,
+ # the patron can only place more holds of the same type. That is, if the
+ # patron placed a record level hold, all the holds the patron places must
+ # be record level. If the patron placed an item level hold, all holds
+ # the patron places must be item level
+ my $forced_hold_level = Koha::Holds->search(
+ {
+ borrowernumber => $borrowernumber,
+ biblionumber => $biblioNum,
+ found => undef,
+ }
+ )->forced_hold_level();
+ if ($forced_hold_level) {
+ $biblioLoopIter{force_hold} = 1 if $forced_hold_level eq 'item';
+ $biblioLoopIter{itemholdable} = 0 if $forced_hold_level eq 'record';
+ }
+