* Fix setMenu of execution.

This commit is contained in:
zhujinyong
2021-03-22 11:44:09 +08:00
parent 3af50442f6
commit c7313cefd6
15 changed files with 48 additions and 54 deletions
+31 -31
View File
@@ -216,7 +216,7 @@ class block extends control
$commonField = 'common';
if($module == 'project')
{
$project = $this->loadModel('project')->getByID($this->session->PRJ);
$project = $this->loadModel('project')->getByID($this->session->project);
$commonField = $project->model . 'common';
}
@@ -431,7 +431,7 @@ class block extends control
/* Create a project block. */
if($dashboard == 'project')
{
$project = $this->loadModel('project')->getByID($this->session->PRJ);
$project = $this->loadModel('project')->getByID($this->session->project);
$model = $project->model;
}
@@ -587,7 +587,7 @@ class block extends control
$this->session->set('storyList', $uri);
if(preg_match('/[^a-zA-Z0-9_]/', $this->params->type)) die();
$projectID = $this->view->block->module == 'my' ? 0 : (int)$this->session->PRJ;
$projectID = $this->view->block->module == 'my' ? 0 : (int)$this->session->project;
$this->view->tasks = $this->loadModel('task')->getUserTasks($this->app->user->account, $this->params->type, $this->viewType == 'json' ? 0 : (int)$this->params->count, null, $this->params->orderBy, $projectID);
}
@@ -602,7 +602,7 @@ class block extends control
$this->session->set('bugList', $this->app->getURI(true));
if(preg_match('/[^a-zA-Z0-9_]/', $this->params->type)) die();
$projectID = $this->lang->navGroup->qa == 'project' ? $this->session->PRJ : 0;
$projectID = $this->lang->navGroup->qa == 'project' ? $this->session->project : 0;
$projectID = $this->view->block->module == 'my' ? 0 : $projectID;
$this->view->bugs = $this->loadModel('bug')->getUserBugs($this->app->user->account, $this->params->type, $this->params->orderBy, $this->viewType == 'json' ? 0 : (int)$this->params->count, null, $projectID);
}
@@ -619,7 +619,7 @@ class block extends control
$this->app->loadLang('testcase');
$this->app->loadLang('testtask');
$projectID = $this->lang->navGroup->qa == 'project' ? $this->session->PRJ : 0;
$projectID = $this->lang->navGroup->qa == 'project' ? $this->session->project : 0;
$projectID = $this->view->block->module == 'my' ? 0 : $projectID;
$cases = array();
@@ -663,7 +663,7 @@ class block extends control
$this->session->set('testtaskList', $this->app->getURI(true));
if(preg_match('/[^a-zA-Z0-9_]/', $this->params->type)) die();
$projectID = $this->lang->navGroup->qa == 'project' ? $this->session->PRJ : 0;
$projectID = $this->lang->navGroup->qa == 'project' ? $this->session->project : 0;
$projectID = $this->view->block->module == 'my' ? 0 : $projectID;
$this->view->testtasks = $this->dao->select('t1.*,t2.name as productName,t3.name as buildName,t4.name as projectName')->from(TABLE_TESTTASK)->alias('t1')
@@ -733,7 +733,7 @@ class block extends control
->leftJoin(TABLE_PRODUCT)->alias('t2')->on('t1.product=t2.id')
->leftJoin(TABLE_BUILD)->alias('t3')->on('t1.build=t3.id')
->where('t1.deleted')->eq('0')
->beginIF($this->view->block->module != 'my' and $this->session->PRJ)->andWhere('t1.project')->eq((int)$this->session->PRJ)->fi()
->beginIF($this->view->block->module != 'my' and $this->session->project)->andWhere('t1.project')->eq((int)$this->session->project)->fi()
->beginIF(!$this->app->user->admin)->andWhere('t1.product')->in($this->app->user->view->products)->fi()
->orderBy('t1.id desc')
->beginIF($this->viewType != 'json')->limit((int)$this->params->count)->fi()
@@ -755,7 +755,7 @@ class block extends control
->leftJoin(TABLE_PRODUCT)->alias('t2')->on('t1.product=t2.id')
->where('t1.deleted')->eq('0')
->beginIF(!$this->app->user->admin)->andWhere('t1.project')->in($this->app->user->view->projects)->fi()
->beginIF($this->view->block->module != 'my' and $this->session->PRJ)->andWhere('t1.project')->eq((int)$this->session->PRJ)->fi()
->beginIF($this->view->block->module != 'my' and $this->session->project)->andWhere('t1.project')->eq((int)$this->session->project)->fi()
->orderBy('t1.id desc')
->beginIF($this->viewType != 'json')->limit((int)$this->params->count)->fi()
->fetchAll();
@@ -1043,7 +1043,7 @@ class block extends control
$count = isset($this->params->count) ? (int)$this->params->count : 0;
/* Get projects. */
$projectID = $this->view->block->module == 'my' ? 0 : (int)$this->session->PRJ;
$projectID = $this->view->block->module == 'my' ? 0 : (int)$this->session->project;
$executions = $this->loadModel('execution')->getOrderedExecutions($projectID, $status, $count);
if(empty($executions))
{
@@ -1163,7 +1163,7 @@ class block extends control
*/
public function printWaterfallReportBlock()
{
$project = $this->loadModel('project')->getByID($this->session->PRJ);
$project = $this->loadModel('project')->getByID($this->session->project);
$today = helper::today();
$date = date('Ymd', strtotime('this week Monday'));
$begin = $project->begin;
@@ -1173,14 +1173,14 @@ class block extends control
$task = $this->dao->select("
sum(consumed) as totalConsumed,
sum(if(status != 'cancel' and status != 'closed', `left`, 0)) as totalLeft")
->from(TABLE_TASK)->where('project')->eq($this->session->PRJ)
->from(TABLE_TASK)->where('project')->eq($this->session->project)
->andWhere('deleted')->eq(0)
->andWhere('parent')->lt(1)
->fetch();
$this->view->pv = $this->weekly->getPV($this->session->PRJ, $today);
$this->view->ev = $this->weekly->getEV($this->session->PRJ, $today);
$this->view->ac = $this->weekly->getAC($this->session->PRJ, $today);
$this->view->pv = $this->weekly->getPV($this->session->project, $today);
$this->view->ev = $this->weekly->getEV($this->session->project, $today);
$this->view->ac = $this->weekly->getAC($this->session->project, $today);
$this->view->sv = $this->weekly->getSV($this->view->ev, $this->view->pv);
$this->view->cv = $this->weekly->getCV($this->view->ev, $this->view->ac);
@@ -1196,11 +1196,11 @@ class block extends control
*/
public function printWaterfallGanttBlock()
{
$products = $this->loadModel('product')->getProductPairsByProject($this->session->PRJ);
$products = $this->loadModel('product')->getProductPairsByProject($this->session->project);
$productID = $this->session->product ? $this->session->product : 0;
$productID = isset($products[$productID]) ? $productID : key($products);
$this->view->plans = $this->loadModel('programplan')->getDataForGantt($this->session->PRJ, $productID, 0, 'task', false);
$this->view->plans = $this->loadModel('programplan')->getDataForGantt($this->session->project, $productID, 0, 'task', false);
$this->view->products = $products;
$this->view->productID = $productID;
}
@@ -1217,7 +1217,7 @@ class block extends control
$this->session->set('issueList', $uri);
if(preg_match('/[^a-zA-Z0-9_]/', $this->params->type)) die();
$this->view->users = $this->loadModel('user')->getPairs('noletter');
$this->view->issues = $this->loadModel('issue')->getBlockIssues($this->session->PRJ, $this->params->type, $this->viewType == 'json' ? 0 : (int)$this->params->count, $this->params->orderBy);
$this->view->issues = $this->loadModel('issue')->getBlockIssues($this->session->project, $this->params->type, $this->viewType == 'json' ? 0 : (int)$this->params->count, $this->params->orderBy);
}
/**
@@ -1231,7 +1231,7 @@ class block extends control
$uri = $this->app->getURI(true);
$this->session->set('riskList', $uri);
$this->view->users = $this->loadModel('user')->getPairs('noletter');
$this->view->risks = $this->loadModel('risk')->getBlockRisks($this->session->PRJ, $this->params->type, $this->viewType == 'json' ? 0 : (int)$this->params->count, $this->params->orderBy);
$this->view->risks = $this->loadModel('risk')->getBlockRisks($this->session->project, $this->params->type, $this->viewType == 'json' ? 0 : (int)$this->params->count, $this->params->orderBy);
}
/**
@@ -1243,12 +1243,12 @@ class block extends control
public function printWaterfallEstimateBlock()
{
$this->app->loadLang('durationestimation');
$projectID = $this->session->PRJ;
$projectID = $this->session->project;
$members = $this->loadModel('project')->getTeamMemberPairs($projectID);
$budget = $this->loadModel('workestimation')->getBudget($projectID);
if(empty($budget)) $budget = new stdclass();
$this->view->people = $this->dao->select('sum(people) as people')->from(TABLE_DURATIONESTIMATION)->where('project')->eq($this->session->PRJ)->fetch('people');
$this->view->people = $this->dao->select('sum(people) as people')->from(TABLE_DURATIONESTIMATION)->where('project')->eq($this->session->project)->fetch('people');
$this->view->members = count($members) ? count($members) - 1 : 0;
$this->view->consumed = $this->dao->select('sum(cast(consumed as decimal(10,2))) as consumed')->from(TABLE_TASK)->where('project')->eq($projectID)->andWhere('deleted')->eq(0)->andWhere('parent')->lt(1)->fetch('consumed');
$this->view->budget = $budget;
@@ -1264,7 +1264,7 @@ class block extends control
{
$this->loadModel('milestone');
$this->loadModel('weekly');
$projectID = $this->session->PRJ;
$projectID = $this->session->project;
$project = $this->loadModel('project')->getByID($projectID);
$begin = $project->begin;
@@ -1301,7 +1301,7 @@ class block extends control
*/
public function printScrumOverviewBlock()
{
$projectID = $this->session->PRJ;
$projectID = $this->session->project;
$this->app->loadLang('execution');
$totalData = $this->loadModel('project')->getOverviewList('byId', $projectID, 'id_desc', 1);
@@ -1324,7 +1324,7 @@ class block extends control
$this->app->loadClass('pager', $static = true);
$pager = pager::init(0, $count, 1);
$this->app->loadLang('execution');
$this->view->executionStats = $this->loadModel('project')->getStats($this->session->PRJ, $type, 0, 0, 30, 'id_desc', $pager);
$this->view->executionStats = $this->loadModel('project')->getStats($this->session->project, $type, 0, 0, 30, 'id_desc', $pager);
}
/**
@@ -1367,7 +1367,7 @@ class block extends control
$sprints = $this->dao->select('status, count(*) as sprints')->from(TABLE_EXECUTION)
->where('deleted')->eq(0)
->andWhere('type')->eq('sprint')
->andWhere('parent')->eq($this->session->PRJ)
->andWhere('parent')->eq($this->session->project)
->groupBy('status')
->fetchPairs();
@@ -1392,7 +1392,7 @@ class block extends control
*/
public function printProjectDynamicBlock()
{
$projectID = $this->session->PRJ;
$projectID = $this->session->project;
$executions = $this->loadModel('execution')->getPairs($projectID);
$products = $this->loadModel('product')->getProductPairsByProject($projectID);
@@ -1424,7 +1424,7 @@ class block extends control
$this->session->set('releaseList', $this->app->getURI(true));
$this->session->set('productPlanList', $this->app->getURI(true));
$products = $this->loadModel('product')->getPairs('', $this->session->PRJ);
$products = $this->loadModel('product')->getPairs('', $this->session->project);
if(!is_numeric($productID)) $productID = key($products);
$this->view->roadmaps = $this->product->getRoadmap($productID, 0, 6);
@@ -1461,7 +1461,7 @@ class block extends control
->leftJoin(TABLE_PROJECT)->alias('t4')->on('t1.project=t4.id')
->leftJoin(TABLE_PROJECTPRODUCT)->alias('t5')->on('t1.project=t5.project')
->where('t1.deleted')->eq('0')
->andWhere('t1.project')->eq($this->session->PRJ)->fi()
->andWhere('t1.project')->eq($this->session->project)->fi()
->andWhere('t1.product = t5.product')
->beginIF($status != 'all')->andWhere('t1.status')->eq($status)->fi()
->orderBy('t1.id desc')
@@ -1483,7 +1483,7 @@ class block extends control
$status = isset($this->params->type) ? $this->params->type : '';
$count = isset($this->params->count) ? (int)$this->params->count : 0;
$projectID = $this->lang->navGroup->qa == 'project' ? $this->session->PRJ : 0;
$projectID = $this->lang->navGroup->qa == 'project' ? $this->session->project : 0;
$products = $this->loadModel('product')->getOrderedProducts($status, $count, $projectID);
if(empty($products))
{
@@ -1587,7 +1587,7 @@ class block extends control
*/
public function printExecutionOverviewBlock()
{
$projectID = $this->view->block->module == 'my' ? 0 : (int)$this->session->PRJ;
$projectID = $this->view->block->module == 'my' ? 0 : (int)$this->session->project;
$executions = $this->loadModel('execution')->getList($projectID);
$total = 0;
@@ -1620,7 +1620,7 @@ class block extends control
{
$casePairs = $this->dao->select('lastRunResult, COUNT(*) AS count')->from(TABLE_CASE)
->where('1=1')
->beginIF($this->view->block->module != 'my' and $this->session->PRJ)->andWhere('project')->eq((int)$this->session->PRJ)->fi()
->beginIF($this->view->block->module != 'my' and $this->session->project)->andWhere('project')->eq((int)$this->session->project)->fi()
->groupBy('lastRunResult')
->fetchPairs();
@@ -1657,7 +1657,7 @@ class block extends control
$status = isset($this->params->type) ? $this->params->type : 'all';
$pager = pager::init(0, $count, 1);
$projectID = $this->view->block->module == 'my' ? 0 : (int)$this->session->PRJ;
$projectID = $this->view->block->module == 'my' ? 0 : (int)$this->session->project;
$this->view->executionStats = $this->loadModel('project')->getStats($projectID, $status, 0, 0, 30, 'id_asc', $pager);
}