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/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))
{