From f516dcad8a0ed60ed8fd520fb2113ee4ac23cc71 Mon Sep 17 00:00:00 2001 From: xieqiyu Date: Fri, 28 Nov 2025 02:42:40 +0000 Subject: [PATCH] * [task#152647] Set the button of stage when stage are baselined. --- module/execution/control.php | 12 ++++++++++++ module/execution/lang/de.php | 3 +++ module/execution/lang/en.php | 3 +++ module/execution/lang/fr.php | 3 +++ module/execution/lang/zh-cn.php | 3 +++ module/execution/model.php | 2 ++ module/execution/ui/activate.html.php | 6 ++++-- module/project/ui/execution.html.php | 8 +++++++- module/task/model.php | 9 ++++++++- 9 files changed, 45 insertions(+), 4 deletions(-) diff --git a/module/execution/control.php b/module/execution/control.php index 214c5e90eb..70f42ae4e7 100644 --- a/module/execution/control.php +++ b/module/execution/control.php @@ -1066,6 +1066,13 @@ class execution extends control $this->loadModel('project')->checkAccess($projectID, $allProjects); if(empty($projectID)) $projectID = key($allProjects) ? key($allProjects) : 0; + /* 过滤掉阶段已打基线的项目。*/ + $executionList = $this->project->getExecutionList(array_keys($allProjects)); + foreach($executionList as $executionInfo) + { + if(!empty($executionInfo->frozen)) unset($allProjects[$executionInfo->project]); + } + $project = empty($projectID) ? null : $this->loadModel('project')->fetchByID($projectID); $project ? $this->executionZen->correctExecutionCommonLang($project, $execution->type) : $project = null; $products = $this->executionZen->getLinkedProducts($copyExecutionID, $planID, $project); @@ -1377,6 +1384,11 @@ class execution extends control $relatedProjects = $this->dao->select('id,project')->from(TABLE_PROJECT)->where('id')->in($executionIDList)->fetchPairs(); /* 获取执行所属的项目列表。*/ $projects = $this->dao->select('*')->from(TABLE_PROJECT)->where('id')->in($relatedProjects)->fetchAll('id'); /* 获取执行所属的项目列表中每个项目的项目信息。*/ + foreach($executions as $key => $execution) + { + if(!empty($execution->frozen)) unset($executions[$key]); + } + list($pmUsers, $poUsers, $qdUsers, $rdUsers) = $this->executionZen->setUserMoreLink($executions); /* Set custom fields. */ diff --git a/module/execution/lang/de.php b/module/execution/lang/de.php index 853a3c9935..64789b800b 100644 --- a/module/execution/lang/de.php +++ b/module/execution/lang/de.php @@ -163,6 +163,9 @@ $lang->execution->typeTip = "The sub-stages of other types can be cre $lang->execution->waterfallTip = "In the Waterfall {$lang->projectCommon} or in the Waterfall + {$lang->projectCommon},"; $lang->execution->progressTip = 'All Progress = Consumed / (Consumed + Left)'; $lang->execution->limitedTip = "Limited users can only edit tasks that are relevant to them and cannot create new tasks. Relevant tasks include those assigned to them, completed tasks, canceled tasks, closed tasks, and the last edited tasks, but exclude those copied to them. \nIf a user was not a limited user before but is now classified as one, they will still have permissions for tasks they created in the past."; +$lang->execution->stageFrozenTip = 'After the stage are baselined, %s is not allowed.'; +$lang->execution->createChildStage = 'create child stage'; +$lang->execution->ganttDrag = 'Drag'; $lang->execution->start = 'Start'; $lang->execution->activate = 'Aktivieren'; diff --git a/module/execution/lang/en.php b/module/execution/lang/en.php index 7bf9c3c25a..d1eba823a2 100644 --- a/module/execution/lang/en.php +++ b/module/execution/lang/en.php @@ -163,6 +163,9 @@ $lang->execution->typeTip = "The sub-stages of other types can be cre $lang->execution->waterfallTip = "In the Waterfall {$lang->projectCommon} or in the Waterfall + {$lang->projectCommon},"; $lang->execution->progressTip = 'All Progress = Consumed / (Consumed + Left)'; $lang->execution->limitedTip = "Limited users can only edit tasks that are relevant to them and cannot create new tasks. Relevant tasks include those assigned to them, completed tasks, canceled tasks, closed tasks, and the last edited tasks, but exclude those copied to them. \nIf a user was not a limited user before but is now classified as one, they will still have permissions for tasks they created in the past."; +$lang->execution->stageFrozenTip = 'After the stage are baselined, %s is not allowed.'; +$lang->execution->createChildStage = 'create child stage'; +$lang->execution->ganttDrag = 'Drag'; $lang->execution->start = 'Start'; $lang->execution->activate = 'Activate'; diff --git a/module/execution/lang/fr.php b/module/execution/lang/fr.php index becad61f4c..ddd9e9a5b0 100644 --- a/module/execution/lang/fr.php +++ b/module/execution/lang/fr.php @@ -163,6 +163,9 @@ $lang->execution->typeTip = "The sub-stages of other types can be cre $lang->execution->waterfallTip = "In the Waterfall {$lang->projectCommon} or in the Waterfall + {$lang->projectCommon},"; $lang->execution->progressTip = 'All Progress = Consumed / (Consumed + Left)'; $lang->execution->limitedTip = "Limited users can only edit tasks that are relevant to them and cannot create new tasks. Relevant tasks include those assigned to them, completed tasks, canceled tasks, closed tasks, and the last edited tasks, but exclude those copied to them. \nIf a user was not a limited user before but is now classified as one, they will still have permissions for tasks they created in the past."; +$lang->execution->stageFrozenTip = 'After the stage are baselined, %s is not allowed.'; +$lang->execution->createChildStage = 'create child stage'; +$lang->execution->ganttDrag = 'Drag'; $lang->execution->start = 'Démarrer'; $lang->execution->activate = 'Activer'; diff --git a/module/execution/lang/zh-cn.php b/module/execution/lang/zh-cn.php index 8b5fb30479..ecfacce9f8 100644 --- a/module/execution/lang/zh-cn.php +++ b/module/execution/lang/zh-cn.php @@ -163,6 +163,9 @@ $lang->execution->typeTip = '“综合”类型的父阶段可以创 $lang->execution->waterfallTip = "瀑布{$lang->projectCommon}和融合瀑布{$lang->projectCommon}中,"; $lang->execution->progressTip = '总进度 = 已消耗工时 / (已消耗工时 + 剩余工时)'; $lang->execution->limitedTip = "受限用户只能编辑与自己相关的任务,不能新增任务。与自己相关的内容,包含指派给、已完成、已取消、已关闭、最后编辑,不包含抄送给的内容。 \n如果该用户之前不是受限用户,现在是受限用户,那么之前由他创建的任务还有相关的操作权限。"; +$lang->execution->stageFrozenTip = '阶段打基线后不允许%s'; +$lang->execution->createChildStage = '创建子阶段'; +$lang->execution->ganttDrag = '拖拽'; $lang->execution->start = "开始"; $lang->execution->activate = "激活"; diff --git a/module/execution/model.php b/module/execution/model.php index 524845622e..75dcad9e47 100755 --- a/module/execution/model.php +++ b/module/execution/model.php @@ -3929,6 +3929,7 @@ class executionModel extends model */ public static function isClickable(object $execution, string $action): bool { + if(!empty($execution->frozen) && in_array($action, array('edit', 'createChildStage', 'delete', 'putoff'))) return false; if($action == 'createChildStage') return commonModel::hasPriv('programplan', 'create') && $execution->type == 'stage'; if($action == 'createTask') return commonModel::hasPriv('task', 'create') && commonModel::hasPriv('execution', 'create') && empty($execution->isParent); if(!commonModel::hasPriv('execution', $action)) return false; @@ -4964,6 +4965,7 @@ class executionModel extends model if($actionName == 'createChildStage' && $action['disabled'] && $execution->type != 'stage') $action['hint'] = $this->lang->programplan->error->notStage; if(!$action['disabled']) break; if($actionName == 'close' && $execution->status != 'closed') break; + if(!empty($execution->frozen) && in_array($actionName, array('edit', 'createChildStage', 'delete', 'putoff'))) $action['hint'] = sprintf($this->lang->execution->stageFrozenTip, $this->lang->execution->$actionName); } if(!empty($action)) diff --git a/module/execution/ui/activate.html.php b/module/execution/ui/activate.html.php index d1e6f77e03..6eca1e1aaf 100644 --- a/module/execution/ui/activate.html.php +++ b/module/execution/ui/activate.html.php @@ -26,13 +26,15 @@ formPanel datePicker ( set::name('begin'), - set::value($newBegin) + set::value($newBegin), + set::disabled(!empty($execution->frozen)) ), $lang->execution->to, datePicker ( set::name('end'), - set::value($newEnd) + set::value($newEnd), + set::disabled(!empty($execution->frozen)) ) ) ), diff --git a/module/project/ui/execution.html.php b/module/project/ui/execution.html.php index 16cb76f598..95b1629ef6 100644 --- a/module/project/ui/execution.html.php +++ b/module/project/ui/execution.html.php @@ -25,6 +25,12 @@ jsVar('confirmCreateStage', $lang->project->confirmCreateStage); $searchTask = strtolower($status) == 'bysearch'; +$frozenExecutions = 0; +foreach($executionStats as $execution) +{ + if(!empty($execution->frozen)) $frozenExecutions ++; +} + $footToolbar = array(); $canModify = common::canModify('project', $project); $canBatchEdit = hasPriv('execution', 'batchEdit'); @@ -32,7 +38,7 @@ $canBatchChangeStatus = hasPriv('execution', 'batchChangeStatus'); $canBatchAction = $canModify && ($canBatchEdit || $canBatchChangeStatus); if($canBatchAction) { - if($canBatchEdit) + if($canBatchEdit && empty($frozenExecutions)) { $footToolbar['items'][] = array ( diff --git a/module/task/model.php b/module/task/model.php index 0b65701f4d..5fb026acc0 100755 --- a/module/task/model.php +++ b/module/task/model.php @@ -3390,8 +3390,15 @@ class taskModel extends model */ public function updateExecutionEsDateByGantt(object $postData): bool { + $stage = $this->dao->select('project,parent,frozen')->from(TABLE_EXECUTION)->where('id')->eq($postData->id)->fetch(); + if(!empty($stage->frozen)) + { + $this->app->loadLang('execution'); + dao::$errors[] = sprintf($this->lang->execution->stageFrozenTip, $this->lang->execution->ganttDrag); + return false; + } + /* Get parent information. */ - $stage = $this->dao->select('project,parent')->from(TABLE_EXECUTION)->where('id')->eq($postData->id)->fetch(); $parentID = $stage->project != $stage->parent ? $stage->parent : 0; $parentData = $this->dao->select('begin,end')->from(TABLE_PROJECT)->where('id')->eq($parentID ? $parentID : $stage->project)->fetch();