Bugzilla – Attachment 162754 Details for
Bug 36066
REST API: We should only allow deleting cancelled order lines
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 36066: (follow-up) Move 403 to 409 when status ne cancelled
Bug-36066-follow-up-Move-403-to-409-when-status-ne.patch (text/plain), 2.59 KB, created by
Marcel de Rooy
on 2024-03-05 14:56:11 UTC
(
hide
)
Description:
Bug 36066: (follow-up) Move 403 to 409 when status ne cancelled
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2024-03-05 14:56:11 UTC
Size:
2.59 KB
patch
obsolete
>From a71c988d4c861e9687aa42d248bcf0286ebd9806 Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Tue, 5 Mar 2024 14:54:02 +0000 >Subject: [PATCH] Bug 36066: (follow-up) Move 403 to 409 when status ne > cancelled >Content-Type: text/plain; charset=utf-8 > >Test plan: >Run t/db_dependent/api/v1/acquisitions_orders.t > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >--- > Koha/REST/V1/Acquisitions/Orders.pm | 2 +- > api/v1/swagger/paths/acquisitions_orders.yaml | 4 ++++ > t/db_dependent/api/v1/acquisitions_orders.t | 2 +- > 3 files changed, 6 insertions(+), 2 deletions(-) > >diff --git a/Koha/REST/V1/Acquisitions/Orders.pm b/Koha/REST/V1/Acquisitions/Orders.pm >index 371132acca..b254e4da7e 100644 >--- a/Koha/REST/V1/Acquisitions/Orders.pm >+++ b/Koha/REST/V1/Acquisitions/Orders.pm >@@ -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' } > ); > } >diff --git a/api/v1/swagger/paths/acquisitions_orders.yaml b/api/v1/swagger/paths/acquisitions_orders.yaml >index 260597281d..1cd70a4d2c 100644 >--- a/api/v1/swagger/paths/acquisitions_orders.yaml >+++ b/api/v1/swagger/paths/acquisitions_orders.yaml >@@ -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: >diff --git a/t/db_dependent/api/v1/acquisitions_orders.t b/t/db_dependent/api/v1/acquisitions_orders.t >index 39782efc17..be4867221d 100755 >--- a/t/db_dependent/api/v1/acquisitions_orders.t >+++ b/t/db_dependent/api/v1/acquisitions_orders.t >@@ -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') >-- >2.30.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 36066
:
162017
|
162276
|
162735
|
162736
|
162738
|
162739
|
162754
|
162790
|
162791
|
162792