diff --git a/module/bug/control.php b/module/bug/control.php index 4decd84b84..92f7ba569d 100644 --- a/module/bug/control.php +++ b/module/bug/control.php @@ -570,8 +570,8 @@ class bug extends control if($projectID) { - $project = $this->loadModel('project')->getByID($projectID); - if(empty($bugID)) $projects = array($projectID => $project->name); + $project = $this->loadModel('project')->getByID($projectID); + if(empty($bugID) or $this->app->tab != 'qa') $projects = array($projectID => $project->name); } } elseif($projectID) @@ -580,8 +580,8 @@ class bug extends control $productList = $this->config->CRProduct ? $this->product->getOrderedProducts('all', 40, $projectID) : $this->product->getOrderedProducts('normal', 40, $projectID); foreach($productList as $product) $products[$product->id] = $product->name; - $project = $this->loadModel('project')->getByID($projectID); - if(empty($bugID)) $projects += array($projectID => $project->name); + $project = $this->loadModel('project')->getByID($projectID); + if(empty($bugID) or $this->app->tab != 'qa') $projects += array($projectID => $project->name); /* Set project menu. */ if($this->app->tab == 'project') $this->project->setMenu($projectID); @@ -591,8 +591,8 @@ class bug extends control $projects += $this->product->getProjectPairsByProduct($productID, $branch); } - /* When copying bug, get all project linked to the product. */ - if(!empty($bugID)) $projects += $this->product->getProjectPairsByProduct($productID, $branch); + /* Link all projects to product when copying bug under qa.*/ + if(!empty($bugID) and $this->app->tab == 'qa') $projects += $this->product->getProjectPairsByProduct($productID, $branch); /* Get block id of assinge to me. */ $blockID = 0; diff --git a/module/execution/control.php b/module/execution/control.php index 0a963e0551..904db8455a 100644 --- a/module/execution/control.php +++ b/module/execution/control.php @@ -1631,7 +1631,7 @@ class execution extends control $this->view->productPlans = $productPlans; $this->view->branchGroups = $this->execution->getBranchByProduct(array_keys($linkedProducts), $this->config->systemMode == 'new' ? $execution->project : 0, 'noclosed', $linkedBranchList); $this->view->teamMembers = $this->execution->getTeamMembers($executionID); - if($this->config->systemMode == 'new') $this->view->allProjects = $this->project->getPairsByModel($project->model, 0, 'noclosed'); + if($this->config->systemMode == 'new') $this->view->allProjects = $this->project->getPairsByModel($project->model, 0, 'noclosed', $project->id); $this->display(); } @@ -1677,8 +1677,9 @@ class execution extends control if($this->app->tab == 'project') { - $this->project->setMenu($this->session->project); - $this->view->project = $this->project->getById($this->session->project); + $projectID = $this->session->project; + $this->project->setMenu($projectID); + $this->view->project = $this->project->getById($projectID); } if(!$this->post->executionIDList) return print(js::locate($this->session->executionList, 'parent')); @@ -1716,7 +1717,7 @@ class execution extends control $this->view->position[] = $this->lang->execution->batchEdit; $this->view->executionIDList = $executionIDList; $this->view->executions = $executions; - $this->view->allProjects = $this->project->getPairsByModel('all', 0, 'noclosed'); + $this->view->allProjects = $this->project->getPairsByModel('all', 0, 'noclosed', isset($projectID) ? $projectID : 0); $this->view->pmUsers = $pmUsers; $this->view->poUsers = $poUsers; $this->view->qdUsers = $qdUsers; diff --git a/module/project/model.php b/module/project/model.php index 9076a4abde..0ae9c93ae7 100644 --- a/module/project/model.php +++ b/module/project/model.php @@ -678,12 +678,14 @@ class projectModel extends model /** * Get project pairs by model and project. * - * @param string $model all|scrum|waterfall|kanban - * @param int $programID + * @param string $model all|scrum|waterfall|kanban + * @param int $programID + * @param string $param noclosed + * @param string|int|array $append * @access public * @return array */ - public function getPairsByModel($model = 'all', $programID = 0, $param = '') + public function getPairsByModel($model = 'all', $programID = 0, $param = '', $append = '') { if(defined('TUTORIAL')) return $this->loadModel('tutorial')->getProjectPairs(); @@ -696,6 +698,7 @@ class projectModel extends model ->beginIF($model != 'all')->andWhere('model')->eq($model)->fi() ->beginIF(strpos($param, 'noclosed') !== false)->andWhere('status')->ne('closed')->fi() ->beginIF(!$this->app->user->admin)->andWhere('id')->in($this->app->user->view->projects)->fi() + ->beginIF(!empty($append))->orWhere('id')->in($append)->fi() ->orderBy('id_desc') ->fetchAll();