Bugzilla – Attachment 154513 Details for
Bug 34024
REST API should not allow changing the pickup location on found holds
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 34024: Block changing pickup location for found holds
Bug-34024-Block-changing-pickup-location-for-found.patch (text/plain), 2.22 KB, created by
Martin Renvoize (ashimema)
on 2023-08-17 10:21:09 UTC
(
hide
)
Description:
Bug 34024: Block changing pickup location for found holds
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2023-08-17 10:21:09 UTC
Size:
2.22 KB
patch
obsolete
>From 60ef85eb9d93af2415d63436ec92e821ebd54121 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Mon, 31 Jul 2023 14:26:01 -0300 >Subject: [PATCH] Bug 34024: Block changing pickup location for found holds > >This patch adds a check on holds for 'found' statuses. Holds with the >following statuses have special workflows in Koha, and overwritting >their pickup locations yields uncertain scenarios: > >* Waiting: the item has probably been put on a special shelve >* In transit: the item is travelling to a new destination, and changing > the pickup location should include some validations, and probably > generate some notifications. At least. >* In processing: the item has already been taken out of the shelve for > some internal processing. Changing the pickup location could interfere > with this workflow. Overriding this limitation could be introduced > with care on a separate report. > >To test: >1. Apply the unit tests patch >2. Run: > $ ktd --shell > k$ prove t/db_dependent/api/v1/holds.t >=> FAIL: Tests don't pass. Holds go through (200) instead of being >rejected (409). >3. Apply this patch >4. Repeat 2 >=> SUCCESS: Tests pass! >5. Sign off :-D > >Signed-off-by: Sam Lau <samalau@gmail.com> >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > Koha/REST/V1/Holds.pm | 11 +++++++++++ > 1 file changed, 11 insertions(+) > >diff --git a/Koha/REST/V1/Holds.pm b/Koha/REST/V1/Holds.pm >index 79deaaac25..97a4cbd1b4 100644 >--- a/Koha/REST/V1/Holds.pm >+++ b/Koha/REST/V1/Holds.pm >@@ -535,6 +535,17 @@ sub update_pickup_location { > my $overrides = $c->stash('koha.overrides'); > my $can_override = $overrides->{any} && C4::Context->preference('AllowHoldPolicyOverride'); > >+ my $error_code = >+ $hold->is_waiting ? 'hold_waiting' >+ : $hold->is_in_transit ? 'hold_in_transit' >+ : $hold->is_in_processing ? 'hold_in_processing' >+ : undef; >+ >+ return $c->render( >+ status => 409, >+ openapi => { error => 'Cannot change pickup location', error_code => $error_code } >+ ) if $error_code; >+ > $hold->set_pickup_location( > { > library_id => $pickup_library_id, >-- >2.41.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 34024
:
154105
|
154106
|
154126
|
154127
|
154132
| 154513 |
154514
|
154515