* Fix bug.

This commit is contained in:
leiyong
2021-02-01 08:17:23 +08:00
parent 458b1e09b0
commit 450aa98ce0
10 changed files with 38 additions and 25 deletions
+4 -4
View File
@@ -161,6 +161,9 @@ class build extends control
*/
public function view($buildID, $type = 'story', $link = 'false', $param = '', $orderBy = 'id_desc', $recTotal = 0, $recPerPage = 100, $pageID = 1)
{
$build = $this->build->getByID((int)$buildID, true);
if(!$build) die(js::error($this->lang->notFound) . js::locate('back'));
/* Set session and load modules. */
if($type == 'story')$this->session->set('storyList', $this->app->getURI(true));
if($type == 'bug') $this->session->set('bugList', $this->app->getURI(true));
@@ -172,10 +175,7 @@ class build extends control
$this->app->loadClass('pager', $static = true);
if($this->app->getViewType() == 'mhtml') $recPerPage = 10;
/* Get build, product and bugs. */
$build = $this->build->getByID((int)$buildID, true);
if(!$build) die(js::error($this->lang->notFound) . js::locate('back'));
/* Get product and bugs. */
$product = $this->loadModel('product')->getById($build->product);
if($product->type != 'normal') $this->lang->product->branch = sprintf($this->lang->product->branch, $this->lang->product->branchName[$product->type]);
+3 -3
View File
@@ -489,11 +489,11 @@ class issue extends control
{
/* Set actions and get issue by id. */
$issue = $this->issue->getByID($issueID);
$this->session->PRJ = $issue->PRJ;
$this->commonAction($issueID, 'issue');
if(!$issue) die(js::error($this->lang->notFound) . js::locate('back'));
$this->session->PRJ = $issue->PRJ;
$this->commonAction($issueID, 'issue');
$this->view->title = $this->lang->issue->common . $this->lang->colon . $issue->title;
$this->view->position[] = $this->lang->issue->common;
$this->view->position[] = $this->lang->issue->basicInfo;
+7 -2
View File
@@ -110,6 +110,9 @@ class program extends control
*/
public function PGMProduct($programID = 0, $browseType = 'noclosed', $orderBy = 'order_desc', $recTotal = 0, $recPerPage = 15, $pageID = 1)
{
$program = $this->program->getPGMByID($programID);
if(empty($program) || $program->type != 'program') die(js::error($this->lang->notFound) . js::locate('back'));
$this->lang->navGroup->program = 'program';
$this->lang->program->switcherMenu = $this->program->getPGMSwitcher($programID, true);
$this->lang->program->mainMenuAction = $this->program->getPGMMainAction();
@@ -122,7 +125,6 @@ class program extends control
/* Get the top programID. */
if($programID)
{
$program = $this->program->getPGMByID($programID);
$path = explode(',', $program->path);
$path = array_filter($path);
$programID = current($path);
@@ -763,6 +765,9 @@ class program extends control
*/
public function index($projectID = 0)
{
$project = $this->program->getPRJByID($projectID);
if(empty($project) || $project->type != 'project') die(js::error($this->lang->notFound) . js::locate('back'));
$this->lang->navGroup->program = 'project';
$projectID = $this->program->savePRJState($projectID, $this->program->getPRJPairs());
@@ -771,7 +776,7 @@ class program extends control
$this->view->title = $this->lang->program->common . $this->lang->colon . $this->lang->program->PRJIndex;
$this->view->position[] = $this->lang->program->PRJIndex;
$this->view->project = $this->program->getPRJByID($projectID);
$this->view->project = $project;
$this->display();
}
+4 -4
View File
@@ -102,7 +102,7 @@ class programModel extends model
*/
public function getPGMByID($programID = 0)
{
return $this->dao->select('*')->from(TABLE_PROGRAM)->where('id')->eq($programID)->fetch();
return $this->dao->select('*')->from(TABLE_PROGRAM)->where('id')->eq($programID)->andWhere('`type`')->eq('program')->fetch();
}
/**
@@ -828,7 +828,7 @@ class programModel extends model
$currentProjectName = $this->lang->program->common;
if($projectID)
{
$currentProject = $this->project->getById($projectID);
$currentProject = $this->getPRJById($projectID);
$currentProjectName = $currentProject->name;
}
@@ -919,9 +919,9 @@ class programModel extends model
*/
public function getPRJByID($projectID)
{
if(!$projectID) return false;
$project = $this->dao->select('*')->from(TABLE_PROJECT)->where('id')->eq($projectID)->andWhere('`type`')->eq('project')->fetch();
if(!$project) return false;
$project = $this->dao->findById($projectID)->from(TABLE_PROJECT)->fetch();
if($project->end == '0000-00-00') $project->end = '';
return $project;
}
+5 -2
View File
@@ -1618,9 +1618,12 @@ class project extends control
*/
public function view($executionID)
{
$this->app->loadLang('program');
$execution = $this->project->getById($executionID, true);
if(!$execution) die(js::error($this->lang->notFound) . js::locate('back'));
if(empty($execution) || strpos('stage,sprint', $execution->type) === false) die(js::error($this->lang->notFound) . js::locate('back'));
$this->app->loadLang('program');
$this->session->PRJ = $execution->project;
/* Project not found to prevent searching for .*/
if(!isset($this->projects[$execution->id])) $this->projects = $this->project->getExecutionPairs($execution->project, 'all', 'nocode');
+3 -4
View File
@@ -42,11 +42,10 @@ class projectrelease extends control
public function commonAction($productID = 0, $branch = 0)
{
$this->lang->product->menu = $this->lang->product->viewMenu;
$this->lang->product->switcherMenu = $this->loadModel('product')->getSwitcher($productID);
$this->lang->product->switcherMenu = $this->product->getSwitcher($productID);
/* Get product and product list by project. */
$this->loadModel('product');
$products = $this->loadModel('product')->getProductPairsByProject($this->session->PRJ);
$products = $this->product->getProductPairsByProject($this->session->PRJ);
if(!$productID) $productID = key($products);
$product = $this->product->getById($productID);
@@ -54,7 +53,7 @@ class projectrelease extends control
$this->view->product = $product;
$this->view->branches = (isset($product->type) and $product->type == 'normal') ? array() : $this->loadModel('branch')->getPairs($productID);
$this->view->branch = $branch;
$this->view->project = $this->loadModel('project')->getById($this->session->PRJ);
$this->view->project = $this->loadModel('program')->getPRJById($this->session->PRJ);
}
/**
+3 -3
View File
@@ -140,6 +140,9 @@ class release extends control
*/
public function view($releaseID, $type = 'story', $link = 'false', $param = '', $orderBy = 'id_desc', $recTotal = 0, $recPerPage = 100, $pageID = 1)
{
$release = $this->release->getById((int)$releaseID, true);
if(!$release) die(js::error($this->lang->notFound) . js::locate('back'));
if($type == 'story') $this->session->set('storyList', $this->app->getURI(true));
if($type == 'bug' or $type == 'leftBug') $this->session->set('bugList', $this->app->getURI(true));
@@ -150,9 +153,6 @@ class release extends control
$this->app->loadClass('pager', $static = true);
if($this->app->getViewType() == 'mhtml') $recPerPage = 10;
$release = $this->release->getById((int)$releaseID, true);
if(!$release) die(js::error($this->lang->notFound) . js::locate('back'));
$storyPager = new pager($type == 'story' ? $recTotal : 0, $recPerPage, $type == 'story' ? $pageID : 1);
$stories = $this->dao->select('*')->from(TABLE_STORY)->where('id')->in($release->stories)->andWhere('deleted')->eq(0)
->beginIF($type == 'story')->orderBy($orderBy)->fi()
+3 -2
View File
@@ -133,14 +133,15 @@ class risk extends control
*/
public function view($riskID)
{
$this->loadModel('action');
$risk = $this->risk->getById($riskID);
if(empty($risk)) die(js::error($this->lang->notFound) . js::locate('back'));
$this->session->PRJ = $risk->PRJ;
$this->view->title = $this->lang->risk->common . $this->lang->colon . $this->lang->risk->view;
$this->view->position[] = $this->lang->risk->view;
$this->view->risk = $risk;
$this->view->actions = $this->action->getList('risk', $riskID);
$this->view->actions = $this->loadModel('action')->getList('risk', $riskID);
$this->view->users = $this->loadModel('user')->getPairs('noletter');
$this->display();
+5
View File
@@ -197,6 +197,11 @@ class testtask extends control
/* Get test task, and set menu. */
$task = $this->testtask->getById($taskID, true);
if(!$task) die(js::error($this->lang->notFound) . js::locate('back'));
/* When the session changes, you need to query the related products again. */
if($this->session->PRJ != $task->PRJ) $this->view->products = $this->products = $this->product->getProductPairsByProject($task->PRJ);
$this->session->PRJ = $task->PRJ;
$productID = $task->product;
$buildID = $task->build;
+1 -1
View File
@@ -46,7 +46,7 @@ class weekly extends control
$this->view->sv = $this->weekly->getSV($this->view->ev, $this->view->pv);
$this->view->cv = $this->weekly->getCV($this->view->ev, $this->view->ac);
$this->view->program = $this->loadModel('project')->getByID($program);
$this->view->program = $this->loadModel('program')->getPRJByID($program);
$this->view->weekSN = $this->weekly->getWeekSN($this->view->program->begin, $date);
$this->view->monday = $this->weekly->getThisMonday($date);
$this->view->lastDay = $this->weekly->getLastDay($date);