Bug 41679

Summary: Stock rotation repatriation modal can conflict with holds modal
Product: Koha Reporter: Nick Clemens (kidclamp) <nick>
Component: Staff interfaceAssignee: Martin Renvoize (ashimema) <martin.renvoize>
Status: Needs Signoff --- QA Contact: Testopia <testopia>
Severity: normal    
Priority: P5 - low CC: gmcharlt, martin.renvoize
Version: Main   
Hardware: All   
OS: All   
GIT URL: Initiative type: ---
Sponsorship status: --- Comma delimited list of Sponsors:
Crowdfunding goal: 0 Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:
Attachments: Bug 41679: Fix overlapping modals when hold conflicts with stock rotation transfer

Description Nick Clemens (kidclamp) 2026-01-21 19:43:29 UTC
To recreate
 1 - Enable StokcRotation system preference
 2 - Navigate to Cataloging->Stock rotation
 3 - Click '+ New rota' fill out with any values
 4 - Click 'Manage->stages' for the Rota
 5 - Add a stage for Centerville for 1 day, and Midway for 1 day
 6 - Return to rotas
 7 - Click Manage->items for the rota
 8 - Add an item
 9 - Return to rotas
10 - Click 'Activate'
11 - On the command line run the stock rotation job
     perl misc/cronjobs/stockrotation.pl -x
12 - There should be one item for initiation
13 - Run it again, there should be one stationary item
14 - Place an item specific hold for the item, for pickup at Midway
15 - Check the item in at centerville, confirm transfer
16 - Check the item in at Midway, confirm hold
17 - Run the stock rotation job again
18 - There should be one item for repatriation
19 - Check in the item again
20 - Boom! You get two overlapping modals
Comment 1 Martin Renvoize (ashimema) 2026-01-30 12:19:46 UTC
Created attachment 192235 [details] [review]
Bug 41679: Fix overlapping modals when hold conflicts with stock rotation transfer

When checking in an item that has both a hold and a stock rotation
repatriation transfer, both modals would appear simultaneously,
overlapping each other and making it impossible to interact with
either one properly.

This occurred because:
1. The hold modal showed when 'waiting' was set
2. The transfer modal condition checked for 'reserved' but not 'waiting'
3. Both modals had the "block" class, causing simultaneous display

This patch ensures holds take precedence over stock rotation transfers
by adding a check for the 'waiting' flag to the transfer modal condition.

When a hold is found, only the hold modal displays. The stock rotation
transfer can be handled at a subsequent check-in, which is appropriate
since holds are patron-facing and time-sensitive, while stock rotation
is an internal process that can be deferred.

Test plan:
1. Enable StockRotation system preference
2. Navigate to Cataloging->Stock rotation
3. Click '+ New rota' and fill out with any values
4. Click 'Manage->stages' for the Rota
5. Add a stage for Centerville for 1 day, and Midway for 1 day
6. Return to rotas
7. Click Manage->items for the rota
8. Add an item
9. Return to rotas
10. Click 'Activate'
11. On the command line run the stock rotation job:
    perl misc/cronjobs/stockrotation.pl -x
12. There should be one item for initiation
13. Run it again, there should be one stationary item
14. Place an item specific hold for the item, for pickup at Midway
15. Check the item in at Centerville, confirm transfer
16. Check the item in at Midway, confirm hold
17. Run the stock rotation job again:
    perl misc/cronjobs/stockrotation.pl -x
18. There should be one item for repatriation
19. Check in the item again at Midway
20. Before patch: Two overlapping modals appear (hold + transfer)
21. After patch: Only the hold modal appears
22. Confirm the hold - no transfer modal should appear
23. The stock rotation transfer will be handled at the next check-in