Bug 30869 - Stock rotation rotas cannot be deleted
Summary: Stock rotation rotas cannot be deleted
Status: RESOLVED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Tools (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal
Assignee: Pedro Amorim
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-05-31 00:13 UTC by David Roberts
Modified: 2024-05-14 15:16 UTC (History)
7 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Small patch
Documentation contact: Aude Charillon
Documentation submission: https://gitlab.com/koha-community/koha-manual/-/merge_requests/871
Text to go in the release notes:
Version(s) released in:
23.05.00,22.11.04
Circulation function:


Attachments
Add delete action to stock rotation rotas (5.08 KB, patch)
2022-11-03 17:31 UTC, Pedro Amorim
Details | Diff | Splinter Review
Add delete action to stock rotation rotas (5.09 KB, patch)
2022-11-03 18:04 UTC, Pedro Amorim
Details | Diff | Splinter Review
Bug 30869: Stock rotation rotas cannot be deleted (5.31 KB, patch)
2023-01-13 13:26 UTC, Pedro Amorim
Details | Diff | Splinter Review
Bug 30869: Stock rotation rotas cannot be deleted (5.36 KB, patch)
2023-01-13 20:40 UTC, David Nind
Details | Diff | Splinter Review
Bug 30869: Stock rotation rotas cannot be deleted (5.38 KB, patch)
2023-01-17 10:28 UTC, Pedro Amorim
Details | Diff | Splinter Review
Bug 30869: Add the ability to delete stock rotation rotas (5.69 KB, patch)
2023-02-23 15:03 UTC, Jonathan Druart
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description David Roberts 2022-05-31 00:13:39 UTC
At the moment, it isn't possible to delete any rotas that have 0 items linked to it. The only way to do it is in MySQL - it would be good if this was possible from the staff client.
Comment 1 Martin Renvoize (ashimema) 2022-10-05 15:00:19 UTC
In it's most basic form, this should just be exposed as a delete button for any rota's that have no items attached.

Thinking more widely, it would be nice to allow deletion regardless and give options to disassociate items from the rota at deletion time including setting where those items should end up.

From memory, non-cyclical rota's don't clean up after themselves either.. it might be nice to have the option to remove the item to rota link once at item hits it's final destination.
Comment 2 Katrin Fischer 2022-10-16 12:36:12 UTC
Confirmed on master with my superlibrarian user:

* Enable StockRotation system preference
* Tools > Stock rotation > New rota
* Enter Name, save.
* There is no delete button visible.
Comment 3 Pedro Amorim 2022-11-03 17:31:27 UTC Comment hidden (obsolete)
Comment 4 Pedro Amorim 2022-11-03 18:04:37 UTC
Created attachment 143148 [details] [review]
Add delete action to stock rotation rotas

To test:
1) Enable StockRotation system preference
2) Tools > Stock rotation > New rota
3) Enter Name, save
4) Verify "Delete" button shows on the right
5) Click "Delete" -> Confirm "Yes"
6) Repeat steps 1-3 and click "Manage"->"Stages"
7) Add a new stage, enter Library and Duration, click "Save"
8) Return to rotas, click "Manage"->"Items"
9) Add item, enter barcode, click "Save" (optional: add more than 1 item)
10) Click "return to rotas" and press "Delete"
11) Verify the warning now shows, because items are attached, with the attached items count
12) Click "Delete" -> Deletion is successful
Comment 5 David Nind 2023-01-11 00:12:15 UTC
The patch no longer applies 8-(..

root@kohadevbox:koha(bz30869)$ git bz apply 30869

Bug 30869 - Stock rotation rotas cannot be deleted

143148 - Add delete action to stock rotation rotas

Apply? [(y)es, (n)o, (i)nteractive] y
Applying: Bug 30869: Stock rotation rotas cannot be deleted
Using index info to reconstruct a base tree...
M       koha-tmpl/intranet-tmpl/prog/en/modules/tools/stockrotation.tt
Falling back to patching base and 3-way merge...
Auto-merging koha-tmpl/intranet-tmpl/prog/en/modules/tools/stockrotation.tt
CONFLICT (content): Merge conflict in koha-tmpl/intranet-tmpl/prog/en/modules/tools/stockrotation.tt
error: Failed to merge in the changes.
Patch failed at 0001 Bug 30869: Stock rotation rotas cannot be deleted
Comment 6 David Nind 2023-01-11 00:13:55 UTC
Also, the QA Team will require the patch to be formatted according to the guidelines at https://wiki.koha-community.org/wiki/Commit_messages
Comment 7 Pedro Amorim 2023-01-13 13:26:07 UTC
Created attachment 145275 [details] [review]
Bug 30869: Stock rotation rotas cannot be deleted

'At the moment, it isn't possible to delete any rotas that have 0 items linked to it. The only way to do it is in MySQL - it would be good if this was possible from the staff client.'
This patch implements this, and also implements the possibility of deleting a rota with items linked to it, providing a warning that the item(s) currently in rotation will remain at its/their current stage library.

Test plan:
1) Enable StockRotation system preference
2) Cataloging > Stock rotation > New rota
3) Enter Name, save
4) Verify 'Delete' button shows on the right
5) Click 'Delete' -> Confirm 'Yes'
6) Repeat steps 1-3 and click 'Manage'->'Stages'
7) Add a new stage, enter Library and Duration, click 'Save'
8) Return to rotas, click 'Manage'->'Items'
9) Add item, enter barcode, click 'Save' (optional: add more than 1 item)
10) Optional: Click 'Move to next stage' and verify that item is now in different branch
11) Click 'return to rotas' and press 'Delete'
12) Verify the warning now shows, because items are attached, with the attached items count
13) Click 'Delete' -> Deletion is successful
14) If you did step 10, verify the item is still in the branch that it was at the time the rota was deleted

