Lines 65-84
If no parameters are given, all libraries with pickup_location => 1 are returned
Link Here
|
65 |
sub pickup_locations { |
65 |
sub pickup_locations { |
66 |
my ($self, $params) = @_; |
66 |
my ($self, $params) = @_; |
67 |
|
67 |
|
68 |
my $item = $params->{'item'}; |
|
|
69 |
my $biblio = $params->{'biblio'}; |
70 |
my $patron = $params->{'patron'}; |
71 |
|
72 |
if ($biblio && $item) { |
73 |
Koha::Exceptions::BadParameter->throw( |
74 |
error => "Koha::Libraries->pickup_locations takes either 'biblio' or " |
75 |
." 'item' as parameter, but not both." |
76 |
); |
77 |
} |
78 |
unless (! defined $patron || ref($patron) eq 'Koha::Patron') { |
79 |
$patron = Koha::Patrons->find($patron); |
80 |
} |
81 |
|
82 |
# Select libraries that are configured as pickup locations |
68 |
# Select libraries that are configured as pickup locations |
83 |
my $libraries = $self->search({ |
69 |
my $libraries = $self->search({ |
84 |
pickup_location => 1 |
70 |
pickup_location => 1 |
Lines 86-105
sub pickup_locations {
Link Here
|
86 |
order_by => ['branchname'] |
72 |
order_by => ['branchname'] |
87 |
}); |
73 |
}); |
88 |
|
74 |
|
89 |
return $libraries unless $item or $biblio; |
75 |
return $libraries; |
90 |
if($item) { |
|
|
91 |
unless (ref($item) eq 'Koha::Item') { |
92 |
$item = Koha::Items->find($item); |
93 |
return $libraries unless $item; |
94 |
} |
95 |
return $item->pickup_locations( {patron => $patron} ); |
96 |
} else { |
97 |
unless (ref($biblio) eq 'Koha::Biblio') { |
98 |
$biblio = Koha::Biblios->find($biblio); |
99 |
return $libraries unless $biblio; |
100 |
} |
101 |
return $biblio->pickup_locations( {patron => $patron} ); |
102 |
} |
103 |
} |
76 |
} |
104 |
|
77 |
|
105 |
=head3 search_filtered |
78 |
=head3 search_filtered |