From fa7837bcf8811f95cbe0372bf8a126a1fd92a25a Mon Sep 17 00:00:00 2001 From: "shiyangyangwork@yahoo.cn" Date: Mon, 21 Nov 2011 09:02:13 +0000 Subject: [PATCH] * finish the task #609. --- module/bug/control.php | 20 ++++++++++++++++++++ module/bug/lang/en.php | 1 + module/bug/lang/zh-cn.php | 1 + module/bug/model.php | 3 ++- module/task/control.php | 26 ++++++++++++++++++++++++++ module/task/lang/en.php | 1 + module/task/lang/zh-cn.php | 1 + 7 files changed, 52 insertions(+), 1 deletion(-) diff --git a/module/bug/control.php b/module/bug/control.php index ebde76137a..dd9359f34b 100644 --- a/module/bug/control.php +++ b/module/bug/control.php @@ -470,6 +470,18 @@ class bug extends control $this->action->logHistory($actionID, $changes); $this->sendmail($bugID, $actionID); } + + $bug = $this->bug->getById($bugID); + if($bug->toTask != 0) + { + foreach($changes as $change) + { + if($change['field'] == 'status') + { + echo js::alert($this->lang->bug->remindTask . $bug->toTask); + } + } + } die(js::locate($this->createLink('bug', 'view', "bugID=$bugID"), 'parent')); } @@ -575,6 +587,12 @@ class bug extends control $actionID = $this->action->create('bug', $bugID, 'Resolved', $this->post->comment, $this->post->resolution); } $this->sendmail($bugID, $actionID); + + $bug = $this->bug->getById($bugID); + if($bug->toTask != 0) + { + echo js::alert($this->lang->bug->remindTask . $bug->toTask); + } die(js::locate($this->createLink('bug', 'view', "bugID=$bugID"), 'parent')); } @@ -685,6 +703,7 @@ class bug extends control */ public function delete($bugID, $confirm = 'no') { + $bug = $this->bug->getById($bugID); if($confirm == 'no') { die(js::confirm($this->lang->bug->confirmDelete, inlink('delete', "bugID=$bugID&confirm=yes"))); @@ -692,6 +711,7 @@ class bug extends control else { $this->bug->delete(TABLE_BUG, $bugID); + if($bug->toTask != 0) echo js::alert($this->lang->bug->remindTask . $bug->toTask); die(js::locate($this->session->bugList, 'parent')); } } diff --git a/module/bug/lang/en.php b/module/bug/lang/en.php index e81a7dbd00..0e69b34904 100644 --- a/module/bug/lang/en.php +++ b/module/bug/lang/en.php @@ -141,6 +141,7 @@ $lang->bug->buttonCreateTestcase = 'Create case'; $lang->bug->confirmChangeProduct = 'Change product will change project, task and story also, are you sure?'; $lang->bug->confirmDelete = 'Are you sure to delete this bug?'; $lang->bug->setTemplateTitle = 'Please input the template title:'; +$lang->bug->remindTask = 'This bug has been to be a task, please update the task:'; /* Templates. */ $lang->bug->tplStep = "

[Steps]

"; diff --git a/module/bug/lang/zh-cn.php b/module/bug/lang/zh-cn.php index de3240a514..eddcb80cc6 100644 --- a/module/bug/lang/zh-cn.php +++ b/module/bug/lang/zh-cn.php @@ -141,6 +141,7 @@ $lang->bug->buttonCreateTestcase = '创建用例'; $lang->bug->confirmChangeProduct = '修改产品会导致相应的项目、需求和任务发生变化,确定吗?'; $lang->bug->confirmDelete = '您确认要删除该Bug吗?'; $lang->bug->setTemplateTitle = '请输入bug模板标题(保存之前请先填写bug重现步骤):'; +$lang->bug->remindTask = '该Bug已经转化为任务,请及时更新任务状态。任务:'; /* 模板。*/ $lang->bug->tplStep = "

[步骤]

