From 8b650b83093d6c18d516e8237098da4cdab0e8cb Mon Sep 17 00:00:00 2001 From: sunguangming Date: Mon, 5 Jun 2023 14:03:23 +0800 Subject: [PATCH] * Move code. --- module/task/model.php | 16 ++++++++++++++++ module/task/tao.php | 15 --------------- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/module/task/model.php b/module/task/model.php index ee5f5a38de..d41fcf17f3 100755 --- a/module/task/model.php +++ b/module/task/model.php @@ -1844,6 +1844,22 @@ class taskModel extends model $task = $this->getById($oldEffort->objectID); $data = $this->buildTaskForUpdateEffort($task, $oldEffort, $effort); + /* Process multi-task by effort. */ + if(!empty($task->team)) + { + $currentTeam = $this->getTeamByAccount($task->team, $oldEffort->account, array('order' => $oldEffort->order)); + if($currentTeam) + { + $newTeamInfo = new stdclass(); + $newTeamInfo->consumed = $currentTeam->consumed + $effort->consumed - $oldEffort->consumed; + if($currentTeam->status != 'done') $newTeamInfo->left = $left; + if($currentTeam->status != 'done' and $newTeamInfo->consumed > 0 and $left == 0) $newTeamInfo->status = 'done'; + $this->dao->update(TABLE_TASKTEAM)->data($newTeamInfo)->where('id')->eq($currentTeam->id)->exec(); + + $data = $this->computeMultipleHours($task, $data); + } + } + $this->dao->update(TABLE_TASK)->data($data)->where('id')->eq($task->id)->exec(); if(dao::isError()) return false; diff --git a/module/task/tao.php b/module/task/tao.php index 2e68d3af11..0a6c990c79 100644 --- a/module/task/tao.php +++ b/module/task/tao.php @@ -190,21 +190,6 @@ class taskTao extends taskModel $data->assignedTo = $task->openedBy; } - if(!empty($task->team)) - { - $currentTeam = $this->getTeamByAccount($task->team, $oldEffort->account, array('order' => $oldEffort->order)); - if($currentTeam) - { - $newTeamInfo = new stdclass(); - $newTeamInfo->consumed = $currentTeam->consumed + $effort->consumed - $oldEffort->consumed; - if($currentTeam->status != 'done') $newTeamInfo->left = $left; - if($currentTeam->status != 'done' and $newTeamInfo->consumed > 0 and $left == 0) $newTeamInfo->status = 'done'; - $this->dao->update(TABLE_TASKTEAM)->data($newTeamInfo)->where('id')->eq($currentTeam->id)->exec(); - - $data = $this->computeMultipleHours($task, $data); - } - } - return $data; }