Bug 40225 - The --send-all option in the stockrotation job fails if there are no items to rotate at all
Summary: The --send-all option in the stockrotation job fails if there are no items to...
Status: Needs Signoff
Alias: None
Product: Koha
Classification: Unclassified
Component: Cataloging (show other bugs)
Version: unspecified
Hardware: All All
: P5 - low normal
Assignee: Martin Renvoize (ashimema)
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-06-24 11:44 UTC by Martin Renvoize (ashimema)
Modified: 2025-06-24 12:06 UTC (History)
2 users (show)

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


Attachments
Bug 40225: Check stationary items for stockrotation (1.06 KB, patch)
2025-06-24 12:02 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 40225: Send stockrotation report even when all items are stationary (2.01 KB, patch)
2025-06-24 12:06 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 Martin Renvoize (ashimema) 2025-06-24 11:44:54 UTC
The send-all option claims to send notices even if there are no items to rotate for the given branch; However, if there are no items to action anywhere on the system we skip all notices entirely, not respecting the send-all option.
Comment 1 Martin Renvoize (ashimema) 2025-06-24 12:02:47 UTC
Created attachment 183444 [details] [review]
Bug 40225: Check stationary items for stockrotation

We should send the report even if all items are stationary
Comment 2 Martin Renvoize (ashimema) 2025-06-24 12:06:10 UTC
Created attachment 183445 [details] [review]
Bug 40225: Send stockrotation report even when all items are stationary

The stockrotation cronjob was only sending email reports when there were
actionable items (items that needed to be moved between branches). This
meant that libraries would not receive any notification when all items
in their rotation were stationary, even when the --send-all flag was
passed to the script.

This patch modifies the report logic to also send reports when there are
only stationary items, ensuring libraries have visibility into the complete
status of their stock rotation items.

Test plan:
1. Set up a stock rotation rota with items that are all stationary
   (items that should stay at their current branch)
2. Run the stockrotation cronjob: perl misc/cronjobs/stockrotation.pl
3. Without this patch: No email report is generated
4. Apply this patch
5. Run the cronjob again
6. Verify that an email report is now generated showing the stationary items
7. Test with mixed scenarios (some actionable, some stationary items)
8. Confirm reports are sent in all cases where items exist in the rotation