* finish task #2050.

This commit is contained in:
wangyidong
2014-08-18 09:02:04 +00:00
parent 7681375b68
commit de50683bc3
3 changed files with 26 additions and 15 deletions
+16 -13
View File
@@ -929,40 +929,43 @@ class projectModel extends model
public function importBug($projectID)
{
$this->loadModel('bug');
$bugLang = $this->app->loadLang('bug');
$this->loadModel('task');
$this->loadModel('story');
$now = helper::now();
$BugToTasks = fixer::input('post')->get();
foreach($BugToTasks->import as $key => $value)
$now = helper::now();
$modules = $this->loadModel('tree')->getTaskOptionMenu($projectID);
$bugToTasks = fixer::input('post')->get();
$bugs = $this->bug->getByList(array_keys($bugToTasks->import));
foreach($bugToTasks->import as $key => $value)
{
$bug = $this->bug->getById($key);
$bug = $bugs[$key];
$task = new stdClass();
$task->project = $projectID;
$task->story = $bug->story;
$task->storyVersion = $bug->story;
$task->storyVersion = $bug->storyVersion;
$task->module = isset($modules[$bug->module]) ? $bug->module : 0;
$task->fromBug = $key;
$task->name = $bug->title;
$task->type = 'devel';
$task->pri = $BugToTasks->pri[$key];
$task->pri = $bugToTasks->pri[$key];
$task->consumed = 0;
$task->status = 'wait';
$task->desc = $bugLang->bug->resolve . ':' . '#' . html::a(helper::createLink('bug', 'view', "bugID=$key"), sprintf('%03d', $key));
$task->desc = $this->lang->bug->resolve . ':' . '#' . html::a(helper::createLink('bug', 'view', "bugID=$key"), sprintf('%03d', $key));
$task->openedDate = $now;
$task->openedBy = $this->app->user->account;
if(!empty($BugToTasks->estimate[$key]))
if(!empty($bugToTasks->estimate[$key]))
{
$task->estimate = $BugToTasks->estimate[$key];
$task->estimate = $bugToTasks->estimate[$key];
$task->left = $task->estimate;
}
if(!empty($BugToTasks->assignedTo[$key]))
if(!empty($bugToTasks->assignedTo[$key]))
{
$task->assignedTo = $BugToTasks->assignedTo[$key];
$task->assignedTo = $bugToTasks->assignedTo[$key];
$task->assignedDate = $now;
}
if(!$bug->confirmed) $this->dao->update(TABLE_BUG)->set('confirmed')->eq(1)->where('id')->eq($bug->id)->exec();
$this->dao->insert(TABLE_TASK)->data($task)->checkIF($BugToTasks->estimate[$key] != '', 'estimate', 'float')->exec();
$this->dao->insert(TABLE_TASK)->data($task)->checkIF($bugToTasks->estimate[$key] != '', 'estimate', 'float')->exec();
if(dao::isError())
{
+1
View File
@@ -37,6 +37,7 @@ function setStoryRelated(num)
$.get(link, function(moduleID)
{
$('#module' + num).val(moduleID);
$('#module' + num).trigger("chosen:updated");
});
}
}
+9 -2
View File
@@ -439,8 +439,7 @@ class treeModel extends model
if($linkStory)
{
/* Get story paths of this project. */
$paths = $this->dao->select('t3.' . $field)
->from(TABLE_PROJECTSTORY)->alias('t1')
$paths = $this->dao->select('DISTINCT t3.' . $field)->from(TABLE_PROJECTSTORY)->alias('t1')
->leftJoin(TABLE_STORY)->alias('t2')->on('t1.story = t2.id')
->leftJoin(TABLE_MODULE)->alias('t3')->on('t2.module = t3.id')
->where('t1.project')->eq($projectID)
@@ -461,6 +460,14 @@ class treeModel extends model
->andWhere('type')->eq('task')
->fetchPairs();
/* Add task paths of this project for has existed. */
$paths += $this->dao->select('DISTINCT t1.' . $field)->from(TABLE_MODULE)->alias('t1')
->leftJoin(TABLE_TASK)->alias('t2')->on('t1.id=t2.module')
->where('t2.module')->ne(0)
->andWhere('t2.deleted')->eq(0)
->andWhere('t1.type')->eq('story')
->fetchPairs();
/* Get all modules from paths. */
foreach($paths as $path)
{