* Finish task #87014.

This commit is contained in:
liumengyi
2023-03-14 03:09:15 +00:00
parent 9728298427
commit 0955f65414
9 changed files with 177 additions and 1 deletions
+21 -1
View File
@@ -2864,10 +2864,11 @@ class executionModel extends model
{
$this->loadModel('task');
$dateExceed = '';
$taskStories = array();
$parents = array();
$execution = $this->getByID($executionID);
$tasks = $this->dao->select('id,execution,assignedTo,story,consumed,status,parent')->from(TABLE_TASK)->where('id')->in($this->post->tasks)->fetchAll('id');
$tasks = $this->dao->select('id,execution,assignedTo,story,consumed,status,parent,estStarted,deadline')->from(TABLE_TASK)->where('id')->in($this->post->tasks)->fetchAll('id');
foreach($tasks as $task)
{
/* Save the assignedToes and stories, should linked to execution. */
@@ -2887,6 +2888,13 @@ class executionModel extends model
$data->canceledDate = null;
}
if(!empty($this->config->limitTaskDate))
{
if($task->estStarted < $execution->begin or $task->estStarted > $execution->end or $task->deadline > $execution->end or $task->deadline < $execution->begin) $dateExceed .= "#{$task->id},";
if($task->estStarted < $execution->begin or $task->estStarted > $execution->end) $data->estStarted = $execution->begin;
if($task->deadline > $execution->end or $task->deadline < $execution->begin) $data->deadline = $execution->end;
}
/* Update tasks. */
$this->dao->update(TABLE_TASK)->data($data)->where('id')->eq($task->id)->exec();
unset($data->status);
@@ -2895,6 +2903,12 @@ class executionModel extends model
$this->loadModel('action')->create('task', $task->id, 'moved', '', $task->execution);
}
if(!empty($dateExceed))
{
$dateExceed = trim($dateExceed, ',');
echo js::alert(sprintf($this->lang->task->error->dateExceed, $dateExceed));
}
/* Get stories of children task. */
if(!empty($parents))
{
@@ -3045,6 +3059,12 @@ class executionModel extends model
return false;
}
if(!empty($this->config->limitTaskDate))
{
$this->task->checkEstStartedAndDeadline($executionID, $task->estStarted, $task->deadline);
if(dao::isError()) return false;
}
$tasks[$key] = $task;
}