From 894dbc62e9917576feef9aaaffc88b81e89d8303 Mon Sep 17 00:00:00 2001 From: wangyidong Date: Fri, 8 Nov 2024 15:20:22 +0800 Subject: [PATCH] * [perf story #69170] Adjust for batch cancel. --- module/task/control.php | 8 ++++---- module/task/model.php | 7 ++----- module/task/ui/activate.html.php | 2 +- module/task/view/activate.html.php | 2 +- 4 files changed, 8 insertions(+), 11 deletions(-) diff --git a/module/task/control.php b/module/task/control.php index e1025adf85..3357ee7e2b 100755 --- a/module/task/control.php +++ b/module/task/control.php @@ -798,8 +798,8 @@ class task extends control { if(!in_array($task->status, $this->config->task->unfinishedStatus)) continue; - $task = $this->taskZen->buildTaskForCancel($task); - $this->task->cancel($task); + $taskData = $this->taskZen->buildTaskForCancel($task); + $this->task->cancel($task, $taskData); } } @@ -840,7 +840,7 @@ class task extends control } /* Skip parent task when batch close task. */ - if($task->parent == '-1') + if($task->isParent) { $parentTasks[$taskID] = $taskID; continue; @@ -967,7 +967,7 @@ class task extends control public function delete(int $executionID, int $taskID, string $from = '') { $task = $this->task->getByID($taskID); - if($task->parent == '-1') return $this->send(array('result' => 'fail', 'message' => $this->lang->task->cannotDeleteParent)); + if($task->isParent) return $this->send(array('result' => 'fail', 'message' => $this->lang->task->cannotDeleteParent)); $this->task->delete(TABLE_TASK, $taskID); if($task->parent > 0) diff --git a/module/task/model.php b/module/task/model.php index 864309ef36..7062001281 100755 --- a/module/task/model.php +++ b/module/task/model.php @@ -2651,13 +2651,10 @@ class taskModel extends model { foreach($tasks as &$task) { - $task = $this->processTask($task); + $task = $this->processTask($task, false); if(!empty($task->children)) { - foreach($task->children as &$child) - { - $child = $this->processTask($child); - } + foreach($task->children as &$child) $child = $this->processTask($child, false); } } diff --git a/module/task/ui/activate.html.php b/module/task/ui/activate.html.php index aaaf39aa13..b3741fcda8 100644 --- a/module/task/ui/activate.html.php +++ b/module/task/ui/activate.html.php @@ -102,7 +102,7 @@ if($isMultiple) } $leftBox = ''; -if($task->parent != '-1') +if($task->isParent == '0') { $leftBox = formGroup( set::width('1/2'), diff --git a/module/task/view/activate.html.php b/module/task/view/activate.html.php index c13fb06885..b9da4c4968 100644 --- a/module/task/view/activate.html.php +++ b/module/task/view/activate.html.php @@ -65,7 +65,7 @@ - parent != '-1'):?> + isParent == '0'):?> task->left;?>