* Remove the updateParentAfterSplit function that its code has been implemented in method updateParentStatus.

This commit is contained in:
hufangzhou
2023-05-11 15:50:15 +08:00
parent 5a1ab3e24c
commit d6969808e9
3 changed files with 7 additions and 28 deletions
+1 -1
View File
@@ -110,7 +110,7 @@ $config->task->datatable->fieldList['deadline']['title'] = 'deadlineAB';
$config->task->datatable->fieldList['deadline']['fixed'] = 'no';
$config->task->datatable->fieldList['deadline']['width'] = '70';
$config->task->datatable->fieldList['deadline']['required'] = 'no';
$config->task->datatable->fieldList['deadline']['control'] = 'date';
$config->task->datatable->fieldList['deadline']['control'] = 'date';
$config->task->datatable->fieldList['estimate']['title'] = 'estimateAB';
$config->task->datatable->fieldList['estimate']['fixed'] = 'no';
+6 -8
View File
@@ -184,7 +184,7 @@ class taskModel extends model
/* 拆分任务后更新其他数据。 Process other data after split task. */
$children = !empty($parentID) ? implode(',', $taskIdList) : '';
if($parentID) $this->afterSplitTask($oldParentTask, $children);
if($parentID && $taskID) $this->afterSplitTask($oldParentTask, $children);
/* 更新当前执行下的任务泳道。 Update the task lane under current execution. */
if(!isset($output['laneID']) or !isset($output['columnID'])) $this->kanban->updateLane($execution->id, 'task');
@@ -3780,22 +3780,20 @@ class taskModel extends model
*/
public function afterSplitTask(object $oldParentTask, string $children = ''): bool
{
$parentID = (int)$oldParentTask->id;
$parentID = (int)$oldParentTask->id;
$oneOfChildren = current(explode(',', $children));
/* 当一个普通任务有消耗时,拆分子任务并更新父任务状态。 */
/* When a normal task is consumed, create the subtask and update the parent task status. */
if($oldParentTask->parent == 0 && $oldParentTask->consumed > 0)
{
$taskID = $this->taskTao->splitConsumedTask($oldParentTask);
if(!$taskID) return false;
$this->updateParentStatus($taskID);
$inheritTask = $this->taskTao->splitConsumedTask($oldParentTask);
if(!$inheritTask) return false;
}
$this->updateParentStatus($oneOfChildren);
$this->computeBeginAndEnd($parentID);
$this->taskTao->updateParentAfterSplit($parentID);
/* 记录父任务日志。 */
$newParentTask = $this->dao->findById($parentID)->from(TABLE_TASK)->fetch();
$changes = common::createChanges($oldParentTask, $newParentTask);
$actionID = $this->action->create('task', $parentID, 'createChildren', '', trim($children, ','));
-19
View File
@@ -495,25 +495,6 @@ class taskTao extends taskModel
return (int)$childTaskID;
}
/**
* 拆分之后更新父任务的parent、lastEditedBy、lastEditedDate字段。
* Update the parent's parent, lastEditedBy, and lastEditedDate fields after split.
*
* @param int $parentID
* @access protected
* @return bool
*/
protected function updateParentAfterSplit(int $parentID): bool
{
$task = new stdclass();
$task->parent = '-1';
$task->lastEditedBy = $this->app->user->account;
$task->lastEditedDate = helper::now();
$this->dao->update(TABLE_TASK)->data($task)->where('id')->eq($parentID)->exec();
return !dao::isError();
}
/**
* 将任务的层级改为父子结构。
* Change the hierarchy of tasks to a parent-child structure.