diff --git a/module/execution/control.php b/module/execution/control.php index 10357a5a01..ed8629afc6 100644 --- a/module/execution/control.php +++ b/module/execution/control.php @@ -1589,7 +1589,9 @@ class execution extends control if(!empty($this->config->user->moreLink)) $this->config->moreLinks["RD"] = $this->config->user->moreLink; $this->loadModel('product'); - $allProducts = $this->config->systemMode == 'classic' ? $this->product->getPairs('noclosed') : $this->product->getProductPairsByProject($projectID, 'noclosed'); + $allProducts = $this->config->systemMode == 'classic' ? $this->product->getPairs('noclosed') : $this->product->getProductPairsByProject($projectID, 'noclosed'); + $copyProjects = $this->loadModel('project')->getPairsByProgram(isset($project->parent) ? $project->parent : '', 'noclosed', '', 'order_asc', '', isset($project->model) ? $project->model : ''); + $copyProjectID = ($projectID == 0) ? key($copyProjects) : $projectID; $this->view->title = (($this->app->tab == 'execution') and ($this->config->systemMode == 'new')) ? $this->lang->execution->createExec : $this->lang->execution->create; $this->view->position[] = $this->view->title; @@ -1604,6 +1606,8 @@ class execution extends control $this->view->team = $team; $this->view->teams = array(0 => '') + $this->execution->getCanCopyObjects((int)$projectID); $this->view->allProjects = array(0 => '') + $this->project->getPairsByModel('all', 0, 'noclosed'); + $this->view->copyProjects = $copyProjects; + $this->view->copyExecutions = array('' => '') + $this->execution->getList($copyProjectID); $this->view->executionID = $executionID; $this->view->productID = $productID; $this->view->projectID = $projectID; @@ -4037,4 +4041,18 @@ class execution extends control echo json_encode($date); } } + + /** + * Ajax get copy project executions. + * + * @param int $projectID + * @access public + * @return void + */ + public function ajaxGetCopyProjectExecutions($projectID = 0) + { + $executions = $this->execution->getList($projectID); + echo json_encode($executions); + } + } diff --git a/module/execution/css/create.css b/module/execution/css/create.css index cb9f540c66..6a7e4ef15c 100644 --- a/module/execution/css/create.css +++ b/module/execution/css/create.css @@ -30,3 +30,6 @@ #dateRange {vertical-align: top; padding-top: 13px;} #dateRangeOption {vertical-align: top; padding-top: 13px;} +#copyProjectModal .projectSelect {display: inline-block; margin-left: 10px; width: 20%;} +#copyProjectModal .titleBox{position: relative; bottom: 3px; display: inline-block;} +a.chosen-single > div > b {top: -4px !important;} diff --git a/module/execution/js/create.js b/module/execution/js/create.js index 2cb6a485bb..6dcd9c0483 100644 --- a/module/execution/js/create.js +++ b/module/execution/js/create.js @@ -8,7 +8,11 @@ $(function() var heightType = $("[name='heightType']:checked").val(); setCardCount(heightType); - $('#copyProjects a').click(function(){setCopyProject($(this).data('id')); $('#copyProjectModal').modal('hide')}); + $(document).on('click', '#copyProjects a', function() + { + setCopyProject($(this).data('id')); $('#copyProjectModal').modal('hide'); + }); + $('#begin').on('change', function() { $("#end").val(''); @@ -168,3 +172,43 @@ function subString(title, stringLength) return title; } + +/** + * Load project executions. + * + * @param int $projectID + * @access public + * @return void + */ +function loadProjectExecutions(projectID) +{ + $.get(createLink('execution', 'ajaxGetCopyProjectExecutions', 'projectID=' + projectID + '&$copyExecutionID' + copyExecutionID), function(data) + { + if(data != '[]') + { + $('.alert').replaceWith("