https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43506

--- Comment #1 from Martin Renvoize (ashimema) 
<[email protected]> ---
Created attachment 205429
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=205429&action=edit
Bug 43506: Add Koha::Library::OpeningHours->copy_to

Adds a copy_to method mirroring Koha::Library::Calendar::copy_to, so a
library's opening hours can be duplicated onto another library instead
of being re-entered slot by slot.

Copies in two passes: self-contained slots and open-ended openers
first (building a source-id -> target-id map as they go), then
close-only linked rows, re-pointing closes_opening_id at the *copy* of
their opener rather than the source's row id. Idempotent, matching
Calendar's copy_to - a slot already present on the target (matched on
weekday/type/open_time/close_time, or for a linked closer, on its
mapped opener id) is left alone rather than duplicated.

Test plan:
1. prove t/db_dependent/Koha/Library/OpeningHours.t
2. Note the new "copy_to (Bug 43506)" subtest: copies a simple slot
   and a linked multi-day span (Friday opener / Monday closer) from
   one library to another, confirms the copy resolves correctly via
   resolved_intervals on the target, confirms re-running the copy
   does not duplicate anything, and confirms the source is untouched.

-- 
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/

Reply via email to