Lines 99-110
sub InIndependentBranchesMode {
Link Here
|
99 |
return ( not C4::Context->preference("IndependentBranches") or C4::Context::IsSuperLibrarian ); |
99 |
return ( not C4::Context->preference("IndependentBranches") or C4::Context::IsSuperLibrarian ); |
100 |
} |
100 |
} |
101 |
|
101 |
|
|
|
102 |
our $cached_pickup_locations = {}; |
102 |
sub pickup_locations { |
103 |
sub pickup_locations { |
103 |
my ( $self, $params ) = @_; |
104 |
my ( $self, $params ) = @_; |
104 |
my $search_params = $params->{search_params} || {}; |
105 |
my $search_params = $params->{search_params} || {}; |
105 |
my $selected = $params->{selected}; |
106 |
my $selected = $params->{selected}; |
106 |
my @libraries; |
107 |
my @libraries; |
107 |
|
108 |
|
|
|
109 |
my $cache_key; |
110 |
|
108 |
if(defined $search_params->{item} || defined $search_params->{biblio}) { |
111 |
if(defined $search_params->{item} || defined $search_params->{biblio}) { |
109 |
my $item = $search_params->{'item'}; |
112 |
my $item = $search_params->{'item'}; |
110 |
my $biblio = $search_params->{'biblio'}; |
113 |
my $biblio = $search_params->{'biblio'}; |
Lines 117-128
sub pickup_locations {
Link Here
|
117 |
if ($item) { |
120 |
if ($item) { |
118 |
$item = Koha::Items->find($item) |
121 |
$item = Koha::Items->find($item) |
119 |
unless ref($item) eq 'Koha::Item'; |
122 |
unless ref($item) eq 'Koha::Item'; |
|
|
123 |
|
124 |
$cache_key = "I" . $item->homebranch . "-" . $patron->branchcode; |
125 |
return $cached_pickup_locations->{$cache_key} if defined $cached_pickup_locations->{$cache_key}; |
126 |
|
120 |
@libraries = @{ $item->pickup_locations( { patron => $patron } ) } |
127 |
@libraries = @{ $item->pickup_locations( { patron => $patron } ) } |
121 |
if defined $item; |
128 |
if defined $item; |
122 |
} |
129 |
} |
123 |
elsif ($biblio) { |
130 |
elsif ($biblio) { |
124 |
$biblio = Koha::Biblios->find($biblio) |
131 |
$biblio = Koha::Biblios->find($biblio) |
125 |
unless ref($biblio) eq 'Koha::Biblio'; |
132 |
unless ref($biblio) eq 'Koha::Biblio'; |
|
|
133 |
|
134 |
$cache_key = "B" . $biblio->id . "-" . $patron->branchcode; |
135 |
return $cached_pickup_locations->{$cache_key} if defined $cached_pickup_locations->{$cache_key}; |
136 |
|
126 |
@libraries = @{ $biblio->pickup_locations( { patron => $patron } ) } |
137 |
@libraries = @{ $biblio->pickup_locations( { patron => $patron } ) } |
127 |
if defined $biblio; |
138 |
if defined $biblio; |
128 |
} |
139 |
} |
Lines 144-149
sub pickup_locations {
Link Here
|
144 |
} |
155 |
} |
145 |
} |
156 |
} |
146 |
|
157 |
|
|
|
158 |
$cached_pickup_locations->{$cache_key} = \@libraries; |
147 |
return \@libraries; |
159 |
return \@libraries; |
148 |
} |
160 |
} |
149 |
|
161 |
|
150 |
- |
|
|