From b7e3fe90033d5e957c2b12e4b9fd91c40ddbe4ea Mon Sep 17 00:00:00 2001 From: zhouxin Date: Wed, 17 Nov 2021 15:49:24 +0800 Subject: [PATCH] Finis task #44486,44487,44488. --- module/action/lang/de.php | 7 +++ module/action/lang/en.php | 7 +++ module/action/lang/fr.php | 7 +++ module/action/lang/vi.php | 7 +++ module/action/lang/zh-cn.php | 8 +++ module/action/lang/zh-tw.php | 7 +++ module/action/model.php | 5 ++ module/common/model.php | 116 +++++++++++++++++++++++++++++++++++ module/execution/control.php | 13 ++++ module/execution/model.php | 1 + module/program/control.php | 2 + module/project/control.php | 1 + module/task/control.php | 21 +++++++ 13 files changed, 202 insertions(+) diff --git a/module/action/lang/de.php b/module/action/lang/de.php index 7d8d8eaca2..166a75bda5 100644 --- a/module/action/lang/de.php +++ b/module/action/lang/de.php @@ -150,6 +150,9 @@ $lang->action->desc->resolved = '$date, resolved by $actoraction->desc->managed = '$date, by $actor managed.' . "\n"; $lang->action->desc->estimated = '$date, by $actor estimated.' . "\n"; $lang->action->desc->run = '$date, by $actor executed.' . "\n"; +$lang->action->desc->syncprogram = '$date, started by $actor(The start of the project sets the status of the program as Ongoing)' . "\n"; +$lang->action->desc->syncproject = '$date, The start of the execution sets the status of the project as Ongoing' . "\n"; +$lang->action->desc->syncexecution = '$date, The start of the task sets the status of the execution as Ongoing' . "\n"; /* 子任务修改父任务的历史操作记录 */ $lang->action->desc->createchildren = '$date, $actor created a child task $extra。' . "\n"; @@ -265,6 +268,10 @@ $lang->action->label->reviewrejected = 'Reject'; $lang->action->label->reviewclarified = 'Clarify'; $lang->action->label->commitsummary = 'Commit Summary'; $lang->action->label->updatetrainee = 'Update Trainee'; +$lang->action->label->syncprogram = 'start'; +$lang->action->label->syncproject = 'start'; +$lang->action->label->syncexecution = 'start'; +$lang->action->label->startProgram = '(The start of the project sets the status of the program as Ongoing)'; /* 动态信息按照对象分组 */ $lang->action->dynamicAction = new stdclass; diff --git a/module/action/lang/en.php b/module/action/lang/en.php index 53a397e4d2..74bf4065d9 100755 --- a/module/action/lang/en.php +++ b/module/action/lang/en.php @@ -164,6 +164,9 @@ $lang->action->desc->resolved = '$date, resolved by $actoraction->desc->managed = '$date, by $actor managed.' . "\n"; $lang->action->desc->estimated = '$date, by $actor estimated.' . "\n"; $lang->action->desc->run = '$date, by $actor executed.' . "\n"; +$lang->action->desc->syncprogram = '$date, started by $actor(The start of the project sets the status of the program as Ongoing)' . "\n"; +$lang->action->desc->syncproject = '$date, The start of the execution sets the status of the project as Ongoing' . "\n"; +$lang->action->desc->syncexecution = '$date, The start of the task sets the status of the execution as Ongoing' . "\n"; /* Used to describe the history of operations related to parent-child tasks. */ $lang->action->desc->createchildren = '$date, $actor created a child task $extra。' . "\n"; @@ -280,6 +283,10 @@ $lang->action->label->reviewclarified = 'Clarify'; $lang->action->label->commitsummary = 'Commit Summary'; $lang->action->label->updatetrainee = 'Update Trainee'; $lang->action->label->setdefaultbranch = 'Set default branch'; +$lang->action->label->syncprogram = 'start'; +$lang->action->label->syncproject = 'start'; +$lang->action->label->syncexecution = 'start'; +$lang->action->label->startProgram = '(The start of the project sets the status of the program as Ongoing)'; /* Dynamic information is grouped by object. */ $lang->action->dynamicAction = new stdclass; diff --git a/module/action/lang/fr.php b/module/action/lang/fr.php index 0754fd1130..d54512e2ef 100644 --- a/module/action/lang/fr.php +++ b/module/action/lang/fr.php @@ -150,6 +150,9 @@ $lang->action->desc->resolved = '$date, resolved by $actoraction->desc->managed = '$date, by $actor managed.' . "\n"; $lang->action->desc->estimated = '$date, by $actor estimated.' . "\n"; $lang->action->desc->run = '$date, by $actor executed.' . "\n"; +$lang->action->desc->syncprogram = '$date, started by $actor(The start of the project sets the status of the program as Ongoing)' . "\n"; +$lang->action->desc->syncproject = '$date, The start of the execution sets the status of the project as Ongoing' . "\n"; +$lang->action->desc->syncexecution = '$date, The start of the task sets the status of the execution as Ongoing' . "\n"; /* 子任务修改父任务的历史操作记录 */ $lang->action->desc->createchildren = '$date, $actor a créé un sous-tâche $extra。' . "\n"; @@ -265,6 +268,10 @@ $lang->action->label->reviewrejected = 'Reject'; $lang->action->label->reviewclarified = 'Clarify'; $lang->action->label->commitsummary = 'Commit Summary'; $lang->action->label->updatetrainee = 'Update Trainee'; +$lang->action->label->syncprogram = 'start'; +$lang->action->label->syncproject = 'start'; +$lang->action->label->syncexecution = 'start'; +$lang->action->label->startProgram = '(The start of the project sets the status of the program as Ongoing)'; /* 动态信息按照对象分组 */ $lang->action->dynamicAction = new stdclass(); diff --git a/module/action/lang/vi.php b/module/action/lang/vi.php index 67a7ae7567..ce4be8b8ef 100644 --- a/module/action/lang/vi.php +++ b/module/action/lang/vi.php @@ -150,6 +150,9 @@ $lang->action->desc->resolved = '$date, resolved by $actoraction->desc->managed = '$date, by $actor managed.' . "\n"; $lang->action->desc->estimated = '$date, by $actor estimated.' . "\n"; $lang->action->desc->run = '$date, by $actor executed.' . "\n"; +$lang->action->desc->syncprogram = '$date, started by $actor(The start of the project sets the status of the program as Ongoing)' . "\n"; +$lang->action->desc->syncproject = '$date, The start of the execution sets the status of the project as Ongoing' . "\n"; +$lang->action->desc->syncexecution = '$date, The start of the task sets the status of the execution as Ongoing' . "\n"; /* Used to describe the history of operations related to parent-child tasks. */ $lang->action->desc->createchildren = '$date, $actor created a child task $extra。' . "\n"; @@ -265,6 +268,10 @@ $lang->action->label->reviewrejected = 'Reject'; $lang->action->label->reviewclarified = 'Clarify'; $lang->action->label->commitsummary = 'Commit Summary'; $lang->action->label->updatetrainee = 'Update Trainee'; +$lang->action->label->syncprogram = 'start'; +$lang->action->label->syncproject = 'start'; +$lang->action->label->syncexecution = 'start'; +$lang->action->label->startProgram = '(The start of the project sets the status of the program as Ongoing)'; /* Dynamic information is grouped by object. */ $lang->action->dynamicAction = new stdclass; diff --git a/module/action/lang/zh-cn.php b/module/action/lang/zh-cn.php index 7f71f341bc..8cbf105983 100755 --- a/module/action/lang/zh-cn.php +++ b/module/action/lang/zh-cn.php @@ -164,6 +164,10 @@ $lang->action->desc->resolved = '$date, 由 $actor 解 $lang->action->desc->managed = '$date, 由 $actor 维护。' . "\n"; $lang->action->desc->estimated = '$date, 由 $actor 估算。' . "\n"; $lang->action->desc->run = '$date, 由 $actor 执行。' . "\n"; +$lang->action->desc->syncprogram = '$date, 由 $actor 启动(因项目开始而启动项目集)。' . "\n"; +$lang->action->desc->syncproject = '$date, 系统判断由执行开始,将项目状态置为进行中。' . "\n"; +$lang->action->desc->syncexecution = '$date, 系统判断由任务开始,将执行状态置为进行中。' . "\n"; + /* 用来描述和父子任务相关的操作历史记录。*/ $lang->action->desc->createchildren = '$date, 由 $actor 创建子任务 $extra。' . "\n"; @@ -280,6 +284,10 @@ $lang->action->label->reviewclarified = '有待明确'; $lang->action->label->commitsummary = '提交培训总结'; $lang->action->label->updatetrainee = '更新培训人员'; $lang->action->label->setdefaultbranch = '设置了默认分支'; +$lang->action->label->syncprogram = '开始了'; +$lang->action->label->syncproject = '开始了'; +$lang->action->label->syncexecution = '开始了'; +$lang->action->label->startProgram = '(因项目开始而启动项目集)'; /* 动态信息按照对象分组 */ $lang->action->dynamicAction = new stdclass(); diff --git a/module/action/lang/zh-tw.php b/module/action/lang/zh-tw.php index 93f8d1a424..3cf12df3db 100755 --- a/module/action/lang/zh-tw.php +++ b/module/action/lang/zh-tw.php @@ -164,6 +164,9 @@ $lang->action->desc->resolved = '$date, 由 $actor 解 $lang->action->desc->managed = '$date, 由 $actor 維護。' . "\n"; $lang->action->desc->estimated = '$date, 由 $actor 估算。' . "\n"; $lang->action->desc->run = '$date, 由 $actor 執行。' . "\n"; +$lang->action->desc->syncprogram = '$date, 由 $actor 啟動(因項目開始而啟動項目集)。' . "\n"; +$lang->action->desc->syncproject = '$date, 系統判斷由執行開始,將項目狀態置為進行中。' . "\n"; +$lang->action->desc->syncexecution = '$date, 系統判斷由任務開始,將執行狀態置為進行中。' . "\n"; /* 用來描述和父子任務相關的操作歷史記錄。*/ $lang->action->desc->createchildren = '$date, 由 $actor 創建子任務 $extra。' . "\n"; @@ -279,6 +282,10 @@ $lang->action->label->reviewrejected = '拒絶'; $lang->action->label->reviewclarified = '有待明確'; $lang->action->label->commitsummary = '提交培訓總結'; $lang->action->label->updatetrainee = '更新培訓人員'; +$lang->action->label->syncprogram = '開始了'; +$lang->action->label->syncproject = '開始了'; +$lang->action->label->syncexecution = '開始了'; +$lang->action->label->startProgram = '(因項目開始而啟動項目集)'; /* 動態信息按照對象分組 */ $lang->action->dynamicAction = new stdclass(); diff --git a/module/action/model.php b/module/action/model.php index f5f9ad45e2..48edc495db 100755 --- a/module/action/model.php +++ b/module/action/model.php @@ -969,6 +969,11 @@ class actionModel extends model /* Add name field to the actions. */ $action->objectName = isset($objectNames[$action->objectType][$action->objectID]) ? $objectNames[$action->objectType][$action->objectID] : ''; + if($action->objectType =='program' and strpos('syncexecution,syncproject,syncprogram', $action->action) !==false) + { + $action->objectName .= $this->lang->action->label->startProgram; + } + $projectID = isset($relatedProjects[$action->objectType][$action->objectID]) ? $relatedProjects[$action->objectType][$action->objectID] : 0; $actionType = strtolower($action->action); diff --git a/module/common/model.php b/module/common/model.php index d33cbf4d0c..94e4c2c146 100644 --- a/module/common/model.php +++ b/module/common/model.php @@ -36,6 +36,122 @@ class commonModel extends model } } + /** + * Set the status of execution, project, and program to doing. + * + * @param int $objectID + * @access public + * @return void + */ + public function syncPPEStatus($objectID) + { + global $app; + $thisModule = $app->rawModule; + + if($this->config->systemMode == 'classic') + { + if($thisModule == 'task') $this->syncExecutionStatus($objectID); + } + + if($this->config->systemMode == 'new') + { + if($thisModule == 'task') + { + $taskID = $objectID; + $execution = $this->syncExecutionStatus($taskID); + $project = $this->syncProjectStatus($execution); + $this->syncProgramStatus($project); + } + if($thisModule == 'execution') + { + $executionID = $objectID; + $execution = $this->dao->select('*')->from(TABLE_EXECUTION)->where('id')->eq($executionID)->fetch(); + $project = $this->syncProjectStatus($execution); + $this->syncProgramStatus($project); + } + if($thisModule == 'project') + { + $projectID = $objectID; + $project = $this->dao->select('*')->from(TABLE_PROJECT)->where('id')->eq($projectID)->fetch(); + $this->syncProgramStatus($project); + } + if($thisModule == 'program') + { + $programID = $objectID; + $program = $this->dao->select('*')->from(TABLE_PROGRAM)->where('id')->eq($programID)->fetch(); + $this->syncProgramStatus($program); + } + } + } + + /** + * Set the status of the program to which theproject is linked as Ongoing. + * + * @param object $project + * @access public + * @return void + */ + public function syncProgramStatus($project) + { + if($project->parent == 0) return; + + $parentPath = str_replace(",{$project->id},", '', $project->path); + $parentPath = explode(',', trim($parentPath, ',')); + $waitList = $this->dao->select('id')->from(TABLE_PROGRAM) + ->where('id')->in($parentPath) + ->andWhere('status')->eq('wait') + ->orderBy('id_desc') + ->fetchPairs(); + + foreach($waitList as $programID) + { + $this->dao->update(TABLE_PROGRAM)->set('status')->eq('doing')->where('id')->eq($programID)->exec(); + $this->loadModel('action')->create('program', $programID, 'syncprogram'); + } + } + + /** + * Set the status of the project to which the execution is linked as Ongoing. + * + * @param object $execution + * @access public + * @return object $project + */ + public function syncProjectStatus($execution) + { + $projectID = $execution->project; + $project = $this->dao->select('*')->from(TABLE_PROJECT)->where('id')->eq($projectID)->fetch(); + + if($project->status == 'wait') + { + $this->dao->update(TABLE_PROJECT)->set('status')->eq('doing')->where('id')->eq($projectID)->exec(); + $this->loadModel('action')->create('project', $projectID, 'syncproject'); + } + return $project; + } + + /** + * Set the status of the execution to which the task is linked as Ongoing. + * + * @param int $taskID + * @access public + * @return object $execution + */ + public function syncExecutionStatus($taskID) + { + $execution = $this->dao->select('t1.*')->from(TABLE_EXECUTION)->alias('t1') + ->leftJoin(TABLE_TASK)->alias('t2')->on('t1.id=t2.execution') + ->where('t2.id')->eq($taskID) + ->fetch(); + + if($execution->status == 'wait') + { + $this->dao->update(TABLE_EXECUTION)->set('status')->eq('doing')->where('id')->eq($execution->id)->exec(); + $this->loadModel('action')->create('execution', $execution->id, 'syncexecution'); + } + return $execution; + } + /** * Set the header info. * diff --git a/module/execution/control.php b/module/execution/control.php index 6981d3f0de..58caaea281 100644 --- a/module/execution/control.php +++ b/module/execution/control.php @@ -1469,6 +1469,7 @@ class execution extends control } $this->executeHooks($executionID); + if($_POST['status'] == 'doing') $this->loadModel('common')->syncPPEStatus($executionID); return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => inlink('view', "executionID=$executionID"))); } @@ -1574,6 +1575,16 @@ class execution extends control $actionID = $this->loadModel('action')->create($this->objectType, $executionID, 'Edited'); $this->action->logHistory($actionID, $changes); + + foreach($changes as $changeField) + { + if($changeField['field'] == 'status' && $changeField['old'] =='wait' && $changeField['new'] =='doing') + { + $syncExecution = $executionID; + break; + } + } + $this->loadModel('common')->syncPPEStatus($syncExecution); } } die(js::locate($this->session->executionList, 'parent')); @@ -1651,6 +1662,8 @@ class execution extends control $actionID = $this->action->create($this->objectType, $executionID, 'Started', $this->post->comment); $this->action->logHistory($actionID, $changes); } + + $this->loadModel('common')->syncPPEStatus($executionID); $this->executeHooks($executionID); die(js::reload('parent.parent')); } diff --git a/module/execution/model.php b/module/execution/model.php index 7d8f0cdbbd..98fbb8e5bf 100644 --- a/module/execution/model.php +++ b/module/execution/model.php @@ -583,6 +583,7 @@ class executionModel extends model $oldExecutions = $this->getByIdList($this->post->executionIDList); $nameList = array(); $codeList = array(); + $projectModel = ''; /* Replace required language. */ if($this->app->tab == 'project') diff --git a/module/program/control.php b/module/program/control.php index b2ac179ed0..2c659df5ce 100644 --- a/module/program/control.php +++ b/module/program/control.php @@ -288,6 +288,8 @@ class program extends control $actionID = $this->action->create('program', $programID, 'Started', $this->post->comment); $this->action->logHistory($actionID, $changes); } + + $this->loadModel('common')->syncPPEStatus($programID); $this->executeHooks($programID); die(js::reload('parent.parent')); } diff --git a/module/project/control.php b/module/project/control.php index 86532a81f5..750d12f1b1 100644 --- a/module/project/control.php +++ b/module/project/control.php @@ -1421,6 +1421,7 @@ class project extends control } } } + $this->loadModel('common')->syncPPEStatus($projectID); $this->executeHooks($projectID); die(js::reload('parent.parent')); diff --git a/module/task/control.php b/module/task/control.php index 0c39718954..3cd0eb2f55 100644 --- a/module/task/control.php +++ b/module/task/control.php @@ -395,6 +395,8 @@ class task extends control $this->executeHooks($taskID); + if($_POST['status'] == 'doing') $this->loadModel('common')->syncPPEStatus($taskID); + if($task->fromBug != 0) { foreach($changes as $change) @@ -464,10 +466,25 @@ class task extends control if(!empty($allChanges)) { + /* updateStatus is a description of whether to update the responsibility performance*/ + $updateStatus = false; foreach($allChanges as $taskID => $changes) { if(empty($changes)) continue; + /* Determine whether the status of a task has been changed, if the status of a task has been changed, set $updateStatus to taskID*/ + if($updateStatus == false) + { + foreach($changes as $changeField) + { + if($changeField['field'] == 'status' && $changeField['new'] == 'doing') + { + $updateStatus = $taskID; + break; + } + } + } + $actionID = $this->loadModel('action')->create('task', $taskID, 'Edited'); $this->action->logHistory($actionID, $changes); @@ -484,6 +501,7 @@ class task extends control } } } + if($updateStatus !== false) $this->loadModel('common')->syncPPEStatus($updateStatus); } } $this->loadModel('score')->create('ajax', 'batchOther'); @@ -792,6 +810,7 @@ class task extends control } $this->executeHooks($taskID); + $this->loadModel('common')->syncPPEStatus($taskID); /* Remind whether to update status of the bug, if task which from that bug has been finished. */ if($changes and $this->task->needUpdateBugStatus($task)) @@ -838,6 +857,8 @@ class task extends control $changes = $this->task->recordEstimate($taskID); if(dao::isError()) die(js::error(dao::getError())); + $this->loadModel('common')->syncPPEStatus($taskID); + /* Remind whether to update status of the bug, if task which from that bug has been finished. */ $task = $this->task->getById($taskID); if($changes and $this->task->needUpdateBugStatus($task))