* Code for task #6484.
This commit is contained in:
@@ -1489,8 +1489,8 @@ class bug extends control
|
||||
$relatedBranch = array('0' => $this->lang->branch->all) + $this->dao->select('id, name')->from(TABLE_BRANCH)->where('id')->in($relatedBranchIdList)->fetchPairs();
|
||||
$relatedBuilds = array('trunk' => $this->lang->trunk) + $this->dao->select('id, name')->from(TABLE_BUILD)->where('id')->in($relatedBuildIdList)->fetchPairs();
|
||||
$relatedFiles = $this->dao->select('id, objectID, pathname, title')->from(TABLE_FILE)->where('objectType')->eq('bug')->andWhere('objectID')->in(@array_keys($bugs))->andWhere('extra')->ne('editor')->fetchGroup('objectID');
|
||||
$relatedModules = $this->loadModel('tree')->getAllModulePairs('bug');
|
||||
|
||||
$this->loadModel('tree');
|
||||
foreach($bugs as $bug)
|
||||
{
|
||||
if($this->post->fileType == 'csv')
|
||||
@@ -1509,11 +1509,11 @@ class bug extends control
|
||||
$bug->task = !isset($relatedTasks[$bug->task]) ? '' : $relatedTasks[$bug->task] . "($bug->task)";
|
||||
$bug->case = !isset($relatedCases[$bug->case]) ? '' : $relatedCases[$bug->case] . "($bug->case)";
|
||||
|
||||
if(isset($relatedModules[$bug->module])) $bug->module = $relatedModules[$bug->module] . "(#$bug->module)";
|
||||
if(isset($relatedBugs[$bug->duplicateBug])) $bug->duplicateBug = $relatedBugs[$bug->duplicateBug] . "($bug->duplicateBug)";
|
||||
if(isset($relatedBuilds[$bug->resolvedBuild])) $bug->resolvedBuild = $relatedBuilds[$bug->resolvedBuild] . "(#$bug->resolvedBuild)";
|
||||
if(isset($relatedBranch[$bug->branch])) $bug->branch = $relatedBranch[$bug->branch] . "(#$bug->branch)";
|
||||
$bugh->module = $bug->module ? $this->tree->getModulePathByID($bug->module) . "(#$bug->module)" : '';
|
||||
|
||||
|
||||
if(isset($bugLang->priList[$bug->pri])) $bug->pri = $bugLang->priList[$bug->pri];
|
||||
if(isset($bugLang->typeList[$bug->type])) $bug->type = $bugLang->typeList[$bug->type];
|
||||
if(isset($bugLang->severityList[$bug->severity])) $bug->severity = $bugLang->severityList[$bug->severity];
|
||||
|
||||
@@ -1530,8 +1530,8 @@ class story extends control
|
||||
$relatedFiles = $this->dao->select('id, objectID, pathname, title')->from(TABLE_FILE)->where('objectType')->eq('story')->andWhere('objectID')->in(@array_keys($stories))->andWhere('extra')->ne('editor')->fetchGroup('objectID');
|
||||
$relatedSpecs = $this->dao->select('*')->from(TABLE_STORYSPEC)->where('`story`')->in(@array_keys($stories))->orderBy('version desc')->fetchGroup('story');
|
||||
$relatedBranch = array('0' => $this->lang->branch->all) + $this->dao->select('id, name')->from(TABLE_BRANCH)->where('id')->in($relatedBranchIdList)->fetchPairs();
|
||||
$relatedModules = $this->loadModel('tree')->getAllModulePairs();
|
||||
|
||||
$this->loadModel('tree');
|
||||
foreach($stories as $story)
|
||||
{
|
||||
$story->spec = '';
|
||||
@@ -1560,7 +1560,6 @@ class story extends control
|
||||
if(isset($products[$story->product])) $story->product = $this->post->fileType == 'word' ? $products[$story->product] : $products[$story->product] . "(#$story->product)";
|
||||
if(isset($relatedModules[$story->module])) $story->module = $this->post->fileType == 'word' ? $relatedModules[$story->module] : $relatedModules[$story->module] . "(#$story->module)";
|
||||
if(isset($relatedBranch[$story->branch])) $story->branch = $relatedBranch[$story->branch] . "(#$story->branch)";
|
||||
$story->module = $story->module ? (($this->post->fileType == 'word') ? $this->tree->getModulePathByID($story->module) : $this->tree->getModulePathByID($story->module) . "(#$story->module)") : '';
|
||||
if(isset($story->plan))
|
||||
{
|
||||
$plans = '';
|
||||
|
||||
@@ -1378,9 +1378,9 @@ class task extends control
|
||||
}
|
||||
|
||||
/* Get related objects title or names. */
|
||||
$this->loadModel('tree');
|
||||
$relatedStories = $this->dao->select('id,title')->from(TABLE_STORY)->where('id')->in($relatedStoryIdList)->fetchPairs();
|
||||
$relatedFiles = $this->dao->select('id, objectID, pathname, title')->from(TABLE_FILE)->where('objectType')->eq('task')->andWhere('objectID')->in(@array_keys($tasks))->andWhere('extra')->ne('editor')->fetchGroup('objectID');
|
||||
$relatedModules = $this->loadModel('tree')->getAllModulePairs('task');
|
||||
|
||||
if($tasks)
|
||||
{
|
||||
@@ -1474,7 +1474,7 @@ class task extends control
|
||||
if(isset($taskLang->priList[$task->pri])) $task->pri = $taskLang->priList[$task->pri];
|
||||
if(isset($taskLang->statusList[$task->status])) $task->status = $this->processStatus('task', $task);
|
||||
if(isset($taskLang->reasonList[$task->closedReason])) $task->closedReason = $taskLang->reasonList[$task->closedReason];
|
||||
$task->module = $task->module ? $this->tree->getModulePathByID($task->module) . "(#$task->module)" : '';
|
||||
if(isset($relatedModules[$task->module])) $task->module = $relatedModules[$task->module] . "(#$task->module)";
|
||||
|
||||
if(isset($users[$task->openedBy])) $task->openedBy = $users[$task->openedBy];
|
||||
if(isset($users[$task->assignedTo])) $task->assignedTo = $users[$task->assignedTo];
|
||||
|
||||
@@ -1171,11 +1171,11 @@ class testcase extends control
|
||||
}
|
||||
|
||||
/* Get related objects title or names. */
|
||||
$relatedModules = $this->loadModel('tree')->getAllModulePairs('case');
|
||||
$relatedStories = $this->dao->select('id,title')->from(TABLE_STORY) ->where('id')->in($relatedStoryIdList)->fetchPairs();
|
||||
$relatedCases = $this->dao->select('id, title')->from(TABLE_CASE)->where('id')->in($relatedCaseIdList)->fetchPairs();
|
||||
$relatedSteps = $this->dao->select('id,parent,`case`,version,type,`desc`,expect')->from(TABLE_CASESTEP)->where('`case`')->in(@array_keys($cases))->orderBy('version desc,id')->fetchGroup('case', 'id');
|
||||
|
||||
$this->loadModel('tree');
|
||||
$cases = $this->testcase->appendData($cases);
|
||||
foreach($cases as $case)
|
||||
{
|
||||
@@ -1221,8 +1221,8 @@ class testcase extends control
|
||||
/* fill some field with useful value. */
|
||||
$case->product = !isset($products[$case->product]) ? '' : $products[$case->product] . "(#$case->product)";
|
||||
$case->branch = !isset($branches[$case->branch]) ? '' : $branches[$case->branch] . "(#$case->branch)";
|
||||
$case->module = !isset($relatedModules[$case->module])? '' : $relatedModules[$case->module] . "(#$case->module)";
|
||||
$case->story = !isset($relatedStories[$case->story]) ? '' : $relatedStories[$case->story] . "(#$case->story)";
|
||||
$case->module = $case->module ? $this->tree->getModulePathByID($case->module) . "(#$case->module)" : '';
|
||||
|
||||
if(isset($caseLang->priList[$case->pri])) $case->pri = $caseLang->priList[$case->pri];
|
||||
if(isset($caseLang->typeList[$case->type])) $case->type = $caseLang->typeList[$case->type];
|
||||
|
||||
+25
-13
@@ -26,27 +26,39 @@ class treeModel extends model
|
||||
}
|
||||
|
||||
/**
|
||||
* Get module path by ID.
|
||||
* Get all module pairs with path.
|
||||
*
|
||||
* @param int $moduleID
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function getModulePathByID($moduleID)
|
||||
public function getAllModulePairs($type = 'task')
|
||||
{
|
||||
$module = $this->dao->findById((int)$moduleID)->from(TABLE_MODULE)->fetch();
|
||||
if($module->parent == '0') return '/' . $module->name;
|
||||
$modules = $this->dao->select('*')->from(TABLE_MODULE)
|
||||
->where('type')->eq('story')
|
||||
->beginIF($type == 'task')->orWhere('type')->eq('task')->fi()
|
||||
->beginIF($type == 'bug')->orWhere('type')->eq('bug')->fi()
|
||||
->beginIF($type == 'case')->orWhere('type')->eq('case')->fi()
|
||||
->andWhere('deleted')->eq('0')
|
||||
->fetchAll();
|
||||
|
||||
$path = substr($module->path, 1, -1);
|
||||
$modules = $this->dao->select('id,name')->from(TABLE_MODULE)->where('id')->in($path)->orderBy('grade')->fetchPairs();
|
||||
|
||||
$modulePath = '';
|
||||
foreach($modules as $moduleName)
|
||||
$pairs = array();
|
||||
foreach($modules as $module)
|
||||
{
|
||||
$modulePath .= '/' . $moduleName;
|
||||
if($module->parent == '0')
|
||||
{
|
||||
$pairs[$module->id] = '/' . $module->name;
|
||||
continue;
|
||||
}
|
||||
|
||||
$path = substr($module->path, 1, -1);
|
||||
$relatedModules = $this->dao->select('id, name')->from(TABLE_MODULE)->where('id')->in($path)->orderBy('grade')->fetchPairs();
|
||||
$modulePath = '';
|
||||
|
||||
foreach($relatedModules as $moduleName) $modulePath .= '/' . $moduleName;
|
||||
$pairs[$module->id] = $modulePath;
|
||||
}
|
||||
|
||||
return $modulePath;
|
||||
|
||||
return $pairs;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user