diff --git a/module/bug/control.php b/module/bug/control.php index c6a42059b3..56fb4ce14a 100755 --- a/module/bug/control.php +++ b/module/bug/control.php @@ -1688,7 +1688,7 @@ class bug extends control public function ajaxGetProjects(int $productID, string $branch = '', int $projectID = 0, string $pageType = '') { $product = $this->loadModel('product')->fetchByID($productID); - $projectPairs = $product->shadow ? $this->loadModel('project')->getPairs(false, 'noproduct,noclosed') : array(); + $projectPairs = $product->shadow ? $this->loadModel('project')->getPairs(false, 'noproduct,noclosed,haspriv') : array(); $projects = $this->product->getProjectPairsByProduct($productID, $branch, array_keys($projectPairs)); if($this->app->getViewType() == 'json') return print(json_encode($projects)); if($pageType == 'old') return print(html::select('project', array(0 => '') + $projects, $projectID, "class='form-control' onchange='loadProductExecutions({$productID}, this.value)'")); diff --git a/module/bug/zen.php b/module/bug/zen.php index 9ccaa6dcd9..43a6bdfb11 100644 --- a/module/bug/zen.php +++ b/module/bug/zen.php @@ -1176,7 +1176,7 @@ class bugZen extends bug if(!empty($bug->execution) && empty($executions[$bug->execution]) && !in_array($execution->attribute, $unAllowedStage)) $executions[$execution->id] = $execution->name . "({$this->lang->bug->deleted})"; /* Get project pairs. */ - $projectPairs = $product->shadow ? $this->loadModel('project')->getPairs(false, 'noproduct,noclosed') : array(); + $projectPairs = $product->shadow ? $this->loadModel('project')->getPairs(false, 'noproduct,noclosed,haspriv') : array(); $projects = $this->product->getProjectPairsByProduct($bug->product, (string)$bug->branch, array_keys($projectPairs)); if(!empty($bug->project) && empty($projects[$bug->project])) { diff --git a/module/project/model.php b/module/project/model.php index 0ee37b4d68..fe109c0795 100755 --- a/module/project/model.php +++ b/module/project/model.php @@ -730,19 +730,20 @@ class projectModel extends model * Get project pairs. * * @param bool $ignoreVision - * @param string $param + * @param string $params * @access public * @return object */ - public function getPairs(bool $ignoreVision = false, string $param = '') + public function getPairs(bool $ignoreVision = false, string $params = '') { return $this->dao->select('id, name')->from(TABLE_PROJECT) ->where('type')->eq('project') ->andWhere('deleted')->eq(0) ->beginIF(!$ignoreVision)->andWhere('vision')->eq($this->config->vision)->fi() - ->beginIF(strpos($param, 'noproduct') !== false)->andWhere('hasProduct')->eq(0)->fi() - ->beginIF(strpos($param, 'noclosed') !== false)->andWhere('status')->ne('closed')->fi() - ->beginIF(strpos($param, 'nosprint') !== false)->andWhere('multiple')->eq('0')->fi() + ->beginIF(strpos($params, 'noproduct') !== false)->andWhere('hasProduct')->eq(0)->fi() + ->beginIF(strpos($params, 'noclosed') !== false)->andWhere('status')->ne('closed')->fi() + ->beginIF(strpos($params, 'nosprint') !== false)->andWhere('multiple')->eq('0')->fi() + ->beginIF(!$this->app->user->admin && strpos($params, 'haspriv') !== false)->andWhere('id')->in($this->app->user->view->projects)->fi() ->fetchPairs(); }