diff --git a/module/product/control.php b/module/product/control.php index 57bfeb27d4..7aa6e809e8 100644 --- a/module/product/control.php +++ b/module/product/control.php @@ -967,10 +967,11 @@ class product extends control * @param int $branch * @param string $number * @param int $executionID + * @param string $from showImport * @access public * @return void */ - public function ajaxGetExecutions($productID, $projectID = 0, $branch = 0, $number = '', $executionID = 0) + public function ajaxGetExecutions($productID, $projectID = 0, $branch = 0, $number = '', $executionID = 0, $from = '') { if($this->app->tab == 'execution' and $this->session->execution) { @@ -978,7 +979,7 @@ class product extends control if($execution->type == 'kanban') $projectID = $execution->project; } - $executions = $this->product->getExecutionPairsByProduct($productID, $branch, 'id_desc', $projectID, empty($this->config->CRExecution) ? 'noclosed' : ''); + $executions = $from == 'showImport' ? $this->product->getAllExecutionPairsByProduct($productID, $branch, $projectID) : $this->product->getExecutionPairsByProduct($productID, $branch, 'id_desc', $projectID, empty($this->config->CRExecution) ? 'noclosed' : ''); if($this->app->getViewType() == 'json') return print(json_encode($executions)); if($number === '') @@ -987,9 +988,10 @@ class product extends control } else { - $executionsName = "executions[$number]"; $executions = empty($executions) ? array('' => '') : $executions; - return print(html::select($executionsName, $executions, '', "class='form-control' onchange='loadExecutionBuilds($productID, this.value, $number)'")); + $executionsName = $from == 'showImport' ? "execution[$number]" : "executions[$number]"; + $misc = $from == 'showImport' ? "class='form-control' onchange='loadExecutionBuilds(this.value, $number)'" : "class='form-control' onchange='loadExecutionBuilds($productID, this.value, $number)'"; + return print(html::select($executionsName, $executions, '', $misc)); } } diff --git a/module/product/model.php b/module/product/model.php index 010ea89847..8c5a148f4e 100644 --- a/module/product/model.php +++ b/module/product/model.php @@ -1272,10 +1272,11 @@ class productModel extends model * * @param int $productID * @param int $branch + * @param int $projectID * @access public * @return array */ - public function getAllExecutionPairsByProduct($productID, $branch = 0) + public function getAllExecutionPairsByProduct($productID, $branch = 0, $projectID = 0) { if(empty($productID)) return array(); $executions = $this->dao->select('t2.id,t2.project,t2.name,t2.grade,t2.parent')->from(TABLE_PROJECTPRODUCT)->alias('t1') @@ -1283,6 +1284,7 @@ class productModel extends model ->where('t1.product')->eq($productID) ->andWhere('t2.type')->in('stage,sprint,kanban') ->beginIF($branch)->andWhere('t1.branch')->in($branch)->fi() + ->beginIF($projectID)->andWhere('t2.project')->eq($projectID)->fi() ->beginIF(!$this->app->user->admin)->andWhere('t2.id')->in($this->app->user->view->sprints)->fi() ->andWhere('t2.deleted')->eq('0') ->fetchAll('id'); diff --git a/module/tree/control.php b/module/tree/control.php index c826a7df18..f6bdc2242c 100644 --- a/module/tree/control.php +++ b/module/tree/control.php @@ -537,17 +537,18 @@ class tree extends control * @param int $branchID * @param int $number * @param int $currentModuleID + * @param string $from showImport * @access public * @return string the html select string. */ - public function ajaxGetModules($productID, $viewType = 'story', $branchID = 0, $number = 0, $currentModuleID = 0) + public function ajaxGetModules($productID, $viewType = 'story', $branchID = 0, $number = 0, $currentModuleID = 0, $from = '') { $currentModule = $this->tree->getById($currentModuleID); $currentModuleID = (isset($currentModule->branch) and $currentModule->branch == 0) ? $currentModuleID : 0; $modules = $this->tree->getOptionMenu($productID, $viewType, $startModuleID = 0, $branchID); - $moduleName = $viewType == 'bug' ? "modules[$number]" : "module[$number]"; + $moduleName = $viewType == 'bug' && $from != 'showImport' ? "modules[$number]" : "module[$number]"; $modules = empty($modules) ? array('' => '') : $modules; echo html::select($moduleName, $modules, $currentModuleID, 'class=form-control'); }