* Finish task #3220.

This commit is contained in:
pengjiangxiu
2017-09-21 09:10:22 +08:00
parent 221a7e1db9
commit a0779473fc
3 changed files with 26 additions and 4 deletions
+21 -1
View File
@@ -111,7 +111,27 @@ class taskModel extends model
$tasks = fixer::input('post')->get();
$batchNum = count(reset($tasks));
$result = $this->loadModel('common')->removeDuplicate('task', $tasks, "project=$projectID");
$storyIDs = array();
$taskNames = array();
foreach($tasks->story as $key => $storyID)
{
if(empty($tasks->name[$key])) continue;
$inNames = in_array($tasks->name[$key], $taskNames);
if(!$inNames || $inNames && !in_array($storyID, $storyIDs))
{
$storyIDs[] = $storyID;
$taskNames[] = $tasks->name[$key];
}
else
{
dao::$errors['message'][] = sprintf($this->lang->duplicate, $this->lang->task->common);
echo js::error(dao::getError());
exit;
}
}
$result = $this->loadModel('common')->removeDuplicate('task', $tasks, "project=$projectID and story " . helper::dbIN($storyIDs));
$tasks = $result['data'];
/* check estimate. */