diff --git a/module/execution/control.php b/module/execution/control.php index 18b23b3220..a73b869e18 100644 --- a/module/execution/control.php +++ b/module/execution/control.php @@ -3439,8 +3439,8 @@ class execution extends control if(!empty($_POST)) { - if($object->type != 'project' and $object->project != 0) $this->execution->linkStory($object->project); - $this->execution->linkStory($objectID, array(), array(), $extra); + if($object->type != 'project' and $object->project != 0) $this->execution->linkStory($object->project, array(), array(), '', array(), $storyType); + $this->execution->linkStory($objectID, array(), array(), $extra, array(), $storyType); if(isonlybody()) { @@ -3572,6 +3572,7 @@ class execution extends control $this->view->browseLink = $browseLink; $this->view->project = $project; $this->view->storyType = $storyType; + if($this->config->edition == 'ipd') $this->view->roadmaps = $this->loadModel('roadmap')->getPairs(array_keys($products)); $this->display(); } diff --git a/module/execution/model.php b/module/execution/model.php index 93352e69de..81a29691de 100755 --- a/module/execution/model.php +++ b/module/execution/model.php @@ -3280,11 +3280,12 @@ class executionModel extends model * @param array $products * @param string $extra * @param array $lanes + * @param string $storyType * * @access public * @return bool */ - public function linkStory($executionID, $stories = array(), $products = array(), $extra = '', $lanes = array()) + public function linkStory($executionID, $stories = array(), $products = array(), $extra = '', $lanes = array(), $storyType = 'story') { if(empty($executionID)) return false; if(empty($stories)) $stories = $this->post->stories; @@ -3330,6 +3331,7 @@ class executionModel extends model $action = $execution->type == 'project' ? 'linked2project' : 'linked2execution'; if($action == 'linked2execution' and $execution->type == 'kanban') $action = 'linked2kanban'; if($execution->multiple or $execution->type == 'project') $this->action->create('story', $storyID, $action, '', $executionID); + if($storyType == 'requirement' and $execution->model == 'ipd') $this->dao->update(TABLE_STORY)->set('status')->eq('developing')->where('id')->eq($storyID)->exec(); } if(!isset($output['laneID']) or !isset($output['columnID'])) $this->kanban->updateLane($executionID, 'story'); @@ -3433,6 +3435,7 @@ class executionModel extends model public function unlinkStory($executionID, $storyID, $laneID = 0, $columnID = 0) { $execution = $this->dao->findById($executionID)->from(TABLE_EXECUTION)->fetch(); + $storyType = $this->dao->findById($storyID)->from(TABLE_STORY)->fetch('type'); if($execution->type == 'project') { $executions = $this->dao->select('*')->from(TABLE_EXECUTION)->where('parent')->eq($executionID)->fetchAll('id'); @@ -3441,6 +3444,9 @@ class executionModel extends model } $this->dao->delete()->from(TABLE_PROJECTSTORY)->where('project')->eq($executionID)->andWhere('story')->eq($storyID)->limit(1)->exec(); + /* In ipd project, unlink stories change it's status to launched. */ + if($execution->model == 'ipd' and $storyType == 'requirement') $this->dao->update(TABLE_STORY)->set('status')->eq('launched')->where('id')->eq($storyID)->exec(); + /* Resolve TABLE_KANBANCELL's field cards. */ if($execution->type == 'kanban') { diff --git a/module/execution/view/linkstory.html.php b/module/execution/view/linkstory.html.php index f22479c597..46884c4a02 100644 --- a/module/execution/view/linkstory.html.php +++ b/module/execution/view/linkstory.html.php @@ -48,8 +48,13 @@ story->product;?> story->module;?> - '>story->plan;?> + '>story->plan;?> + model == 'ipd' and $storyType == 'requirement'):?> + story->roadmap;?> + story->status;?> + story->stage;?> + hasProduct && $productType != 'normal'):?> product->branchName[$productType];?> @@ -88,8 +93,13 @@ createLink('product', 'browse', "productID=$story->product&branch=$story->branch"), $products[$story->product]->name);?> '>module, '')?> - ' title='planTitle;?>'>planTitle;?> + ' title='planTitle;?>'>planTitle;?> + model == 'ipd' and $storyType == 'requirement'):?> + roadmap, '');?> + story->statusList, $story->status);?> + story->stageList, $story->stage);?> + hasProduct && $productType != 'normal'):?> product][$story->branch])) echo $branchGroups[$story->product][$story->branch];?>