diff --git a/module/story/js/create.js b/module/story/js/create.js
index 23b7231072..8f28ec71ab 100644
--- a/module/story/js/create.js
+++ b/module/story/js/create.js
@@ -203,7 +203,7 @@ function loadModuleForSiblings(productID, branch, branchIndex)
{
/* Load module */
var currentModule = 0;
- var moduleLink = createLink('tree', 'ajaxGetOptionMenu', 'productID=' + productID + '&viewtype=story&branch=' + branch + '&rootModuleID=0&returnType=html&fieldID=' + branchIndex + '&needManage=true&extra=¤tModuleID=' + currentModule);
+ var moduleLink = createLink('tree', 'ajaxGetOptionMenu', 'productID=' + productID + '&viewtype=story&branch=' + branch + '&rootModuleID=0&returnType=html&fieldID=' + branchIndex + '&needManage=false&extra=¤tModuleID=' + currentModule);
if(branchIndex > 0)
{
var $moduleIDBox = $('.addBranchesBox'+ branchIndex +' #moduleIdBox');
@@ -217,7 +217,7 @@ function loadModuleForSiblings(productID, branch, branchIndex)
$moduleIDBox.find('#modules' + branchIndex).chosen();
if(branchIndex == 0)
{
- $('.switchBranch #moduleIdBox span:first-child').remove()
+ $('.switchBranch #moduleIdBox > span:first-child').remove()
}
$moduleIDBox.prepend("" + storyModule + "" );
@@ -240,7 +240,7 @@ function loadPlanForSiblings(productID, branch, branchIndex)
if(typeof(branch) == 'undefined') branch = 0;
if(!branch) branch = 0;
var expired = config.currentMethod == 'create' ? 'unexpired' : '';
- planLink = createLink('product', 'ajaxGetPlans', 'productID=' + productID + '&branch=' + branch + '&planID=' + $('#plan').val() + '&fieldID=' + branchIndex + '&needCreate=true&expired='+ expired +'¶m=skipParent,' + config.currentMethod);
+ planLink = createLink('product', 'ajaxGetPlans', 'productID=' + productID + '&branch=' + branch + '&planID=' + $('#plan').val() + '&fieldID=' + branchIndex + '&needCreate=false&expired='+ expired +'¶m=skipParent,' + config.currentMethod);
if(branchIndex > 0)
{
var $planIdBox = $('.addBranchesBox'+ branchIndex +' #planIdBox');
diff --git a/module/story/model.php b/module/story/model.php
index 464a76a15a..9e4f359820 100644
--- a/module/story/model.php
+++ b/module/story/model.php
@@ -251,6 +251,20 @@ class storyModel extends model
$this->post->plans = isset($story->plan) ? array($story->plan) : array(0 => 0);
}
+ /* check module */
+ $requiredFields = "," . $this->config->story->create->requiredFields . ",";
+ if(strpos($requiredFields, ',module,') !== false)
+ {
+ foreach($this->post->modules as $module)
+ {
+ if(empty($module))
+ {
+ dao::$errors[] = sprintf($this->lang->error->notempty, $this->lang->story->module);
+ return false;
+ }
+ }
+ }
+
$storyIds = array();
$mainStoryID = 0;
foreach($this->post->branches as $key => $branch)
@@ -260,9 +274,6 @@ class storyModel extends model
$story->plan = $this->post->plans[$key];
if(strpos('draft,reviewing', $story->status) !== false) $story->stage = $this->post->plan > 0 ? 'planned' : 'wait';
-
- $requiredFields = "," . $this->config->story->create->requiredFields . ",";
-
if($story->type == 'requirement') $requiredFields = str_replace(',plan,', ',', $requiredFields);
if(strpos($requiredFields, ',estimate,') !== false)
{
diff --git a/module/tree/control.php b/module/tree/control.php
index f245d371b6..a4c8277215 100644
--- a/module/tree/control.php
+++ b/module/tree/control.php
@@ -544,7 +544,7 @@ class tree extends control
$currentModuleID = (isset($currentModule->branch) and $currentModule->branch == 0) ? $currentModuleID : 0;
$output = html::select("$field", $optionMenu, $currentModuleID, "class='form-control' $changeFunc");
- if(count($optionMenu) == 1 and $needManage)
+ if(count($optionMenu) == 1 and $needManage !== 'false')
{
$output .= "";
$output .= html::a($this->createLink('tree', 'browse', "rootID=$rootID&view=$viewType¤tModuleID=0&branch=$branch", '', true), $this->lang->tree->manage, '', "class='text-primary' data-toggle='modal' data-type='iframe' data-width='95%'");