* [task#140912,done,2h] finish task.

This commit is contained in:
sunguangming
2025-04-14 10:41:30 +08:00
committed by 刘刚
parent 90ec191c6b
commit c300f8b87b
8 changed files with 32 additions and 7 deletions
+15 -1
View File
@@ -978,8 +978,22 @@ class task extends control
public function delete(int $executionID, int $taskID, string $from = '')
{
$task = $this->task->getByID($taskID);
if($task->isParent) return $this->send(array('result' => 'fail', 'message' => $this->lang->task->cannotDeleteParent));
/* 如果是父任务,先删除所有子任务 */
if($task->isParent)
{
$childIdList = $this->task->getAllChildId($taskID);
$childTasks = $this->task->getByIdList($childIdList);
foreach($childTasks as $childID => $childTask)
{
if(strpos(",{$childTask->path},", ",$taskID,") === false) continue;
$this->task->delete(TABLE_TASK, $childID);
if($childTask->fromBug != 0) $this->dao->update(TABLE_BUG)->set('toTask')->eq(0)->where('id')->eq($childTask->fromBug)->exec();
if($childTask->story) $this->loadModel('story')->setStage($childTask->story);
}
}
/* 删除当前任务 */
$this->task->delete(TABLE_TASK, $taskID);
if($task->parent > 0)
{