Lines 406-411
sub pickup_locations {
Link Here
|
406 |
my $c = shift->openapi->valid_input or return; |
406 |
my $c = shift->openapi->valid_input or return; |
407 |
|
407 |
|
408 |
my $hold_id = $c->validation->param('hold_id'); |
408 |
my $hold_id = $c->validation->param('hold_id'); |
|
|
409 |
# FIXME: We should really skip the path params in $c->objects->search |
410 |
delete $c->validation->output->{hold_id}; |
409 |
my $hold = Koha::Holds->find( $hold_id, { prefetch => [ 'patron' ] } ); |
411 |
my $hold = Koha::Holds->find( $hold_id, { prefetch => [ 'patron' ] } ); |
410 |
|
412 |
|
411 |
unless ($hold) { |
413 |
unless ($hold) { |
Lines 416-431
sub pickup_locations {
Link Here
|
416 |
} |
418 |
} |
417 |
|
419 |
|
418 |
return try { |
420 |
return try { |
419 |
my @pickup_locations = |
421 |
my $ps_set; |
420 |
$hold->itemnumber |
|
|
421 |
? @{ $hold->item->pickup_locations( { patron => $hold->patron } )->as_list() } |
422 |
: @{ $hold->biblio->pickup_locations( { patron => $hold->patron } )->as_list() }; |
423 |
|
422 |
|
424 |
@pickup_locations = map { $_->to_api } @pickup_locations; |
423 |
if ( $hold->itemnumber ) { |
|
|
424 |
$ps_set = $hold->item->pickup_locations( { patron => $hold->patron } ); |
425 |
} |
426 |
else { |
427 |
$ps_set = $hold->biblio->pickup_locations( { patron => $hold->patron } ); |
428 |
} |
429 |
|
430 |
my $pickup_locations = $c->objects->search( $ps_set ); |
425 |
|
431 |
|
426 |
return $c->render( |
432 |
return $c->render( |
427 |
status => 200, |
433 |
status => 200, |
428 |
openapi => \@pickup_locations |
434 |
openapi => $pickup_locations |
429 |
); |
435 |
); |
430 |
} |
436 |
} |
431 |
catch { |
437 |
catch { |