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

(-)a/Koha/REST/V1/Holds.pm (-6 / +12 lines)
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 {
(-)a/api/v1/swagger/paths/holds.json (-3 / +25 lines)
Lines 619-627 Link Here
619
      "x-mojo-to": "Holds#pickup_locations",
619
      "x-mojo-to": "Holds#pickup_locations",
620
      "operationId": "getHoldPickupLocations",
620
      "operationId": "getHoldPickupLocations",
621
      "tags": ["holds"],
621
      "tags": ["holds"],
622
      "parameters": [{
622
      "parameters": [
623
        {
623
          "$ref": "../parameters.json#/hold_id_pp"
624
          "$ref": "../parameters.json#/hold_id_pp"
624
        }],
625
        },
626
        {
627
          "$ref": "../parameters.json#/match"
628
        },
629
        {
630
          "$ref": "../parameters.json#/order_by"
631
        },
632
        {
633
          "$ref": "../parameters.json#/page"
634
        },
635
        {
636
          "$ref": "../parameters.json#/per_page"
637
        },
638
        {
639
          "$ref": "../parameters.json#/q_param"
640
        },
641
        {
642
          "$ref": "../parameters.json#/q_body"
643
        },
644
        {
645
          "$ref": "../parameters.json#/q_header"
646
        }
647
      ],
625
      "produces": ["application/json"],
648
      "produces": ["application/json"],
626
      "responses": {
649
      "responses": {
627
        "200": {
650
        "200": {
628
- 

Return to bug 27015