Koha-clms/Koha/Item
Tomás Cohen Arazi dece71cb3e
Bug 41728: (follow-up) Add no_short_circuit option to checkin availability
This follow-up replaces the unconditional removal of short-circuit logic
with a caller-controlled no_short_circuit parameter, following the same
pattern established by Koha::Patron->can_place_holds.

By default, check() short-circuits on the first blocker. This is the
correct behavior for AddReturn, which processes blockers sequentially
and only acts on the first one it finds (BlockedWithdrawn => early return,
Wrongbranch => early return, BlockedLost => sets doreturn=0). Running all
policy checks only to discard the results is wasteful, specially when
some of them (e.g. can_be_returned_at) hit the database.

When no_short_circuit => 1 is passed, all checks run and all blockers
are collected. This is the behavior API consumers will need: present the
full set of issues in a single response instead of requiring
fix-one-recheck cycles.

Test plan:
1. Apply patch
2. Run:
   $ ktd --shell
  k$ prove t/db_dependent/Koha/Item/Checkin/Availability.t
=> SUCCESS: Tests pass!
  k$ prove t/db_dependent/Circul*
=> SUCCESS: Tests pass!
3. Sign off :-D

Signed-off-by: Tomás Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Pedro Amorim <pedro.amorim@openfifth.co.uk>
2026-09-04 11:23:59 +00:00
..
Checkin Bug 41728: (follow-up) Add no_short_circuit option to checkin availability 2026-09-04 11:23:59 +00:00
Search Bug 40680: Move EXPORT_OK right after Modern::Perl 2025-12-01 08:33:56 -07:00
Transfer Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
Attributes.pm Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
Template.pm Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
Templates.pm Bug 42764: Fix spelling errors across the codebase 2026-06-03 16:09:04 +00:00
Transfer.pm Bug 42443: (QA follow-up) Use POST /transfers/{transfer_id}/cancellation 2026-09-04 11:23:41 +00:00
Transfers.pm Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00