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

(-)a/Koha/REST/V1/Hold.pm (-7 / +7 lines)
Lines 1-4 Link Here
1
package Koha::REST::V1::Hold;
1
package Koha::REST::V1::Holds;
2
2
3
# This file is part of Koha.
3
# This file is part of Koha.
4
#
4
#
Lines 181-190 sub add { Link Here
181
            if ( $_->isa('Koha::Exceptions::Object::FKConstraint') ) {
181
            if ( $_->isa('Koha::Exceptions::Object::FKConstraint') ) {
182
                my $broken_fk = $_->broken_fk;
182
                my $broken_fk = $_->broken_fk;
183
183
184
                if ( grep { $_ eq $broken_fk } keys %{$Koha::REST::V1::Hold::to_api_mapping} ) {
184
                if ( grep { $_ eq $broken_fk } keys %{$Koha::REST::V1::Holds::to_api_mapping} ) {
185
                    $c->render(
185
                    $c->render(
186
                        status  => 404,
186
                        status  => 404,
187
                        openapi => $Koha::REST::V1::Hold::to_api_mapping->{$broken_fk} . ' not found.'
187
                        openapi => $Koha::REST::V1::Holds::to_api_mapping->{$broken_fk} . ' not found.'
188
                    );
188
                    );
189
                }
189
                }
190
                else {
190
                else {
Lines 284-291 sub _to_api { Link Here
284
    my $hold = shift;
284
    my $hold = shift;
285
285
286
    # Rename attributes
286
    # Rename attributes
287
    foreach my $column ( keys %{ $Koha::REST::V1::Hold::to_api_mapping } ) {
287
    foreach my $column ( keys %{ $Koha::REST::V1::Holds::to_api_mapping } ) {
288
        my $mapped_column = $Koha::REST::V1::Hold::to_api_mapping->{$column};
288
        my $mapped_column = $Koha::REST::V1::Holds::to_api_mapping->{$column};
289
        if (    exists $hold->{ $column }
289
        if (    exists $hold->{ $column }
290
             && defined $mapped_column )
290
             && defined $mapped_column )
291
        {
291
        {
Lines 313-320 attribute names. Link Here
313
sub _to_model {
313
sub _to_model {
314
    my $hold = shift;
314
    my $hold = shift;
315
315
316
    foreach my $attribute ( keys %{ $Koha::REST::V1::Hold::to_model_mapping } ) {
316
    foreach my $attribute ( keys %{ $Koha::REST::V1::Holds::to_model_mapping } ) {
317
        my $mapped_attribute = $Koha::REST::V1::Hold::to_model_mapping->{$attribute};
317
        my $mapped_attribute = $Koha::REST::V1::Holds::to_model_mapping->{$attribute};
318
        if (    exists $hold->{ $attribute }
318
        if (    exists $hold->{ $attribute }
319
             && defined $mapped_attribute )
319
             && defined $mapped_attribute )
320
        {
320
        {
(-)a/api/v1/swagger/paths/holds.json (-5 / +4 lines)
Lines 1-7 Link Here
1
{
1
{
2
  "/holds": {
2
  "/holds": {
3
    "get": {
3
    "get": {
4
      "x-mojo-to": "Hold#list",
4
      "x-mojo-to": "Holds#list",
5
      "operationId": "listHolds",
5
      "operationId": "listHolds",
6
      "tags": ["patrons", "holds"],
6
      "tags": ["patrons", "holds"],
7
      "parameters": [
7
      "parameters": [
Lines 150-156 Link Here
150
      }
150
      }
151
    },
151
    },
152
    "post": {
152
    "post": {
153
      "x-mojo-to": "Hold#add",
153
      "x-mojo-to": "Holds#add",
154
      "operationId": "addHold",
154
      "operationId": "addHold",
155
      "tags": ["patrons", "holds"],
155
      "tags": ["patrons", "holds"],
156
      "parameters": [{
156
      "parameters": [{
Lines 250-256 Link Here
250
  },
250
  },
251
  "/holds/{hold_id}": {
251
  "/holds/{hold_id}": {
252
    "put": {
252
    "put": {
253
      "x-mojo-to": "Hold#edit",
253
      "x-mojo-to": "Holds#edit",
254
      "operationId": "editHold",
254
      "operationId": "editHold",
255
      "tags": ["holds"],
255
      "tags": ["holds"],
256
      "parameters": [{
256
      "parameters": [{
Lines 334-340 Link Here
334
      }
334
      }
335
    },
335
    },
336
    "delete": {
336
    "delete": {
337
      "x-mojo-to": "Hold#delete",
337
      "x-mojo-to": "Holds#delete",
338
      "operationId": "deleteHold",
338
      "operationId": "deleteHold",
339
      "tags": ["holds"],
339
      "tags": ["holds"],
340
      "parameters": [{
340
      "parameters": [{
341
- 

Return to bug 20006