* finish the task #610.

This commit is contained in:
shiyangyangwork@yahoo.cn
2011-11-21 06:09:08 +00:00
parent 574f4d7097
commit 744c43fedf
7 changed files with 57 additions and 5 deletions

View File

@@ -564,9 +564,16 @@ class bug extends control
if(!empty($_POST))
{
$this->bug->resolve($bugID);
$storyID = $this->bug->resolve($bugID);
if(dao::isError()) die(js::error(dao::getError()));
$actionID = $this->action->create('bug', $bugID, 'Resolved', $this->post->comment, $this->post->resolution);
if($this->post->resolution == 'tostory')
{
$actionID = $this->action->create('bug', $bugID, 'ToStory', $this->post->comment, $storyID);
}
else
{
$actionID = $this->action->create('bug', $bugID, 'Resolved', $this->post->comment, $this->post->resolution);
}
$this->sendmail($bugID, $actionID);
die(js::locate($this->createLink('bug', 'view', "bugID=$bugID"), 'parent'));
}

View File

@@ -221,6 +221,7 @@ $lang->bug->resolutionList[''] = '';
$lang->bug->resolutionList['bydesign'] = 'By design';
$lang->bug->resolutionList['duplicate'] = 'Duplicate';
$lang->bug->resolutionList['external'] = 'External';
$lang->bug->resolutionList['tostory'] = 'To story';
$lang->bug->resolutionList['fixed'] = 'Fixed';
$lang->bug->resolutionList['notrepro'] = 'Not reproduce';
$lang->bug->resolutionList['postponed'] = 'Postponed';
@@ -296,3 +297,4 @@ $lang->bug->report->bugHistories->graph->xAxisName = 'Histories';
/* 操作记录。*/
$lang->bug->action->resolved = array('main' => '$date, Resolved by <strong>$actor</strong>, resolution is <strong>$extra</strong>.', 'extra' => $lang->bug->resolutionList);
$lang->bug->action->tostory = array('main' => '$date, To story by <strong>$actor</strong>, ID is <strong>$extra</strong>。');

View File

@@ -221,6 +221,7 @@ $lang->bug->resolutionList[''] = '';
$lang->bug->resolutionList['bydesign'] = '设计如此';
$lang->bug->resolutionList['duplicate'] = '重复Bug';
$lang->bug->resolutionList['external'] = '外部原因';
$lang->bug->resolutionList['tostory'] = '转为需求';
$lang->bug->resolutionList['fixed'] = '已解决';
$lang->bug->resolutionList['notrepro'] = '无法重现';
$lang->bug->resolutionList['postponed'] = '延期处理';
@@ -296,3 +297,4 @@ $lang->bug->report->bugHistories->graph->xAxisName = '处理步骤';
/* 操作记录。*/
$lang->bug->action->resolved = array('main' => '$date, 由 <strong>$actor</strong> 解决,方案为 <strong>$extra</strong>。', 'extra' => $lang->bug->resolutionList);
$lang->bug->action->tostory = array('main' => '$date, 由 <strong>$actor</strong> 转化为<strong>需求</strong>,编号为 <strong>$extra</strong>。');

View File

@@ -209,18 +209,52 @@ class bugModel extends model
*/
public function resolve($bugID)
{
$oldBug = $this->getById($bugID);
$now = helper::now();
if($this->post->resolution == 'tostory')
{
$oldBug = $this->getById($bugID);
$story->product = $oldBug->product;
$story->module = $oldBug->module;
$story->source = 'bug';
$story->fromBug = $bugID;
$story->title = $oldBug->title;
$story->keywords = $oldBug->keywords;
$story->pri = $oldBug->pri;
$story->status = 'active';
$story->mailto = $oldBug->mailto;
$story->openedBy = $this->app->user->account;
$story->openedDate = $now;
$story->assignedDate = 0;
$story->version = 1;
$this->dao->insert(TABLE_STORY)->data($story)->exec();
if(dao::isError())
{
echo js::error(dao::getError());
die(js::reload('parent'));
}
$storyID = $this->dao->lastInsertID();
$storySpec->story = $storyID;
$storySpec->version = 1;
$storySpec->title = $oldBug->title;
$storySpec->spec = $oldBug->steps;
$this->dao->insert(TABLE_STORYSPEC)->data($storySpec)->exec();
}
$bug = fixer::input('post')
->add('resolvedBy', $this->app->user->account)
->add('resolvedDate', $now)
->add('status', 'resolved')
->add('confirmed', 1)
->add('assignedDate', $now)
->add('lastEditedBy', $this->app->user->account)
->add('lastEditedDate', $now)
->setDefault('duplicateBug', 0)
->setDefault('assignedTo', $oldBug->openedBy)
->setIF($this->post->resolution == 'tostory', 'toStory', $storyID)
->setIF($this->post->resolution == 'tostory', 'status', 'closed')
->setIF($this->post->resolution != 'tostory', 'status', 'resolved')
->remove('comment')
->get();
@@ -231,8 +265,10 @@ class bugModel extends model
->checkIF($bug->resolution == 'fixed', 'resolvedBuild','notempty')
->where('id')->eq((int)$bugID)
->exec();
return $storyID;
}
/**
* Activate a bug.
*

View File

@@ -580,7 +580,6 @@ class projectModel extends model
$bugLang = $this->app->loadLang('bug');
$this->loadModel('task');
$this->loadModel('story');
$bugPath = $this->app->getModulePath('bug', 'config');
$now = helper::now();
$BugToTasks = fixer::input('post')->get();

View File

@@ -119,6 +119,9 @@ $lang->story->sourceList['market'] = 'Market';
$lang->story->sourceList['service'] = 'Service';
$lang->story->sourceList['competitor'] = 'Competitor';
$lang->story->sourceList['partner'] = 'Partner';
$lang->story->sourceList['dev'] = 'Developer';
$lang->story->sourceList['tester'] = 'Tester';
$lang->story->sourceList['bug'] = 'FromBug';
$lang->story->sourceList['other'] = 'Other';
$lang->story->priList[] = '';

View File

@@ -119,6 +119,9 @@ $lang->story->sourceList['market'] = '市场';
$lang->story->sourceList['service'] = '客服';
$lang->story->sourceList['competitor'] = '竞争对手';
$lang->story->sourceList['partner'] = '合作伙伴';
$lang->story->sourceList['dev'] = '开发人员';
$lang->story->sourceList['tester'] = '测试人员';
$lang->story->sourceList['bug'] = 'Bug转化';
$lang->story->sourceList['other'] = '其他';
$lang->story->priList[] = '';