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>
(cherry picked from commit 4032da3f96
)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
This commit is contained in:
parent
1c556d6ed1
commit
e0f35d65e2
3 changed files with 6 additions and 2 deletions
|
@ -202,7 +202,7 @@ sub delete {
|
||||||
} elsif ( ( $order->orderstatus && $order->orderstatus ne 'cancelled' ) || !$order->datecancellationprinted ) {
|
} elsif ( ( $order->orderstatus && $order->orderstatus ne 'cancelled' ) || !$order->datecancellationprinted ) {
|
||||||
# Koha may (historically) have inconsistent order data here (e.g. cancelled without date)
|
# Koha may (historically) have inconsistent order data here (e.g. cancelled without date)
|
||||||
return $c->render(
|
return $c->render(
|
||||||
status => 403,
|
status => 409,
|
||||||
openapi => { error => 'Order status must be cancelled' }
|
openapi => { error => 'Order status must be cancelled' }
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -289,6 +289,10 @@
|
||||||
description: Order not found
|
description: Order not found
|
||||||
schema:
|
schema:
|
||||||
$ref: "../swagger.yaml#/definitions/error"
|
$ref: "../swagger.yaml#/definitions/error"
|
||||||
|
"409":
|
||||||
|
description: Conflict
|
||||||
|
schema:
|
||||||
|
$ref: "../swagger.yaml#/definitions/error"
|
||||||
"500":
|
"500":
|
||||||
description: |
|
description: |
|
||||||
Internal server error. Possible `error_code` attribute values:
|
Internal server error. Possible `error_code` attribute values:
|
||||||
|
|
|
@ -476,7 +476,7 @@ subtest 'delete() tests' => sub {
|
||||||
|
|
||||||
# Check if status is cancelled?
|
# Check if status is cancelled?
|
||||||
$order->orderstatus('new')->store;
|
$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;
|
$order->orderstatus('cancelled')->store;
|
||||||
$t->delete_ok( "//$auth_userid:$password@/api/v1/acquisitions/orders/" . $order->ordernumber )
|
$t->delete_ok( "//$auth_userid:$password@/api/v1/acquisitions/orders/" . $order->ordernumber )
|
||||||
->status_is(204, 'SWAGGER3.2.4')
|
->status_is(204, 'SWAGGER3.2.4')
|
||||||
|
|
Loading…
Reference in a new issue