diff --git a/module/product/control.php b/module/product/control.php index 571b2eba51..c929bdb076 100644 --- a/module/product/control.php +++ b/module/product/control.php @@ -970,10 +970,11 @@ class product extends control * @param bool $needCreate * @param string $expired * @param string $from + * @param string $param * @access public * @return void */ - public function ajaxGetPlans($productID, $branch = 0, $planID = 0, $fieldID = '', $needCreate = false, $expired = '', $from = '') + public function ajaxGetPlans($productID, $branch = 0, $planID = 0, $fieldID = '', $needCreate = false, $expired = '', $from = '', $param = '') { $this->loadModel('productplan'); if($from == 'story' and $branch == BRANCH_MAIN) @@ -991,24 +992,43 @@ class product extends control } $field = $fieldID ? "plans[$fieldID]" : 'plan'; - $output = "
"; - $output .= "
"; - $output .= html::select($field, $plans, $planID, "class='form-control chosen'"); - $output .= "
"; - if(count($plans) == 1 and $needCreate) + + $output = ''; + if(strpos($param, 'batchEdit') !== false) { + $output = "
"; $output .= "
"; - $output .= "
"; - $output .= html::a($this->createLink('productplan', 'create', "productID=$productID&branch=$branch", '', true), "", '', "class='btn btn-icon' data-toggle='modal' data-type='iframe' data-width='95%' title='{$this->lang->productplan->create}'"); - $output .= '
'; - $output .= '
'; - $output .= "
"; - $output .= "
"; - $output .= html::a("javascript:void(0)", "", '', "class='btn btn-icon refresh' data-toggle='tooltip' title='{$this->lang->refresh}' onclick='loadProductPlans($productID)'"); - $output .= '
'; - $output .= '
'; + $output .= html::select($field, $plans, $planID, "class='form-control chosen'"); + $output .= "
"; + if(count($plans) == 1 and $needCreate) + { + $output .= "
"; + $output .= "
"; + $output .= html::a($this->createLink('productplan', 'create', "productID=$productID&branch=$branch", '', true), "", '', "class='btn btn-icon' data-toggle='modal' data-type='iframe' data-width='95%' title='{$this->lang->productplan->create}'"); + $output .= '
'; + $output .= '
'; + $output .= "
"; + $output .= "
"; + $output .= html::a("javascript:void(0)", "", '', "class='btn btn-icon refresh' data-toggle='tooltip' title='{$this->lang->refresh}' onclick='loadProductPlans($productID)'"); + $output .= '
'; + $output .= '
'; + } + $output .= "
"; + } + else + { + $output .= html::select($field, $plans, $planID, "class='form-control chosen'"); + if(count($plans) == 1 and $needCreate) + { + $output .= "
"; + $output .= html::a($this->createLink('productplan', 'create', "productID=$productID&branch=$branch", '', true), "", '', "class='btn btn-icon' data-toggle='modal' data-type='iframe' data-width='95%' title='{$this->lang->productplan->create}'"); + $output .= '
'; + $output .= "
"; + $output .= html::a("javascript:void(0)", "", '', "class='btn btn-icon refresh' data-toggle='tooltip' title='{$this->lang->refresh}' onclick='loadProductPlans($productID)'"); + $output .= '
'; + } + } - $output .= ""; die($output); } diff --git a/module/story/js/batchedit.js b/module/story/js/batchedit.js index e26b145ec8..835f2de2da 100644 --- a/module/story/js/batchedit.js +++ b/module/story/js/batchedit.js @@ -34,7 +34,7 @@ function loadBranches(product, branch, storyID) $('#modules' + storyID).parent('td').load(moduleLink, function(){$('#modules' + storyID).chosen();}); planID = $('#plans' + storyID).val(); - planLink = createLink('product', 'ajaxGetPlans', 'productID=' + product + '&branch=' + branch + '&planID=' + planID + '&fieldID=' + storyID + '&needCreate=false&expired=&from=story'); + planLink = createLink('product', 'ajaxGetPlans', 'productID=' + product + '&branch=' + branch + '&planID=' + planID + '&fieldID=' + storyID + '&needCreate=false&expired=&from=story¶m=batchEdit'); $('#plans' + storyID).parent('td').load(planLink, function(){$('#plans' + storyID).chosen();}); }