dotproject / dotProject

Stable 2 series
Other
207 stars 106 forks source link

Create an option that will allow tasks to be automatically made dynamic when child tasks are added #201

Open gklesczewski opened 1 year ago

gklesczewski commented 1 year ago

By default, if a standard task (non-dynamic) is created, then a child task is added to that task, the newly made parent task will left unmodified.

Add an option such that a given task is created as not Dynamic. Add a child task to that task - automatically convert the task to a Dynamic task, allowing the child task to inherit the start and end dates of the parent.

rafaelqg commented 6 months ago

It is very simple to accomplish. Basically you need to add this block of code at the end of file https://github.com/dotproject/dotProject/blob/devel/modules/tasks/do_task_aed.php. (ex. at line 234)

if (obj->task_parent !== ""){ $q = new DBQuery(); $q->addTable('tasks', 't');
$q->addUpdate('task_dynamic', 1);
$q->addWhere('task_id = '.$obj->task_parent); $q->exec(); }

But as it is going o change a core module, I recommend you do that in your own instance, instead waiting for a general tool update.

fatabek commented 5 months ago

It should be like "if (obj->task_parent !== ""){" "if ($obj->task_parent !== ""){" There must be a "$" at the beginning of "obj", otherwise it gives an error.

rafaelqg commented 5 months ago

It should be like "if (obj->task_parent !== ""){" "if ($obj->task_parent !== ""){" There must be a "$" at the beginning of "obj", otherwise it gives an error.

Thanks for observing that. Great !