https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43108
--- Comment #6 from David Nind <[email protected]> --- Created attachment 202191 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=202191&action=edit Bug 43108: Add booking availability endpoint GET /api/v1/biblios/{biblio_id}/booking_availability returns, for each calendar date in the requested range, the booking availability of a record's bookable items: per (date, item), the blockers that prevent a new booking and the warnings that are advisory context only. It is the server-side source of truth for the booking calendar, so display and enforcement share one implementation. - Koha::Biblio::Availability::Booking computes each per-(date, item) cell as an availability result (blockers: booking, checkout, lead, trail; warnings: holiday, lead_floor, lead_theoretical), shaped like Koha::Result::Availability->to_hashref; namespace and vocabulary follow bug 41728 / bug 42386. Koha::Biblio->booking_availability is a thin wrapper around it - lead/trail windows derive from the effective bookings_lead_period and bookings_trail_period rules for the passed pickup library, patron and item type context; one rule set applies to every existing booking, matching the booking calendar - closed days of the pickup library are marked via Koha::Calendar - booking dates and checkout due dates are attributed to their library timezone calendar day (consistent with bug 42868) - excluded_booking_id leaves out the booking being edited; item_id restricts the calculation to a single item - the route requires the circulate/manage_bookings permission, same as GET /biblios/{biblio_id}/bookings Test plan: 1. Run the tests from the previous patch: prove t/db_dependent/Koha/Biblio/Availability/Booking.t \ t/db_dependent/Koha/Biblio.t \ t/db_dependent/api/v1/biblios.t 2. Regenerate the spec bundle (yarn api:bundle) or remove api/v1/swagger/swagger_bundle.json, restart plack, then with a record that has bookable items: curl -u koha:koha "<staff>/api/v1/biblios/<biblio_id>/booking_availability?from_date=2026-07-01&to_date=2026-07-31&pickup_library_id=<branch>" 3. Confirm booked/lead/trail/holiday dates match the booking modal's calendar for the same record and context Sponsored-by: Büchereizentrale Schleswig-Holstein <https://www.bz-sh.de/> Assisted-by: Fable 5 (Anthropic) Signed-off-by: David Nind <[email protected]> -- 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/
