From 2e79c5f8696744194ed021936b33f8e3af0b5d34 Mon Sep 17 00:00:00 2001 From: zhouxin Date: Wed, 29 Dec 2021 03:49:17 +0000 Subject: [PATCH 1/9] Finish task #46679 and fix a bug. --- module/my/control.php | 1 + module/programplan/control.php | 1 + module/programplan/js/create.js | 2 + module/programplan/lang/en.php | 1 + module/programplan/lang/zh-cn.php | 1 + module/programplan/model.php | 3 +- module/programplan/view/create.html.php | 65 +++++++++++++------------ module/project/view/view.html.php | 2 +- 8 files changed, 43 insertions(+), 33 deletions(-) diff --git a/module/my/control.php b/module/my/control.php index 748fcb8c36..6f6d6827d3 100644 --- a/module/my/control.php +++ b/module/my/control.php @@ -1078,6 +1078,7 @@ class my extends control $this->session->set('opportunityLibList', $uri, 'assetlib'); $this->session->set('practiceLibList', $uri, 'assetlib'); $this->session->set('componentLibList', $uri, 'assetlib'); + $this->session->set('opportunityList', $uri, 'project'); /* Set the pager. */ $this->app->loadClass('pager', $static = true); diff --git a/module/programplan/control.php b/module/programplan/control.php index 8faba1e7c3..9eb751e67d 100644 --- a/module/programplan/control.php +++ b/module/programplan/control.php @@ -145,6 +145,7 @@ class programplan extends control $this->view->plans = $this->programplan->getStage($planID ? $planID : $projectID, $this->productID, 'parent'); $this->view->planID = $planID; $this->view->type = 'lists'; + $this->view->PMUsers = $this->loadModel('user')->getPairs('noclosed|nodeleted|pmfirst', $project->PM); $this->display(); } diff --git a/module/programplan/js/create.js b/module/programplan/js/create.js index 62a08dbd0e..cd4322931a 100644 --- a/module/programplan/js/create.js +++ b/module/programplan/js/create.js @@ -5,6 +5,8 @@ function addItem(obj) var newItem = $('#names' + i).closest('tr'); newItem.find('.form-date').datepicker(); $("#output" + i).chosen(); + $("#PM_i__chosen").remove(); + $("#PM" + i).chosen(); $("#output_i__chosen").remove(); i ++; } diff --git a/module/programplan/lang/en.php b/module/programplan/lang/en.php index 5a6a4ed3ab..0d93fbccb9 100644 --- a/module/programplan/lang/en.php +++ b/module/programplan/lang/en.php @@ -21,6 +21,7 @@ $lang->programplan->createSubPlan = 'Create Sub Stage'; $lang->programplan->parent = 'Parent Stage'; $lang->programplan->emptyParent = 'N/A'; $lang->programplan->name = 'Stage Name'; +$lang->programplan->PM = 'Stage Manager'; $lang->programplan->subStageName = 'Sub Stage Name'; $lang->programplan->percent = 'Workload Ratio'; $lang->programplan->percentAB = 'Ratio'; diff --git a/module/programplan/lang/zh-cn.php b/module/programplan/lang/zh-cn.php index ef8951ee19..69bebee6ad 100644 --- a/module/programplan/lang/zh-cn.php +++ b/module/programplan/lang/zh-cn.php @@ -21,6 +21,7 @@ $lang->programplan->createSubPlan = '创建二级阶段'; $lang->programplan->parent = '父阶段'; $lang->programplan->emptyParent = '无'; $lang->programplan->name = '阶段名称'; +$lang->programplan->PM = '阶段负责人'; $lang->programplan->subStageName = '子阶段名称'; $lang->programplan->percent = '工作量占比'; $lang->programplan->percentAB = '工作量占比'; diff --git a/module/programplan/model.php b/module/programplan/model.php index 321c3b8309..6cac0425b7 100644 --- a/module/programplan/model.php +++ b/module/programplan/model.php @@ -409,8 +409,6 @@ class programplanModel extends model $parentACL = $parentStage->acl; } - $attributes = array_values($attributes); - $milestone = array_values($milestone); $datas = array(); foreach($names as $key => $name) { @@ -431,6 +429,7 @@ class programplanModel extends model $plan->realEnd = empty($realEnd[$key]) ? '0000-00-00' : $realEnd[$key]; $plan->output = empty($output[$key]) ? '' : implode(',', $output[$key]); $plan->acl = empty($parentID) ? $acl[$key] : $parentACL; + $plan->PM = empty($PM[$key]) ? '' : $PM[$key]; $datas[] = $plan; } diff --git a/module/programplan/view/create.html.php b/module/programplan/view/create.html.php index 98dfed8df9..812f4b8d97 100644 --- a/module/programplan/view/create.html.php +++ b/module/programplan/view/create.html.php @@ -45,6 +45,7 @@ + programplan->PM;?> programplan->percent;?> @@ -69,20 +70,21 @@ - + +
- + %
stage->typeList, $stage->type, "class='form-control'");?> - project->aclList, 'open', "class='form-control' $class");?> + project->aclList, 'open', "class='form-control' $class");?> programplan->milestoneList, 0);?> - - - - + + + + config->qcVersion)):?> @@ -98,22 +100,23 @@ setMilestone ? '' : "disabled='disabled'"?> - id);?> + id);?> - + +
- + %
stage->typeList, $plan->attribute, "class='form-control'");?> - project->aclList, $plan->acl, "class='form-control' $class");?> + project->aclList, $plan->acl, "class='form-control' $class");?> programplan->milestoneList, $plan->milestone, $disabled);?> - - - - + + + + config->qcVersion)):?> output) ? 0 : explode(',', $plan->output);?> @@ -128,20 +131,21 @@ - + +
- + %
stage->typeList, '', "class='form-control'");?> - project->aclList, 'open', "class='form-control' $class");?> + project->aclList, 'open', "class='form-control' $class");?> programplan->milestoneList, 0);?> - - - - + + + + config->qcVersion)):?> @@ -167,21 +171,22 @@ - - + + + - + - - - - + + + + config->qcVersion)):?> diff --git a/module/project/view/view.html.php b/module/project/view/view.html.php index 82cc615f3c..0285d8c651 100644 --- a/module/project/view/view.html.php +++ b/module/project/view/view.html.php @@ -193,7 +193,7 @@ - + From 97ea32f7c36fa7002857ed9313e0c98aab3431b2 Mon Sep 17 00:00:00 2001 From: tianshujie Date: Thu, 30 Dec 2021 13:49:49 +0800 Subject: [PATCH 2/9] * Modify the mutual test question. --- module/productplan/js/browse.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/module/productplan/js/browse.js b/module/productplan/js/browse.js index 5b6e183368..aac308c533 100644 --- a/module/productplan/js/browse.js +++ b/module/productplan/js/browse.js @@ -134,6 +134,10 @@ function createCardMenu(options) var branchStatus = branchStatusList[card.branch]; if(branchStatus == 'closed') className = 'disabled'; } + else if(card.status == 'done' || card.status == 'closed') + { + className = 'disabled'; + } if(systemMode == 'new') { @@ -291,7 +295,7 @@ function renderKanbanItem(item, $item) var end = $.zui.createDate(item.end); if(end.toLocaleDateString() < today.toLocaleDateString() && (item.status == 'wait' || item.status == 'doing')) { - $expired = $('.titleBox').children('.expired'); + $expired = $titleBox.children('.expired'); if(!$expired.length) { $('' + productplanLang.expired + '').appendTo($titleBox); From 4d56aa8bdcd5f7d45f04a2375d6970bd3b1e6a68 Mon Sep 17 00:00:00 2001 From: tianshujie Date: Thu, 30 Dec 2021 14:02:55 +0800 Subject: [PATCH 3/9] * Add card drop-down operation. --- module/kanban/model.php | 2 +- module/productplan/js/browse.js | 5 +++-- module/productplan/model.php | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/module/kanban/model.php b/module/kanban/model.php index ee6580f9be..d13038a88d 100644 --- a/module/kanban/model.php +++ b/module/kanban/model.php @@ -537,7 +537,7 @@ class kanbanModel extends model $branches = array(); $colorIndex = 0; $laneOrder = 1; - $cardActions = array('view', 'createExecution', 'linkStory', 'linkBug', 'edit', 'start', 'finish', 'close', 'activate'); + $cardActions = array('view', 'createExecution', 'linkStory', 'linkBug', 'edit', 'start', 'finish', 'close', 'activate', 'delete'); if($product->type == 'normal') { diff --git a/module/productplan/js/browse.js b/module/productplan/js/browse.js index aac308c533..7a4dbda12c 100644 --- a/module/productplan/js/browse.js +++ b/module/productplan/js/browse.js @@ -167,6 +167,7 @@ function createCardMenu(options) if(privs.includes('finish')) items.push({label: productplanLang.finish, icon: 'checked', url: createLink('productplan', 'finish', "planID=" + card.id), attrs: {'target': 'hiddenwin'}}); if(privs.includes('close')) items.push({label: productplanLang.close, icon: 'off', url: createLink('productplan', 'close', "planID=" + card.id), attrs: {'target': 'hiddenwin'}}); if(privs.includes('activate')) items.push({label: productplanLang.activate, icon: 'magic', url: createLink('productplan', 'activate', "planID=" + card.id), attrs: {'target': 'hiddenwin'}}); + if(privs.includes('delete')) items.push({label: productplanLang.delete, icon: 'trash', url: createLink('productplan', 'delete', "planID=" + card.id), attrs: {'target': 'hiddenwin'}}); var bounds = options.$trigger[0].getBoundingClientRect(); items.$options = {x: bounds.right, y: bounds.top}; @@ -263,7 +264,7 @@ function changeCardColType(card, fromColType, toColType, kanbanID) function renderKanbanItem(item, $item) { var privs = item.actions; - var printMoreBtn = (privs.includes('createExecution') || privs.includes('linkStory') || privs.includes('linkBug') || privs.includes('edit') || privs.includes('start') || privs.includes('finish') || privs.includes('close') || privs.includes('activate')); + var printMoreBtn = (privs.includes('createExecution') || privs.includes('linkStory') || privs.includes('linkBug') || privs.includes('edit') || privs.includes('start') || privs.includes('finish') || privs.includes('close') || privs.includes('activate') || privs.includes('delete')); /* Output header information. */ var $header = $item.children('.header'); @@ -285,7 +286,7 @@ function renderKanbanItem(item, $item) if(!$title.length) { if(privs.includes('view')) $title = $('').appendTo($titleBox).attr('href', createLink('productplan', 'view', 'cardID=' + item.id)); - if(!privs.includes('view')) $title = $('

').appendTo($titleBox); + if(!privs.includes('view')) $title = $('').appendTo($titleBox); } $title.text(item.title).attr('title', item.title); diff --git a/module/productplan/model.php b/module/productplan/model.php index 2d9fca41e1..efc2fd08d8 100644 --- a/module/productplan/model.php +++ b/module/productplan/model.php @@ -959,7 +959,7 @@ class productplanModel extends model if($plan->status != 'done' or $plan->parent < 0) return false; break; case 'activate' : - if($plan->status != 'closed' or $plan->parent < 0) return false; + if($plan->status == 'wait' or $plan == 'doing' or $plan->parent < 0) return false; break; } From 6b8e4630ba18a26f82192d7f5a3ea78d46a937ca Mon Sep 17 00:00:00 2001 From: liumengyi Date: Thu, 30 Dec 2021 14:23:37 +0800 Subject: [PATCH 4/9] * Fix bug for task #46654. --- module/productplan/css/browse.css | 2 +- module/productplan/model.php | 20 +++++++++++-------- module/productplan/view/browsebylist.html.php | 15 ++++++++++---- module/productplan/view/view.html.php | 5 +++-- 4 files changed, 27 insertions(+), 15 deletions(-) diff --git a/module/productplan/css/browse.css b/module/productplan/css/browse.css index d9750bbb47..154e628e50 100644 --- a/module/productplan/css/browse.css +++ b/module/productplan/css/browse.css @@ -18,7 +18,7 @@ td.c-branch {overflow: hidden; text-align: left !important; text-overflow: ellip .c-title {width: 160px;} .c-branch {width: 100px;} .c-story {width: 80px;} -.c-execution {width: 120px;} +.c-execution {width: 50px !important;} .c-bug, .c-hour {width: 60px;} .plan-name {position: relative; display: flex; align-items: center;} diff --git a/module/productplan/model.php b/module/productplan/model.php index 2d9fca41e1..b67c2a7a76 100644 --- a/module/productplan/model.php +++ b/module/productplan/model.php @@ -532,9 +532,13 @@ class productplanModel extends model ->batchCheck($this->config->productplan->start->requiredFields, 'notempty') ->checkIF(!empty($_POST['begin']) && !empty($_POST['end']), 'end', 'ge', $plan->begin) ->where('id')->eq($planID) - ->beginIF(isset($parentPlan))->orWhere('id')->eq($oldPlan->parent)->fi() ->exec(); - if($parentPlan->status != 'doing') $parentChange = true; + + if(isset($parentPlan) and $parentPlan->status != 'doing') + { + $this->dao->update(TABLE_PRODUCTPLAN)->set('status')->eq($status)->where('id')->eq($oldPlan->parent)->exec(); + $parentChange = true; + } } elseif($status == 'doing' and isset($parentPlan) and $parentPlan->status != 'doing') { @@ -719,17 +723,17 @@ class productplanModel extends model $maxEnd = $end; foreach($childPlans as $childPlan) { - if($childPlan->begin < $minBegin) $minBegin = $childPlan->begin; - if($childPlan->end > $maxEnd) $maxEnd = $childPlan->end; + if($childPlan->begin < $minBegin and $minBegin != '2030-01-01') $minBegin = $childPlan->begin; + if($childPlan->end > $maxEnd and $maxEnd != '2030-01-01') $maxEnd = $childPlan->end; } - if($minBegin < $begin) dao::$errors['begin'] = sprintf($this->lang->beginGreaterChild, $minBegin); - if($maxEnd > $end) dao::$errors['end'] = sprintf($this->lang->endLetterChild, $maxEnd); + if($minBegin < $begin and $begin != '2030-01-01') dao::$errors['begin'] = sprintf($this->lang->beginGreaterChild, $minBegin); + if($maxEnd > $end and $end != '2030-01-01') dao::$errors['end'] = sprintf($this->lang->endLetterChild, $maxEnd); } elseif($plan->parent > 0) { $parentPlan = $this->getByID($plan->parent); - if($begin < $parentPlan->begin) dao::$errors['begin'] = sprintf($this->lang->productplan->beginLetterParent, $parentPlan->begin); - if($end > $parentPlan->end) dao::$errors['end'] = sprintf($this->lang->productplan->endGreaterParent, $parentPlan->end); + if($begin < $parentPlan->begin and $parentPlan->begin != '2030-01-01') dao::$errors['begin'] = sprintf($this->lang->productplan->beginLetterParent, $parentPlan->begin); + if($end > $parentPlan->end and $parentPlan->end != '2030-01-01') dao::$errors['end'] = sprintf($this->lang->productplan->endGreaterParent, $parentPlan->end); } } diff --git a/module/productplan/view/browsebylist.html.php b/module/productplan/view/browsebylist.html.php index 96ba8f4bc7..9563308bb9 100644 --- a/module/productplan/view/browsebylist.html.php +++ b/module/productplan/view/browsebylist.html.php @@ -78,6 +78,7 @@
loadModel('file');?> + parent == '-1') echo ' has-child';?>' title="title?>"> end < helper::now()) $suffix = "{$this->lang->productplan->expired}"; - if($plan->parent == '-1') $suffix .= ''; + if($plan->end < $today and in_array($plan->status, array('wait', 'doing'))) $suffix = "{$this->lang->productplan->expired}"; + if($plan->parent == '-1' and isset($plan->children)) $suffix .= ''; if(!empty($suffix)) echo '
'; echo html::a(inlink('view', "id=$plan->id"), $plan->title); if(!empty($suffix)) echo $suffix . '
'; @@ -181,8 +182,14 @@ common::printIcon('productplan', 'edit', "planID=$plan->id", $plan, 'list'); if(common::hasPriv('productplan', 'create', $plan)) { - if($plan->parent > '0') echo " "; - if($plan->parent <= '0') echo html::a($this->createLink('productplan', 'create', "product=$productID&branch=$branch&parent={$plan->id}"), "", '', "class='btn' title='{$this->lang->productplan->children}'"); + if($plan->parent > '0' or in_array($plan->status, array('done', 'closed'))) + { + echo " "; + } + else + { + echo html::a($this->createLink('productplan', 'create', "product=$productID&branch=$branch&parent={$plan->id}"), "", '', "class='btn' title='{$this->lang->productplan->children}'"); + } } if(common::hasPriv('productplan', 'delete', $plan)) diff --git a/module/productplan/view/view.html.php b/module/productplan/view/view.html.php index d891801f4b..7423ce1262 100644 --- a/module/productplan/view/view.html.php +++ b/module/productplan/view/view.html.php @@ -59,11 +59,12 @@ common::printLink('productplan', 'finish', "planID=$plan->id", "{$lang->productplan->finishAB}", '', "class='btn btn-link {$class}' target='hiddenwin' title='{$lang->productplan->finish}'", '', false, $plan); $class = $plan->status == 'done' ? '' : 'disabled'; common::printLink('productplan', 'close', "planID=$plan->id", "{$lang->productplan->closeAB}", '', "class='btn btn-link {$class}' target='hiddenwin' title='{$lang->productplan->close}'", '', false, $plan); - $class = $plan->status == 'closed' ? '' : 'disabled'; + $class = in_array($plan->status, array('closed', 'done')) ? '' : 'disabled'; common::printLink('productplan', 'activate', "planID=$plan->id", "{$lang->productplan->activateAB}", '', "class='btn btn-link {$class}' target='hiddenwin' title='{$lang->productplan->activate}'", '', false, $plan); } - if(common::hasPriv('productplan', 'create', $plan) and $plan->parent <= '0') echo html::a($this->createLink('productplan', 'create', "product={$plan->product}&branch={$plan->branch}&parent={$plan->id}"), " " . $this->lang->productplan->children , '', "class='btn btn-link' title='{$this->lang->productplan->children}'"); + $class = in_array($plan->status, array('done', 'closed')) ? 'disabled' : ''; + if(common::hasPriv('productplan', 'create', $plan) and $plan->parent <= '0') echo html::a($this->createLink('productplan', 'create', "product={$plan->product}&branch={$plan->branch}&parent={$plan->id}"), " " . $this->lang->productplan->children , '', "class='btn btn-link {$class}' title='{$this->lang->productplan->children}'"); if(common::hasPriv('productplan', 'edit', $plan)) echo html::a($this->createLink('productplan', 'edit', "planID=$plan->id"), " " . $this->lang->edit, '', "class='btn btn-link' title='{$this->lang->edit}'"); if(common::hasPriv('productplan', 'delete', $plan) and $plan->parent >= 0) echo html::a($this->createLink('productplan', 'delete', "planID=$plan->id"), " " . $this->lang->delete, '', "class='btn btn-link' title='{$this->lang->delete}' target='hiddenwin'"); } From e3933a0f883b1c07a613203e0c0f2ebb7f2f3778 Mon Sep 17 00:00:00 2001 From: liumengyi Date: Thu, 30 Dec 2021 14:26:35 +0800 Subject: [PATCH 5/9] * Modify judgment for task#46654. --- module/productplan/view/browsebylist.html.php | 1 + 1 file changed, 1 insertion(+) diff --git a/module/productplan/view/browsebylist.html.php b/module/productplan/view/browsebylist.html.php index 9563308bb9..3b4fdafbfb 100644 --- a/module/productplan/view/browsebylist.html.php +++ b/module/productplan/view/browsebylist.html.php @@ -167,6 +167,7 @@ $branchStatus = isset($branchStatusList[$plan->branch]) ? $branchStatusList[$plan->branch] : ''; if($branchStatus == 'closed') $disabled = 'disabled'; } + if(in_array($plan->status, array('done', 'closed'))) $disabled = 'disabled'; if($config->systemMode == 'new') { From 82a0d10f4b984a32a057bea8fbea7b1e85953cd3 Mon Sep 17 00:00:00 2001 From: tianshujie Date: Thu, 30 Dec 2021 14:29:53 +0800 Subject: [PATCH 6/9] * The plan is completed or closed grayed out to create an execution button. --- module/productplan/js/browse.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/module/productplan/js/browse.js b/module/productplan/js/browse.js index 7a4dbda12c..48add680b1 100644 --- a/module/productplan/js/browse.js +++ b/module/productplan/js/browse.js @@ -125,7 +125,11 @@ function createCardMenu(options) var executionLink = systemMode == 'new' ? '#projects' : createLink('execution', 'create', "projectID=0&executionID=0©ExecutionID=0&plan=" + card.id + "&confirm=no&productID=" + productID); var today = new Date(); var end = $.zui.createDate(card.end); - if(end.toLocaleDateString() < today.toLocaleDateString() && (card.status == 'wait' || card.status == 'doing')) + if(end.toLocaleDateString() < today.toLocaleDateString()) + { + className = 'disabled'; + } + else if(card.status == 'done' || card.status == 'closed') { className = 'disabled'; } @@ -134,10 +138,6 @@ function createCardMenu(options) var branchStatus = branchStatusList[card.branch]; if(branchStatus == 'closed') className = 'disabled'; } - else if(card.status == 'done' || card.status == 'closed') - { - className = 'disabled'; - } if(systemMode == 'new') { From 9ecbdf2509d3a83f13649b8f8700112812448661 Mon Sep 17 00:00:00 2001 From: liumengyi Date: Thu, 30 Dec 2021 14:33:20 +0800 Subject: [PATCH 7/9] * Modify the judged data type. --- module/productplan/view/browsebylist.html.php | 2 +- module/productplan/view/view.html.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/module/productplan/view/browsebylist.html.php b/module/productplan/view/browsebylist.html.php index 3b4fdafbfb..9aebfe29e2 100644 --- a/module/productplan/view/browsebylist.html.php +++ b/module/productplan/view/browsebylist.html.php @@ -183,7 +183,7 @@ common::printIcon('productplan', 'edit', "planID=$plan->id", $plan, 'list'); if(common::hasPriv('productplan', 'create', $plan)) { - if($plan->parent > '0' or in_array($plan->status, array('done', 'closed'))) + if($plan->parent > 0 or in_array($plan->status, array('done', 'closed'))) { echo " "; } diff --git a/module/productplan/view/view.html.php b/module/productplan/view/view.html.php index 7423ce1262..e966ae107a 100644 --- a/module/productplan/view/view.html.php +++ b/module/productplan/view/view.html.php @@ -64,7 +64,7 @@ } $class = in_array($plan->status, array('done', 'closed')) ? 'disabled' : ''; - if(common::hasPriv('productplan', 'create', $plan) and $plan->parent <= '0') echo html::a($this->createLink('productplan', 'create', "product={$plan->product}&branch={$plan->branch}&parent={$plan->id}"), " " . $this->lang->productplan->children , '', "class='btn btn-link {$class}' title='{$this->lang->productplan->children}'"); + if(common::hasPriv('productplan', 'create', $plan) and $plan->parent <= 0) echo html::a($this->createLink('productplan', 'create', "product={$plan->product}&branch={$plan->branch}&parent={$plan->id}"), " " . $this->lang->productplan->children , '', "class='btn btn-link {$class}' title='{$this->lang->productplan->children}'"); if(common::hasPriv('productplan', 'edit', $plan)) echo html::a($this->createLink('productplan', 'edit', "planID=$plan->id"), " " . $this->lang->edit, '', "class='btn btn-link' title='{$this->lang->edit}'"); if(common::hasPriv('productplan', 'delete', $plan) and $plan->parent >= 0) echo html::a($this->createLink('productplan', 'delete', "planID=$plan->id"), " " . $this->lang->delete, '', "class='btn btn-link' title='{$this->lang->delete}' target='hiddenwin'"); } From ebe4c658070d4f924bd4c2a63a934968ae38e3ee Mon Sep 17 00:00:00 2001 From: liumengyi Date: Thu, 30 Dec 2021 15:11:43 +0800 Subject: [PATCH 8/9] * Add child Label. --- module/productplan/view/browsebylist.html.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/module/productplan/view/browsebylist.html.php b/module/productplan/view/browsebylist.html.php index 9aebfe29e2..cd6dc6fdf4 100644 --- a/module/productplan/view/browsebylist.html.php +++ b/module/productplan/view/browsebylist.html.php @@ -113,10 +113,13 @@