diff --git a/module/story/control.php b/module/story/control.php index f8d0d8722d..062aec48fc 100644 --- a/module/story/control.php +++ b/module/story/control.php @@ -144,6 +144,27 @@ class story extends control $this->display(); } + /* 激活需求。*/ + public function activate($storyID) + { + $this->loadModel('action'); + if(!empty($_POST)) + { + $this->story->activate($storyID); + if(dao::isError()) die(js::error(dao::getError())); + $actionID = $this->action->create('story', $storyID, 'Activated', $this->post->comment); + $this->action->logHistory($actionID, $changes); + die(js::locate($this->createLink('story', 'view', "storyID=$storyID"), 'parent')); + } + + $this->commonAction($storyID); + + /* 赋值到模板。*/ + $this->view->header->title = $this->view->product->name . $this->lang->colon . $this->lang->story->activate . $this->lang->colon . $this->view->story->title; + $this->view->position[] = $this->lang->story->activate; + $this->display(); + } + /* 需求详情。*/ public function view($storyID, $version = 0) { diff --git a/module/story/lang/zh-cn.php b/module/story/lang/zh-cn.php index dc60ffb67e..c20708911b 100644 --- a/module/story/lang/zh-cn.php +++ b/module/story/lang/zh-cn.php @@ -27,6 +27,7 @@ $lang->story->change = "变更"; $lang->story->review = '评审'; $lang->story->edit = "编辑需求"; $lang->story->close = '关闭'; +$lang->story->activate = '激活'; $lang->story->delete = "删除需求"; $lang->story->view = "需求详情"; $lang->story->tasks = "相关任务"; diff --git a/module/story/model.php b/module/story/model.php index 2c00465f76..6ce1d9b6da 100644 --- a/module/story/model.php +++ b/module/story/model.php @@ -227,12 +227,17 @@ class storyModel extends model $oldStory = $this->dao->findById($storyID)->from(TABLE_STORY)->fetch(); $now = date('Y-m-d H:i:s'); $story = fixer::input('post') + ->add('lastEditedBy', $this->app->user->account) + ->add('lastEditedDate', $now) ->add('closedDate', $now) + ->add('closedBy', $this->app->user->account) ->add('assignedTo', 'closed') ->add('assignedDate', $now) ->add('status', 'closed') ->removeIF($this->post->closedReason != 'duplicate', 'duplicateStory') ->removeIF($this->post->closedReason != 'subdivided', 'childStories') + ->setIF($this->post->closedReason == 'done', 'stage', 'released') + ->setIF($this->post->closedReason != 'done', 'plan', 0) ->remove('comment') ->get(); $this->dao->update(TABLE_STORY)->data($story) @@ -244,6 +249,27 @@ class storyModel extends model return true; } + /* 激活需求。*/ + public function activate($storyID) + { + $oldStory = $this->dao->findById($storyID)->from(TABLE_STORY)->fetch(); + $now = date('Y-m-d H:i:s'); + $story = fixer::input('post') + ->add('lastEditedBy', $this->app->user->account) + ->add('lastEditedDate', $now) + ->add('assignedDate', $now) + ->add('status', 'active') + ->add('closedBy', '') + ->add('closedReason', '') + ->add('closedDate', '0000-00-00') + ->add('reviewedBy', '') + ->add('reviewedDate', '0000-00-00') + ->remove('comment') + ->get(); + $this->dao->update(TABLE_STORY)->data($story)->autoCheck()->where('id')->eq($storyID)->exec(); + return true; + } + /* 获得某一个产品某一个模块下面的所有需求列表。*/ public function getProductStories($productID = 0, $moduleIds = 0, $status = 'all', $orderBy = 'id|desc', $pager = null) { diff --git a/module/story/view/activate.html.php b/module/story/view/activate.html.php new file mode 100644 index 0000000000..875b3ebc50 --- /dev/null +++ b/module/story/view/activate.html.php @@ -0,0 +1,47 @@ +. + * + * @copyright Copyright: 2009 Chunsheng Wang + * @author Chunsheng Wang + * @package story + * @version $Id$ + * @link http://www.zentao.cn + */ +?> + +
+
+ + + + + + + + + + + + + +
story->activate;?>
story->assignedTo;?>closedBy, 'class="select-3"');?>
story->comment;?>
+ goback, inlink('view', "storyID=$story->id"));?> +
+ +
+
+ diff --git a/module/story/view/view.html.php b/module/story/view/view.html.php index cf058676b0..7115ace11b 100644 --- a/module/story/view/view.html.php +++ b/module/story/view/view.html.php @@ -33,6 +33,7 @@ if(!($story->status != 'closed' and common::printLink('story', 'change', "storyID=$story->id", $lang->story->change))) echo $lang->story->change . ' '; if(!(($story->status == 'draft' or $story->status == 'changed') and common::printLink('story', 'review', "storyID=$story->id", $lang->story->review))) echo $lang->story->review . ' '; if(!($story->status != 'closed' and common::printLink('story', 'close', "storyID=$story->id", $lang->story->close))) echo $lang->story->close . ' '; + if(!($story->status == 'closed' and $story->closedReason == 'postponed' and common::printLink('story', 'activate', "storyID=$story->id", $lang->story->activate))) echo $lang->story->activate . ' '; if(!common::printLink('story', 'edit', "storyID=$story->id", $lang->edit)) echo $lang->edit . ' '; echo html::a($browseLink, $lang->goback); ?> @@ -57,6 +58,7 @@ if(!($story->status != 'closed' and common::printLink('story', 'change', "storyID=$story->id", $lang->story->change))) echo $lang->story->change . ' '; if(!(($story->status == 'draft' or $story->status == 'changed') and common::printLink('story', 'review', "storyID=$story->id", $lang->story->review))) echo $lang->story->review . ' '; if(!($story->status != 'closed' and common::printLink('story', 'close', "storyID=$story->id", $lang->story->close))) echo $lang->story->close . ' '; + if(!($story->status == 'closed' and $story->closedReason == 'postponed' and common::printLink('story', 'activate', "storyID=$story->id", $lang->story->activate))) echo $lang->story->activate . ' '; if(!common::printLink('story', 'edit', "storyID=$story->id", $lang->edit)) echo $lang->edit . ' '; echo html::a($browseLink, $lang->goback); ?> @@ -134,7 +136,7 @@ closedReason) echo $lang->story->reasonList[$story->closedReason]; - if($story->duplicateStory) + if(isset($story->extraStories[$story->duplicateStory])) { echo html::a(inlink('view', "storyID=$story->duplicateStory"), '#' . $story->duplicateStory . ' ' . $story->extraStories[$story->duplicateStory]); }