* finish task#1685.

This commit is contained in:
azhi
2013-08-08 15:45:54 +08:00
parent a14b2c5e7d
commit 3d17951ba7
4 changed files with 79 additions and 5 deletions
+32
View File
@@ -451,6 +451,38 @@ class bugModel extends model
->exec();
}
/**
* Batch resolve bugs.
*
* @param array $bugIDList
* @param string $resolution
* @param string $resolvedBuild
* @access public
* @return void
*/
public function batchResolve($bugIDList, $resolution, $resolvedBuild)
{
$now = helper::now();
foreach($bugIDList as $bugID)
{
$oldBug = $this->getById($bugID);
if($oldBug->status != 'active') continue;
$bug = new stdClass();
$bug->resolution = $resolution;
$bug->resolvedBuild = $resolution == 'fixed' ? $resolvedBuild : '';
$bug->resolvedBy = $this->app->user->account;
$bug->resolvedDate = $now;
$bug->status = 'resolved';
$bug->confirmed = 1;
$bug->assignedTo = $oldBug->openedBy;
$bug->assignedDate = $now;
$bug->lastEditedBy = $this->app->user->account;
$bug->lastEditedDate = $now;
$this->dao->update(TABLE_BUG)->data($bug)->where('id')->eq($bugID)->exec();
}
}
/**
* Activate a bug.
*