+ # 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 $holds = Koha::Holds->search(
+ {
+ borrowernumber => $patron->borrowernumber,
+ biblionumber => $biblionumber,
+ found => undef,
+ }
+ );
+ $force_hold_level = $holds->forced_hold_level();
+ $biblioloopiter{force_hold_level} = $force_hold_level;
+ $template->param( force_hold_level => $force_hold_level );
+
+ # For a librarian to be able to place multiple record holds for a patron for a record,
+ # we must find out what the maximum number of holds they can place for the patron is
+ my $max_holds_for_record = GetMaxPatronHoldsForRecord( $patron->borrowernumber, $biblionumber );
+ my $remaining_holds_for_record = $max_holds_for_record - $holds->count();
+ $biblioloopiter{remaining_holds_for_record} = $max_holds_for_record;
+ $template->param( max_holds_for_record => $max_holds_for_record );
+ $template->param( remaining_holds_for_record => $remaining_holds_for_record );
+
+ { # alreadypossession
+ # Check to see if patron is allowed to place holds on records where the
+ # patron already has an item from that record checked out
+ if ( !C4::Context->preference('AllowHoldsOnPatronsPossessions')
+ && CheckIfIssuedToPatron( $patron->borrowernumber, $biblionumber ) )
+ {
+ $template->param( alreadypossession => 1, );
+ }