Merge branch 'master' of github.com:easysoft/zentaopms

This commit is contained in:
wangyidong
2017-08-21 14:48:02 +08:00
7 changed files with 66 additions and 28 deletions
+2 -2
View File
@@ -1467,7 +1467,7 @@ class bugModel extends model
$i++;
}
}
return array('title' => $title, 'steps' => $bugSteps, 'storyID' => $run->case->story, 'moduleID' => $run->case->module, 'version' => $run->case->version);
}
@@ -1538,7 +1538,7 @@ class bugModel extends model
{
$datas = $this->dao->select('module as name, count(module) as value')->from(TABLE_BUG)->where($this->reportCondition())->groupBy('module')->orderBy('value DESC')->fetchAll('name');
if(!$datas) return array();
$modules = $this->loadModel('tree')->getModulesName(array_keys($datas));
$modules = $this->loadModel('tree')->getModulesName(array_keys($datas),true,true);
foreach($datas as $moduleID => $data) $data->name = isset($modules[$moduleID]) ? $modules[$moduleID] : '/';
return $datas;
}
+8 -8
View File
@@ -1268,11 +1268,11 @@ class story extends control
/**
* The report page.
*
* @param int $productID
* @param string $browseType
*
* @param int $productID
* @param string $browseType
* @param int $branchID
* @param int $moduleID
* @param int $moduleID
* @access public
* @return void
*/
@@ -1307,12 +1307,12 @@ class story extends control
$this->view->checkedCharts = $this->post->charts ? join(',', $this->post->charts) : '';
$this->display();
}
/**
* get data to export
*
* @param int $productID
* @param string $orderBy
*
* @param int $productID
* @param string $orderBy
* @access public
* @return void
*/
+28 -7
View File
@@ -193,7 +193,7 @@ class storyModel extends model
->set('version')->eq(1)
->exec();
}
if($bugID > 0)
{
$bug = new stdclass();
@@ -1959,7 +1959,7 @@ class storyModel extends model
/**
* Get report data of storys per product
*
*
* @access public
* @return array
*/
@@ -1975,25 +1975,46 @@ class storyModel extends model
}
/**
* Get report data of storys per module
*
* Get report data of storys per module
*
* @access public
* @return array
*/
public function getDataOfStorysPerModule()
{
$datas = $this->dao->select('module as name, count(module) as value')->from(TABLE_STORY)
$datas = $this->dao->select('module as name, count(module) as value, product, branch')->from(TABLE_STORY)
->where($this->reportCondition())
->groupBy('module')->orderBy('value DESC')->fetchAll('name');
if(!$datas) return array();
$branchIDList = array();
foreach($datas as $key => $project)
{
if(!$project->branch) continue;
$branchIDList[] = $project->branch;
}
$branchIDList = array_unique($branchIDList);
$branchs = $this->dao->select('id, name')->from(TABLE_BRANCH)->where('id')->in($branchIDList)->andWhere('deleted')->eq(0)->fetchALL('id');
$modules = $this->loadModel('tree')->getModulesName(array_keys($datas));
foreach($datas as $moduleID => $data) $data->name = isset($modules[$moduleID]) ? $modules[$moduleID] : '/';
foreach($datas as $moduleID => $data)
{
$branch = '';
if(isset($branchs[$data->branch]->name))
{
$branch = '/' . $branchs[$data->branch]->name;
}
$data->name = $branch . (isset($modules[$moduleID]) ? $modules[$moduleID] : '/');
}
return $datas;
}
/**
* Get report data of storys per source
*
*
* @access public
* @return array
*/
+3 -2
View File
@@ -139,7 +139,8 @@ class task extends control
}
$users = $this->loadModel('user')->getPairs('noclosed');
$stories = $this->story->getProjectStoryPairs($projectID);
$moduleIdList = $this->tree->getAllChildID($moduleID);
$stories = $this->story->getProjectStoryPairs($projectID, 0, 0, $moduleIdList);
$members = $this->project->getTeamMemberPairs($projectID, 'nodeleted');
$moduleOptionMenu = $this->tree->getTaskOptionMenu($projectID);
@@ -1087,7 +1088,7 @@ class task extends control
*/
public function report($projectID, $browseType = 'all')
{
$this->loadModel('report');
$this->view->charts = array();
+3 -2
View File
@@ -1356,7 +1356,8 @@ class taskModel extends model
->orderBy('value DESC')
->fetchAll('name');
if(!$datas) return array();
$modules = $this->loadModel('tree')->getModulesName(array_keys($datas));
$modules = $this->loadModel('tree')->getModulesName(array_keys($datas),true,true);
foreach($datas as $moduleID => $data) $data->name = isset($modules[$moduleID]) ? $modules[$moduleID] : '/';
return $datas;
}
@@ -1422,7 +1423,7 @@ class taskModel extends model
return $priList;
}
/**
* Get report data of tasks per deadline
*
+2 -2
View File
@@ -62,11 +62,11 @@
<div class='main main-side'>
<fieldset>
<legend><?php echo $lang->task->legendBasic;?></legend>
<table class='table table-form'>
<table class='table table-form'>
<tr>
<th class='w-80px'><?php echo $lang->task->project;?></th>
<td><?php echo html::select('project', $projects, $task->project, 'class="form-control chosen" onchange="loadAll(this.value)"');?></td>
</tr>
</tr>
<tr>
<th><?php echo $lang->task->module;?></th>
<td id="moduleIdBox"><?php echo html::select('module', $modules, $task->module, 'class="form-control chosen" onchange="loadModuleRelated()"');?></td>
+20 -5
View File
@@ -1103,18 +1103,21 @@ class treeModel extends model
/**
* Get modules name.
*
* @param array $moduleIdList
* @param bool $allPath
*
* @param array $moduleIdList
* @param bool $allPath
* @param bool $branchPath
* @access public
* @return array
*/
public function getModulesName($moduleIdList, $allPath = true)
public function getModulesName($moduleIdList, $allPath = true, $branchPath = false)
{
if(!$allPath) return $this->dao->select('id, name')->from(TABLE_MODULE)->where('id')->in($moduleIdList)->andWhere('deleted')->eq(0)->fetchPairs('id', 'name');
$modules = $this->dao->select('id, name, path')->from(TABLE_MODULE)->where('id')->in($moduleIdList)->andWhere('deleted')->eq(0)->fetchAll('path');
$modules = $this->dao->select('id, name, path, branch')->from(TABLE_MODULE)->where('id')->in($moduleIdList)->andWhere('deleted')->eq(0)->fetchAll('path');
$allModules = $this->dao->select('id, name')->from(TABLE_MODULE)->where('id')->in(join(array_keys($modules)))->andWhere('deleted')->eq(0)->fetchPairs('id', 'name');
$branchIDList = array();
$modulePairs = array();
foreach($modules as $module)
{
@@ -1122,7 +1125,19 @@ class treeModel extends model
$moduleName = '';
foreach($paths as $path) $moduleName .= '/' . $allModules[$path];
$modulePairs[$module->id] = $moduleName;
if($module->branch) $branchIDList[] = $module->branch;
}
if(!$branchPath) return $modulePairs;
$branchIDList = array_unique($branchIDList);
$branchs = $this->dao->select('id, name')->from(TABLE_BRANCH)->where('id')->in($branchIDList)->andWhere('deleted')->eq(0)->fetchALL('id');
foreach($modules as $module)
{
if(isset($modulePairs[$module->id])) $modulePairs[$module->id] = '/' . $branchs[$module->branch]->name . $modulePairs[$module->id];
}
return $modulePairs;
}