diff --git a/module/block/control.php b/module/block/control.php index 97b8c240ed..4c495d49c3 100644 --- a/module/block/control.php +++ b/module/block/control.php @@ -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); } diff --git a/module/bug/control.php b/module/bug/control.php index e037c2b4d5..def51c6a53 100644 --- a/module/bug/control.php +++ b/module/bug/control.php @@ -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) { diff --git a/module/build/control.php b/module/build/control.php index 64f9e38007..0ba0fad7ce 100644 --- a/module/build/control.php +++ b/module/build/control.php @@ -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); diff --git a/module/doc/control.php b/module/doc/control.php index 7147df9c9c..9466f4c39b 100644 --- a/module/doc/control.php +++ b/module/doc/control.php @@ -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 { diff --git a/module/execution/control.php b/module/execution/control.php index bbf85352c6..df23d17c30 100644 --- a/module/execution/control.php +++ b/module/execution/control.php @@ -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); diff --git a/module/execution/model.php b/module/execution/model.php index ed9497d869..ad5e38f632 100644 --- a/module/execution/model.php +++ b/module/execution/model.php @@ -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); diff --git a/module/product/control.php b/module/product/control.php index 28caed261b..b4f889178a 100644 --- a/module/product/control.php +++ b/module/product/control.php @@ -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); diff --git a/module/product/model.php b/module/product/model.php index 1bcd27a152..165e70ea0c 100644 --- a/module/product/model.php +++ b/module/product/model.php @@ -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.*/ diff --git a/module/productplan/control.php b/module/productplan/control.php index 35bafa162e..d687bdc59e 100644 --- a/module/productplan/control.php +++ b/module/productplan/control.php @@ -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); } /** diff --git a/module/project/control.php b/module/project/control.php index 6033f94b7c..bf9dc57219 100644 --- a/module/project/control.php +++ b/module/project/control.php @@ -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); diff --git a/module/release/control.php b/module/release/control.php index 00a639a52c..4e23cf9da1 100644 --- a/module/release/control.php +++ b/module/release/control.php @@ -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); } /** diff --git a/module/repo/control.php b/module/repo/control.php index 6c53faba2d..c291621f40 100644 --- a/module/repo/control.php +++ b/module/repo/control.php @@ -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 { diff --git a/module/story/control.php b/module/story/control.php index 833bda8797..da386b6a47 100644 --- a/module/story/control.php +++ b/module/story/control.php @@ -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') { diff --git a/module/task/control.php b/module/task/control.php index f87ede1663..036b0c69b7 100644 --- a/module/task/control.php +++ b/module/task/control.php @@ -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]; diff --git a/module/tree/control.php b/module/tree/control.php index d80e41ce17..293ebd4627 100644 --- a/module/tree/control.php +++ b/module/tree/control.php @@ -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;