View | Details | Raw Unified | Return to bug 26988
Collapse All | Expand All

(-)a/Koha/REST/V1/Holds.pm (-5 / +11 lines)
Lines 406-412 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
    my $hold = Koha::Holds->find($hold_id);
409
    my $hold = Koha::Holds->find( $hold_id, { prefetch => [ 'patron' ] } );
410
410
411
    unless ($hold) {
411
    unless ($hold) {
412
        return $c->render(
412
        return $c->render(
Lines 416-426 sub pickup_locations { Link Here
416
    }
416
    }
417
417
418
    return try {
418
    return try {
419
        my $pickup_locations = $hold->itemnumber ?
419
        my @pickup_locations =
420
        $hold->item->pickup_locations({ patron => $hold->patron }) : $hold->biblio->pickup_locations({ patron => $hold->patron });
420
            $hold->itemnumber
421
        warn Data::Dumper::Dumper( $pickup_locations );
421
          ? @{ $hold->item->pickup_locations( { patron => $hold->patron } ) }
422
          : @{ $hold->biblio->pickup_locations( { patron => $hold->patron } ) };
423
424
        @pickup_locations = map { $_->to_api } @pickup_locations;
422
425
423
        return $c->render( status => 200, openapi => $pickup_locations );
426
        return $c->render(
427
            status  => 200,
428
            openapi => \@pickup_locations
429
        );
424
    }
430
    }
425
    catch {
431
    catch {
426
        $c->unhandled_exception($_);
432
        $c->unhandled_exception($_);
(-)a/api/v1/swagger/paths/holds.json (-2 / +7 lines)
Lines 625-631 Link Here
625
      "produces": ["application/json"],
625
      "produces": ["application/json"],
626
      "responses": {
626
      "responses": {
627
        "200": {
627
        "200": {
628
          "description": "Hold pickup location"
628
          "description": "Hold pickup location",
629
          "schema": {
630
            "type": "array",
631
            "items": {
632
              "$ref": "../definitions.json#/library"
633
            }
634
          }
629
        },
635
        },
630
        "400": {
636
        "400": {
631
          "description": "Missing or wrong parameters",
637
          "description": "Missing or wrong parameters",
632
- 

Return to bug 26988