diff --git a/module/bug/model.php b/module/bug/model.php
index ba4506029f..78207944e1 100644
--- a/module/bug/model.php
+++ b/module/bug/model.php
@@ -13,6 +13,8 @@
desc . "
";
- $i++;
- }
- $bugSteps .= $bugStep ? str_replace('
', '', $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'] . "
";
- $i++;
- }
- $bugSteps .= $bugResult ? str_replace('
', '', $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 . "
";
+
+ list($i, $order) = $this->buildStepOrder($step, $steps, $i);
+
+ $stepResult = (!isset($stepResults[$stepId]) or empty($stepResults[$stepId]['real'])) ? '' : $stepResults[$stepId]['real'];
+ $bugStep .= $order . '. ' . $step->desc . "
";
+ $bugResult .= $order . '. ' . $stepResult . "
";
+ $bugExpect .= $order . '. ' . $step->expect . "
";
+
$i++;
}
+ $bugSteps .= $bugStep ? str_replace('
', '', $this->lang->bug->tplStep) . $bugStep : $this->lang->bug->tplStep;
+ $bugSteps .= $bugResult ? str_replace('
', '', $this->lang->bug->tplResult) . $bugResult : $this->lang->bug->tplResult;
$bugSteps .= $bugExpect ? str_replace('
', '', $this->lang->bug->tplExpect) . $bugExpect : $this->lang->bug->tplExpect;
}
else
@@ -2862,4 +2852,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");
+ }
}