| 
      
            Lines 252-257
          sub can_be_transferred {
      
      
        Link Here
      
     | 
  
        
          | 252 | 
              return 0;  | 
          252 | 
              return 0;  | 
        
        
          | 253 | 
          }  | 
          253 | 
          }  | 
        
        
          | 254 | 
           | 
          254 | 
           | 
        
            
               | 
               | 
              255 | 
              =head3 validate_pickup_location  | 
            
            
              | 256 | 
               | 
            
            
              | 257 | 
                  $biblio->validate_pickup_location( {patron => $patron, pickup_location_id => $branchcode } ); | 
            
            
              | 258 | 
               | 
            
            
              | 259 | 
              Returns 1 if the pickup location is valid, nothing if it is not. This function is similar to, but distinct  | 
            
            
              | 260 | 
              from pickup_locations in that it does not need to calculate all valid locations, but simply to check until  | 
            
            
              | 261 | 
              1 item is found that validates the passed location. Rather than confusing the logic in that sub, some code  | 
            
            
              | 262 | 
              is duplicated.  | 
            
            
              | 263 | 
               | 
            
            
              | 264 | 
              =cut  | 
            
            
              | 265 | 
               | 
            
            
              | 266 | 
              sub validate_pickup_location { | 
            
            
              | 267 | 
                  my ( $self, $params ) = @_;  | 
            
            
              | 268 | 
               | 
            
            
              | 269 | 
                  my $patron = $params->{patron}; | 
            
            
              | 270 | 
                  my $branchcode = $params->{pickup_location_id}; | 
            
            
              | 271 | 
               | 
            
            
              | 272 | 
                  my %seen;  | 
            
            
              | 273 | 
                  foreach my $item ( $self->items->as_list ) { | 
            
            
              | 274 | 
                      # The 5 variables below determine the valid locations for any item, no need to check twice  | 
            
            
              | 275 | 
                      my $cache_key = sprintf "Pickup_locations:%s:%s:%s:%s:%s",  | 
            
            
              | 276 | 
                         $item->itype,$item->homebranch,$item->holdingbranch,$item->ccode || "",$patron->branchcode||"" ;  | 
            
            
              | 277 | 
                      next if $seen{ $cache_key }; | 
            
            
              | 278 | 
               | 
            
            
              | 279 | 
                      my @item_pickup_locations = $item->pickup_locations( { patron => $patron } )->_resultset->get_column('branchcode')->all; | 
            
            
              | 280 | 
                      $seen{ $cache_key} = 1; | 
            
            
              | 281 | 
               | 
            
            
              | 282 | 
                      return 1 if grep { $branchcode eq $_ } @item_pickup_locations; | 
            
            
              | 283 | 
                  }  | 
            
            
              | 284 | 
               | 
            
            
              | 285 | 
                  return;  | 
            
            
              | 286 | 
              }  | 
            
        
          | 255 | 
           | 
          287 | 
           | 
        
        
          | 256 | 
          =head3 pickup_locations  | 
          288 | 
          =head3 pickup_locations  | 
        
        
          | 257 | 
           | 
          289 | 
           |