From a1f4993517f28dc91208aed76c15c30bdf591340 Mon Sep 17 00:00:00 2001 From: qiyu-xie Date: Thu, 22 Oct 2020 14:02:07 +0800 Subject: [PATCH] * Fix bug. --- module/task/model.php | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/module/task/model.php b/module/task/model.php index d7b319309d..623b3ee84e 100644 --- a/module/task/model.php +++ b/module/task/model.php @@ -379,7 +379,7 @@ class taskModel extends model /* Update task estimate log. */ $clonedTaskID = $this->dao->lastInsertID(); - $this->dao->update(TABLE_TASKESTIMATE)->set('task')->eq($clonedTaskID)->where('task')->eq($oldParentTask->id)->exec(); + $this->updateTaskID($clonedTaskID, $oldParentTask->id); } $this->updateParentStatus($taskID); @@ -466,6 +466,19 @@ class taskModel extends model return !dao::isError(); } + /** + * Update task ID in TABLE_TASKESTIMATE. + * + * @param int $newID + * @param int $oldID + * @access public + * @return void + */ + public function updateTaskID($newID, $oldID) + { + $this->dao->update(TABLE_TASKESTIMATE)->set('task')->eq($newID)->where('task')->eq($oldID)->exec(); + } + /** * Update parent status by taskID. * @@ -481,7 +494,7 @@ class taskModel extends model if($parentID <= 0) return true; $oldParentTask = $this->dao->select('*')->from(TABLE_TASK)->where('id')->eq($parentID)->fetch(); - if($oldParentTask->parent != '-1') $this->dao->update(TABLE_TASK)->set('parent')->eq('-1')->where('id')->eq($parentID)->exec(); + if($oldParentTask->parent != '-1') $this->dao->update(TABLE_TASK)->set('parent')->eq('-1')->where('id')->eq($parentID)->exec(); $this->computeWorkingHours($parentID); $childrenStatus = $this->dao->select('id,status')->from(TABLE_TASK)->where('parent')->eq($parentID)->andWhere('deleted')->eq(0)->fetchPairs('status', 'status'); @@ -2282,7 +2295,7 @@ class taskModel extends model $task = $this->processTask($task); if(!empty($task->children)) { - foreach($task->children as $child) + foreach($task->children as $child) { $tasks[$task->id]->children[$child->id] = $this->processTask($child); }