Bugzilla – Attachment 162791 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: Only allow cancelled order deletion in API
Bug-36066-Only-allow-cancelled-order-deletion-in-A.patch (text/plain), 1.63 KB, created by
Victor Grousset/tuxayo
on 2024-03-05 21:40:26 UTC
(
hide
)
Description:
Bug 36066: Only allow cancelled order deletion in API
Filename:
MIME Type:
Creator:
Victor Grousset/tuxayo
Created:
2024-03-05 21:40:26 UTC
Size:
1.63 KB
patch
obsolete
>From 6d9ebe5f67c452485d3ead60d83ce94d040e211e Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Mon, 12 Feb 2024 09:54:04 +0000 >Subject: [PATCH] Bug 36066: Only allow cancelled order deletion in API > >Note: I had trouble with listing orders in API without >status, although formally not required according specs. > >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: David Nind <david@davidnind.com> >Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net> >--- > Koha/REST/V1/Acquisitions/Orders.pm | 10 +++++++++- > 1 file changed, 9 insertions(+), 1 deletion(-) > >diff --git a/Koha/REST/V1/Acquisitions/Orders.pm b/Koha/REST/V1/Acquisitions/Orders.pm >index 0155a38922..371132acca 100644 >--- a/Koha/REST/V1/Acquisitions/Orders.pm >+++ b/Koha/REST/V1/Acquisitions/Orders.pm >@@ -183,7 +183,9 @@ sub update { > > =head3 delete > >-Controller function that handles deleting a Koha::Patron object >+Controller function that handles deleting a Koha::Acquisition::Order object >+ >+Note that we only allow deletion when the status is cancelled. > > =cut > >@@ -197,6 +199,12 @@ sub delete { > status => 404, > openapi => { error => 'Order not found' } > ); >+ } 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, >+ openapi => { error => 'Order status must be cancelled' } >+ ); > } > > return try { >-- >2.44.0
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