https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=33711
--- Comment #1 from Tomás Cohen Arazi (tcohen) <[email protected]> --- Created attachment 211058 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=211058&action=edit Bug 33711: Add Koha::Item::Availability::Checkout This patch adds a checkout availability class, mirroring Koha::Item::Availability::Checkin from bug 42383, and the Koha::Item->checkout_availability convenience method. The class wraps CanBookBeIssued (it doesn't reimplement it) and returns a Koha::Item::Availability::Checkout::Result where: - every UPPERCASE key is renamed to a snake_case key, using a documented one to one mapping (KEY_MAP and WARNING_KEY_MAP). key_from_legacy and legacy_from_key translate both ways, and legacy_override_params returns the legacy keys for AddIssue's confirmations/forced params. - the data CanBookBeIssued stores in sibling keys (issued_*, res*, current_loan_count, circulation_rule_TOO_MANY, item_notforloan, branch_to_return, ...) becomes the payload of the key it relates to. Payloads carry ids instead of objects (recall_id, booking_id, patron_id, hold_id) so callers can fetch or embed them, and dates (the due date, the high holds return date) as RFC3339 strings. - the business rules callers applied on top of CanBookBeIssued are applied in the class: AllowHoldCheckoutOverride hold promotion and OnSiteCheckoutsForce relaxation (from circ/circulation.pl), the circulate.force_checkout requirement for every confirmation but high_holds and additional_materials (from circulation.tt), and the public route promotions and stripping (from Koha::REST::V1::Checkouts::_check_availability), selected with the 'interface' param. - the 'overrides' param replaces circ/circulation.pl's 'forceallow', following the 'overrides' param of the hold availability classes (bug 42386): a hashref of blocker keys, or { any => 1 }. When the user has circulate.force_checkout, the overridden blockers (but unknown_barcode, no_open_days and statistical_patron, and the holds when AllowHoldCheckoutOverride is disabled) are relaxed like OnSiteCheckoutsForce does: reported as warnings and recorded as forced, so AddIssue logs them. to_api lists them under 'forced'. Confirmations are not affected, they still need the token. - the 'library' param sets the library the check is done for. It defaults to the user environment's library, which CanBookBeIssued reads, and is restored afterwards. Checking availability doesn't write anything. CanBookBeIssued records a 'localuse' statistic and updates datelastseen for statistical patrons, so they are detected up front and a statistical_patron blocker is returned without calling CanBookBeIssued. This leaves CanBookBeIssued and its callers (SIP, ILS-DI, curbside pickup, ILL, SCO) untouched. The result's token is bound to the item, the patron and the user, so a confirmation obtained for one patron cannot be used for another one. Callers are not changed yet, that will be done in a follow-up. Test plan: 1. Apply this patch 2. Run: $ ktd --shell k$ prove t/db_dependent/Koha/Item/Availability/Checkout.t => SUCCESS: Tests pass! 3. Sign off :-D Assisted-by: Opus 5.5 (Anthropic) -- You are receiving this mail because: You are watching all bug changes. You are on the CC list for the bug. _______________________________________________ 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/