"; diff --git a/module/bug/model.php b/module/bug/model.php index 1f283b3b84..1d5ad08873 100644 --- a/module/bug/model.php +++ b/module/bug/model.php @@ -210,9 +210,10 @@ class bugModel extends model public function resolve($bugID) { $now = helper::now(); + $oldBug = $this->getById($bugID); + $storyID = 0; if($this->post->resolution == 'tostory') { - $oldBug = $this->getById($bugID); $story->product = $oldBug->product; $story->module = $oldBug->module; $story->source = 'bug'; diff --git a/module/task/control.php b/module/task/control.php index f4d681612b..14a1da97e2 100644 --- a/module/task/control.php +++ b/module/task/control.php @@ -173,6 +173,7 @@ class task extends control if(dao::isError()) die(js::error(dao::getError())); $files = $this->loadModel('file')->saveUpload('task', $taskID); + $task = $this->task->getById($taskID); if($this->post->comment != '' or !empty($changes) or !empty($files)) { $action = !empty($changes) ? 'Edited' : 'Commented'; @@ -182,6 +183,17 @@ class task extends control $this->action->logHistory($actionID, $changes); $this->sendmail($taskID, $actionID); } + + if($task->fromBug != 0) + { + foreach($changes as $change) + { + if($change['field'] == 'status') + { + echo js::alert($this->lang->task->remindBug . $task->fromBug); + } + } + } die(js::locate($this->createLink('task', 'view', "taskID=$taskID"), 'parent')); } @@ -313,12 +325,24 @@ class task extends control $changes = $this->task->finish($taskID); if(dao::isError()) die(js::error(dao::getError())); + $task = $this->task->getById($taskID); if($this->post->comment != '' or !empty($changes)) { $actionID = $this->action->create('task', $taskID, 'Finished', $this->post->comment); $this->action->logHistory($actionID, $changes); $this->sendmail($taskID, $actionID); } + + if($task->fromBug != 0) + { + foreach($changes as $change) + { + if($change['field'] == 'status') + { + echo js::alert($this->lang->task->remindBug . $task->fromBug); + } + } + } die(js::locate($this->createLink('task', 'view', "taskID=$taskID"), 'parent')); } @@ -468,6 +492,7 @@ class task extends control */ public function delete($projectID, $taskID, $confirm = 'no') { + $task = $this->task->getById($taskID); if($confirm == 'no') { die(js::confirm($this->lang->task->confirmDelete, inlink('delete', "projectID=$projectID&taskID=$taskID&confirm=yes"))); @@ -476,6 +501,7 @@ class task extends control { $story = $this->dao->select('story')->from(TABLE_TASK)->where('id')->eq($taskID)->fetch('story'); $this->task->delete(TABLE_TASK, $taskID); + if($task->fromBug != 0) $this->dao->update(TABLE_BUG)->set('toTask')->eq(0)->where('id')->eq($task->fromBug)->exec(); if($story) $this->loadModel('story')->setStage($story); die(js::locate($this->session->taskList, 'parent')); } diff --git a/module/task/lang/en.php b/module/task/lang/en.php index 587491c4a9..414de4ec1a 100644 --- a/module/task/lang/en.php +++ b/module/task/lang/en.php @@ -126,6 +126,7 @@ $lang->task->copyStoryTitle = "Same as story"; $lang->task->afterSubmit = "After created"; $lang->task->successSaved = "Success saved"; $lang->task->delayWarning = " Postponed %s days "; +$lang->task->remindBug = "This task from Bug, please update the Bug:"; /* Report. */ $lang->task->report->common = 'Report'; diff --git a/module/task/lang/zh-cn.php b/module/task/lang/zh-cn.php index cea03d7ab5..2d29c2f51e 100644 --- a/module/task/lang/zh-cn.php +++ b/module/task/lang/zh-cn.php @@ -126,6 +126,7 @@ $lang->task->copyStoryTitle = "同需求"; $lang->task->afterSubmit = "添加之后"; $lang->task->successSaved = "成功添加,"; $lang->task->delayWarning = " 延期%s天 "; +$lang->task->remindBug = "该需求为Bug转化得到,请及时更新相关Bug。来源Bug:"; /* 统计报表。*/ $lang->task->report->common = '统计报表';