From cf00a736a1cc72146302f5ea4ac520a42d468fb4 Mon Sep 17 00:00:00 2001 From: tanghucheng Date: Wed, 26 Oct 2022 09:03:24 +0800 Subject: [PATCH 1/3] * Finish task #73241. --- module/execution/model.php | 3 +++ module/execution/view/edit.html.php | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/module/execution/model.php b/module/execution/model.php index c72f62c2a5..d60d43d29a 100644 --- a/module/execution/model.php +++ b/module/execution/model.php @@ -64,6 +64,9 @@ class executionModel extends model public function setMenu($executionID, $buildID = 0, $extra = '') { $execution = $this->getByID($executionID); + + if($execution->type == 'stage') unset($this->lang->execution->menu->settings['subMenu']->products); + if($execution and $execution->type == 'kanban') { global $lang; diff --git a/module/execution/view/edit.html.php b/module/execution/view/edit.html.php index 27a7b10be2..1e6bb50aaa 100644 --- a/module/execution/view/edit.html.php +++ b/module/execution/view/edit.html.php @@ -142,7 +142,7 @@ execution->manageProducts;?> - grade == 2 ? "readonly='readonly'" : '';?> + grade == 2 or $execution->type == 'stage') ? "disabled" : '';?>
@@ -165,12 +165,14 @@ ?> + type != 'stage'):?>
+
From d96d6bb803a5ffdda5ac9efff6c898789f753929 Mon Sep 17 00:00:00 2001 From: tanghucheng Date: Thu, 27 Oct 2022 08:09:26 +0800 Subject: [PATCH 2/3] * Finish task #73234,73242. --- module/execution/control.php | 20 ++++++++++++++++++++ module/execution/js/common.js | 16 +++++++++------- module/execution/model.php | 9 ++++++++- module/execution/view/create.html.php | 7 ++++++- module/programplan/control.php | 1 + module/programplan/view/gantt.html.php | 4 ++++ module/project/control.php | 13 +++++++++++-- module/project/css/execution.css | 1 + module/project/view/execution.html.php | 4 ++++ 9 files changed, 64 insertions(+), 11 deletions(-) diff --git a/module/execution/control.php b/module/execution/control.php index 5068b485e1..4bd148740c 100644 --- a/module/execution/control.php +++ b/module/execution/control.php @@ -1646,6 +1646,26 @@ class execution extends control $this->view->linkedBranches = $linkedBranches; } + if(!$project->division) + { + $products = $this->loadModel('product')->getProducts($projectID); + $branches = $this->project->getBranchesByProject($projectID); + $plans = $this->loadModel('productplan')->getGroupByProduct(array_keys($products), 'skipParent|unexpired'); + + $linkedBranches = array(); + foreach($products as $productID => $product) + { + foreach($branches[$productID] as $branchID => $branch) + { + $linkedBranches[$productID][$branchID] = $branchID; + $productPlans[$productID][$branchID] = isset($plans[$productID][$branchID]) ? $plans[$productID][$branchID] : array(); + } + } + + $this->view->branches = $branches; + $this->view->linkedBranches = $linkedBranches; + } + if(!empty($_POST)) { $executionID = $this->execution->create($copyExecutionID); diff --git a/module/execution/js/common.js b/module/execution/js/common.js index 1ede120620..499bff5775 100644 --- a/module/execution/js/common.js +++ b/module/execution/js/common.js @@ -124,13 +124,15 @@ function loadBranches(product) { if($('#productsBox .input-group:last select:first').val() != 0) { - var length = $('#productsBox .input-group').size(); - $('#productsBox .row').append('
' + $('#productsBox .col-sm-4:last').html().replace('required', '') + '
'); - if($('#productsBox .input-group:last select').size() >= 2) $('#productsBox .input-group:last select:last').remove(); - $('#productsBox .input-group:last .chosen-container').remove(); - $('#productsBox .input-group:last select:first').attr('name', 'products[' + length + ']').attr('id', 'products' + length); - $('#productsBox .input-group:last .chosen').chosen(); - + if(model !== 'waterfall') + { + var length = $('#productsBox .input-group').size(); + $('#productsBox .row').append('
' + $('#productsBox .col-sm-4:last').html().replace('required', '') + '
'); + if($('#productsBox .input-group:last select').size() >= 2) $('#productsBox .input-group:last select:last').remove(); + $('#productsBox .input-group:last .chosen-container').remove(); + $('#productsBox .input-group:last select:first').attr('name', 'products[' + length + ']').attr('id', 'products' + length); + $('#productsBox .input-group:last .chosen').chosen(); + } adjustProductBoxMargin(); } diff --git a/module/execution/model.php b/module/execution/model.php index d60d43d29a..eefd118e6f 100644 --- a/module/execution/model.php +++ b/module/execution/model.php @@ -339,6 +339,12 @@ class executionModel extends model $type = 'sprint'; if($project) $type = zget($this->config->execution->modelList, $project->model, 'sprint'); + if($project->model == 'waterfall') + { + $this->checkWorkload('create', $_POST['percent'], $project); + if(dao::isError()) return false; + } + $this->config->execution->create->requiredFields .= ',project'; } @@ -1175,7 +1181,7 @@ class executionModel extends model } /* The total workload of the first stage should not exceed 100%. */ - if($type == 'create' or (empty($oldExecution) and $oldExecution->grade == 1)) + if($type == 'create' or (!empty($oldExecution) and $oldExecution->grade == 1)) { $oldPercentTotal = $this->dao->select('SUM(t2.percent) as total')->from(TABLE_PROJECTPRODUCT)->alias('t1') ->leftJoin(TABLE_EXECUTION)->alias('t2')->on('t1.project=t2.id') @@ -4616,6 +4622,7 @@ class executionModel extends model $burns = join(',', $execution->burns); echo ""; + if(!empty($execution->division)) echo "{$execution->productName}"; echo ""; if(common::hasPriv('execution', 'batchEdit')) echo "id class='table-nest-icon icon table-nest-toggle'>"; if($this->config->systemMode == 'new') diff --git a/module/execution/view/create.html.php b/module/execution/view/create.html.php index 4da8c28962..25bc3cdfe3 100644 --- a/module/execution/view/create.html.php +++ b/module/execution/view/create.html.php @@ -48,6 +48,7 @@ execution->cancelCopy);?> execution->copyNoExecution);?> +model);?>
@@ -137,12 +138,14 @@
+ division ? '' : 'disabled';?> type != 'normal' and isset($branchGroups[$product->id]));?> id] as $branchID => $branch):?>
- id, "class='form-control chosen' onchange='loadBranches(this)' data-last='" . $product->id . "'");?> + id, "class='form-control chosen' $class onchange='loadBranches(this)' data-last='" . $product->id . "'");?> + id);?> id], $branchID, "class='form-control chosen' onchange=\"loadPlans('#products{$i}', this.value)\"");?>
@@ -150,12 +153,14 @@ + division):?>
+
diff --git a/module/programplan/control.php b/module/programplan/control.php index efb2988be9..e0414d396e 100644 --- a/module/programplan/control.php +++ b/module/programplan/control.php @@ -110,6 +110,7 @@ class programplan extends control $this->view->title = $this->lang->programplan->browse; $this->view->position[] = $this->lang->programplan->browse; $this->view->projectID = $projectID; + $this->view->project = $this->project->getByID($projectID); $this->view->productID = $this->productID; $this->view->productList = $this->loadModel('product')->getProductPairsByProject($projectID); $this->view->type = $type; diff --git a/module/programplan/view/gantt.html.php b/module/programplan/view/gantt.html.php index e68b128d0e..f766ce1705 100644 --- a/module/programplan/view/gantt.html.php +++ b/module/programplan/view/gantt.html.php @@ -80,6 +80,7 @@ form {display: block; margin-top: 0em; margin-block-end: 1em;} app->getModuleName() == 'programplan'):?>
+ division) or !empty($project->hasProduct)):?> product->allProduct;?> + + programplan->gantt;?> +
diff --git a/module/project/control.php b/module/project/control.php index 64c64facf5..656ab48760 100644 --- a/module/project/control.php +++ b/module/project/control.php @@ -1035,10 +1035,19 @@ class project extends control $this->view->title = $this->lang->execution->allExecutions; $this->view->position[] = $this->lang->execution->allExecutions; - $executionStats = $this->execution->getStatData($projectID, $status, $productID, 0, $this->cookie->showTask, '', $orderBy, $pager); - $showToggleIcon = false; + $executionStats = $this->execution->getStatData($projectID, $status, $productID, 0, $this->cookie->showTask, '', $orderBy, $pager); + $showToggleIcon = false; + $productNameList = $this->dao->select('t1.id,GROUP_CONCAT(t3.`name`) as productName')->from(TABLE_EXECUTION)->alias('t1') + ->leftjoin(TABLE_PROJECTPRODUCT)->alias('t2')->on('t1.id=t2.project') + ->leftjoin(TABLE_PRODUCT)->alias('t3')->on('t2.product=t3.id') + ->where('t1.project')->eq($projectID) + ->andWhere('t1.type')->eq('stage') + ->groupBy('t1.id') + ->fetchPairs(); + foreach($executionStats as $execution) { + $execution->productName = isset($productNameList[$execution->id]) ? $productNameList[$execution->id] : ''; if(!empty($execution->tasks) or !empty($execution->children)) { $showToggleIcon = true; diff --git a/module/project/css/execution.css b/module/project/css/execution.css index 71939a8e6b..4c3cddba23 100644 --- a/module/project/css/execution.css +++ b/module/project/css/execution.css @@ -13,6 +13,7 @@ th.table-nest-title .check-all {position: absolute; left: 15px; top: 7px;} #executionTableList > tr:not(.has-nest-child) .project-type-label {margin-left: 22px;} .table-statistic {padding-left: 10px;} td.flex {display: flex; flex-flow: row nowrap; justify-content: flex-start; align-items: center; margin-bottom: 0px;} +th.c-name {width: 80px;} td.c-name > .project-type-label {flex: 0 0 36px; padding-right: 2px;} .c-name > a, .table-children .text-left > a, .c-name > span.text-ellipsis { padding-left: 5px; text-overflow: clip;} span.table-nest-icon.table-nest-toggle {min-width: 22px; max-width: 22px;} diff --git a/module/project/view/execution.html.php b/module/project/view/execution.html.php index d349c0629b..af18757430 100644 --- a/module/project/view/execution.html.php +++ b/module/project/view/execution.html.php @@ -14,6 +14,7 @@ execution->checkedExecutions);?>