From 714aa3bafa1569894b92e83862e8e9f9841fc029 Mon Sep 17 00:00:00 2001 From: caoyanyi Date: Thu, 25 May 2023 15:34:08 +0800 Subject: [PATCH] - Remove unused fields. --- module/task/control.php | 8 ++++---- module/task/model.php | 14 +++++--------- module/task/test/model/afterstart.php | 4 ++-- module/task/test/task.class.php | 5 ++--- 4 files changed, 13 insertions(+), 18 deletions(-) diff --git a/module/task/control.php b/module/task/control.php index 6486817b25..b205d2e532 100755 --- a/module/task/control.php +++ b/module/task/control.php @@ -240,7 +240,7 @@ class task extends control ->add('id', $taskID) ->get(); - $changes = $this->task->assign($task); + $this->task->assign($task); if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError())); $this->executeHooks($taskID); @@ -430,7 +430,7 @@ class task extends control if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError())); /* Update other data related to the task after it is started. */ - $result = $this->task->afterStart($task, $taskData, $changes, $this->post->left, $this->post->comment, $output); + $result = $this->task->afterStart($task, $changes, $this->post->left, $output); if(is_array($result)) $this->send($result); /* Get the information returned after a task is started. */ @@ -665,7 +665,7 @@ class task extends control if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError())); /* Update other data related to the task after it is started. */ - $result = $this->task->afterStart($task, $taskData, $changes, 0, $this->post->comment, $output); + $result = $this->task->afterStart($task, $changes, 0, $output); if(is_array($result)) $this->send($result); /* Get the information returned after a task is started. */ @@ -841,7 +841,7 @@ class task extends control $taskIDList = array_unique($this->post->taskIDList); $tasks = $this->task->getByList($taskIDList); - foreach($tasks as $taskID => $task) + foreach($tasks as $task) { if(!in_array($task->status, $this->config->task->unfinishedStatus)) continue; diff --git a/module/task/model.php b/module/task/model.php index 1cd6ac2962..f8b939a125 100755 --- a/module/task/model.php +++ b/module/task/model.php @@ -158,11 +158,9 @@ class taskModel extends model { $this->loadModel('story'); - $parentID = !empty($tasks) ? current($tasks)->parent : 0; - $oldParentTask = $this->dao->findById($parentID)->from(TABLE_TASK)->fetch(); - $executionID = !empty($tasks) ? current($tasks)->execution : 0; - $execution = $this->loadModel('execution')->getById($executionID); - $taskIdList = array(); + $parentID = !empty($tasks) ? current($tasks)->parent : 0; + $executionID = !empty($tasks) ? current($tasks)->execution : 0; + $taskIdList = array(); foreach($tasks as $task) { /* Get the lane and column of the current task. */ @@ -1270,15 +1268,13 @@ class taskModel extends model * Other data process after task start. * * @param object $oldTask - * @param object $task * @param array $changes * @param int $left - * @param string $comment * @param array $output * @access public * @return array|bool */ - public function afterStart(object $oldTask, object $task, array $changes, int $left, string $comment, array $output): array|bool + public function afterStart(object $oldTask, array $changes, int $left, array $output): array|bool { /* Update the data of the parent task. */ if($oldTask->parent > 0) $this->computeBeginAndEnd($oldTask->parent); @@ -3955,7 +3951,7 @@ class taskModel extends model $files = $this->loadModel('file')->saveUpload('task', $task->id); if($changes || $this->post->comment) { - $fileAction = !empty($files) ? $this->lang->addFiles . join(',', $files) . "\n" : ''; + $fileAction = !empty($files) ? $this->lang->addFiles . implode(',', $files) . "\n" : ''; $actionID = $this->loadModel('action')->create('task', $task->id, $action, $fileAction . $this->post->comment); $this->action->logHistory($actionID, $changes); } diff --git a/module/task/test/model/afterstart.php b/module/task/test/model/afterstart.php index c731a36851..63b72ed2ea 100755 --- a/module/task/test/model/afterstart.php +++ b/module/task/test/model/afterstart.php @@ -42,5 +42,5 @@ r($taskTester->afterStartTest($taskIDList[4], $closedTask)) && p() r($taskTester->afterStartTest($taskIDList[6], $childTask)) && p() && e('1'); // 测试开始任务状态为未开始的子任务后的数据处理 r($taskTester->afterStartTest($taskIDList[7], $linearTask)) && p() && e('1'); // 测试开始任务状态为未开始的串行任务后的数据处理 r($taskTester->afterStartTest($taskIDList[8], $multiTask)) && p() && e('1'); // 测试开始任务状态为进行中的并行任务后的数据处理 -r($taskTester->afterStartTest($taskIDList[0], $waitTask, 'ceceshi')) && p() && e('1'); // 测试给任务增加备注 -r($taskTester->afterStartTest($taskIDList[0], $waitTask, '', $output)) && p() && e('1'); // 测试更新任务的看板数据 +r($taskTester->afterStartTest($taskIDList[0], $waitTask)) && p() && e('1'); // 测试给任务增加备注 +r($taskTester->afterStartTest($taskIDList[0], $waitTask, $output)) && p() && e('1'); // 测试更新任务的看板数据 diff --git a/module/task/test/task.class.php b/module/task/test/task.class.php index 10739f102b..97823fa587 100755 --- a/module/task/test/task.class.php +++ b/module/task/test/task.class.php @@ -229,12 +229,11 @@ class taskTest * * @param int $taskID * @param array $param - * @param string $comment * @param array $output * @access public * @return array|bool */ - public function afterStartTest(int $taskID, array $param = array(), string $comment = '', array $output = array()): array|bool + public function afterStartTest(int $taskID, array $param = array(), array $output = array()): array|bool { $task = new stdclass(); $startFields = array('id' => $taskID, 'status' => 'doing', 'assignedTo' => '', 'realstarted' => '', 'left' => 0, 'consumed' => 0); @@ -243,7 +242,7 @@ class taskTest $oldTask = $this->objectModel->getByID($taskID); $changes = $this->objectModel->start($oldTask, $task); - $result = $this->objectModel->afterStart($oldTask, $task, $changes, $task->left, $comment, $output); + $result = $this->objectModel->afterStart($oldTask, $changes, $task->left, $output); return $result; }