| Lines 550-555
          sub can_be_transferred {
      
      
        Link Here | 
        
          | 550 |         $limittype => $limittype eq 'itemtype' | 550 |         $limittype => $limittype eq 'itemtype' | 
        
          | 551 |                         ? $self->effective_itemtype : $self->ccode | 551 |                         ? $self->effective_itemtype : $self->ccode | 
        
          | 552 |     })->count ? 0 : 1; | 552 |     })->count ? 0 : 1; | 
            
              |  |  | 553 |  | 
            
              | 554 | } | 
            
              | 555 |  | 
            
              | 556 | =head3 libs_can_transfer_to | 
            
              | 557 |  | 
            
              | 558 | $item->libs_can_transfer_to({ to => $to_libraries, from => $from_library }) | 
            
              | 559 | Checks if an item can be transferred to given libraries. | 
            
              | 560 |  | 
            
              | 561 | This feature is controlled by two system preferences: | 
            
              | 562 | UseBranchTransferLimits to enable / disable the feature | 
            
              | 563 | BranchTransferLimitsType to use either an itemnumber or ccode as an identifier | 
            
              | 564 |                          for setting the limitations | 
            
              | 565 |  | 
            
              | 566 | Takes HASHref that can have the following parameters: | 
            
              | 567 |     MANDATORY PARAMETERS: | 
            
              | 568 |     $to   : Array of Koha::Libraries | 
            
              | 569 |     OPTIONAL PARAMETERS: | 
            
              | 570 |     $from : Koha::Library  # if not given, item holdingbranch | 
            
              | 571 |                            # will be used instead | 
            
              | 572 |  | 
            
              | 573 | Returns arry of Koha::Libraries that item can be transferred to $to_library. | 
            
              | 574 |  | 
            
              | 575 | If checking only one library please use $item->can_be_transferred. | 
            
              | 576 |  | 
            
              | 577 | =cut | 
            
              | 578 |  | 
            
              | 579 | sub libs_can_transfer_to { | 
            
              | 580 |     my ($self, $params ) = @_; | 
            
              | 581 |  | 
            
              | 582 |     my $to   = $params->{to}; | 
            
              | 583 |     my $from = $params->{from}; | 
            
              | 584 |     $from = defined $from ? $from->branchcode : $self->holdingbranch; | 
            
              | 585 |  | 
            
              | 586 |     return $to unless C4::Context->preference('UseBranchTransferLimits'); | 
            
              | 587 |  | 
            
              | 588 |     my $limittype = C4::Context->preference('BranchTransferLimitsType'); | 
            
              | 589 |     my $limiter = $limittype eq 'itemtype' ? $self->effective_itemtype : $self->ccode; | 
            
              | 590 |  | 
            
              | 591 |     my @destinations = map { $_->branchcode } @$to; | 
            
              | 592 |     my @cant_transfer; | 
            
              | 593 |     my $limits = Koha::Item::Transfer::Limits->search({ | 
            
              | 594 |                 fromBranch => $from, | 
            
              | 595 |                 $limittype => $limiter | 
            
              | 596 |             }); | 
            
              | 597 |     my @limits = $limits->get_column('toBranch'); | 
            
              | 598 |     return $to unless @limits; | 
            
              | 599 |  | 
            
              | 600 |     my @can_transfer = Koha::Libraries->search({ | 
            
              | 601 |         branchcode => { | 
            
              | 602 |             -in => \@destinations, | 
            
              | 603 |             -not_in => \@limits, | 
            
              | 604 |         } | 
            
              | 605 |     }); | 
            
              | 606 |     return \@can_transfer; | 
        
          | 553 | } | 607 | } | 
        
          | 554 |  | 608 |  | 
        
          | 555 | =head3 pickup_locations | 609 | =head3 pickup_locations | 
  
    | Lines 596-609
          sub pickup_locations {
      
      
        Link Here | 
        
          | 596 |         })->as_list; | 650 |         })->as_list; | 
        
          | 597 |     } | 651 |     } | 
        
          | 598 |  | 652 |  | 
          
            
              | 599 |     my @pickup_locations; | 653 |     my $pickup_locations = $self->libs_can_transfer_to({ | 
            
              | 600 |     foreach my $library (@libs) { | 654 |         to => \@libs | 
            
              | 601 |         if ($library->pickup_location && $self->can_be_transferred({ to => $library })) { | 655 |     }); | 
            
              | 602 |             push @pickup_locations, $library; |  |  | 
            
              | 603 |         } | 
            
              | 604 |     } | 
        
          | 605 |  | 656 |  | 
          
            
              | 606 |     return \@pickup_locations; | 657 |     return $pickup_locations; | 
        
          | 607 | } | 658 | } | 
        
          | 608 |  | 659 |  | 
        
          | 609 | =head3 article_request_type | 660 | =head3 article_request_type | 
            
              | 610 | -  |  |  |