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

(-)a/Koha/REST/V1/Holds.pm (-7 / +3 lines)
Lines 171-184 sub add { Link Here
171
            $can_place_hold->{status} = 'tooManyReserves';
171
            $can_place_hold->{status} = 'tooManyReserves';
172
        }
172
        }
173
173
174
        my $override_header = $c->req->headers->header('x-koha-override');
174
        my $overrides = $c->stash('koha.overrides');
175
        $override_header = decode_json($override_header)
175
        my $can_override = $overrides->{any} and C4::Context->preference('AllowHoldPolicyOverride');
176
          if $override_header;
177
176
178
        my $can_override = $override_header->{AllowHoldPolicyOverride}
177
        unless ( $can_override || $can_place_hold->{status} eq 'OK' ) {
179
          and C4::Context->preference('AllowHoldPolicyOverride');
180
181
        unless ($can_override || $can_place_hold->{status} eq 'OK' ) {
182
            return $c->render(
178
            return $c->render(
183
                status => 403,
179
                status => 403,
184
                openapi =>
180
                openapi =>
(-)a/api/v1/swagger/paths/holds.json (-2 / +9 lines)
Lines 171-177 Link Here
171
      "x-mojo-to": "Holds#add",
171
      "x-mojo-to": "Holds#add",
172
      "operationId": "addHold",
172
      "operationId": "addHold",
173
      "tags": ["patrons", "holds"],
173
      "tags": ["patrons", "holds"],
174
      "parameters": [{
174
      "parameters": [
175
        {
175
          "name": "body",
176
          "name": "body",
176
          "in": "body",
177
          "in": "body",
177
          "description": "A JSON object containing informations about the new hold",
178
          "description": "A JSON object containing informations about the new hold",
Lines 215-220 Link Here
215
            },
216
            },
216
            "required": [ "patron_id", "pickup_library_id" ]
217
            "required": [ "patron_id", "pickup_library_id" ]
217
          }
218
          }
219
        },
220
        {
221
          "name": "x-koha-override",
222
          "description": "Comma-separated list of overrides (valid values: any)",
223
          "in": "header",
224
          "type": "string",
225
          "required": false
218
        }
226
        }
219
      ],
227
      ],
220
      "consumes": ["application/json"],
228
      "consumes": ["application/json"],
221
- 

Return to bug 27797