https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28527

--- Comment #17 from Martin Renvoize (ashimema) 
<[email protected]> ---
Created attachment 203485
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=203485&action=edit
Bug 28527: (follow-up) Redirect cancelled in-transit transfers to the right
branch

AddReturn's handling of a transfer cancelled whilst in transit always
redirected the item back to the transfer's frombranch, on the
assumption that the original purpose of the trip no longer applies
(true for a cancelled hold or recall, the case this was built around).

That assumption doesn't hold for every reason:

- For StockrotationAdvance/StockrotationRepatriation, redirecting to
  frombranch sends the item backwards. Koha::StockRotationItem's
  stage is already updated to the next stage optimistically when the
  advance transfer is created, and StockRotation's own cron already
  re-evaluates and corrects an item's location every run (needs_
  repatriating/needs_advancing, see Bug 42513). Creating a redirect
  here is a redundant transfer that StockRotation would then have to
  notice and correct a second time. Skip creating one at all and let
  StockRotation handle it in a single hop, as it already can.

- For ReturnToHome/ReturnToHolding/RotatingCollection/
  LibraryFloatLimit, the transfer's destination was never in doubt -
  it's the item's home/holding branch or a collection's base - so
  cancelling this specific transfer attempt doesn't mean that
  destination stopped being correct. Redirect onward to tobranch
  instead of backward to frombranch.

- Everything else (Reserve, LostReserve, CancelReserve, Recall,
  RecallCancellation, Manual, TransferCancellation) keeps the existing
  frombranch behaviour: the specific reason for the trip is gone, so
  send the item home.

New Koha::Item::Transfer->reroute_to encapsulates this decision.

Test plan:
1. prove t/db_dependent/Koha/Item/Transfer.t
   => New 'reroute_to tests' subtest passes
2. prove t/db_dependent/Circulation/Returns.t
   => New 'Cancelled in-transit transfers are rerouted appropriately'
      subtest passes: no transfer created for StockrotationAdvance,
      frombranch for Reserve, tobranch for ReturnToHome
3. prove t/db_dependent/Circulation.t t/db_dependent/Circulation/ \
       t/db_dependent/Koha/Item.t t/db_dependent/Reserves.t \
       t/db_dependent/StockRotationItems.t t/db_dependent/Holds.t
   => All pass, no regressions

-- 
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/

Reply via email to