You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
isWorkingDay(): replace the hard-coded Holiday add-on file with a hook #565
w2p_Utilities_Date::isWorkingDay() (classes/w2p/Utilities/Date.class.php L181–206) special-cases one add-on. It checks isActiveModule('holiday'), requires modules/holiday/holiday_functions.class.php, and calls HolidayFunctions::isHoliday($this).
As a result:
Core is tied to one module's directory, file and static class name. No other module (an HR or leave module, a company-calendar module) can supply non-working dates.
The add-on is called once per day checked. Calendars call it once per cell and calcFinish() once per day of the loop, so any caching has to happen inside the add-on.
Proposal: a hook gathered by w2p_System_HookHandler, e.g. hook_nonWorkingDates(w2p_Utilities_Date $start, w2p_Utilities_Date $end, ?int $userId): array returning ['Y-m-d' => true|false] (false = an extra working day). Core would:
call it once per span and cache the result per request
catch Throwable per module, as calendar() and calendar_links() already do
keep cal_working_days as the base rule
The optional $userId would let a module apply per-user absence if core later passes the task assignee (web2project/modules-holiday#12).
The Holiday add-on would then implement the hook instead of being required by path.
Activity