From 2a28c13c7ed32bcddef12022f17be7e5b0f2b9fd Mon Sep 17 00:00:00 2001 From: sunjun Date: Tue, 5 Jul 2022 07:39:55 +0000 Subject: [PATCH 1/6] sprint_59473 --- module/execution/control.php | 13 +++++++++- module/execution/css/create.css | 2 ++ module/execution/js/create.js | 37 ++++++++++++++++++++++++++- module/execution/model.php | 24 +++++++++++++++++ module/execution/view/create.html.php | 6 +++++ 5 files changed, 80 insertions(+), 2 deletions(-) diff --git a/module/execution/control.php b/module/execution/control.php index b509ca3f4f..33a4fe10bb 100644 --- a/module/execution/control.php +++ b/module/execution/control.php @@ -1525,7 +1525,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->execution->getCopyProjectPairsByProgramAndModel(empty($project->parent) ? 0 : $project->parent, 'noclosed', 'order_asc', empty($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; @@ -1540,6 +1542,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; @@ -3973,4 +3977,11 @@ class execution extends control echo json_encode($date); } } + + public function ajaxGetProjectExecutions($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..6b847c0677 100644 --- a/module/execution/css/create.css +++ b/module/execution/css/create.css @@ -30,3 +30,5 @@ #dateRange {vertical-align: top; padding-top: 13px;} #dateRangeOption {vertical-align: top; padding-top: 13px;} +#myModalLabel {width: 20%; display: inline-block;} +.projectSelect {display: inline-block; margin: 0 auto; width:20%;} diff --git a/module/execution/js/create.js b/module/execution/js/create.js index 2cb6a485bb..fa932dfa54 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,34 @@ function subString(title, stringLength) return title; } + +/** + * Load project executions. + * + * @param int $projectID + * @access public + * @return void + */ +function loadProjectExecutions(projectID) +{ + $.get(createLink('execution', 'ajaxGetProjectExecutions', 'projectID=' + projectID + '&$copyExecutionID' + copyExecutionID), function(data) + { + if(data != '[]') + { + $('.alert').replaceWith("
"); + $("#copyProjects > div[data-id != '']").remove(); + $(".model-body").remove(); + var data = JSON.parse(data); + $.each(data, function(id, execution) + { + var type = execution.type == 'stage' ? 'waterfall' : execution.type; + var active = copyExecutionID == id ? ' active' : ''; + $('#copyProjects').append(""); + }); + } + else + { + $('#copyProjects').replaceWith("
" + copyNoExecution + "
") + } + }); +} diff --git a/module/execution/model.php b/module/execution/model.php index 124dd02c13..372c54a49a 100644 --- a/module/execution/model.php +++ b/module/execution/model.php @@ -4322,4 +4322,28 @@ class executionModel extends model echo ''; } } + + /** + * Get copy project pairs by program and model. + * + * @param int $programID + * @param string $status + * @param string $orderBy + * @param string $model + * @access public + * @return array + */ + public function getCopyProjectPairsByProgramAndModel($programID = 0, $status = 'all', $orderBy = 'order_asc', $model = '') + { + return $this->dao->select('id, name')->from(TABLE_PROJECT) + ->where('type')->eq('project') + ->andWhere('deleted')->eq(0) + ->andWhere('vision')->eq($this->config->vision) + ->beginIF($programID !== '')->andWhere('parent')->eq($programID)->fi() + ->beginIF($model)->andWhere('model')->eq($model)->fi() + ->beginIF($status == 'noclosed')->andWhere('status')->ne('closed')->fi() + ->beginIF(!$this->app->user->admin)->andWhere('id')->in($this->app->user->view->projects)->fi() + ->orderBy($orderBy) + ->fetchPairs(); + } } diff --git a/module/execution/view/create.html.php b/module/execution/view/create.html.php index 3a671c7a24..03e94ccbfa 100644 --- a/module/execution/view/create.html.php +++ b/module/execution/view/create.html.php @@ -45,6 +45,8 @@ systemMode);?> + +execution->copyNoExecution);?>
@@ -266,6 +268,9 @@
+ $execution):?> From 5b228a26041239528c1f6ca6cfc9c0f1f11056bf Mon Sep 17 00:00:00 2001 From: sunjun Date: Tue, 5 Jul 2022 08:04:57 +0000 Subject: [PATCH 2/6] sprint_59473 --- module/execution/view/create.html.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/execution/view/create.html.php b/module/execution/view/create.html.php index 03e94ccbfa..36b2ee8dec 100644 --- a/module/execution/view/create.html.php +++ b/module/execution/view/create.html.php @@ -280,7 +280,7 @@
- + systemMode == 'new' and $projectID == 0) $executions = $copyExecutions;?> $execution):?> From 900b52a96bef9866a4117e5e16e084a36280e1d9 Mon Sep 17 00:00:00 2001 From: sunjun Date: Tue, 5 Jul 2022 08:24:41 +0000 Subject: [PATCH 3/6] sprint_59473 --- module/execution/css/create.css | 4 ++-- module/execution/view/create.html.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/module/execution/css/create.css b/module/execution/css/create.css index 6b847c0677..37a08c608b 100644 --- a/module/execution/css/create.css +++ b/module/execution/css/create.css @@ -30,5 +30,5 @@ #dateRange {vertical-align: top; padding-top: 13px;} #dateRangeOption {vertical-align: top; padding-top: 13px;} -#myModalLabel {width: 20%; display: inline-block;} -.projectSelect {display: inline-block; margin: 0 auto; width:20%;} +#copyProjectModal .projectSelect {display: inline-block; margin-left: 10px; width: 20%;} +#copyProjectModal .titleBox{position: relative; bottom: 3px; display: inline-block;} diff --git a/module/execution/view/create.html.php b/module/execution/view/create.html.php index 36b2ee8dec..9df87094ce 100644 --- a/module/execution/view/create.html.php +++ b/module/execution/view/create.html.php @@ -267,7 +267,7 @@