+3
-13
@@ -570,24 +570,15 @@ class bug extends control
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function resolve($bugID, $toStory = false)
|
||||
public function resolve($bugID)
|
||||
{
|
||||
$this->view->users = $this->user->getPairs('nodeleted');
|
||||
|
||||
if(!empty($_POST))
|
||||
{
|
||||
$storyID = $this->bug->resolve($bugID);
|
||||
$this->bug->resolve($bugID);
|
||||
if(dao::isError()) die(js::error(dao::getError()));
|
||||
|
||||
if($this->post->resolution == 'tostory')
|
||||
{
|
||||
$actionID = $this->action->create('bug', $bugID, 'ToStory', $this->post->comment, $storyID);
|
||||
$this->action->create('bug', $bugID, 'Closed');
|
||||
}
|
||||
else
|
||||
{
|
||||
$actionID = $this->action->create('bug', $bugID, 'Resolved', $this->post->comment, $this->post->resolution);
|
||||
}
|
||||
$actionID = $this->action->create('bug', $bugID, 'Resolved', $this->post->comment, $this->post->resolution);
|
||||
$this->sendmail($bugID, $actionID);
|
||||
|
||||
$bug = $this->bug->getById($bugID);
|
||||
@@ -606,7 +597,6 @@ class bug extends control
|
||||
$this->view->position[] = html::a($this->createLink('bug', 'browse', "productID=$productID"), $this->products[$productID]);
|
||||
$this->view->position[] = $this->lang->bug->resolve;
|
||||
|
||||
$this->view->toStory = $toStory;
|
||||
$this->view->bug = $bug;
|
||||
$this->view->builds = $this->loadModel('build')->getProductBuildPairs($productID);
|
||||
$this->view->actions = $this->action->getList('bug', $bugID);
|
||||
|
||||
@@ -231,7 +231,6 @@ $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';
|
||||
|
||||
@@ -231,7 +231,6 @@ $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'] = '延期处理';
|
||||
|
||||
+1
-53
@@ -211,66 +211,16 @@ class bugModel extends model
|
||||
public function resolve($bugID)
|
||||
{
|
||||
$now = helper::now();
|
||||
$oldBug = $this->getById($bugID);
|
||||
$storyID = 0;
|
||||
if($this->post->resolution == 'tostory')
|
||||
{
|
||||
$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();
|
||||
|
||||
$actionID = $this->loadModel('action')->create('story', $storyID, 'Frombug', '', $bugID);
|
||||
|
||||
$file = $this->dao->select('*')->from(TABLE_FILE)->where('objectType')->eq('bug')->andWhere('objectID')->eq($bugID)->fetch();
|
||||
if(!empty($file))
|
||||
{
|
||||
$file->objectType = 'story';
|
||||
$file->objectID = $storyID;
|
||||
unset($file->id);
|
||||
$this->dao->insert(TABLE_FILE)->data($file)->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', 'closedBy', $this->app->user->account)
|
||||
->setIF($this->post->resolution == 'tostory', 'closedDate', $now)
|
||||
->setIF($this->post->resolution == 'tostory', 'assignedTo', 'closed')
|
||||
->setIF($this->post->resolution != 'tostory', 'status', 'resolved')
|
||||
->remove('comment')
|
||||
->get();
|
||||
|
||||
@@ -281,10 +231,8 @@ class bugModel extends model
|
||||
->checkIF($bug->resolution == 'fixed', 'resolvedBuild','notempty')
|
||||
->where('id')->eq((int)$bugID)
|
||||
->exec();
|
||||
return $storyID;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Activate a bug.
|
||||
*
|
||||
|
||||
@@ -16,11 +16,7 @@
|
||||
<caption><?php echo $bug->title;?></caption>
|
||||
<tr>
|
||||
<td class='rowhead'><?php echo $lang->bug->resolution;?></td>
|
||||
<?php if($toStory == false):?>
|
||||
<td><?php echo html::select('resolution', $lang->bug->resolutionList, '', 'class=select-3 onchange=setDuplicate(this.value)');?></td>
|
||||
<?php else:?>
|
||||
<td><?php echo $lang->bug->resolutionList['tostory'];echo html::input('resolution', 'tostory', 'class=select-3 hidden');?></td>
|
||||
<?php endif;?>
|
||||
</tr>
|
||||
<tr id='duplicateBugBox' style='display:none'>
|
||||
<td class='rowhead'><?php echo $lang->bug->duplicateBug;?></td>
|
||||
|
||||
@@ -25,9 +25,9 @@
|
||||
common::printLink('bug', 'edit', $params, $lang->bug->buttonEdit);
|
||||
if(!($bug->status == 'active' and common::printLink('bug', 'resolve', $params, $lang->bug->buttonResolve))) echo $lang->bug->buttonResolve . ' ';
|
||||
if(!($bug->status == 'resolved' and common::printLink('bug', 'close', $params, $lang->bug->buttonClose))) echo $lang->bug->buttonClose . ' ';
|
||||
if($bug->status == 'active' and common::hasPriv('bug', 'resolve'))
|
||||
if($bug->status == 'active' and common::hasPriv('story', 'create'))
|
||||
{
|
||||
common::printLink('bug', 'resolve', "$params&toStory=true", $lang->bug->resolutionList['tostory']) . ' ';
|
||||
common::printLink('story', 'create', "product=$bug->product&module=0&story=0&project=0&bugID=$bug->id", $lang->bug->resolutionList['tostory']) . ' ';
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -62,7 +62,7 @@
|
||||
if(!($bug->status == 'resolved' and common::printLink('bug', 'close', $params, $lang->bug->buttonClose))) echo $lang->bug->buttonClose . ' ';
|
||||
if($bug->status == 'active' and common::hasPriv('bug', 'resolve'))
|
||||
{
|
||||
common::printLink('bug', 'resolve', "$params&toStory=true", $lang->bug->resolutionList['tostory']) . ' ';
|
||||
common::printLink('story', 'create', "product=$bug->product&module=0&story=0&project=0&bugID=$bug->id", $lang->bug->resolutionList['tostory']) . ' ';
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -33,14 +33,21 @@ class story extends control
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function create($productID = 0, $moduleID = 0, $storyID = 0, $projectID = 0)
|
||||
public function create($productID = 0, $moduleID = 0, $storyID = 0, $projectID = 0, $bugID = 0)
|
||||
{
|
||||
if(!empty($_POST))
|
||||
{
|
||||
$storyID = $this->story->create($projectID);
|
||||
$storyID = $this->story->create($projectID, $bugID);
|
||||
if(dao::isError()) die(js::error(dao::getError()));
|
||||
$this->loadModel('action');
|
||||
$actionID = $this->action->create('story', $storyID, 'Opened', '');
|
||||
if($bugID == 0)
|
||||
{
|
||||
$actionID = $this->action->create('story', $storyID, 'Opened', '');
|
||||
}
|
||||
else
|
||||
{
|
||||
$actionID = $this->action->create('story', $storyID, 'Frombug', '', $bugID);
|
||||
}
|
||||
$this->sendMail($storyID, $actionID);
|
||||
if($projectID == 0)
|
||||
{
|
||||
@@ -75,6 +82,7 @@ class story extends control
|
||||
|
||||
/* Init vars. */
|
||||
$planID = 0;
|
||||
$source = '';
|
||||
$pri = 0;
|
||||
$estimate = '';
|
||||
$title = '';
|
||||
@@ -87,6 +95,7 @@ class story extends control
|
||||
{
|
||||
$story = $this->story->getByID($storyID);
|
||||
$planID = $story->plan;
|
||||
$source = $story->source;
|
||||
$pri = $story->pri;
|
||||
$productID = $story->product;
|
||||
$moduleID = $story->module;
|
||||
@@ -98,6 +107,17 @@ class story extends control
|
||||
$mailto = $story->mailto;
|
||||
}
|
||||
|
||||
if($bugID > 0)
|
||||
{
|
||||
$oldBug = $this->loadModel('bug')->getById($bugID);
|
||||
$productID = $oldBug->product;
|
||||
$source = 'bug';
|
||||
$title = $oldBug->title;
|
||||
$keywords = $oldBug->keywords;
|
||||
$pri = $oldBug->pri;
|
||||
$mailto = $oldBug->mailto;
|
||||
}
|
||||
|
||||
$this->view->header->title = $product->name . $this->lang->colon . $this->lang->story->create;
|
||||
$this->view->position[] = html::a($this->createLink('product', 'browse', "product=$productID"), $product->name);
|
||||
$this->view->position[] = $this->lang->story->create;
|
||||
@@ -107,6 +127,7 @@ class story extends control
|
||||
$this->view->moduleOptionMenu = $moduleOptionMenu;
|
||||
$this->view->plans = $this->loadModel('productplan')->getPairs($productID, 'unexpired');
|
||||
$this->view->planID = $planID;
|
||||
$this->view->source = $source;
|
||||
$this->view->pri = $pri;
|
||||
$this->view->productID = $productID;
|
||||
$this->view->estimate = $estimate;
|
||||
|
||||
+16
-1
@@ -97,7 +97,7 @@ class storyModel extends model
|
||||
* @access public
|
||||
* @return int|bool the id of the created story or false when error.
|
||||
*/
|
||||
public function create($projectID = 0)
|
||||
public function create($projectID = 0, $bugID = 0)
|
||||
{
|
||||
$now = helper::now();
|
||||
$story = fixer::input('post')
|
||||
@@ -115,8 +115,10 @@ class storyModel extends model
|
||||
->setIF($this->post->needNotReview, 'status', 'active')
|
||||
->setIF($this->post->plan > 0, 'stage', 'planned')
|
||||
->setIF($projectID > 0, 'stage', 'projected')
|
||||
->setIF($bugID > 0, 'fromBug', $bugID)
|
||||
->remove('files,labels,spec,verify,needNotReview')
|
||||
->get();
|
||||
|
||||
$this->dao->insert(TABLE_STORY)->data($story)->autoCheck()->batchCheck($this->config->story->create->requiredFields, 'notempty')->exec();
|
||||
if(!dao::isError())
|
||||
{
|
||||
@@ -140,6 +142,19 @@ class storyModel extends model
|
||||
->set('version')->eq(1)
|
||||
->exec();
|
||||
}
|
||||
|
||||
if($bugID > 0)
|
||||
{
|
||||
$bug->toStory = $storyID;
|
||||
$bug->status = 'closed';
|
||||
$bug->closedBy = $this->app->user->account;
|
||||
$bug->closedDate = $now;
|
||||
$bug->assignedTo = 'closed';
|
||||
$this->dao->update(TABLE_BUG)->data($bug)->exec();
|
||||
|
||||
$this->loadModel('action')->create('bug', $bugID, 'ToStory', '', $storyID);
|
||||
$this->action->create('bug', $bugID, 'Closed');
|
||||
}
|
||||
return $storyID;
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
?>
|
||||
<?php include './header.html.php';?>
|
||||
<?php include '../../common/view/kindeditor.html.php';?>
|
||||
<form method='post' enctype='multipart/form-data' target='hiddenwin'>
|
||||
<form method='post' enctype='multipart/form-data' >
|
||||
<table align='center' class='table-1'>
|
||||
<caption><?php echo $lang->story->create;?></caption>
|
||||
<tr>
|
||||
@@ -28,7 +28,7 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<th class='rowhead'><?php echo $lang->story->source;?></th>
|
||||
<td><?php echo html::select('source', $lang->story->sourceList, '', 'class=select-3');?></td>
|
||||
<td><?php echo html::select('source', $lang->story->sourceList, $source, 'class=select-3');?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class='rowhead'><?php echo $lang->story->title;?></th>
|
||||
|
||||
Reference in New Issue
Block a user