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

(-)a/Koha/REST/V1/Acquisitions/Orders.pm (-1 / +1 lines)
Lines 202-208 sub delete { Link Here
202
    } elsif ( ( $order->orderstatus && $order->orderstatus ne 'cancelled' ) || !$order->datecancellationprinted ) {
202
    } elsif ( ( $order->orderstatus && $order->orderstatus ne 'cancelled' ) || !$order->datecancellationprinted ) {
203
        # Koha may (historically) have inconsistent order data here (e.g. cancelled without date)
203
        # Koha may (historically) have inconsistent order data here (e.g. cancelled without date)
204
        return $c->render(
204
        return $c->render(
205
            status  => 403,
205
            status  => 409,
206
            openapi => { error => 'Order status must be cancelled' }
206
            openapi => { error => 'Order status must be cancelled' }
207
        );
207
        );
208
    }
208
    }
(-)a/api/v1/swagger/paths/acquisitions_orders.yaml (+4 lines)
Lines 289-294 Link Here
289
        description: Order not found
289
        description: Order not found
290
        schema:
290
        schema:
291
          $ref: "../swagger.yaml#/definitions/error"
291
          $ref: "../swagger.yaml#/definitions/error"
292
      "409":
293
        description: Conflict
294
        schema:
295
          $ref: "../swagger.yaml#/definitions/error"
292
      "500":
296
      "500":
293
        description: |
297
        description: |
294
          Internal server error. Possible `error_code` attribute values:
298
          Internal server error. Possible `error_code` attribute values:
(-)a/t/db_dependent/api/v1/acquisitions_orders.t (-2 / +1 lines)
Lines 476-482 subtest 'delete() tests' => sub { Link Here
476
476
477
    # Check if status is cancelled?
477
    # Check if status is cancelled?
478
    $order->orderstatus('new')->store;
478
    $order->orderstatus('new')->store;
479
    $t->delete_ok( "//$auth_userid:$password@/api/v1/acquisitions/orders/" . $order->ordernumber )->status_is(403);
479
    $t->delete_ok( "//$auth_userid:$password@/api/v1/acquisitions/orders/" . $order->ordernumber )->status_is(409);
480
    $order->orderstatus('cancelled')->store;
480
    $order->orderstatus('cancelled')->store;
481
    $t->delete_ok( "//$auth_userid:$password@/api/v1/acquisitions/orders/" . $order->ordernumber )
481
    $t->delete_ok( "//$auth_userid:$password@/api/v1/acquisitions/orders/" . $order->ordernumber )
482
      ->status_is(204, 'SWAGGER3.2.4')
482
      ->status_is(204, 'SWAGGER3.2.4')
483
- 

Return to bug 36066