Bug 36066: (follow-up) Move 403 to 409 when status ne cancelled

Test plan:
Run t/db_dependent/api/v1/acquisitions_orders.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
Marcel de Rooy 2024-03-05 14:54:02 +00:00 committed by Katrin Fischer
parent dcbda39c0a
commit 4032da3f96
Signed by: kfischer
GPG key ID: 0EF6E2C03357A834
3 changed files with 6 additions and 2 deletions

View file

@ -202,7 +202,7 @@ sub delete {
} elsif ( ( $order->orderstatus && $order->orderstatus ne 'cancelled' ) || !$order->datecancellationprinted ) {
# Koha may (historically) have inconsistent order data here (e.g. cancelled without date)
return $c->render(
status => 403,
status => 409,
openapi => { error => 'Order status must be cancelled' }
);
}

View file

@ -289,6 +289,10 @@
description: Order not found
schema:
$ref: "../swagger.yaml#/definitions/error"
"409":
description: Conflict
schema:
$ref: "../swagger.yaml#/definitions/error"
"500":
description: |
Internal server error. Possible `error_code` attribute values:

View file

@ -476,7 +476,7 @@ subtest 'delete() tests' => sub {
# Check if status is cancelled?
$order->orderstatus('new')->store;
$t->delete_ok( "//$auth_userid:$password@/api/v1/acquisitions/orders/" . $order->ordernumber )->status_is(403);
$t->delete_ok( "//$auth_userid:$password@/api/v1/acquisitions/orders/" . $order->ordernumber )->status_is(409);
$order->orderstatus('cancelled')->store;
$t->delete_ok( "//$auth_userid:$password@/api/v1/acquisitions/orders/" . $order->ordernumber )
->status_is(204, 'SWAGGER3.2.4')