| Lines 577-605
          sub MapItemsToHoldRequests {
      
      
        Link Here | 
        
          | 577 |             $pull_branches = [keys %items_by_branch]; | 577 |             $pull_branches = [keys %items_by_branch]; | 
        
          | 578 |             $holdingbranch = least_cost_branch( $pickup_branch, $pull_branches, $transport_cost_matrix ); | 578 |             $holdingbranch = least_cost_branch( $pickup_branch, $pull_branches, $transport_cost_matrix ); | 
        
          | 579 |             if ( $holdingbranch ) { | 579 |             if ( $holdingbranch ) { | 
          
            
              | 580 |  | 580 |                 $itemnumber = get_least_cost_item( $priority_branch, $holdingbranch, \%items_by_branch, \%items_by_itemnumber, $libraries, $request ); | 
            
              | 581 |                 my $holding_branch_items = $items_by_branch{$holdingbranch}; |  |  | 
            
              | 582 |                 foreach my $item (@$holding_branch_items) { | 
            
              | 583 |                     next if $request->{borrowerbranch} ne $item->{$priority_branch}; | 
            
              | 584 |                     next unless $items_by_itemnumber{ $item->{itemnumber} }->{_object}->can_be_transferred( { to => $libraries->{ $request->{branchcode} } } ); | 
            
              | 585 |  | 
            
              | 586 |                     # Don't fill item level holds that contravene the hold pickup policy at this time | 
            
              | 587 |                     next unless _checkHoldPolicy($item, $request); | 
            
              | 588 |  | 
            
              | 589 |                     # If hold itemtype is set, item's itemtype must match | 
            
              | 590 |                     next unless ( !$request->{itemtype} | 
            
              | 591 |                         || $item->{itype} eq $request->{itemtype} ); | 
            
              | 592 |  | 
            
              | 593 |                     # If hold item_group is set, item's item_group must match | 
            
              | 594 |                     next unless ( | 
            
              | 595 |                         !$request->{item_group_id} | 
            
              | 596 |                         || (   $item->{_object}->item_group | 
            
              | 597 |                             && $item->{_object}->item_group->id eq $request->{item_group_id} ) | 
            
              | 598 |                     ); | 
            
              | 599 |  | 
            
              | 600 |                     $itemnumber = $item->{itemnumber}; | 
            
              | 601 |                     last; | 
            
              | 602 |                 } | 
        
          | 603 |             } | 581 |             } | 
        
          | 604 |             else { | 582 |             else { | 
        
          | 605 |                 next; | 583 |                 next; | 
  
    | Lines 959-962
          sub update_queue_for_biblio {
      
      
        Link Here | 
        
          | 959 |     return $result; | 937 |     return $result; | 
        
          | 960 | } | 938 | } | 
        
          | 961 |  | 939 |  | 
            
              |  |  | 940 | sub get_least_cost_item { | 
            
              | 941 |     my ( $priority_branch, $holdingbranch, $items_by_branch, $items_by_itemnumber, $libraries, $request ) = @_; | 
            
              | 942 |     my $holding_branch_items = $items_by_branch->{$holdingbranch}; | 
            
              | 943 |     foreach my $item (@$holding_branch_items) { | 
            
              | 944 |         next if $request->{borrowerbranch} ne $item->{$priority_branch}; | 
            
              | 945 |         next | 
            
              | 946 |             unless $items_by_itemnumber->{ $item->{itemnumber} }->{_object} | 
            
              | 947 |             ->can_be_transferred( { to => $libraries->{ $request->{branchcode} } } ); | 
            
              | 948 |  | 
            
              | 949 |         # Don't fill item level holds that contravene the hold pickup policy at this time | 
            
              | 950 |         next unless _checkHoldPolicy( $item, $request ); | 
            
              | 951 |  | 
            
              | 952 |         # If hold itemtype is set, item's itemtype must match | 
            
              | 953 |         next unless ( !$request->{itemtype} | 
            
              | 954 |             || $item->{itype} eq $request->{itemtype} ); | 
            
              | 955 |  | 
            
              | 956 |         # If hold item_group is set, item's item_group must match | 
            
              | 957 |         next | 
            
              | 958 |             unless ( | 
            
              | 959 |             !$request->{item_group_id} | 
            
              | 960 |             || (   $item->{_object}->item_group | 
            
              | 961 |                 && $item->{_object}->item_group->id eq $request->{item_group_id} ) | 
            
              | 962 |             ); | 
            
              | 963 |  | 
            
              | 964 |         return $item->{itemnumber}; | 
            
              | 965 |     } | 
            
              | 966 | } | 
            
              | 967 |  | 
        
          | 962 | 1; | 968 | 1; | 
            
              | 963 | -  |  |  |