+ finish task#576

This commit is contained in:
chencongzhi520@gmail.com
2011-10-22 06:27:14 +00:00
parent 559eb7f492
commit 0cf5462fec
4 changed files with 17 additions and 3 deletions

View File

@@ -347,6 +347,13 @@ class bug extends control
if($runID > 0) $resultID = $this->dao->select('id')->from(TABLE_TESTRESULT)->where('run')->eq($runID)->orderBy('id desc')->limit(1)->fetch('id');
if(isset($resultID) and $resultID > 0) extract($this->bug->getBugInfoFromResult($resultID));
/* If set caseID and runID='', get the last result info as the template. */
if($caseID > 0 && $runID == '')
{
$resultID = $this->dao->select('id')->from(TABLE_TESTRESULT)->where('`case`')->eq($caseID)->orderBy('date desc')->limit(1)->fetch('id');
if(isset($resultID) and $resultID > 0) extract($this->bug->getBugInfoFromResult($resultID, $caseID, $version));
}
/* If bugID setted, use this bug as template. */
if(isset($bugID))
{

View File

@@ -353,16 +353,21 @@ class bugModel extends model
* Get bug info from a result.
*
* @param int $resultID
* @param int $caseID
* @param int $version
* @access public
* @return array
*/
public function getBugInfoFromResult($resultID)
public function getBugInfoFromResult($resultID, $caseID = 0, $version = 0)
{
$title = '';
$bugSteps = '';
$result = $this->dao->findById($resultID)->from(TABLE_TESTRESULT)->fetch();
$run = $this->loadModel('testtask')->getRunById($result->run);
if($caseID > 0)
$run->case = $this->loadModel('testcase')->getById($caseID, $version);
else
$run = $this->loadModel('testtask')->getRunById($result->run);
if($result and $result->caseResult == 'fail')
{
$title = $run->case->title;

View File

@@ -63,7 +63,7 @@ var moduleID = '<?php echo $moduleID;?>';
<th class='w-user'><?php common::printOrderLink('lastRun', $orderBy, $vars, $lang->testtask->lastRun);?></th>
<th class='w-80px'><?php common::printOrderLink('lastResult',$orderBy, $vars, $lang->testtask->lastResult);?></th>
<th class='w-status'><?php common::printOrderLink('status', $orderBy, $vars, $lang->statusAB);?></th>
<th class='w-120px {sorter:false}'><?php echo $lang->actions;?></th>
<th class='w-200px {sorter:false}'><?php echo $lang->actions;?></th>
<?php endif;?>
</tr>
<?php foreach($cases as $case):?>
@@ -87,6 +87,7 @@ var moduleID = '<?php echo $moduleID;?>';
common::printLink('testcase', 'delete', "caseID=$case->id", $lang->delete, 'hiddenwin');
common::printLink('testtask', 'runCase', "runID=0&extras=caseID=$case->id", $this->app->loadLang('testtask')->testtask->runCase, '', 'class="runcase"');
common::printLink('testtask', 'results', "runID=0&extras=caseID=$case->id,version=$case->version", $lang->testtask->results, '', 'class="results"');
if($case->lastResult == 'fail') common::printLink('bug', 'create', "product=$case->product&extra=caseID=$case->id,version=$case->version,runID=", $lang->testtask->createBug);
?>
</td>
<?php endif;?>

View File

@@ -21,6 +21,7 @@
{
common::printLink('testtask', 'runCase', "runID=0&extras=version=$currentVersion,caseID=$case->id", $this->app->loadLang('testtask')->testtask->runCase, '', 'class="runcase"');
common::printLink('testtask', 'results', "runID=0&extras=caseID=$case->id,version=$case->version", $lang->testtask->results, '', 'class="results"');
if($case->lastResult == 'fail') common::printLink('bug', 'create', "product=$case->product&extra=caseID=$case->id,version=$case->version,runID=", $lang->testtask->createBug);
common::printLink('testcase', 'edit', "caseID=$case->id", $lang->testcase->buttonEdit);
common::printLink('testcase', 'create', "productID=$case->product&moduleID=$case->module&testcaseID=$case->id", $lang->copy);
common::printLink('testcase', 'delete', "caseID=$case->id", $lang->delete, 'hiddenwin');