https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43124 Bug ID: 43124 Summary: Add Koha::Item::Availability::Hold and Koha::Biblio::Availability::Hold Initiative type: --- Sponsorship --- status: Product: Koha Version: Main Hardware: All OS: All Status: NEW Severity: enhancement Priority: P5 - low Component: Hold requests Assignee: koha-bugs@lists.koha-community.org Reporter: martin.renvoize@openfifth.co.uk QA Contact: testopia@bugs.koha-community.org CC: gmcharlt@gmail.com, lisette@bywatersolutions.com, tomascohen@gmail.com Depends on: 41728 Blocks: 43123 Target Milestone: --- Add two new classes for evaluating hold eligibility, replacing the ad hoc per-item query pattern in CanItemBeReserved. Koha::Item::Availability::Hold->check($item, $patron, $params) evaluates the existing 13 gate holdability check for a single item and returns a Koha::Item::Availability::Hold::Result, a subclass of Koha::Result::Availability (blockers, confirmations, warnings, context). This mirrors Koha::Item::Availability::Checkin from bug 41728 exactly. Koha::Biblio::Availability::Hold is the batching layer that fetches a biblio's items once, with prefetch on checkout, transfer, current hold and biblioitem relationships, then calls Koha::Item::Availability::Hold->check per item against that warm data, aggregating the results into a summary. Multi-patron calls reuse the same item fetch across every patron in the batch rather than repeating it per patron. C4::Reserves::CanItemBeReserved is refactored to become a thin wrapper around Koha::Item::Availability::Hold, so existing callers are unaffected and behaviour is unchanged. No REST or UI change is included in this bug. This bug depends on bug 41728, which introduces the shared Koha::Result::Availability base class these new classes are built on. Test plan 1. Run the existing C4::Reserves and Koha::Item test suites and confirm no regressions. 2. Add unit tests for Koha::Item::Availability::Hold covering the standard holdability gates (already held, too many reserves, age restricted, not for loan, item level hold policy, etc). 3. Add unit tests for Koha::Biblio::Availability::Hold confirming it issues a small, roughly constant number of queries regardless of item count (benchmark with 10, 50 and 100 item biblios). 4. Confirm CanItemBeReserved returns identical results to the pre-patch version for a representative set of items and patrons. Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41728 [Bug 41728] Add `Koha::Item::Availability::Checkin` to centralize logic https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43123 [Bug 43123] Hold placement workflow: Vue modernisation (epic) -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.