From 830fc538ac926c10a7562b7b76e219c18cb26a85 Mon Sep 17 00:00:00 2001 From: sunguangming Date: Thu, 18 Aug 2022 14:09:52 +0800 Subject: [PATCH 1/4] * Code for taskteam table. --- db/update17.5.sql | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/db/update17.5.sql b/db/update17.5.sql index 6adf70483f..4774842924 100644 --- a/db/update17.5.sql +++ b/db/update17.5.sql @@ -5,7 +5,8 @@ CREATE TABLE `zt_taskteam` ( `estimate` decimal(12,2) NOT NULL, `consumed` decimal(12,2) NOT NULL, `left` decimal(12,2) NOT NULL, - `type` char(10) NOT NULL DEFAULT 'new', + `transfer` char(30) NOT NULL, + `status` enum('wait','doing','done') NOT NULL DEFAULT 'wait', `order` tinyint(3) NOT NULL, PRIMARY KEY (`id`), KEY `task` (`task`) From 88ae33eaef171906d89faa025ee0f9a2444000d3 Mon Sep 17 00:00:00 2001 From: sunguangming Date: Thu, 18 Aug 2022 15:21:40 +0800 Subject: [PATCH 2/4] * Code for import task bug and add sql. --- db/zentao.sql | 14 ++++++++++++++ module/execution/model.php | 6 ++++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/db/zentao.sql b/db/zentao.sql index 7bee5678c7..9a37ee438a 100755 --- a/db/zentao.sql +++ b/db/zentao.sql @@ -1605,6 +1605,20 @@ CREATE TABLE IF NOT EXISTS `zt_taskspec` ( `deadline` date NOT NULL, UNIQUE KEY `task` (`task`,`version`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; +-- DROP TABLE IF EXISTS `zt_taskteam`; +CREATE TABLE `zt_taskteam` ( + `id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT, + `task` mediumint(8) unsigned NOT NULL, + `account` char(30) NOT NULL, + `estimate` decimal(12,2) NOT NULL, + `consumed` decimal(12,2) NOT NULL, + `left` decimal(12,2) NOT NULL, + `transfer` char(30) NOT NULL, + `status` enum('wait','doing','done') NOT NULL DEFAULT 'wait', + `order` tinyint(3) NOT NULL, + PRIMARY KEY (`id`), + KEY `task` (`task`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- DROP TABLE IF EXISTS `zt_team`; CREATE TABLE IF NOT EXISTS `zt_team` ( `id` mediumint(8) unsigned NOT NULL auto_increment, diff --git a/module/execution/model.php b/module/execution/model.php index a43f07e044..59736aed37 100644 --- a/module/execution/model.php +++ b/module/execution/model.php @@ -2146,7 +2146,8 @@ class executionModel extends model { $this->loadModel('task'); - $tasks = $this->dao->select('id,execution,assignedTo,story,consumed,status')->from(TABLE_TASK)->where('id')->in($this->post->tasks)->fetchAll('id'); + $execution = $this->getByID($executionID); + $tasks = $this->dao->select('id,execution,assignedTo,story,consumed,status')->from(TABLE_TASK)->where('id')->in($this->post->tasks)->fetchAll('id'); foreach($tasks as $task) { /* Save the assignedToes and stories, should linked to execution. */ @@ -2154,8 +2155,9 @@ class executionModel extends model $stories[$task->story] = $task->story; $data = new stdclass(); + $data->project = $execution->project; $data->execution = $executionID; - $data->status = $task->consumed > 0 ? 'doing' : 'wait'; + $data->status = $task->consumed > 0 ? 'doing' : 'wait'; if($task->status == 'cancel') { From a603c4568529c4912c63ae5160d1035d56a05b2c Mon Sep 17 00:00:00 2001 From: sunguangming Date: Thu, 18 Aug 2022 16:22:51 +0800 Subject: [PATCH 3/4] * Code for mulit task assigedTo display. --- module/task/model.php | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/module/task/model.php b/module/task/model.php index 5559058583..bd8296a23e 100755 --- a/module/task/model.php +++ b/module/task/model.php @@ -3592,19 +3592,25 @@ class taskModel extends model public function printAssignedHtml($task, $users) { $btnTextClass = ''; + $assignedToText = $assignedToTitle = zget($users, $task->assignedTo); if(!empty($task->team) and $task->mode == 'multi' and $task->status != 'closed') { $assignedToText = $this->lang->task->team; $teamMembers = array(); - foreach($task->team as $teamMember) $teamMembers[] = zget($users, $teamMember->account); + foreach($task->team as $teamMember) + { + $realname = zget($users, $teamMember->account); + if($this->app->user->account == $teamMember->account) + { + $task->assignedTo = $this->app->user->account; + $assignedToText = $realname; + } + $teamMembers[] = $realname; + } + $assignedToTitle = implode($this->lang->comma, $teamMembers); } - else - { - $assignedToText = $assignedToTitle = zget($users, $task->assignedTo); - } - $assignedToText = (!empty($task->team) and $task->mode == 'multi' and $task->status != 'closed') ? $this->lang->task->team : zget($users, $task->assignedTo); if(empty($task->assignedTo)) { From 01172dd2840dc3ec5dfa3d02a4f62fd474c58e94 Mon Sep 17 00:00:00 2001 From: sunguangming Date: Wed, 24 Aug 2022 16:05:21 +0800 Subject: [PATCH 4/4] * Code for muliple task. --- module/task/control.php | 2 +- module/task/model.php | 6 +++++- module/task/view/view.html.php | 2 ++ module/tree/model.php | 2 +- 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/module/task/control.php b/module/task/control.php index f1b1b9e646..705975779b 100755 --- a/module/task/control.php +++ b/module/task/control.php @@ -1338,7 +1338,7 @@ class task extends control { $teams = array_keys($task->team); - $task->nextBy = $this->task->getNextUser($teams, $this->app->user->account); + $task->nextBy = $this->task->getAssignedTo4Multi($members, $task); $task->myConsumed = isset($task->team[$this->app->user->account]) ? $task->team[$this->app->user->account]->consumed : 0; $lastAccount = end($teams); diff --git a/module/task/model.php b/module/task/model.php index bd8296a23e..a54041cb48 100755 --- a/module/task/model.php +++ b/module/task/model.php @@ -1647,6 +1647,7 @@ class taskModel extends model $data = new stdclass(); $data->consumed = $this->post->consumed; $data->left = $this->post->left; + $data->status = 'doing'; $this->dao->update(TABLE_TASKTEAM)->data($data) ->where('task')->eq($taskID) @@ -1919,7 +1920,10 @@ class taskModel extends model if(!empty($oldTask->team)) { - $this->dao->update(TABLE_TASKTEAM)->set('left')->eq(0)->set('consumed')->eq($task->consumed) + $this->dao->update(TABLE_TASKTEAM) + ->set('left')->eq(0) + ->set('consumed')->eq($task->consumed) + ->set('status')->eq('done') ->where('task')->eq((int)$taskID) ->andWhere('account')->eq($this->app->user->account)->exec(); diff --git a/module/task/view/view.html.php b/module/task/view/view.html.php index 738022e41e..91ff4ec6b6 100644 --- a/module/task/view/view.html.php +++ b/module/task/view/view.html.php @@ -350,6 +350,7 @@ task->estimate?> task->consumed?> task->left?> + statusAB;?> team as $member):?> @@ -358,6 +359,7 @@ estimate?> consumed?> left?> + task->statusList, $member->status);?> diff --git a/module/tree/model.php b/module/tree/model.php index 72b121fbaf..8c8a2582ec 100644 --- a/module/tree/model.php +++ b/module/tree/model.php @@ -1452,7 +1452,7 @@ class treeModel extends model $module = $this->getById((int)$moduleID); if(empty($module)) return array(); - return $this->dao->select('id')->from(TABLE_MODULE)->where('path')->like($module->path . '%')->andWhere('deleted')->eq(0)->fetchPairs(); + return $this->dao->select('id')->from(TABLE_MODULE)->where("CONCAT(',', path, ',')")->like("%,$module->path,%")->andWhere('deleted')->eq(0)->fetchPairs(); } /**