From 4058c58ca99d54ce1d0caba383669a281f99880f Mon Sep 17 00:00:00 2001 From: daitingting Date: Wed, 28 Mar 2018 13:19:36 +0800 Subject: [PATCH 1/6] * Update time of task when edit team time or record estimate. --- module/task/lang/en.php | 1 + module/task/lang/zh-cn.php | 1 + module/task/model.php | 51 +++++++++++++++++------- module/task/view/recordestimate.html.php | 3 +- 4 files changed, 41 insertions(+), 15 deletions(-) diff --git a/module/task/lang/en.php b/module/task/lang/en.php index b6d6d063c0..7104288e6b 100644 --- a/module/task/lang/en.php +++ b/module/task/lang/en.php @@ -165,6 +165,7 @@ $lang->task->remindBug = "This Task is converted from a Bug. Do you $lang->task->confirmChangeProject = "If you change {$lang->projectCommon}, the related Module, Story and Assignor will be changed. Do you want to do it?"; $lang->task->confirmFinish = '"Left Hour" is 0. Do you want to change the Status to "Done"?'; $lang->task->confirmRecord = '"Left Hour" is 0. Do you want to set Task as "Done"?'; +$lang->task->confirmTransfer = '"Left Hour" is 0,Do you want to transfer task?'; $lang->task->noticeLinkStory = "No story has been linked. You can %s for this project, then %s."; $lang->task->noticeSaveRecord = 'Your Hour is not saved. Please save it first.'; $lang->task->commentActions = '%s. %s, commented by %s.'; diff --git a/module/task/lang/zh-cn.php b/module/task/lang/zh-cn.php index 555f7e2f5c..57c16442d1 100644 --- a/module/task/lang/zh-cn.php +++ b/module/task/lang/zh-cn.php @@ -165,6 +165,7 @@ $lang->task->remindBug = "该任务为Bug转化得到,是否更新 $lang->task->confirmChangeProject = "修改{$lang->projectCommon}会导致相应的所属模块、相关需求和指派人发生变化,确定吗?"; $lang->task->confirmFinish = '"预计剩余"为0,确认将任务状态改为"已完成"吗?'; $lang->task->confirmRecord = '"剩余"为0,任务将标记为"已完成",您确定吗?'; +$lang->task->confirmTransfer = '"当前剩余"为0,任务将被转交,您确定吗?'; $lang->task->noticeLinkStory = "没有可关联的相关需求,您可以为当前项目%s,然后%s"; $lang->task->noticeSaveRecord = '您有尚未保存的工时记录,请先将其保存。'; $lang->task->commentActions = '%s. %s, 由 %s 添加备注。'; diff --git a/module/task/model.php b/module/task/model.php index 599968ddae..6987b237db 100644 --- a/module/task/model.php +++ b/module/task/model.php @@ -445,6 +445,9 @@ class taskModel extends model $teams = array(); if($this->post->multiple) { + $consumed = 0; + $estimate = 0; + $left = 0; foreach($this->post->team as $row => $account) { if(empty($account) or isset($team[$account])) continue; @@ -457,15 +460,26 @@ class taskModel extends model $member->type = 'task'; $member->estimate = $this->post->teamEstimate[$row] ? $this->post->teamEstimate[$row] : 0; $member->consumed = $this->post->teamConsumed[$row] ? $this->post->teamConsumed[$row] : 0; - $member->left = $member->estimate - $member->consumed; + $member->left = $this->post->teamLeft[$row] ? $this->post->teamLeft[$row] : ($member->estimate - $member->consumed); $member->order = $row; $teams[$account] = $member; - } - if(!empty($teams) and !isset($task->assignedTo)) + $consumed += (float)$member->consumed; + $estimate += (float)$member->estimate; + $left += (float)$member->left; + } + + if(!empty($teams)) { - $firstMember = reset($teams); - $task->assignedTo = $firstMember->account; + $task->consumed = $consumed; + $task->estimate = $estimate; + $task->left = $left; + + if(!isset($task->assignedTo)) + { + $firstMember = reset($teams); + $task->assignedTo = $firstMember->account; + } } } @@ -945,19 +959,28 @@ class taskModel extends model $data->consumed = $teamTime->consumed; $data->left = $teamTime->leftTime; - if($task->status == 'done') + $newTask = new stdClass(); + $newTask->left = $data->left; + $newTask->consumed = $data->consumed; + + if($left != 0 || $task->assignedTo != $teams[count($teams) - 1]) { - $newTask = new stdClass(); - $newTask->left = $data->left; - $newTask->consumed = $data->consumed; - $newTask->assignedTo = $this->getNextUser($teams, $task->assignedTo); - $newTask->assignedDate = $now; + $newTask->status = 'doing'; + if($task->assignedTo != $teams[count($teams) - 1] && $left == 0) + { + $newTask->assignedTo = $this->getNextUser($teams, $task->assignedTo); + $newTask->assignedDate = $now; + } + + $task->status = $oldStatus; $this->dao->update(TABLE_TASK)->data($newTask)->where('id')->eq((int)$taskID)->exec(); - if($task->assignedTo != $teams[count($teams) - 1]) return common::createChanges($task, $newTask); - - $data->assignedTo = $task->openedBy; // Fix bug#1345 + $changes = common::createChanges($task, $newTask); + if(!empty($actionID)) $this->action->logHistory($actionID, $changes); + return $changes; } + + $data->assignedTo = $task->openedBy; } $this->dao->update(TABLE_TASK)->data($data)->where('id')->eq($taskID)->exec(); diff --git a/module/task/view/recordestimate.html.php b/module/task/view/recordestimate.html.php index 697cfa17ed..2411bc8571 100644 --- a/module/task/view/recordestimate.html.php +++ b/module/task/view/recordestimate.html.php @@ -12,7 +12,8 @@ ?> -task->confirmRecord);?> +team);?> +assignedTo != end($team)) ? $lang->task->confirmTransfer : $lang->task->confirmRecord);?> task->noticeSaveRecord);?>
From 3e7af31e9132c750d5ccdd7e27b6572f2e25951c Mon Sep 17 00:00:00 2001 From: daitingting Date: Wed, 28 Mar 2018 13:44:35 +0800 Subject: [PATCH 2/6] * Adjust style for it. --- module/story/view/edit.html.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/module/story/view/edit.html.php b/module/story/view/edit.html.php index 34c6a131e1..04ec57b190 100644 --- a/module/story/view/edit.html.php +++ b/module/story/view/edit.html.php @@ -185,10 +185,13 @@ duplicateStory, "class='form-control' autocomplete='off'");?> - + story->linkStories;?> + createLink('story', 'linkStory', "storyID=$story->id&type=linkStories", '', true), $lang->story->linkStory, '', "data-toggle='modal' data-type='iframe' data-width='95%'");?> + + + - createLink('story', 'linkStory', "storyID=$story->id&type=linkStories", '', true), $lang->story->linkStory, '', "data-toggle='modal' data-type='iframe' data-width='95%'");?>
    linkStories); From dc061563602943d9110c7a90cf9108ebe060928a Mon Sep 17 00:00:00 2001 From: daitingting Date: Wed, 28 Mar 2018 15:57:31 +0800 Subject: [PATCH 3/6] * Adjust condition for taskonlyCondition. --- module/task/model.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/task/model.php b/module/task/model.php index 6987b237db..ec34c23a50 100644 --- a/module/task/model.php +++ b/module/task/model.php @@ -1366,7 +1366,7 @@ class taskModel extends model ->page($pager, 't1.id') ->fetchAll('id'); - $this->loadModel('common')->saveQueryCondition($this->dao->get(), 'task', ($productID or in_array($type, array('assignedtome', 'myinvolved', 'needconfirm'))) ? false : true); + $this->loadModel('common')->saveQueryCondition($this->dao->get(), 'task', ($productID or in_array($type, array('myinvolved', 'needconfirm'))) ? false : true); if(empty($tasks)) return array(); From 97e7d97cb5dbf137f4804c016d0b21bb03ae7a67 Mon Sep 17 00:00:00 2001 From: daitingting Date: Wed, 28 Mar 2018 15:59:31 +0800 Subject: [PATCH 4/6] * Remove useless codes. --- module/project/view/bug.html.php | 2 +- module/project/view/taskheader.html.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/module/project/view/bug.html.php b/module/project/view/bug.html.php index 14064dc887..5124141717 100644 --- a/module/project/view/bug.html.php +++ b/module/project/view/bug.html.php @@ -17,7 +17,7 @@ Build:' . $build->name . ''; ?>
- + id");?>
diff --git a/module/project/view/taskheader.html.php b/module/project/view/taskheader.html.php index 285cffeca0..9ebb5cc06f 100644 --- a/module/project/view/taskheader.html.php +++ b/module/project/view/taskheader.html.php @@ -97,7 +97,7 @@
- + +
+ + +
+