Lines 113-119
sub pickup_locations {
Link Here
|
113 |
|
113 |
|
114 |
return try { |
114 |
return try { |
115 |
|
115 |
|
116 |
my $ps_set = $item->pickup_locations( { patron => $patron } ); |
116 |
my $pl_set = $item->pickup_locations( { patron => $patron } ); |
117 |
|
117 |
|
118 |
my @response = (); |
118 |
my @response = (); |
119 |
if ( C4::Context->preference('AllowHoldPolicyOverride') ) { |
119 |
if ( C4::Context->preference('AllowHoldPolicyOverride') ) { |
Lines 124-147
sub pickup_locations {
Link Here
|
124 |
@response = map { |
124 |
@response = map { |
125 |
my $library = $_; |
125 |
my $library = $_; |
126 |
$library->{needs_override} = ( |
126 |
$library->{needs_override} = ( |
127 |
any { $_->{library_id} eq $library->{library_id} } |
127 |
any { $_->branchcode eq $library->{library_id} } |
128 |
@{$ps_set->as_list} |
128 |
@{ $pl_set->as_list } |
129 |
) |
129 |
) |
130 |
? Mojo::JSON->false |
130 |
? Mojo::JSON->false |
131 |
: Mojo::JSON->true; |
131 |
: Mojo::JSON->true; |
132 |
$library; |
132 |
$library; |
133 |
} @{$libraries}; |
133 |
} @{$libraries}; |
|
|
134 |
} else { |
134 |
|
135 |
|
135 |
return $c->render( |
136 |
my $pickup_locations = $c->objects->search($pl_set); |
136 |
status => 200, |
137 |
@response = map { $_->{needs_override} = Mojo::JSON->false; $_; } @{$pickup_locations}; |
137 |
openapi => \@response |
|
|
138 |
); |
139 |
} |
138 |
} |
140 |
|
139 |
|
141 |
my $pickup_locations = $c->objects->search( $ps_set ); |
|
|
142 |
|
143 |
@response = map { $_->{needs_override} = Mojo::JSON->false; $_; } @{$pickup_locations}; |
144 |
|
145 |
return $c->render( |
140 |
return $c->render( |
146 |
status => 200, |
141 |
status => 200, |
147 |
openapi => \@response |
142 |
openapi => \@response |
148 |
- |
|
|