* finish the task #610.
This commit is contained in:
+38
-2
@@ -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.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user