When the stock rotation cronjob updates an item's owning library and creates a pending transfer, Koha doesn't properly handle cases where the item is checked out or waiting on a holdshelf when the cron runs to change the branch, and then the item is checked in at a different branch than the one listed in branchtransfers.frombranch. When checked in at an unexpected branch, Koha doesn't prompt a transfer at all, which leaves an open transfer request that staff are unaware of. If the item is checked in a second time, Koha will properly prompt the transfer. Steps to reproduce: 1. Set up stock rotation and add a test item to the rotation schedule. 2. Check the item out before the cronjob runs to change the item's branch. 3. Run the stock rotation cronjob to move all items to the next branch. 4. Check in the item at a different branch (neither the old or new owning branch). 5. Note that Koha does not prompt a transfer on the item. 6. The item should have a pending transfer that was not triggered. 7. Check the item in again to trigger the transfer. Note: Is it possible this issue relates or overlaps with the following bugs? * Bug 40331 * Bug 36658