Anonymous Login
2021-03-03 10:17 PST

View Issue Details Jump to Notes ]
IDProjectCategoryView StatusLast Update
0000451Pending RequestsProject Designerpublic2014-08-16 18:53
Reporterw2puser 
Assigned To 
PrioritynormalSeverityminorReproducibilityalways
StatusnewResolutionopen 
Product Version 
Target VersionFixed in Version 
Summary0000451: Moving tasks by days in Project designer ignores non-working days
DescriptionWhen moving a task by days in the project designer, task does not take account of non-working days.
Would expect a 2 day task that was originally set to start on Thurs 9 a.m. and ending Friday 5 p.m, and that was then moved by 1 day would then start on Friday 9 a.m. and finish on Monday 5 p.m. (Possibly need to consider this when changing task duration as well).
The current code simply adds the number of days to the start and end task dates setting the task to start Friday 9 a.m and to finish Saturday 5 p.m.
Additional InformationSuggested fix is to add a check box to the bottom of the Actions table in the Project Designer that allows working days to be respected when moving a task by days.

Possibly a table row with check box to modules/projectdesigner/vw_actions.php - around line 198
The check box defaults to checked
<tr>
<td colspan="20" align="left"><input type="checkbox" name="bulk_task_respect_non_working_days" value="1" checked> Respect Non-Working Days</td>
</tr>

To make use of the check box modify modules/projectdesigner/do-task_bulk_aed.php
To respect non-working days need to move the start date by using the addDuration function and then calculate the end date by using the calcFinish function which both respect non-working days.
If we don't want to respect working days we simply use the addDays function for both start and end dates as previously.
Replace the 'if' block at around line 68 with something like:

if (isset($_POST['bulk_move_date']) && $bulk_move_date != '' && $bulk_move_date) {
         if ($upd_task->task_id && ((int) $upd_task->task_dynamic != 1 && !$upd_task->getDependencies($upd_task->task_id))) {
            $offSet = $bulk_move_date;
            if (isset($_POST['bulk_task_respect_non_working_days']) && $bulk_task_respect_non_working_days == '1') {
               //We will be calculating end date by existing duration and duration type (days/hours)
               $existing_duration = $upd_task->task_duration;
               $existing_duration_type = $upd_task->task_duration_type;
               //Calculate the start date based using days offset and day increments (task may consist of day or hour intervals)
               $new_start_date = new CDate($upd_task->task_start_date);
               $start_date = $new_start_date->addDuration($offSet,'24');
               $end_date = $new_start_date->calcFinish($existing_duration, $existing_duration_type);
            } else {
               //Simply offset current start/end dates if not respecting non working days
               $start_date=new CDate($upd_task->task_start_date);
               $end_date = new CDate($upd_task->task_end_date);
               $start_date->addDays($offSet);
               $end_date->addDays($offSet);
            }
            $upd_task->task_start_date = $start_date->format(FMT_DATETIME_MYSQL);
            $upd_task->task_end_date = $end_date->format(FMT_DATETIME_MYSQL);
            $upd_task->store($AppUI);
            $upd_task->shiftDependentTasks();
         }
      }



This exposes another bug in classes/date.class.php - line 513

$f->addHours(1);

This function is undefined (Possibly a typo and meant to be $f->addDays(1)? Not sure)


TagsNo tags attached.
Attached Files

-Relationships
related to 0000078closedtrevormorse v2.4 Release (Closed) Task dependencies not cascading 
+Relationships

-Notes
There are no notes attached to this issue.
+Notes

-Issue History
Date Modified Username Field Change
2010-05-26 15:47 w2puser New Issue
2011-07-03 23:54 caseydk Relationship added related to 0000078
2014-08-16 18:53 caseydk Category General => Project Designer
+Issue History