Lines 736-760
sub can_be_transferred {
Link Here
|
736 |
|
736 |
|
737 |
$pickup_locations = $item->pickup_locations( {patron => $patron } ) |
737 |
$pickup_locations = $item->pickup_locations( {patron => $patron } ) |
738 |
|
738 |
|
739 |
Returns possible pickup locations for this item, according to patron's home library (if patron is defined and holds are allowed only from hold groups) |
739 |
Returns possible pickup locations for this item, according to patron's home library |
740 |
and if item can be transferred to each pickup location. |
740 |
and if item can be transferred to each pickup location. |
741 |
|
741 |
|
|
|
742 |
Patron parameter is required. |
743 |
|
742 |
=cut |
744 |
=cut |
743 |
|
745 |
|
744 |
sub pickup_locations { |
746 |
sub pickup_locations { |
745 |
my ($self, $params) = @_; |
747 |
my ($self, $params) = @_; |
746 |
|
748 |
|
747 |
my $patron = $params->{patron}; |
749 |
my $patron = $params->{patron}; |
|
|
750 |
# FIXME We should throw an exception if not passed |
748 |
|
751 |
|
749 |
my $circ_control_branch = |
752 |
my $circ_control_branch = |
750 |
C4::Reserves::GetReservesControlBranch( $self->unblessed(), $patron->unblessed ); |
753 |
C4::Reserves::GetReservesControlBranch( $self->unblessed(), $patron->unblessed ); |
751 |
my $branchitemrule = |
754 |
my $branchitemrule = |
752 |
C4::Circulation::GetBranchItemRule( $circ_control_branch, $self->itype ); |
755 |
C4::Circulation::GetBranchItemRule( $circ_control_branch, $self->itype ); |
753 |
|
756 |
|
754 |
if(defined $patron) { |
757 |
return Koha::Libraries->new()->empty if $branchitemrule->{holdallowed} eq 'from_local_hold_group' && !$self->home_branch->validate_hold_sibling( {branchcode => $patron->branchcode} ); |
755 |
return Koha::Libraries->new()->empty if $branchitemrule->{holdallowed} eq 'from_local_hold_group' && !$self->home_branch->validate_hold_sibling( {branchcode => $patron->branchcode} ); |
758 |
return Koha::Libraries->new()->empty if $branchitemrule->{holdallowed} eq 'from_home_library' && $self->home_branch->branchcode ne $patron->branchcode; |
756 |
return Koha::Libraries->new()->empty if $branchitemrule->{holdallowed} eq 'from_home_library' && $self->home_branch->branchcode ne $patron->branchcode; |
|
|
757 |
} |
758 |
|
759 |
|
759 |
my $pickup_libraries = Koha::Libraries->search(); |
760 |
my $pickup_libraries = Koha::Libraries->search(); |
760 |
if ($branchitemrule->{hold_fulfillment_policy} eq 'holdgroup') { |
761 |
if ($branchitemrule->{hold_fulfillment_policy} eq 'holdgroup') { |