Sponsored-by: PTFS-Europe
Comment 8 Pedro Amorim 2023-01-13 13:31:15 UTC
Hi David.
Can you please check now that the patch applies and/or if the test plan goes accordingly.
Thank you!
Comment 9 David Nind 2023-01-13 20:39:23 UTC
(In reply to Pedro Amorim from comment #8)
> Can you please check now that the patch applies and/or if the test plan goes
> accordingly.

Thanks Pedro!

The patch now applies, sign off shortly.

David
Comment 10 David Nind 2023-01-13 20:40:52 UTC
Created attachment 145323 [details] [review]
Bug 30869: Stock rotation rotas cannot be deleted

'At the moment, it isn't possible to delete any rotas that have 0 items linked to it. The only way to do it is in MySQL - it would be good if this was possible from the staff client.'
This patch implements this, and also implements the possibility of deleting a rota with items linked to it, providing a warning that the item(s) currently in rotation will remain at its/their current stage library.

Test plan:
1) Enable StockRotation system preference
2) Cataloging > Stock rotation > New rota
3) Enter Name, save
4) Verify 'Delete' button shows on the right
5) Click 'Delete' -> Confirm 'Yes'
6) Repeat steps 1-3 and click 'Manage'->'Stages'
7) Add a new stage, enter Library and Duration, click 'Save'
8) Return to rotas, click 'Manage'->'Items'
9) Add item, enter barcode, click 'Save' (optional: add more than 1 item)
10) Optional: Click 'Move to next stage' and verify that item is now in different branch
11) Click 'return to rotas' and press 'Delete'
12) Verify the warning now shows, because items are attached, with the attached items count
13) Click 'Delete' -> Deletion is successful
14) If you did step 10, verify the item is still in the branch that it was at the time the rota was deleted

Sponsored-by: PTFS-Europe

Signed-off-by: David Nind <david@davidnind.com>
Comment 11 Pedro Amorim 2023-01-17 10:28:29 UTC
Created attachment 145353 [details] [review]
Bug 30869: Stock rotation rotas cannot be deleted

'At the moment, it isn't possible to delete any rotas that have 0 items linked to it. The only way to do it is in MySQL - it would be good if this was possible from the staff client.'
This patch implements this, and also implements the possibility of deleting a rota with items linked to it, providing a warning that the item(s) currently in rotation will remain at its/their current stage library.

Test plan:
1) Enable StockRotation system preference
2) Cataloging > Stock rotation > New rota
3) Enter Name, save
4) Verify 'Delete' button shows on the right
5) Click 'Delete' -> Confirm 'Yes'
6) Repeat steps 1-3 and click 'Manage'->'Stages'
7) Add a new stage, enter Library and Duration, click 'Save'
8) Return to rotas, click 'Manage'->'Items'
9) Add item, enter barcode, click 'Save' (optional: add more than 1 item)
10) Optional: Click 'Move to next stage' and verify that item is now in different branch
11) Click 'return to rotas' and press 'Delete'
12) Verify the warning now shows, because items are attached, with the attached items count
13) Click 'Delete' -> Deletion is successful
14) If you did step 10, verify the item is still in the branch that it was at the time the rota was deleted

Sponsored-by: PTFS-Europe

Signed-off-by: David Nind <david@davidnind.com>
Comment 12 Pedro Amorim 2023-01-17 10:30:27 UTC
Fixed commit author, had originally been submitted as John Doe.
Comment 13 Jonathan Druart 2023-02-23 15:03:44 UTC
Created attachment 147251 [details] [review]
Bug 30869: Add the ability to delete stock rotation rotas

'At the moment, it isn't possible to delete any rotas that have 0 items linked to it. The only way to do it is in MySQL - it would be good if this was possible from the staff client.'
This patch implements this, and also implements the possibility of deleting a rota with items linked to it, providing a warning that the item(s) currently in rotation will remain at its/their current stage library.

Test plan:
1) Enable StockRotation system preference
2) Cataloging > Stock rotation > New rota
3) Enter Name, save
4) Verify 'Delete' button shows on the right
5) Click 'Delete' -> Confirm 'Yes'
6) Repeat steps 1-3 and click 'Manage'->'Stages'
7) Add a new stage, enter Library and Duration, click 'Save'
8) Return to rotas, click 'Manage'->'Items'
9) Add item, enter barcode, click 'Save' (optional: add more than 1 item)
10) Optional: Click 'Move to next stage' and verify that item is now in different branch
11) Click 'return to rotas' and press 'Delete'
12) Verify the warning now shows, because items are attached, with the attached items count
13) Click 'Delete' -> Deletion is successful
14) If you did step 10, verify the item is still in the branch that it was at the time the rota was deleted

Sponsored-by: PTFS-Europe

Signed-off-by: David Nind <david@davidnind.com>

JD Amended patch:
* Fix QA failures
   FAIL   forbidden patterns
                forbidden pattern: tab char (line 150)
                forbidden pattern: tab char (line 151)
* Adjust commit message to describe what the patch does
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 14 Jonathan Druart 2023-02-23 15:06:04 UTC
This script needs a bit of cleanup, there is no error handling and we should not need the redirects.
Comment 15 Tomás Cohen Arazi (tcohen) 2023-02-24 20:38:36 UTC
Pushed to master for 23.05.

Nice work everyone, thanks!
Comment 16 Jacob O'Mara 2023-03-01 16:51:25 UTC
Nice work, thanks everyone!

Pushed to 22.11.x for the next release.
Comment 17 Lucas Gass (lukeg) 2023-03-10 14:33:23 UTC
Does not apply clean to 22.05.x, no backport.
Comment 18 Aude Charillon 2024-05-14 15:16:25 UTC
Koha manual updated.