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
Task form: Calculate Finish Date / Duration ignore holidays (browser and server disagree) #564
The Duration and Finish Date buttons on the task form (style/_common/tasks/addedit_dates.php L34–35) run the JavaScript calcFinish() / calcDuration() in modules/tasks/addedit.js (L229–421). Those skip non-working days using only the weekday list (var working_days = …cal_working_days in modules/tasks/addedit.php L174).
The server uses w2p_Utilities_Date::isWorkingDay() (calcFinish(), calcDuration(), dependency shifting, Project Designer). That also excludes dates from the Holiday add-on when it's active. So with any holiday in the span, the form fills in one finish date or duration and the server calculates another.
Both JS functions are already marked @deprecated in favor of includes/ajax_functions.php. The xajax replacements (calcFinish() / calcDuration(), registered at L78–79) are never called. They also write end_hour, end_minute and end_hour_ampm, which the form no longer has since the hour/minute/am-pm fields became a single time select. So switching the buttons over needs those assignments updated to the current fields.
Options
Point the buttons at xajax_calcFinish() / xajax_calcDuration(), fix the field names, and delete the JS versions. The server becomes the only implementation.
Keep the JS, but pass the non-working dates for the visible range into the page.
Option 1 is less code and keeps one source of truth.
Found while reviewing the Holiday add-on for 5.0: web2project/modules-holiday#1. Read against master @ 418936fe; not reproduced on a running install.
Activity