diff --git a/module/caselib/model.php b/module/caselib/model.php index 8f03af8c2e..2a4e752873 100644 --- a/module/caselib/model.php +++ b/module/caselib/model.php @@ -74,11 +74,13 @@ class caselibModel extends model * @param int $libID * @param bool $setImgSize * @access public - * @return object + * @return object|bool */ public function getById($libID, $setImgSize = false) { $lib = $this->dao->select('*')->from(TABLE_TESTSUITE)->where('id')->eq((int)$libID)->fetch(); + if(!$lib) return false; + $lib = $this->loadModel('file')->replaceImgURL($lib, 'desc'); if($setImgSize) $lib->desc = $this->file->setImgSize($lib->desc); return $lib; diff --git a/module/execution/control.php b/module/execution/control.php index 6e6036cfb8..6c79a4d124 100644 --- a/module/execution/control.php +++ b/module/execution/control.php @@ -2280,6 +2280,9 @@ class execution extends control $executionID = $this->execution->saveState((int)$executionID, $this->executions); $execution = $this->execution->getById($executionID, true); + $type = $this->config->vision == 'lite' ? 'kanban' : 'stage,sprint,kanban'; + if(empty($execution) || strpos($type, $execution->type) === false) return print(js::error($this->lang->notFound) . js::locate('back')); + $execution->projectInfo = $this->loadModel('project')->getByID($execution->project); if($this->config->systemMode == 'new') @@ -2289,9 +2292,6 @@ class execution extends control $this->view->programList = $this->loadModel('program')->getPairsByList($programList); } - $type = $this->config->vision == 'lite' ? 'kanban' : 'stage,sprint,kanban'; - if(empty($execution) || strpos($type, $execution->type) === false) return print(js::error($this->lang->notFound) . js::locate('back')); - if($execution->type == 'kanban' and defined('RUN_MODE') and RUN_MODE == 'api') return print($this->fetch('execution', 'kanban', "executionID=$executionID")); $this->app->loadLang('program'); diff --git a/module/story/control.php b/module/story/control.php index 1baefae6cd..105528bd04 100644 --- a/module/story/control.php +++ b/module/story/control.php @@ -1237,15 +1237,15 @@ class story extends control $this->session->set('buildList', $uri, $buildApp); $this->app->loadLang('bug'); - $storyID = (int)$storyID; - $story = $this->story->getById($storyID, $version, true); - $version = empty($version) ? $story->version : $version; + $storyID = (int)$storyID; + $story = $this->story->getById($storyID, $version, true); $linkModuleName = $this->config->vision == 'lite' ? 'project' : 'product'; if(!$story) return print(js::error($this->lang->notFound) . js::locate($this->createLink($linkModuleName, 'index'))); if(!$this->app->user->admin and strpos(",{$this->app->user->view->products},", ",$story->product,") === false) return print(js::error($this->lang->product->accessDenied) . js::locate('back')); - $story = $this->story->mergeReviewer($story, true); + $version = empty($version) ? $story->version : $version; + $story = $this->story->mergeReviewer($story, true); $this->story->replaceURLang($story->type); diff --git a/module/task/control.php b/module/task/control.php index 868ed21179..c54d8265ff 100755 --- a/module/task/control.php +++ b/module/task/control.php @@ -951,11 +951,6 @@ class task extends control */ public function view($taskID) { - $this->session->set('executionList', $this->app->getURI(true), 'execution'); - - $this->commonAction($taskID); - if($this->app->tab == 'project') $this->loadModel('project')->setMenu($this->session->project); - $taskID = (int)$taskID; $task = $this->task->getById($taskID, true); if(!$task) @@ -964,6 +959,11 @@ class task extends control return print(js::error($this->lang->notFound) . js::locate($this->createLink('execution', 'all'))); } + $this->session->set('executionList', $this->app->getURI(true), 'execution'); + + $this->commonAction($taskID); + if($this->app->tab == 'project') $this->loadModel('project')->setMenu($this->session->project); + $execution = $this->execution->getById($task->execution); if(!isonlybody() and $execution->type == 'kanban') { diff --git a/module/testcase/control.php b/module/testcase/control.php index fb431e6e3a..01b49602f5 100644 --- a/module/testcase/control.php +++ b/module/testcase/control.php @@ -758,13 +758,15 @@ class testcase extends control $caseID = (int)$caseID; $case = $this->testcase->getById($caseID, $version); - $case = $this->loadModel('story')->checkNeedConfirm($case); + if(!$case) { if(defined('RUN_MODE') && RUN_MODE == 'api') return $this->send(array('status' => 'fail', 'message' => '404 Not found')); return print(js::error($this->lang->notFound) . js::locate($this->createLink('qa', 'index'))); } + $case = $this->loadModel('story')->checkNeedConfirm($case); + if($from == 'testtask') { $run = $this->loadModel('testtask')->getRunByCase($taskID, $caseID);