* 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);
}
+1 -1
View File
@@ -293,7 +293,7 @@ class bug extends control
$extras = str_replace(array(',', ' '), array('&', ''), $extras);
parse_str($extras, $output);
if(isset($output['executionID'])) commonModel::setAppObjectID('execution', $output['executionID']);
if(isset($output['executionID'])) $this->loadModel('execution')->setMenu($output['executionID']);
foreach($output as $paramKey => $paramValue)
{
+1 -2
View File
@@ -46,9 +46,8 @@ class build extends control
}
elseif($this->app->openApp == 'execution')
{
$execution = $this->execution->getByID($executionID);
$executions = $this->execution->getPairs($execution->project);
$this->execution->setMenu($executions, $executionID);
$this->execution->setMenu($executionID);
}
$productGroups = $this->execution->getProducts($executionID);
+1 -2
View File
@@ -936,8 +936,7 @@ class doc extends control
}
elseif($from == 'execution')
{
$executions = $this->loadModel('execution')->getPairs(0, 'all', 'nocode');
$this->execution->setMenu($executions, $objectID);
$this->execution->setMenu($objectID);
}
else
{
+1 -1
View File
@@ -541,7 +541,7 @@ class execution extends control
$this->loadModel('bug');
$executions = $this->execution->getPairs(0, 'all', 'nocode');
$this->execution->setMenu($executions, $executionID);
$this->execution->setMenu($executionID);
/* Load pager. */
$this->app->loadClass('pager', $static = true);
+2 -2
View File
@@ -53,15 +53,15 @@ class executionModel extends model
/**
* Set menu.
*
* @param array $executions
* @param int $executionID
* @param int $buildID
* @param string $extra
* @access public
* @return void
*/
public function setMenu($executions, $executionID, $buildID = 0, $extra = '')
public function setMenu($executionID, $buildID = 0, $extra = '')
{
$executions = $this->loadModel('execution')->getPairs(0, 'all', 'nocode');
if(!$executionID and $this->session->execution) $executionID = $this->session->execution;
if(!$executionID or !in_array($executionID, array_keys($executions))) $executionID = key($executions);
$this->session->set('execution', $executionID);
+2 -1
View File
@@ -121,6 +121,8 @@ class product extends control
*/
public function browse($productID = 0, $branch = 0, $browseType = '', $param = 0, $storyType = 'story', $orderBy = '', $recTotal = 0, $recPerPage = 20, $pageID = 1, $projectID = 0)
{
$productID = $this->product->saveState($productID, $this->products);
if($this->app->openApp == 'product') $this->product->setMenu($productID, $branch);
if($this->app->openApp == 'project') $this->loadModel('project')->setMenu($projectID);
@@ -132,7 +134,6 @@ class product extends control
$this->loadModel('execution');
/* Set product, module and query. */
$productID = $this->app->openApp != 'projectstory' ? $this->product->saveState($productID, $this->products) : $productID;
$branch = ($branch === '') ? (int)$this->cookie->preBranch : (int)$branch;
setcookie('preProductID', $productID, $this->config->cookieLife, $this->config->webRoot, '', false, true);
setcookie('preBranch', (int)$branch, $this->config->cookieLife, $this->config->webRoot, '', false, true);
+1 -1
View File
@@ -768,7 +768,7 @@ class productModel extends model
$this->config->product->search['queryID'] = $queryID;
$this->config->product->search['params']['plan']['values'] = $this->loadModel('productplan')->getPairs($productID);
$product = ($this->app->rawModule == 'projectstory' and empty($productID)) ? $products : array($productID => $products[$productID]);
$product = ($this->app->openApp == 'project' and empty($productID)) ? $products : array($productID => $products[$productID]);
$this->config->product->search['params']['product']['values'] = $product + array('all' => $this->lang->product->allProduct);
/* Get module of all products.*/
+1 -1
View File
@@ -31,7 +31,7 @@ class productplan extends control
$this->view->branch = $branch;
$this->view->branches = $product->type == 'normal' ? array() : $this->loadModel('branch')->getPairs($productID);
$this->view->position[] = html::a($this->createLink('product', 'browse', "productID={$productID}&branch=$branch"), $product->name);
$this->product->setMenu($this->product->getPairs(), $productID, $branch);
$this->product->setMenu($productID, $branch);
}
/**
-1
View File
@@ -174,7 +174,6 @@ class project extends control
*/
public function index($projectID = 0)
{
$this->lang->noMenuModule[] = 'project';
$projectID = $this->project->saveState($projectID, $this->project->getPairsByProgram());
$this->project->setMenu($projectID);
-1
View File
@@ -29,7 +29,6 @@ class release extends control
$this->view->branch = $branch;
$this->view->branches = $product->type == 'normal' ? array() : $this->loadModel('branch')->getPairs($product->id);
$this->view->position[] = html::a($this->createLink('product', 'browse', "productID={$this->view->product->id}&branch=$branch"), $this->view->product->name);
$this->product->setMenu($this->product->getPairs(), $productID, $branch);
}
/**
+1 -2
View File
@@ -51,8 +51,7 @@ class repo extends control
}
else if($openApp == 'execution')
{
$executions = $this->loadModel('execution')->getPairs(0, 'all', 'nocode');
$this->execution->setMenu($executions, $objectID);
$this->execution->setMenu($objectID);
}
else
{
+2 -4
View File
@@ -342,8 +342,7 @@ class story extends control
if($executionID)
{
$executions = $this->execution->getPairs();
$this->execution->setMenu($executions, $executionID);
$this->execution->setMenu($executionID);
$execution = $this->dao->findById((int)$executionID)->from(TABLE_EXECUTION)->fetch();
if($execution->type == 'project')
@@ -848,8 +847,7 @@ class story extends control
$from = $this->app->openApp;
if($from == 'execution')
{
$executions = $this->loadModel('execution')->getPairs(0, 'all', 'nocode');
$this->execution->setMenu($executions, $param);
$this->execution->setMenu($param);
}
elseif($from == 'project')
{
+3 -3
View File
@@ -41,7 +41,7 @@ class task extends control
{
$executions = $this->execution->getPairs();
$executionID = $this->execution->saveState($executionID, $executions);
$this->execution->setMenu($executions, $executionID);
$this->execution->setMenu($executionID);
$this->execution->getLimitedExecution();
$limitedExecutions = !empty($_SESSION['limitedExecutions']) ? $_SESSION['limitedExecutions'] : '';
@@ -83,7 +83,7 @@ class task extends control
$storyLink = $this->session->storyList ? $this->session->storyList : $this->createLink('execution', 'story', "executionID=$executionID");
/* Set menu. */
$this->execution->setMenu($executions, $execution->id);
$this->execution->setMenu($execution->id);
if(!empty($_POST))
{
@@ -1342,7 +1342,7 @@ class task extends control
$executions = $this->execution->getPairs();
$this->execution->setMenu($executions, $executionID);
$this->execution->setMenu($executionID);
$this->executions = $executions;
$this->view->title = $this->executions[$executionID] . $this->lang->colon . $this->lang->task->report->common;
$this->view->position[] = $this->executions[$executionID];
+1 -1
View File
@@ -306,7 +306,7 @@ class tree extends control
$executions = $this->execution->getPairs($this->session->PRJ);
/* Set menu. */
$this->execution->setMenu($executions, $rootID);
$this->execution->setMenu($rootID);
$this->lang->tree->menu = $this->lang->execution->menu;
$this->lang->tree->menuOrder = $this->lang->execution->menuOrder;