This commit is contained in:
zhouxudong
2022-03-28 11:10:21 +08:00
parent 92648cadc8
commit 0f999761c9
+18 -6
View File
@@ -1883,24 +1883,23 @@ class taskModel extends model
->setDefault('canceledDate, lastEditedDate', $now)
->remove('comment')
->get();
$this->dao->update(TABLE_TASK)->data($task)->autoCheck()->where('id')->eq((int)$taskID)->exec();
if($oldTask->fromBug) $this->dao->update(TABLE_BUG)->set('toTask')->eq(0)->where('id')->eq($oldTask->fromBug)->exec();
if($oldTask->parent > 0) $this->updateParentStatus($taskID);
if($oldTask->parent == '-1')
{
$oldChildrenTasks = $this->dao->select('*')->from(TABLE_TASK)->where('parent')->eq($taskID)->andWhere('deleted')->eq(0)->fetchAll('id');
unset($task->assignedTo);
$this->dao->update(TABLE_TASK)->data($task)->autoCheck()->where('parent')->eq((int)$taskID)->exec();
$this->dao->update(TABLE_TASK)->set('assignedTo=openedBy')->where('parent')->eq((int)$taskID)->exec();
if(!dao::isError())
{
$childrenTasks = $this->dao->select('*')->from(TABLE_TASK)->where('parent')->eq($taskID)->andWhere('deleted')->eq(0)->fetchAll('id');
if(count($childrenTasks) > 0)
if(count($oldChildrenTasks) > 0)
{
foreach($childrenTasks as $childrenTask)
foreach($oldChildrenTasks as $oldChildrenTask)
{
$actionID = $this->action->create('task', $childrenTask->id, 'Canceled', $this->post->comment);
$this->action->logHistory($actionID, common::createChanges($childrenTask, $task));
$actionID = $this->action->create('task', $oldChildrenTask->id, 'Canceled', $this->post->comment);
$this->action->logHistory($actionID, common::createChanges($oldChildrenTask, $task));
}
}
}
@@ -1924,6 +1923,7 @@ class taskModel extends model
*/
public function activate($taskID, $extra)
{
$this->loadModel('action');
$extra = str_replace(array(',', ' '), array('&', ''), $extra);
parse_str($extra, $output);
@@ -1974,9 +1974,21 @@ class taskModel extends model
if($oldTask->parent > 0) $this->updateParentStatus($taskID);
if($oldTask->parent == '-1')
{
$oldChildrenTasks = $this->dao->select('*')->from(TABLE_TASK)->where('parent')->eq($taskID)->andWhere('deleted')->eq(0)->fetchAll('id');
unset($task->left);
$this->dao->update(TABLE_TASK)->data($task)->autoCheck()->where('parent')->eq((int)$taskID)->exec();
$this->computeWorkingHours($taskID);
if(!dao::isError())
{
if(count($oldChildrenTasks) > 0)
{
foreach($oldChildrenTasks as $oldChildrenTask)
{
$actionID = $this->action->create('task', $oldChildrenTask->id, 'Activated', $this->post->comment);
$this->action->logHistory($actionID, common::createChanges($oldChildrenTask, $task));
}
}
}
}
if($oldTask->story) $this->loadModel('story')->setStage($oldTask->story);
$this->loadModel('kanban');