diff --git a/module/bug/control.php b/module/bug/control.php
index bff55132c6..ebde76137a 100644
--- a/module/bug/control.php
+++ b/module/bug/control.php
@@ -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'));
}
diff --git a/module/bug/lang/en.php b/module/bug/lang/en.php
index c43273410f..e81a7dbd00 100644
--- a/module/bug/lang/en.php
+++ b/module/bug/lang/en.php
@@ -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 $actor, resolution is $extra.', 'extra' => $lang->bug->resolutionList);
+$lang->bug->action->tostory = array('main' => '$date, To story by $actor, ID is $extra。');
diff --git a/module/bug/lang/zh-cn.php b/module/bug/lang/zh-cn.php
index dc253b543d..de3240a514 100644
--- a/module/bug/lang/zh-cn.php
+++ b/module/bug/lang/zh-cn.php
@@ -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, 由 $actor 解决,方案为 $extra。', 'extra' => $lang->bug->resolutionList);
+$lang->bug->action->tostory = array('main' => '$date, 由 $actor 转化为需求,编号为 $extra。');
diff --git a/module/bug/model.php b/module/bug/model.php
index 9689f7870f..1f283b3b84 100644
--- a/module/bug/model.php
+++ b/module/bug/model.php
@@ -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.
*
diff --git a/module/project/model.php b/module/project/model.php
index 9dbb775b11..ce7c08a977 100644
--- a/module/project/model.php
+++ b/module/project/model.php
@@ -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();
diff --git a/module/story/lang/en.php b/module/story/lang/en.php
index 0b5a9f2fc6..f20cb7dc86 100644
--- a/module/story/lang/en.php
+++ b/module/story/lang/en.php
@@ -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[] = '';
diff --git a/module/story/lang/zh-cn.php b/module/story/lang/zh-cn.php
index ac7541053f..34b739d702 100644
--- a/module/story/lang/zh-cn.php
+++ b/module/story/lang/zh-cn.php
@@ -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[] = '';