From 1ae1352f113fc826fdca9d08dafcd2dc2d4b2db1 Mon Sep 17 00:00:00 2001 From: lanzongjun Date: Wed, 3 Aug 2022 09:28:39 +0800 Subject: [PATCH] * finish task #62889 --- module/programplan/lang/de.php | 1 + module/programplan/lang/en.php | 1 + module/programplan/lang/fr.php | 1 + module/programplan/lang/zh-cn.php | 1 + module/programplan/view/gantt.html.php | 6 +++--- module/task/model.php | 24 +++++++++++++++++------- 6 files changed, 24 insertions(+), 10 deletions(-) diff --git a/module/programplan/lang/de.php b/module/programplan/lang/de.php index c715d8d2c9..c5bc71e4b6 100644 --- a/module/programplan/lang/de.php +++ b/module/programplan/lang/de.php @@ -84,3 +84,4 @@ $lang->programplan->error->createdTask = 'The task has been decomposed. Sub $lang->programplan->error->parentWorkload = 'The sum of the workload of the child phase cannot be greater than that of the parent phase: %s.'; $lang->programplan->error->parentDuration = 'The planned start and planned completion of the child phase cannot exceed the parent phase.'; $lang->programplan->error->sameName = 'Stage name cannot be the same!'; +$lang->programplan->error->taskDrag = 'The %s task cannot be dragged'; \ No newline at end of file diff --git a/module/programplan/lang/en.php b/module/programplan/lang/en.php index 9bd54976bf..ca205f7e10 100644 --- a/module/programplan/lang/en.php +++ b/module/programplan/lang/en.php @@ -84,3 +84,4 @@ $lang->programplan->error->createdTask = 'The task is decomposed. Sub stages $lang->programplan->error->parentWorkload = 'The sum of the workload in the sub stage cannot be > that in the parent stage: %s.'; $lang->programplan->error->parentDuration = 'The planned start and planned completion of the child phase cannot exceed the parent phase.'; $lang->programplan->error->sameName = 'Stage name cannot be the same!'; +$lang->programplan->error->taskDrag = 'The %s task cannot be dragged'; \ No newline at end of file diff --git a/module/programplan/lang/fr.php b/module/programplan/lang/fr.php index c715d8d2c9..c5bc71e4b6 100644 --- a/module/programplan/lang/fr.php +++ b/module/programplan/lang/fr.php @@ -84,3 +84,4 @@ $lang->programplan->error->createdTask = 'The task has been decomposed. Sub $lang->programplan->error->parentWorkload = 'The sum of the workload of the child phase cannot be greater than that of the parent phase: %s.'; $lang->programplan->error->parentDuration = 'The planned start and planned completion of the child phase cannot exceed the parent phase.'; $lang->programplan->error->sameName = 'Stage name cannot be the same!'; +$lang->programplan->error->taskDrag = 'The %s task cannot be dragged'; \ No newline at end of file diff --git a/module/programplan/lang/zh-cn.php b/module/programplan/lang/zh-cn.php index dac57a780a..1723c6b3cc 100644 --- a/module/programplan/lang/zh-cn.php +++ b/module/programplan/lang/zh-cn.php @@ -84,3 +84,4 @@ $lang->programplan->error->createdTask = '已分解任务,不可添加子 $lang->programplan->error->parentWorkload = '子阶段的工作量之和不能大于父阶段的工作量:%s'; $lang->programplan->error->parentDuration = '子阶段计划开始、计划完成不能超过父阶段'; $lang->programplan->error->sameName = '阶段名称不能相同!'; +$lang->programplan->error->taskDrag = '%s的任务不可以拖动'; \ No newline at end of file diff --git a/module/programplan/view/gantt.html.php b/module/programplan/view/gantt.html.php index d094e68cc8..f5bef7c749 100644 --- a/module/programplan/view/gantt.html.php +++ b/module/programplan/view/gantt.html.php @@ -390,9 +390,9 @@ function validateResources(id) flag = true; /* Check status. */ - if(status !== statusLang) + if(status !== statusLang && type === 'task') { - new $.zui.Messager(status + '的任务不可以拖动', { + new $.zui.Messager("programplan->error->taskDrag;?>".replace('%s', status), { type: 'danger', icon: 'exclamation-sign' }).show(); @@ -459,7 +459,7 @@ $(function() gantt.config.readonly = false; gantt.config.order_branch = true; gantt.config.details_on_dblclick = false; - gantt.config.drag_progress = true; + gantt.config.drag_progress = false; gantt.config.drag_links = false; gantt.config.drag_resize = false; gantt.config.smart_rendering = true; diff --git a/module/task/model.php b/module/task/model.php index cdba5ab456..c0ea09162d 100644 --- a/module/task/model.php +++ b/module/task/model.php @@ -3934,6 +3934,14 @@ class taskModel extends model return dao::$errors = sprintf($this->lang->task->overTime, $arg, $arg); } + $updateStartArg = !empty($objectData->realStarted) ? 'realStarted' : 'estStarted'; + $updateEndArg = !empty($objectData->finishedDate) ? 'finishedDate' : 'deadline'; + $this->dao->update(TABLE_TASK) + ->set($updateStartArg)->eq($post->start_date) + ->set($updateEndArg)->eq($post->end_date) + ->set('lastEditedBy')->eq($this->app->user->account) + ->where('id')->eq($objectID) + ->exec(); } elseif($objectType == 'plan') { @@ -3962,19 +3970,21 @@ class taskModel extends model $arg = !empty($parent) ? $this->lang->programplan->parent : $this->lang->project->common; return dao::$errors = sprintf($this->lang->task->overTime, $arg, $arg); } + + $updateStartArg = !empty($objectData->realBegan) ? 'realBegan' : 'begin'; + $updateEndArg = !empty($objectData->realEnd) ? 'realEnd' : 'end'; + $this->dao->update(TABLE_PROJECT) + ->set($updateStartArg)->eq($post->start_date) + ->set($updateEndArg)->eq($post->end_date) + ->set('lastEditedBy')->eq($this->app->user->account) + ->where('id')->eq($objectID) + ->exec(); } else { return false; } - $this->dao->update(TABLE_TASK) - ->set('estStarted')->eq($post->start_date) - ->set('deadline')->eq($post->end_date) - ->set('lastEditedBy')->eq($this->app->user->account) - ->where('id')->eq($objectID) - ->exec(); - return true; } }