diff --git a/module/action/lang/zh-cn.php b/module/action/lang/zh-cn.php index 25bb89d4d6..04e7699c0f 100644 --- a/module/action/lang/zh-cn.php +++ b/module/action/lang/zh-cn.php @@ -30,6 +30,7 @@ $lang->action->desc->closed = '$date, 由 $actor 关闭。'; $lang->action->desc->commented = '$date, 由 $actor 发表评论。'; $lang->action->desc->activated = '$date, 由 $actor 激活。'; $lang->action->desc->moved = '$date, 由 $actor 移动,之前为 "$extra"'; +$lang->action->desc->confirmed = '$date, 由 $actor 确认需求变动,最新版本为#$extra'; $lang->action->desc->diff1 = '修改了 %s,旧值为 "%s",新值为 "%s"。
'; $lang->action->desc->diff2 = '修改了 %s,区别为:
%s
'; @@ -42,6 +43,7 @@ $lang->action->label->activated = '激活了'; $lang->action->label->resolved = '解决了'; $lang->action->label->reviewed = '评审了'; $lang->action->label->moved = '移动了'; +$lang->action->label->confirmed = '确认了需求,'; $lang->action->label->story = '需求|story|view|storyID=%s'; $lang->action->label->task = '任务|task|view|taskID=%s'; $lang->action->label->bug = 'Bug|bug|view|bugID=%s'; diff --git a/module/group/lang/zh-cn.php b/module/group/lang/zh-cn.php index 95be6347d8..83103b2817 100644 --- a/module/group/lang/zh-cn.php +++ b/module/group/lang/zh-cn.php @@ -127,6 +127,7 @@ $lang->resource->task->create = 'create'; $lang->resource->task->edit = 'edit'; $lang->resource->task->delete = 'delete'; $lang->resource->task->view = 'view'; +$lang->resource->task->confirmStoryChange = 'confirmStoryChange'; $lang->resource->task->ajaxGetUserTasks = 'ajaxGetUserTasks'; $lang->resource->task->ajaxGetProjectTasks = 'ajaxGetProjectTasks'; @@ -148,13 +149,15 @@ $lang->resource->bug->resolve = 'resolve'; $lang->resource->bug->activate= 'activate'; $lang->resource->bug->close = 'close'; $lang->resource->bug->report = 'reportChart'; -$lang->resource->bug->ajaxGetUserBugs = 'ajaxGetUserBugs'; +$lang->resource->bug->confirmStoryChange = 'confirmStoryChange'; +$lang->resource->bug->ajaxGetUserBugs = 'ajaxGetUserBugs'; $lang->resource->testcase->index = 'index'; $lang->resource->testcase->browse = 'browse'; $lang->resource->testcase->create = 'create'; $lang->resource->testcase->view = 'view'; $lang->resource->testcase->edit = 'edit'; +$lang->resource->testcase->confirmStoryChange = 'confirmStoryChange'; $lang->resource->testtask->index = 'index'; $lang->resource->testtask->create = 'create'; diff --git a/module/project/view/task.html.php b/module/project/view/task.html.php index ecd34e251c..800ea4e8a2 100644 --- a/module/project/view/task.html.php +++ b/module/project/view/task.html.php @@ -57,7 +57,18 @@ left;?> task->typeList[$task->type];?> delay)) echo 'delayed';?>>deadline, 0, 4) > 0) echo $task->deadline;?> - status;?> >task->statusList[$task->status];?> + status;?> > + storyStatus == 'active' and $task->latestStoryVersion > $task->storyVersion) + { + echo "{$lang->story->changed} "; + } + else + { + echo $lang->task->statusList[$task->status]; + } + ?> + storyID) diff --git a/module/story/lang/zh-cn.php b/module/story/lang/zh-cn.php index 09fea212b3..4d1ff43869 100644 --- a/module/story/lang/zh-cn.php +++ b/module/story/lang/zh-cn.php @@ -24,6 +24,8 @@ $lang->story->browse = "需求列表"; $lang->story->create = "新增需求"; $lang->story->change = "变更"; +$lang->story->changed = '需求变更'; +$lang->story->confirm = '确认'; $lang->story->review = '评审'; $lang->story->edit = "编辑需求"; $lang->story->close = '关闭'; diff --git a/module/task/control.php b/module/task/control.php index e137e01246..7c6890c1e4 100644 --- a/module/task/control.php +++ b/module/task/control.php @@ -180,6 +180,15 @@ class task extends control $this->display(); } + /* 确认需求变动。*/ + public function confirmStoryChange($taskID) + { + $task = $this->task->getById($taskID); + $this->dao->update(TABLE_TASK)->set('storyVersion')->eq($task->latestStoryVersion)->where('id')->eq($taskID)->exec(); + $this->loadModel('action')->create('task', $taskID, 'confirmed', '', $task->latestStoryVersion); + die(js::reload('parent')); + } + /* 删除一个任务。*/ public function delete($projectID, $taskID, $confirm = 'no') { diff --git a/module/task/model.php b/module/task/model.php index 691c0d18ed..dc2f8535aa 100644 --- a/module/task/model.php +++ b/module/task/model.php @@ -99,7 +99,7 @@ class taskModel extends model /* 通过id获取一个任务信息。*/ public function getById($taskID) { - $task = $this->dao->select('t1.*, t2.id AS storyID, t2.title AS storyTitle, t3.realname AS ownerRealName') + $task = $this->dao->select('t1.*, t2.id AS storyID, t2.title AS storyTitle, t2.version AS latestStoryVersion, t2.status AS storyStatus, t3.realname AS ownerRealName') ->from(TABLE_TASK)->alias('t1') ->leftJoin(TABLE_STORY)->alias('t2') ->on('t1.story = t2.id') @@ -109,14 +109,14 @@ class taskModel extends model ->fetch(); if(!$task) return false; $task->files = $this->loadModel('file')->getByObject('task', $taskID); - return $this->computeDelay($task); + return $this->processTask($task); } /* 获得某一个项目的任务列表。*/ public function getProjectTasks($projectID, $status = 'all', $orderBy = 'status_asc, id_desc', $pager = null) { $orderBy = str_replace('status', 'statusCustom', $orderBy); - $tasks = $this->dao->select('t1.*, t2.id AS storyID, t2.title AS storyTitle, t3.realname AS ownerRealName') + $tasks = $this->dao->select('t1.*, t2.id AS storyID, t2.title AS storyTitle, t2.version AS latestStoryVersion, t2.status AS storyStatus, t3.realname AS ownerRealName') ->from(TABLE_TASK)->alias('t1') ->leftJoin(TABLE_STORY)->alias('t2') ->on('t1.story = t2.id') @@ -127,7 +127,7 @@ class taskModel extends model ->orderBy($orderBy) ->page($pager) ->fetchAll(); - if($tasks) return $this->computeDelays($tasks); + if($tasks) return $this->processTasks($tasks); return false; } @@ -150,7 +150,7 @@ class taskModel extends model /* 获得用户的任务列表。*/ public function getUserTasks($account, $status = 'all') { - $tasks = $this->dao->select('t1.*, t2.id as projectID, t2.name as projectName, t3.id as storyID, t3.title as storyTitle') + $tasks = $this->dao->select('t1.*, t2.id as projectID, t2.name as projectName, t3.id as storyID, t3.title as storyTitle, t3.status AS storyStatus, t3.version AS latestStoryVersion') ->from(TABLE_TASK)->alias('t1') ->leftjoin(TABLE_PROJECT)->alias('t2') ->on('t1.project = t2.id') @@ -159,7 +159,7 @@ class taskModel extends model ->where('t1.owner')->eq($account) ->onCaseOf($status != 'all')->andWhere('t1.status')->in($status)->endCase() ->fetchAll(); - if($tasks) return $this->computeDelays($tasks); + if($tasks) return $this->processTasks($tasks); return array(); } @@ -204,23 +204,30 @@ class taskModel extends model return $taskCounts; } - /* 计算延期的天数。*/ - private function computeDelays($tasks) + /* 计算一组任务的相关状态。*/ + private function processTasks($tasks) { $today = helper::today(); foreach($tasks as $task) { + /* 计算是否延期。*/ if($task->deadline != '0000-00-00') { $delay = helper::diffDate($today, $task->deadline); if($delay > 0) $task->delay = $delay; } + /* 判断需求是否变更。*/ + $task->needConfirm = false; + if($task->storyStatus == 'active' and $task->latestStoryVersion > $task->storyVersion) + { + $task->needConfirm = true; + } } return $tasks; } - /* 计算延期的天数。*/ - private function computeDelay($task) + /* 计算一个任务的相关状态。*/ + private function processTask($task) { $today = helper::today(); if($task->deadline != '0000-00-00') @@ -228,7 +235,13 @@ class taskModel extends model $delay = helper::diffDate($today, $task->deadline); if($delay > 0) $task->delay = $delay; } + + /* 判断需求是否变更。*/ + $task->needConfirm = false; + if($task->storyStatus == 'active' and $task->latestStoryVersion > $task->storyVersion) + { + $task->needConfirm = true; + } return $task; } - } diff --git a/module/task/view/view.html.php b/module/task/view/view.html.php index 51271afe7e..94616d246b 100644 --- a/module/task/view/view.html.php +++ b/module/task/view/view.html.php @@ -77,7 +77,17 @@ task->story;?> - storyTitle and !common::printLink('story', 'view', "storyID=$task->story", $task->storyTitle)) echo $task->storyTitle;?> + + storyTitle and !common::printLink('story', 'view', "storyID=$task->story", $task->storyTitle)) echo $task->storyTitle; + if($task->needConfirm) + { + echo "({$lang->story->changed} "; + echo html::a($this->createLink('task', 'confirmStoryChange', "taskID=$task->id"), $lang->story->confirm, 'hiddenwin'); + echo ")"; + } + ?> + task->owner;?>