* finish task #4810.

This commit is contained in:
wangyidong
2018-09-05 11:23:10 +08:00
parent 10e4df924d
commit f3d9444cfb
2 changed files with 49 additions and 15 deletions
+25 -9
View File
@@ -963,12 +963,13 @@ class bug extends control
{
if(!empty($_POST))
{
$this->bug->resolve($bugID);
$changes = $this->bug->resolve($bugID);
if(dao::isError()) die(js::error(dao::getError()));
$files = $this->loadModel('file')->saveUpload('bug', $bugID);
$fileAction = !empty($files) ? $this->lang->addFiles . join(',', $files) . "\n" : '';
$actionID = $this->action->create('bug', $bugID, 'Resolved', $fileAction . $this->post->comment, $this->post->resolution . ($this->post->duplicateBug ? ':' . (int)$this->post->duplicateBug : ''));
$this->action->logHistory($actionID, $changes);
$bug = $this->bug->getById($bugID);
if($bug->toTask != 0)
@@ -1021,9 +1022,16 @@ class bug extends control
{
$bugIDList = $this->post->bugIDList ? $this->post->bugIDList : die(js::locate($this->session->bugList, 'parent'));
$bugIDList = array_unique($bugIDList);
$bugIDList = $this->bug->batchResolve($bugIDList, $resolution, $resolvedBuild);
$changes = $this->bug->batchResolve($bugIDList, $resolution, $resolvedBuild);
if(dao::isError()) die(js::error(dao::getError()));
foreach($bugIDList as $bugID) $this->action->create('bug', $bugID, 'Resolved', '', $resolution);
foreach($changes as $bugID => $bugChanges)
{
$actionID = $this->action->create('bug', $bugID, 'Resolved', '', $resolution);
$this->action->logHistory($actionID, $bugChanges);
}
$this->loadModel('score')->create('ajax', 'batchOther');
die(js::locate($this->session->bugList, 'parent'));
}
@@ -1039,10 +1047,14 @@ class bug extends control
{
if(!empty($_POST))
{
$this->bug->activate($bugID);
$changes = $this->bug->activate($bugID);
if(dao::isError()) die(js::error(dao::getError()));
$files = $this->loadModel('file')->saveUpload('bug', $bugID);
$this->action->create('bug', $bugID, 'Activated', $this->post->comment);
$actionID = $this->action->create('bug', $bugID, 'Activated', $this->post->comment);
$this->action->logHistory($actionID, $changes);
if(isonlybody()) die(js::closeModal('parent.parent'));
die(js::locate($this->createLink('bug', 'view', "bugID=$bugID"), 'parent'));
}
@@ -1074,9 +1086,12 @@ class bug extends control
{
if(!empty($_POST))
{
$this->bug->close($bugID);
$changes = $this->bug->close($bugID);
if(dao::isError()) die(js::error(dao::getError()));
$this->action->create('bug', $bugID, 'Closed', $this->post->comment);
$actionID = $this->action->create('bug', $bugID, 'Closed', $this->post->comment);
$this->action->logHistory($actionID, $changes);
if(isonlybody()) die(js::closeModal('parent.parent'));
die(js::locate($this->createLink('bug', 'view', "bugID=$bugID"), 'parent'));
}
@@ -1157,9 +1172,10 @@ class bug extends control
continue;
}
$this->bug->close($bugID);
$changes = $this->bug->close($bugID);
$this->action->create('bug', $bugID, 'Closed');
$actionID = $this->action->create('bug', $bugID, 'Closed');
$this->action->logHistory($actionID, $changes);
}
$this->loadModel('score')->create('ajax', 'batchOther');
if(isset($skipBugs)) echo js::alert(sprintf($this->lang->bug->skipClose, join(',', $skipBugs)));
+24 -6
View File
@@ -800,6 +800,7 @@ class bugModel extends model
/* Update bugs. */
foreach($activateBugs as $bugID => $bug)
{
$oldBug = $bugs[$bugID];
$this->dao->update(TABLE_BUG)->data($bug, $skipFields = 'comment')->autoCheck()->where('id')->eq((int)$bugID)->exec();
if(dao::isError()) die(js::error('bug#' . $bugID . dao::getError(true)));
@@ -956,9 +957,17 @@ class bugModel extends model
->checkIF($bug->resolution == 'fixed', 'resolvedBuild','notempty')
->where('id')->eq((int)$bugID)
->exec();
if(!dao::isError()) $this->loadModel('score')->create('bug', 'resolve', $oldBug);
/* Link bug to build and release. */
$this->linkBugToBuild($bugID, $bug->resolvedBuild);
if(!dao::isError())
{
$this->loadModel('score')->create('bug', 'resolve', $oldBug);
/* Link bug to build and release. */
$this->linkBugToBuild($bugID, $bug->resolvedBuild);
return common::createChanges($oldBug, $bug);
}
return false;
}
/**
@@ -1041,6 +1050,7 @@ class bugModel extends model
$modules = array();
while($module = $stmt->fetch()) $modules[$module->id] = $module;
$changes = array();
foreach($bugIDList as $i => $bugID)
{
$oldBug = $bugs[$bugID];
@@ -1081,12 +1091,14 @@ class bugModel extends model
$bug->lastEditedDate = $now;
$this->dao->update(TABLE_BUG)->data($bug)->where('id')->eq($bugID)->exec();
$changes[$bugID] = common::createChanges($oldBug, $bug);
}
/* Link bug to build and release. */
$this->linkBugToBuild($bugIDList, $resolvedBuild);
return $bugIDList;
return $changes;
}
/**
@@ -1122,6 +1134,9 @@ class bugModel extends model
$this->dao->update(TABLE_BUG)->data($bug)->autoCheck()->where('id')->eq((int)$bugID)->exec();
$this->dao->update(TABLE_BUG)->set('activatedCount = activatedCount + 1')->where('id')->eq((int)$bugID)->exec();
$bug->activatedCount += 1;
return common::createChanges($oldBug, $bug);
}
/**
@@ -1133,8 +1148,9 @@ class bugModel extends model
*/
public function close($bugID)
{
$now = helper::now();
$bug = fixer::input('post')
$now = helper::now();
$oldBug = $this->getById($bugID);
$bug = fixer::input('post')
->add('assignedTo', 'closed')
->add('assignedDate', $now)
->add('status', 'closed')
@@ -1147,6 +1163,8 @@ class bugModel extends model
->get();
$this->dao->update(TABLE_BUG)->data($bug)->autoCheck()->where('id')->eq((int)$bugID)->exec();
return common::createChanges($oldBug, $bug);
}
/**