diff --git a/module/task/model.php b/module/task/model.php index 7e0f0bd64e..c58513a1ef 100644 --- a/module/task/model.php +++ b/module/task/model.php @@ -782,7 +782,6 @@ class taskModel extends model if($oldTask->parent > 0) { $oldParentTask = $this->dao->select('*')->from(TABLE_TASK)->where('id')->eq($oldTask->parent)->fetch(); - if($task->parent == 0) $this->computeWorkingHours($oldTask->parent); $this->updateParentStatus($taskID, $oldTask->parent, !$changed); $this->computeBeginAndEnd($oldTask->parent); @@ -792,8 +791,11 @@ class taskModel extends model if(!$oldChildCount) $this->dao->update(TABLE_TASK)->set('parent')->eq(0)->where('id')->eq($oldTask->parent)->exec(); $this->dao->update(TABLE_TASK)->set('lastEditedBy')->eq($this->app->user->account)->set('lastEditedDate')->eq(helper::now())->where('id')->eq($oldTask->parent)->exec(); $this->action->create('task', $taskID, 'unlinkParentTask', '', $oldTask->parent); + $actionID = $this->action->create('task', $oldTask->parent, 'unLinkChildrenTask', '', $taskID); + $newParentTask = $this->dao->select('*')->from(TABLE_TASK)->where('id')->eq($oldTask->parent)->fetch(); + $changes = common::createChanges($oldParentTask, $newParentTask); if(!empty($changes)) $this->action->logHistory($actionID, $changes); }