* when link story, store the latest version of the story.

This commit is contained in:
wangchunsheng
2010-02-20 08:53:18 +00:00
parent 8dd09487fe
commit a110027fb8
8 changed files with 25 additions and 3 deletions
+1
View File
@@ -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 = '严重程度';
+2
View File
@@ -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)
+3 -2
View File
@@ -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);
}
+12
View File
@@ -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)
{
+1
View File
@@ -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 = '优先级';
+2
View File
@@ -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')
+2 -1
View File
@@ -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 = '用例步骤';
+2
View File
@@ -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')