Bug 32498

Summary: Checking an in-transit item out at a library other than the tobranch should cancel the transfer rather than complete it
Product: Koha Reporter: Andrew Fuerste-Henry <andrew>
Component: CirculationAssignee: Bugs List <koha-bugs>
Status: NEW --- QA Contact: Testopia <testopia>
Severity: normal    
Priority: P5 - low CC: gmcharlt, kyle.m.hall, martin.renvoize
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:

Description Andrew Fuerste-Henry 2022-12-19 21:57:19 UTC
If an item is mid-transfer and gets checked out at a branch other than its tobranch, Koha marks the transfer as arrived and edits the tobranch to be the branch at which the checkout happens. This makes for a confusing data trail. Instead, the transfer should be cancelled and the original tobranch should be retained.

https://github.com/Koha-Community/Koha/blob/c7a995d28f7ae3759ec9ad377b5f7f2b5828e06a/C4/Circulation.pm#L1613

To recreate:
1: Start a manual transfer of an item from Branch A to Branch B
2: Confirm the item shows as in transit and the branchtransfers table shows frombranch=A, tobranch=B
3: Check item out at Branch A
4: Confirm the branchtransfers table now shows frombranch=A, tobranch=A, has a datearrived value, and has a comment "Forced branchtransfer"

(or, if the checkout happens at a third branch)

5: Start a manual transfer of an item from Branch A to Branch B
6: Confirm the item shows as in transit and the branchtransfers table shows frombranch=A, tobranch=B
7: Check item out at Branch C
8: Confirm the branchtransfers table now shows frombranch=A, tobranch=C, has a datearrived value, and has a comment "Forced branchtransfer"