diff --git a/module/task/model.php b/module/task/model.php index abb74d7a78..9cfcafa9da 100644 --- a/module/task/model.php +++ b/module/task/model.php @@ -410,9 +410,19 @@ class taskModel extends model $clonedTask->parent = $parentID; $this->dao->insert(TABLE_TASK)->data($clonedTask)->autoCheck()->exec(); - /* Update task estimate log. */ $clonedTaskID = $this->dao->lastInsertID(); - $this->updateTaskID($clonedTaskID, $oldParentTask->id); + + /* Update the table by judging the beginning of the version number. */ + if(preg_match('/^\d/', $this->config->version)) + { + /* ZenTao Pms update TABLE_TASKESTIMATE. */ + $this->dao->update(TABLE_TASKESTIMATE)->set('task')->eq($clonedTaskID)->where('task')->eq($oldParentTask->id)->exec(); + } + else + { + /* ZenTao Pro and ZenTao Biz update TABLE_EFFORT. */ + $this->dao->update(TABLE_EFFORT)->set('objectID')->eq($clonedTaskID)->where('objectID')->eq($oldParentTask->id)->exec(); + } } $this->updateParentStatus($taskID); @@ -499,19 +509,6 @@ 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. *