[Bug 42513] New: Stock Rotation fails when Advancement transfer is cancelled and then item is repatriated
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42513 Bug ID: 42513 Summary: Stock Rotation fails when Advancement transfer is cancelled and then item is repatriated Initiative type: --- Sponsorship --- status: Product: Koha Version: Main Hardware: All OS: All Status: NEW Severity: normal Priority: P5 - low Component: Cataloging Assignee: koha-bugs@lists.koha-community.org Reporter: lisette@bywatersolutions.com QA Contact: testopia@bugs.koha-community.org CC: m.de.rooy@rijksmuseum.nl Example: | action | date | reason | cancellation_reason | | ------------------------- | ---------- | -------------------------- | ------------------- | | Item transfer requested | 2025-09-30 | StockrotationAdvance | - | | Item transfer cancelled | 2025-10-01 | - | ItemLost | | Item scanned in +transfer | 2025-10-02 | StockrotationRepatriation | - | | ------------------------- | ---------- | -------------------------- | ------------------- | Because there's no completion date for the StockrotationAdvance transfer, it will never move forward. The check in StockRotationItem.pm sub needs_advancing specifically compares to the most recent completed transfer with a reason of "StockrotationAdvance" We need to check if there's a StockrotationRepatriation to the current stage's branch after the cancelled StockrotationAdvance transfer or it will stay there forever and never rotate unless it's manually advanced. -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42513 Lisette Scheer <lisette@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|koha-bugs@lists.koha-commun |lisette@bywatersolutions.co |ity.org |m Status|NEW |ASSIGNED -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42513 --- Comment #1 from Lisette Scheer <lisette@bywatersolutions.com> --- This patch updates the Koha/StockRotationItem.pm to change needs_advancing to be checked before needs_repatriating. It also updates needs_advancing to handle when the last StockrotationAdvance was cancelled so items don't get stuck never moving. To recreate: 1. Turn on StockRotation in the system preferences 2. Navigate to 'Cataloging'->'Stock Rotation' 3. Click the 'New rota` button give it any name and leave it cyclical 4. On the stock rotations table, click the "Manage" button for your new rota and manage stages 5. Create at least 2 stages at different libraries set the days for each stage to 1 6. In the left hand bar, there should be a 'Manage items' option, click on that. 7. Add 39999000011418 (or a barcode of your choice) to the rota 8. Click 'Stock rotation' in the breadcrumbs 9. on the stock rotation table, activate your rota with the "Activate" button 10. on the stock rotation table, click the manage button, then manage items 11. click 'Move to next stage' 12. Run the following report: select * from branchtransfers You should have 1 transfer with the reason StockrotationAdvance 13. Search the catalog for 39999000011418, edit the item 14. Mark the item as lost 15. Repeat step 12, there should now be a cancellation 16. Remove the lost status 17. Repeat steps 10-12 There should now be one with a cancellation and one without a cancellation 18. Change your library to the library that matches the 'To branch' for your active transfer. 19. Check the item in. 20. Repeat steps 10-12 There should now be a 'date_arrived' on the most recent transfer. 21. Directly edit your database ktd --shell koha-mysql kohadev UPDATE branchtransfers SET date_arrived="date" where branchtransfer_id="yourbranchtransfer_id"; *date arrived should be your date but change the day back in time a day or 2 *branchtransfer_id is the id of the most recent transfer, which should be 2 22. Run your report Observe that the date is updated 23. in your ktd, run this script: perl misc/cronjobs/stockrotation.pl -x (if you're still in the database, first type 'exit' and hit enter) This should show you the results of your item. It should have "status: advancement" This will execute the change. 23. Repeat steps 13-16 24. Repeat steps 21-22 25. in your ktd, run this script (leave the -x off the end) perl misc/cronjobs/stockrotation.pl 26. The status will come up and say 'repatriation' instead of 'advancement' To test the patch: 27. Apply the patch 28. restart_all 29. Repeat step 25 It should now say 'advancement' I'm not setting this to NSO yet because I need to update some tests. I'm also going to put together a through test plan for other options. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42513 --- Comment #2 from Lisette Scheer <lisette@bywatersolutions.com> --- Created attachment 199058 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=199058&action=edit Bug 42513: Stock rotation upgrades to handle cancelled advancements This patch updates the Koha/StockRotationItem.pm to change needs_advancing to be checked before needs_repatriating. It also updates needs_advancing to handle when the last StockrotationAdvance was cancelled so items don't get stuck never moving. To recreate: 1. Turn on StockRotation in the system preferences 2. Navigate to 'Cataloging'->'Stock Rotation' 3. Click the 'New rota` button give it any name and leave it cyclical 4. On the stock rotations table, click the "Manage" button for your new rota and manage stages 5. Create at least 2 stages at different libraries set the days for each stage to 1 6. In the left hand bar, there should be a 'Manage items' option, click on that. 7. Add 39999000011418 (or a barcode of your choice) to the rota 8. Click 'Stock rotation' in the breadcrumbs 9. on the stock rotation table, activate your rota with the "Activate" button 10. on the stock rotation table, click the manage button, then manage items 11. click 'Move to next stage' 12. Run the following report: select * from branchtransfers You should have 1 transfer with the reason StockrotationAdvance 13. Search the catalog for 39999000011418, edit the item 14. Mark the item as lost 15. Repeat step 12, there should now be a cancellation 16. Remove the lost status 17. Repeat steps 10-12 There should now be one with a cancellation and one without a cancellation 18. Change your library to the library that matches the 'To branch' for your active transfer. 19. Check the item in. 20. Repeat steps 10-12 There should now be a 'date_arrived' on the most recent transfer. 21. Directly edit your database ktd --shell koha-mysql kohadev UPDATE branchtransfers SET date_arrived="date" where branchtransfer_id="yourbranchtransfer_id"; *date arrived should be your date but change the day back in time a day or 2 *branchtransfer_id is the id of the most recent transfer, which should be 2 22. Run your report Observe that the date is updated 23. in your ktd, run this script: perl misc/cronjobs/stockrotation.pl -x (if you're still in the database, first type 'exit' and hit enter) This should show you the results of your item. It should have "status: advancement" This will execute the change. 23. Repeat steps 13-16 24. Repeat steps 21-22 25. in your ktd, run this script (leave the -x off the end) perl misc/cronjobs/stockrotation.pl 26. The status will come up and say 'repatriation' instead of 'advancement' To test the patch: 27. Apply the patch 28. restart_all 29. Repeat steps 10-25 It should now say 'advancement' -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42513 Lisette Scheer <lisette@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |martin.renvoize@openfifth.c | |o.uk -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42513 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- QA Contact|testopia@bugs.koha-communit |martin.renvoize@openfifth.c |y.org |o.uk -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42513 Lisette Scheer <lisette@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |Needs Signoff -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org