diff --git a/module/execution/view/taskkanban.html.php b/module/execution/view/taskkanban.html.php index 2a9b390200..82b86be94a 100644 --- a/module/execution/view/taskkanban.html.php +++ b/module/execution/view/taskkanban.html.php @@ -91,7 +91,7 @@ $canCreateStory = ($productID and common::hasPriv('story', 'create')); $canBatchCreateStory = ($productID and common::hasPriv('story', 'batchCreate')); $canLinkStory = ($productID and common::hasPriv('execution', 'linkStory')); - $canLinkStoryByPlan = ($productID and common::hasPriv('execution', 'importplanstories')); + $canLinkStoryByPlan = ($productID and common::hasPriv('execution', 'importplanstories') and !empty($execution->hasProduct)); $hasStoryButton = ($canCreateStory or $canBatchCreateStory or $canLinkStory or $canLinkStoryByPlan); $hasTaskButton = ($canCreateTask or $canBatchCreateTask or $canImportBug); $hasBugButton = ($canCreateBug or $canBatchCreateBug); diff --git a/module/product/model.php b/module/product/model.php index 821ff51233..0b715c3e81 100644 --- a/module/product/model.php +++ b/module/product/model.php @@ -340,9 +340,10 @@ class productModel extends model * @param string $mode * @param string $programID * @param string|array $append + * @param number|bool $shadow * @return array */ - public function getPairs($mode = '', $programID = 0, $append = '') + public function getPairs($mode = '', $programID = 0, $append = '', $shadow = false) { if(defined('TUTORIAL')) return $this->loadModel('tutorial')->getProductPairs(); @@ -359,6 +360,7 @@ class productModel extends model ->beginIF($programID)->andWhere('t1.program')->eq($programID)->fi() ->beginIF(strpos($mode, 'noclosed') !== false)->andWhere('t1.status')->ne('closed')->fi() ->beginIF(!$this->app->user->admin and $this->config->vision == 'rnd')->andWhere('t1.id')->in($views)->fi() + ->beginIF(is_numeric($shadow))->andWHere('t1.shadow')->eq($shadow)->fi() ->andWhere('t1.vision')->eq($this->config->vision) ->orderBy('isClosed, t2.order_asc, t1.line_desc, t1.order_asc') ->fetchPairs('id', 'name'); @@ -373,6 +375,7 @@ class productModel extends model ->beginIF($programID)->andWhere('program')->eq($programID)->fi() ->beginIF(strpos($mode, 'noclosed') !== false)->andWhere('status')->ne('closed')->fi() ->beginIF(!$this->app->user->admin and $this->config->vision == 'rnd')->andWhere('id')->in($views)->fi() + ->beginIF(is_numeric($shadow))->andWHere('t1.shadow')->eq($shadow)->fi() ->andWhere('vision')->eq($this->config->vision) ->orderBy($orderBy) ->fetchPairs('id', 'name'); diff --git a/module/programplan/model.php b/module/programplan/model.php index 4efccd5daa..c9d85a333b 100755 --- a/module/programplan/model.php +++ b/module/programplan/model.php @@ -683,32 +683,34 @@ class programplanModel extends model return false; } + $project = $this->loadModel('project')->getByID($projectID); + $datas = array(); foreach($names as $key => $name) { if(empty($name)) continue; $plan = new stdclass(); - $plan->id = isset($planIDList[$key]) ? $planIDList[$key] : ''; - $plan->type = 'stage'; - $plan->project = $projectID; - $plan->parent = $parentID ? $parentID : $projectID; - $plan->name = $names[$key]; - $plan->percent = $percents[$key]; - $plan->attribute = empty($parentID) ? $attributes[$key] : $parentAttribute; - $plan->milestone = $milestone[$key]; - $plan->begin = empty($begin[$key]) ? '0000-00-00' : $begin[$key]; - $plan->end = empty($end[$key]) ? '0000-00-00' : $end[$key]; - $plan->realBegan = empty($realBegan[$key]) ? '0000-00-00' : $realBegan[$key]; - $plan->realEnd = empty($realEnd[$key]) ? '0000-00-00' : $realEnd[$key]; - $plan->output = empty($output[$key]) ? '' : implode(',', $output[$key]); - $plan->acl = empty($parentID) ? $acl[$key] : $parentACL; - $plan->PM = empty($PM[$key]) ? '' : $PM[$key]; + $plan->id = isset($planIDList[$key]) ? $planIDList[$key] : ''; + $plan->type = 'stage'; + $plan->project = $projectID; + $plan->parent = $parentID ? $parentID : $projectID; + $plan->name = $names[$key]; + $plan->percent = $percents[$key]; + $plan->attribute = empty($parentID) ? $attributes[$key] : $parentAttribute; + $plan->milestone = $milestone[$key]; + $plan->begin = empty($begin[$key]) ? '0000-00-00' : $begin[$key]; + $plan->end = empty($end[$key]) ? '0000-00-00' : $end[$key]; + $plan->realBegan = empty($realBegan[$key]) ? '0000-00-00' : $realBegan[$key]; + $plan->realEnd = empty($realEnd[$key]) ? '0000-00-00' : $realEnd[$key]; + $plan->output = empty($output[$key]) ? '' : implode(',', $output[$key]); + $plan->acl = empty($parentID) ? $acl[$key] : $parentACL; + $plan->PM = empty($PM[$key]) ? '' : $PM[$key]; + $plan->hasProduct = $project->hasProduct; $datas[] = $plan; } - $project = $this->loadModel('project')->getByID($projectID); $totalPercent = 0; $totalDevType = 0; diff --git a/module/story/control.php b/module/story/control.php index a5ce713a48..da9894da2b 100755 --- a/module/story/control.php +++ b/module/story/control.php @@ -502,17 +502,9 @@ class story extends control $this->view->execution = $execution; /* Hidden some fields of projects without products. */ - if($execution->type === 'project' || $execution->type === 'kanban') + if(in_array($execution->type, array('project', 'kanban', 'stage'), true)) { - if($execution->type === 'project') - { - $project = $this->dao->findById((int)$executionID)->from(TABLE_PROJECT)->fetch(); - } - else - { - $projectID = $execution->project; - $project = $this->dao->findById((int)$projectID)->from(TABLE_PROJECT)->fetch(); - } + $project = $this->dao->findById((int)$executionID)->from(TABLE_PROJECT)->fetch(); if(empty($project->hasProduct)) { diff --git a/module/tree/control.php b/module/tree/control.php index dcb034f663..01898938e1 100644 --- a/module/tree/control.php +++ b/module/tree/control.php @@ -102,7 +102,7 @@ class tree extends control if($viewType == 'story') { /* Set menu.*/ - $products = $this->product->getPairs(); + $products = $this->product->getPairs($mode = '', $programID = 0, $append = '', $shadow = 0); $this->product->saveState($rootID, $products); unset($products[$rootID]);