Merge branch 'master' of github.com:easysoft/zentaopms

This commit is contained in:
tianshujie98
2020-07-17 09:00:05 +08:00
25 changed files with 120 additions and 88 deletions
+32 -26
View File
@@ -13,6 +13,8 @@
<?php
class bugModel extends model
{
public $steps = array();
/**
* Set menu.
*
@@ -1671,36 +1673,24 @@ class bugModel extends model
{
$i = 1;
$bugStep = '';
foreach($steps as $stepId)
{
if(!isset($caseSteps[$stepId])) continue;
$step = $caseSteps[$stepId];
$bugStep .= $i . '. ' . $step->desc . "<br />";
$i++;
}
$bugSteps .= $bugStep ? str_replace('<br/>', '', $this->lang->bug->tplStep) . $bugStep : $this->lang->bug->tplStep;
$i = 1;
$bugResult = '';
foreach($steps as $stepId)
{
if(!isset($stepResults[$stepId]) or empty($stepResults[$stepId]['real'])) continue;
$bugResult .= $i . '. ' . $stepResults[$stepId]['real'] . "<br />";
$i++;
}
$bugSteps .= $bugResult ? str_replace('<br/>', '', $this->lang->bug->tplResult) . $bugResult : $this->lang->bug->tplResult;
$i = 1;
$bugExpect = '';
foreach($steps as $stepId)
{
if(!isset($caseSteps[$stepId])) continue;
$step = $caseSteps[$stepId];
if($step->expect) $bugExpect .= $i . '. ' . $step->expect . "<br />";
list($i, $order) = $this->buildStepOrder($step, $steps, $i);
$stepResult = (!isset($stepResults[$stepId]) or empty($stepResults[$stepId]['real'])) ? '' : $stepResults[$stepId]['real'];
$bugStep .= $order . '. ' . $step->desc . "<br />";
$bugResult .= $order . '. ' . $stepResult . "<br />";
$bugExpect .= $order . '. ' . $step->expect . "<br />";
$i++;
}
$bugSteps .= $bugStep ? str_replace('<br/>', '', $this->lang->bug->tplStep) . $bugStep : $this->lang->bug->tplStep;
$bugSteps .= $bugResult ? str_replace('<br/>', '', $this->lang->bug->tplResult) . $bugResult : $this->lang->bug->tplResult;
$bugSteps .= $bugExpect ? str_replace('<br/>', '', $this->lang->bug->tplExpect) . $bugExpect : $this->lang->bug->tplExpect;
}
else
@@ -2664,10 +2654,6 @@ class bugModel extends model
{
echo html::a(helper::createLink('build', 'view', "buildID=$buildID"), $build, '', "title='$bug->openedBuild'");
}
else
{
echo $build;
}
}
break;
case 'assignedTo':
@@ -2862,4 +2848,24 @@ class bugModel extends model
return sprintf($this->lang->bug->summary, count($bugs), $unresolved);
}
/**
* Build step order.
*
* @param object $step
* @param array $caseSteps
* @param int $i
* @access public
* @return array
*/
public function buildStepOrder($step, $caseSteps, $i)
{
if($step->parent == 0 or !in_array($step->parent, $caseSteps)) return array($i, $i);
$i --;
$j = isset($this->steps[$step->parent]) ? (count($this->steps[$step->parent]) + 1) : 1;
$this->steps[$step->parent][] = $step->id;
return array($i, "$i.$j");
}
}