diff --git a/module/bug/lang/zh-cn.php b/module/bug/lang/zh-cn.php index 819f778f94..0c7517f40f 100644 --- a/module/bug/lang/zh-cn.php +++ b/module/bug/lang/zh-cn.php @@ -132,6 +132,7 @@ $lang->bug->module = '所属模块'; $lang->bug->path = '模块路径'; $lang->bug->project = '所属项目'; $lang->bug->story = '相关需求'; +$lang->bug->storyVersion = '需求版本'; $lang->bug->task = '相关任务'; $lang->bug->title = 'Bug标题'; $lang->bug->severity = '严重程度'; diff --git a/module/bug/model.php b/module/bug/model.php index 9e32e8db7e..6ba7e80313 100644 --- a/module/bug/model.php +++ b/module/bug/model.php @@ -44,6 +44,7 @@ class bugModel extends model ->add('openedDate', $now) ->setDefault('project,story,task', 0) ->setIF($this->post->assignedTo != '', 'assignedDate', $now) + ->setIF($this->post->story != false, 'storyVersion', $this->loadModel('story')->getVersion($this->post->story)) ->stripTags('title') ->cleanInt('product, module, severity') ->specialChars('steps') @@ -112,6 +113,7 @@ class bugModel extends model ->setIF(($this->post->resolution != '' or $this->post->resolvedDate != '') and $this->post->assignedTo == '', 'assignedTo', $oldBug->openedBy) ->setIF(($this->post->resolution != '' or $this->post->resolvedDate != '') and $this->post->assignedTo == '', 'assignedDate', $now) ->setIF($this->post->resolution == '' and $this->post->resolvedDate =='', 'status', 'active') + ->setIF($this->post->story != $oldBug->story, 'storyVersion', $this->loadModel('story')->getVersion($this->post->story)) ->get(); $this->dao->update(TABLE_BUG)->data($bug) diff --git a/module/project/model.php b/module/project/model.php index f85d564154..1932e33e4e 100644 --- a/module/project/model.php +++ b/module/project/model.php @@ -179,14 +179,15 @@ class projectModel extends model public function linkStory($projectID) { if($this->post->stories == false) return false; - $this->loadModel('story'); - foreach($this->post->stories as $key => $storyID) + $versions = $this->loadModel('story')->getVersions($this->post->stories); + foreach($this->post->stories as $storyID) { $productID = $this->post->products[$key]; $this->dao->insert(TABLE_PROJECTSTORY) ->set('project')->eq($projectID) ->set('product')->eq($productID) ->set('story')->eq($storyID) + ->set('version')->eq($versions[$storyID]) ->exec(); $this->story->setStage($storyID); } diff --git a/module/story/model.php b/module/story/model.php index 67c3cfbee9..4995c22bac 100644 --- a/module/story/model.php +++ b/module/story/model.php @@ -446,6 +446,18 @@ class storyModel extends model if($projects) return($this->dao->select('account')->from(TABLE_TEAM)->where('project')->in($projects)->fetchPairs('account')); } + /* 获得一个需求对应的版本号。*/ + public function getVersion($storyID) + { + return $this->dao->select('version')->from(TABLE_STORY)->where('id')->eq((int)$storyID)->fetch('version'); + } + + /* 获得需求列表对应的版本列表。*/ + public function getVersions($storyID) + { + return $this->dao->select('id, version')->from(TABLE_STORY)->where('id')->in($storyID)->fetchPairs(); + } + /* 格式化需求显示。*/ private function formatStories($stories) { diff --git a/module/task/lang/zh-cn.php b/module/task/lang/zh-cn.php index ca1963d708..0332de2f4b 100644 --- a/module/task/lang/zh-cn.php +++ b/module/task/lang/zh-cn.php @@ -32,6 +32,7 @@ $lang->task->common = '任务'; $lang->task->id = '编号'; $lang->task->project = '所属项目'; $lang->task->story = '相关需求'; +$lang->task->storyVersion = '需求版本'; $lang->task->name = '任务名称'; $lang->task->type = '任务类型'; $lang->task->pri = '优先级'; diff --git a/module/task/model.php b/module/task/model.php index 2598364bfc..f2f6d70c39 100644 --- a/module/task/model.php +++ b/module/task/model.php @@ -37,6 +37,7 @@ class taskModel extends model ->add('project', (int)$projectID) ->setDefault('estimate, left, story', 0) ->setIF($this->post->estimate != false, 'left', $this->post->estimate) + ->setIF($this->post->story != false, 'storyVersion', $this->loadModel('story')->getVersion($this->post->story)) ->setDefault('statusCustom', strpos(self::CUSTOM_STATUS_ORDER, $this->post->status) + 1) ->remove('after') ->get(); @@ -59,6 +60,7 @@ class taskModel extends model ->specialChars('desc') ->cleanFloat('estimate, left, consumed') ->setDefault('story, estimate, left, consumed', 0) + ->setIF($this->post->story != $oldTask->story, 'storyVersion', $this->loadModel('story')->getVersion($this->post->story)) ->setIF($this->post->status == 'done', 'left', 0) ->setDefault('statusCustom', strpos(self::CUSTOM_STATUS_ORDER, $this->post->status) + 1) ->remove('comment') diff --git a/module/testcase/lang/zh-cn.php b/module/testcase/lang/zh-cn.php index 139d0b50d1..0cefa702b3 100644 --- a/module/testcase/lang/zh-cn.php +++ b/module/testcase/lang/zh-cn.php @@ -25,8 +25,9 @@ $lang->testcase->id = '用例编号'; $lang->testcase->product = '所属产品'; $lang->testcase->module = '所属模块'; $lang->testcase->story = '相关需求'; +$lang->testcase->storyVersion = '需求版本'; $lang->testcase->title = '用例标题'; -$lang->testcase->pri = '优 先 级'; +$lang->testcase->pri = '优先级'; $lang->testcase->type = '用例类型'; $lang->testcase->status = '用例状态'; $lang->testcase->steps = '用例步骤'; diff --git a/module/testcase/model.php b/module/testcase/model.php index c490e9d0d6..23702217fc 100644 --- a/module/testcase/model.php +++ b/module/testcase/model.php @@ -44,6 +44,7 @@ class testcaseModel extends model ->add('openedDate', $now) ->add('status', 'normal') ->add('version', 1) + ->setIF($this->post->story != false, 'storyVersion', $this->loadModel('story')->getVersion($this->post->story)) ->remove('steps,expects') ->setDefault('story', 0) ->stripTags('title') @@ -125,6 +126,7 @@ class testcaseModel extends model ->add('lastEditedBy', $this->app->user->account) ->add('lastEditedDate', $now) ->add('version', $version) + ->setIF($this->post->story != $oldCase->story, 'storyVersion', $this->loadModel('story')->getVersion($this->post->story)) ->setDefault('story', 0) ->stripTags('title') ->remove('comment,steps,expects')