https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43506 --- Comment #2 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 205430 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=205430&action=edit Bug 43506: Add REST endpoint and admin UI for copying opening hours Adds POST /libraries/{library_id}/opening_hours/copy, mirroring Koha::REST::V1::Libraries::Calendar's copy endpoint exactly (body {from_library_id}, 400/source_not_found for an unknown source, 201 with the Location header pointing back at the opening_hours collection). No route collision with GET/PUT/DELETE .../opening_hours/ {opening_hour_id}: verified directly against a running instance that Mojolicious's router prefers the literal "copy" segment over the integer placeholder regardless of declaration order, and the two only share the same HTTP method (POST) with a route that doesn't define it at all, so there was never any real ambiguity. Adds a "Copy hours from" control to the library edit form in Administration -> Libraries (edit only, not add - copying onto a library that doesn't exist yet makes no sense): a dropdown of every other library and a button that POSTs to the new endpoint and reloads the page on success. Verified end-to-end in-browser: seeded one library's GENERAL Monday 09:00-17:00 slot, copied it onto a second, empty library via the new control, and confirmed it appears correctly in that library's own hours table afterwards. Test plan: 1. prove t/db_dependent/api/v1/libraries_opening_hours.t 2. Note the new "copy() tests" subtest: copies a slot between two libraries via the API, confirms it's idempotent (no duplicates on a second copy), and confirms an unknown from_library_id surfaces as 400 source_not_found. 3. yarn build && restart_all, then in Administration -> Libraries, edit a library with no hours of its own, use "Copy hours from" to pick a library that does have hours, and confirm they appear. -- You are receiving this mail because: You are watching all bug changes.