| Lines 340-345
          sub CanBookBeReserved{
      
      
        Link Here | 
        
          | 340 |   if ($canReserve->{status} eq 'OK') { #We can reserve this Item! } | 340 |   if ($canReserve->{status} eq 'OK') { #We can reserve this Item! } | 
        
          | 341 |  | 341 |  | 
        
          | 342 | @RETURNS { status => OK },              if the Item can be reserved. | 342 | @RETURNS { status => OK },              if the Item can be reserved. | 
            
              |  |  | 343 |          { status => onShelfHoldsNotAllowed },  if onShelfHoldsAllowed parameter and item availability combination doesn't allow holds. | 
        
          | 343 |          { status => ageRestricted },   if the Item is age restricted for this borrower. | 344 |          { status => ageRestricted },   if the Item is age restricted for this borrower. | 
        
          | 344 |          { status => damaged },         if the Item is damaged. | 345 |          { status => damaged },         if the Item is damaged. | 
        
          | 345 |          { status => cannotReserveFromOtherBranches }, if syspref 'canreservefromotherbranches' is OK. | 346 |          { status => cannotReserveFromOtherBranches }, if syspref 'canreservefromotherbranches' is OK. | 
  
    | Lines 362-373
          sub CanItemBeReserved {
      
      
        Link Here | 
        
          | 362 |     my $holds_per_record = 1; # Total number of holds allowed for this one given record | 363 |     my $holds_per_record = 1; # Total number of holds allowed for this one given record | 
        
          | 363 |     my $holds_per_day;        # Default to unlimited | 364 |     my $holds_per_day;        # Default to unlimited | 
        
          | 364 |     my $opacitemholds = 'Y';  # Itemlevel holds default to allowed | 365 |     my $opacitemholds = 'Y';  # Itemlevel holds default to allowed | 
            
              |  |  | 366 |     my $on_shelf_holds = 0;   # Default to "if any unavailable" | 
        
          | 365 |  | 367 |  | 
        
          | 366 |     # Get calling context | 368 |     # Get calling context | 
        
          | 367 |     my $caller = (caller(1))[3]; | 369 |     my $caller = (caller(1))[3]; | 
        
          | 368 |  | 370 |  | 
        
          | 369 |     # we retrieve borrowers and items informations # | 371 |     # we retrieve borrowers and items informations # | 
        
          | 370 |     # item->{itype} will come for biblioitems if necessery | 372 |     # item->{itype} will come for biblioitems if necessery | 
            
              |  |  | 373 |  | 
        
          | 371 |     my $item       = Koha::Items->find($itemnumber); | 374 |     my $item       = Koha::Items->find($itemnumber); | 
        
          | 372 |     my $biblio     = $item->biblio; | 375 |     my $biblio     = $item->biblio; | 
        
          | 373 |     my $patron = Koha::Patrons->find( $borrowernumber ); | 376 |     my $patron = Koha::Patrons->find( $borrowernumber ); | 
  
    | Lines 417-422
          sub CanItemBeReserved {
      
      
        Link Here | 
        
          | 417 |         $holds_per_record = $rights->{holds_per_record} // $holds_per_record; | 420 |         $holds_per_record = $rights->{holds_per_record} // $holds_per_record; | 
        
          | 418 |         $holds_per_day    = $rights->{holds_per_day}; | 421 |         $holds_per_day    = $rights->{holds_per_day}; | 
        
          | 419 |         $opacitemholds    = $rights->{opacitemholds}; | 422 |         $opacitemholds    = $rights->{opacitemholds}; | 
            
              |  |  | 423 |         $on_shelf_holds   = $rights->{onshelfholds}; | 
        
          | 420 |     } | 424 |     } | 
        
          | 421 |     else { | 425 |     else { | 
        
          | 422 |         $ruleitemtype = undef; | 426 |         $ruleitemtype = undef; | 
  
    | Lines 426-431
          sub CanItemBeReserved {
      
      
        Link Here | 
        
          | 426 |         return { status => "notReservable" }; | 430 |         return { status => "notReservable" }; | 
        
          | 427 |     } | 431 |     } | 
        
          | 428 |  | 432 |  | 
            
              |  |  | 433 |     # Check for item on shelves and OnShelfHoldsAllowed | 
            
              | 434 |     return { status => 'onShelfHoldsNotAllowed' } | 
            
              | 435 |      if ( 0 == ( | 
            
              | 436 |         $item->{'notforloan'} or | 
            
              | 437 |         $item->{'onloan'} or | 
            
              | 438 |         $item->{'itemlost'} or | 
            
              | 439 |         $item->{'withdrawn'} or | 
            
              | 440 |         $item->{'damaged'} ) | 
            
              | 441 |         && ($on_shelf_holds != "1")); | 
            
              | 442 |  | 
        
          | 429 |     $item = Koha::Items->find( $itemnumber ); | 443 |     $item = Koha::Items->find( $itemnumber ); | 
        
          | 430 |  | 444 |  | 
        
          | 431 |     my $holds = Koha::Holds->search( | 445 |     my $holds = Koha::Holds->search( | 
  
    | Lines 2268-2274
          sub GetHoldRule {
      
      
        Link Here | 
        
          | 2268 |             itemtype     => $itemtype, | 2282 |             itemtype     => $itemtype, | 
        
          | 2269 |             categorycode => $categorycode, | 2283 |             categorycode => $categorycode, | 
        
          | 2270 |             branchcode   => $branchcode, | 2284 |             branchcode   => $branchcode, | 
          
            
              | 2271 |             rules        => ['holds_per_record', 'holds_per_day', 'opacitemholds'], | 2285 |             rules        => ['holds_per_record', 'holds_per_day', 'opacitemholds', 'onshelfholds'], | 
        
          | 2272 |             order_by     => { | 2286 |             order_by     => { | 
        
          | 2273 |                 -desc => [ 'categorycode', 'itemtype', 'branchcode' ] | 2287 |                 -desc => [ 'categorycode', 'itemtype', 'branchcode' ] | 
        
          | 2274 |             } | 2288 |             } | 
  
    | Lines 2277-2282
          sub GetHoldRule {
      
      
        Link Here | 
        
          | 2277 |     $rules->{holds_per_record} = $holds_per_x_rules->{holds_per_record}; | 2291 |     $rules->{holds_per_record} = $holds_per_x_rules->{holds_per_record}; | 
        
          | 2278 |     $rules->{holds_per_day} = $holds_per_x_rules->{holds_per_day}; | 2292 |     $rules->{holds_per_day} = $holds_per_x_rules->{holds_per_day}; | 
        
          | 2279 |     $rules->{opacitemholds} = $holds_per_x_rules->{opacitemholds}; | 2293 |     $rules->{opacitemholds} = $holds_per_x_rules->{opacitemholds}; | 
            
              |  |  | 2294 |     $rules->{onshelfholds}  = $holds_per_x_rules->{onshelfholds}; | 
        
          | 2280 |  | 2295 |  | 
        
          | 2281 |     return $rules; | 2296 |     return $rules; | 
        
          | 2282 | } | 2297 | } |