https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24898
--- Comment #1 from Martin Renvoize (ashimema) <[email protected]> --- Created attachment 203469 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=203469&action=edit Bug 24898: AddIssue no longer falsifies transfers it interrupts When AddIssue found an active transfer for the item being checked out, it unconditionally stamped datearrived to now and rewrote tobranch to the checkout branch, regardless of whether that was actually the transfer's destination. This silently discarded the real destination and recorded a false arrival, with no reason logged for what happened - corrupting the audit trail and confusing any code (e.g. StockRotation) that later reasons about that transfer's history. AddIssue now compares the transfer's tobranch to the branch the checkout is happening at: - If they match, the item has genuinely arrived at its destination and is being checked out from there, so the transfer is completed normally via Transfer->receive (the same call AddReturn already uses for this case). - If they don't match, the item was diverted before completing its journey, so the transfer is cancelled via Transfer->cancel with cancellation_reason 'WrongTransfer' - the same enum value AddReturn already uses for an item turning up at the wrong branch. The original tobranch and reason are preserved rather than overwritten. No schema change is needed; 'WrongTransfer' already existed as a cancellation_reason value for this exact situation on the check-in side, it just wasn't reused here. Test plan: 1. Apply the patch 2. prove t/db_dependent/Circulation.t => All tests pass, including the two 'Checkout should ... transfer' subtests 3. prove t/db_dependent/Circulation/ t/db_dependent/Koha/Item.t \ t/db_dependent/Koha/Item/Transfer.t t/db_dependent/Reserves.t => All pass, no regressions 4. Manually: place a hold on an item at library B, let it transfer from library A, then check it out at library C (neither A nor B). Confirm in branchtransfers that the original transfer now shows cancellation_reason = 'WrongTransfer' and tobranch is still B, not C, and datearrived is NULL. 5. Repeat, checking the item out at library B (the real destination). Confirm the transfer shows datearrived set and tobranch unchanged. -- You are receiving this mail because: You are watching all bug changes. _______________________________________________ Koha-bugs mailing list -- [email protected] To unsubscribe send an email to [email protected] website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/
