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`) 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 149667d56b..5988a04f42 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') { diff --git a/module/task/control.php b/module/task/control.php index d6d6d44700..c97890ac3f 100755 --- a/module/task/control.php +++ b/module/task/control.php @@ -1340,7 +1340,19 @@ class task extends control $currentTeam = $this->task->getTeamByAccount($task->team); if($currentTeam) $task->myConsumed = $currentTeam->consumed; - $members = $this->task->getMemberPairs($task); + $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); + $finishedUsers = $this->task->getFinishedUsers($taskID, $teams); + if(($lastAccount != $task->assignedTo and $task->mode == 'linear') or ($task->mode == 'multi' and count($teams) != count($finishedUsers))) + { + $members = $this->task->getMemberPairs($task); + } + else + { + $task->nextBy = $task->openedBy; + } } $this->view->title = $this->view->execution->name . $this->lang->colon .$this->lang->task->finish; diff --git a/module/task/model.php b/module/task/model.php index caf55d3635..0e8e79fdc4 100755 --- a/module/task/model.php +++ b/module/task/model.php @@ -1961,7 +1961,15 @@ class taskModel extends model if(!empty($oldTask->team) and $currentTeam) { - $this->dao->update(TABLE_TASKTEAM)->set('left')->eq(0)->set('consumed')->eq($task->consumed)->set('status')->eq('done')->where('id')->eq($currentTeam->id)->exec(); + $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(); + + $skipMembers = $oldTask->mode == 'linear' ? $this->loadModel('execution')->getTeamSkip($oldTask->team, $oldTask->assignedTo, $task->assignedTo) : $this->getFinishedUsers($oldTask->id, array_keys($oldTask->team)); + foreach($skipMembers as $account => $team) $this->dao->update(TABLE_TASKTEAM)->set('left')->eq(0)->where('task')->eq($taskID)->andWhere('account')->eq($account)->exec(); $task = $this->computeHours4Multiple($oldTask, $task); @@ -3668,19 +3676,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)) { 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(); } /**