Bug 39717 - Stock rotation stages cannot be moved
Summary: Stock rotation stages cannot be moved
Status: Pushed to main
Alias: None
Product: Koha
Classification: Unclassified
Component: Tools (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal
Assignee: Nick Clemens (kidclamp)
QA Contact: Martin Renvoize (ashimema)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-04-23 20:02 UTC by Nick Clemens (kidclamp)
Modified: 2025-04-24 17:54 UTC (History)
1 user (show)

See Also:
GIT URL:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
25.05.00
Circulation function:


Attachments
Bug 39717: Use numeric comparison for stock rotation stages (2.49 KB, patch)
2025-04-23 20:13 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 39717: Use numeric comparison for stock rotation stages (2.54 KB, patch)
2025-04-23 20:14 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 39717: Use numeric comparison for stock rotation stages (2.65 KB, patch)
2025-04-24 08:11 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Nick Clemens (kidclamp) 2025-04-23 20:02:56 UTC
In the routine Koha::StockRotationStage->move_to we are doing a stringwise comparison of the position to move to, versus the count of stages

This works when we have a limited number of stages, but fails when we have many:

perl -e 'warn "Yes" if "3" le "26"'

It's not.

Changing to <= seems to fix this
Comment 1 Nick Clemens (kidclamp) 2025-04-23 20:13:56 UTC
Created attachment 181395 [details] [review]
Bug 39717: Use numeric comparison for stock rotation stages

To test:
 1 - Enable SotckRotation
     http://localhost:8081/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=StockRotation
 2 - Browse to "Cataloging -> StockRotation"
 3 - 'New rota' - fill out the form and save
 4 - Manage->stages
 5 - Add many stages, more than 10 at least
 6 - Try to move a stage form the bottom to position 3
 7 - Note message above list: Saving changes... Error: Bad Request
 8 - Apply patch, restart_all
 9 - Attempt to move stages, try many combinations
10 - Success!
Comment 2 Nick Clemens (kidclamp) 2025-04-23 20:14:22 UTC
Created attachment 181396 [details] [review]
Bug 39717: Use numeric comparison for stock rotation stages

To test:
 1 - Enable SotckRotation
     http://localhost:8081/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=StockRotation
 2 - Browse to "Cataloging -> StockRotation"
 3 - 'New rota' - fill out the form and save
 4 - Manage->stages
 5 - Add many stages, more than 10 at least
 6 - Try to move a stage form the bottom to position 3
 7 - Note message above list: Saving changes... Error: Bad Request
 8 - Apply patch, restart_all
 9 - Attempt to move stages, try many combinations
10 - Success!

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 3 Nick Clemens (kidclamp) 2025-04-23 20:14:46 UTC
Self SO, moving to QA, this is pretty straightforward
Comment 4 Martin Renvoize (ashimema) 2025-04-24 08:11:09 UTC
Created attachment 181401 [details] [review]
Bug 39717: Use numeric comparison for stock rotation stages

To test:
 1 - Enable SotckRotation
     http://localhost:8081/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=StockRotation
 2 - Browse to "Cataloging -> StockRotation"
 3 - 'New rota' - fill out the form and save
 4 - Manage->stages
 5 - Add many stages, more than 10 at least
 6 - Try to move a stage form the bottom to position 3
 7 - Note message above list: Saving changes... Error: Bad Request
 8 - Apply patch, restart_all
 9 - Attempt to move stages, try many combinations
10 - Success!

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Comment 5 Martin Renvoize (ashimema) 2025-04-24 08:12:21 UTC
Oops.. Passing QA
Comment 6 Katrin Fischer 2025-04-24 17:54:06 UTC
Pushed for 25.05!

Well done everyone, thank you!