Lines 252-268
sub edit {
Link Here
|
252 |
my $hold = Koha::Holds->find( $hold_id ); |
252 |
my $hold = Koha::Holds->find( $hold_id ); |
253 |
|
253 |
|
254 |
unless ($hold) { |
254 |
unless ($hold) { |
255 |
return $c->render( status => 404, |
255 |
return $c->render( |
256 |
openapi => {error => "Hold not found"} ); |
256 |
status => 404, |
|
|
257 |
openapi => { error => "Hold not found" } |
258 |
); |
257 |
} |
259 |
} |
258 |
|
260 |
|
259 |
my $body = $c->req->json; |
261 |
my $overrides = $c->stash('koha.overrides'); |
|
|
262 |
my $can_override = $overrides->{any} && C4::Context->preference('AllowHoldPolicyOverride'); |
263 |
|
264 |
my $body = $c->validation->output->{body}; |
260 |
|
265 |
|
261 |
my $pickup_library_id = $body->{pickup_library_id}; |
266 |
my $pickup_library_id = $body->{pickup_library_id}; |
262 |
|
267 |
|
263 |
if ( |
268 |
if ( |
264 |
defined $pickup_library_id |
269 |
defined $pickup_library_id |
265 |
and not $hold->is_pickup_location_valid({ library_id => $pickup_library_id }) |
270 |
&& ( !$hold->is_pickup_location_valid({ library_id => $pickup_library_id }) && !$can_override ) |
266 |
) |
271 |
) |
267 |
{ |
272 |
{ |
268 |
return $c->render( |
273 |
return $c->render( |
269 |
- |
|
|