diff --git a/module/execution/control.php b/module/execution/control.php index 6d0e3736eb..9dbd9647bb 100644 --- a/module/execution/control.php +++ b/module/execution/control.php @@ -1733,10 +1733,28 @@ class execution extends control $this->view->linkedBranches = $linkedBranches; } + if(!$project->hasProduct) + { + $shadowProduct = $this->loadModel('product')->getShadowProductByProject($project->id); + $productPlan = $this->loadModel('productplan')->getPairs($shadowProduct->id, '0,0', 'noclosed,unexpired', true); + } + if(!empty($_POST)) { if(isset($_POST['attribute']) and in_array($_POST['attribute'], array('request', 'design', 'review'))) unset($_POST['plans']); + /* No product execution link plans. */ + if(!$project->hasProduct and !empty($_POST['plans'])) + { + $plansItem = array(); + foreach($_POST['plans'] as $planItem) + { + if(empty($planItem[0][0])) continue; + $plansItem[] = $planItem[0][0]; + } + $_POST['plans'] = array($_POST['products'][0] => array(0 => $plansItem)); + } + $executionID = $this->execution->create($copyExecutionID); if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError())); diff --git a/module/story/model.php b/module/story/model.php index ce627b9b37..c7769f426f 100644 --- a/module/story/model.php +++ b/module/story/model.php @@ -4218,7 +4218,7 @@ class storyModel extends model if($action == 'batchcreate' and $story->parent > 0) return false; if($action == 'batchcreate' and $story->type == 'requirement' and $story->status != 'closed') return strpos('draft,reviewing,changing', $story->status) === false; if($action == 'batchcreate' and $config->vision == 'lite' and ($story->status == 'active' and ($story->stage == 'wait' or $story->stage == 'projected'))) return true; - /* Adjust code, hide split entry, fix bug #29432. */ + /* Adjust code, hide split entry. */ if($action == 'batchcreate' and ($story->status != 'active' or (isset($shadowProducts[$story->product])) or (!isset($shadowProducts[$story->product]) && $story->stage != 'wait') or !empty($story->plan))) return false; return true; @@ -4489,7 +4489,7 @@ class storyModel extends model $executionID = empty($execution) ? 0 : $execution->id; - /* Adjust code, hide split entry, fix bug #29432. */ + /* Adjust code, hide split entry. */ if(common::hasPriv('story', 'batchCreate') and !$execution->multiple and !$execution->hasProduct and false) { $isClick = $this->isClickable($story, 'batchcreate');