diff --git a/module/bug/control.php b/module/bug/control.php
index 0fa39b530c..6958859aa7 100644
--- a/module/bug/control.php
+++ b/module/bug/control.php
@@ -214,7 +214,7 @@ class bug extends control
if(empty($this->products)) $this->locate($this->createLink('product', 'create'));
$this->app->loadLang('release');
- if(!empty($_POST))
+ if(!empty($_POST) and !isset($_POST['stepIDList']))
{
$response['result'] = 'success';
$response['message'] = '';
diff --git a/module/bug/model.php b/module/bug/model.php
index 4ff8d00aac..8bacca4ece 100644
--- a/module/bug/model.php
+++ b/module/bug/model.php
@@ -724,6 +724,7 @@ class bugModel extends model
{
$title = '';
$bugSteps = '';
+ $steps = $this->post->stepIDList;
$result = $this->dao->findById($resultID)->from(TABLE_TESTRESULT)->fetch();
if($caseID > 0)
@@ -749,13 +750,15 @@ class bugModel extends model
{
foreach($caseSteps as $key => $step)
{
+ if(!in_array($step->id, $steps)) continue;
$bugSteps .= ($key + 1) . '. ' . $step->desc . "
";
}
$bugSteps .= $this->lang->bug->tplResult;
foreach($caseSteps as $key => $step)
{
- if(!$stepResults[$step->id]['real']) continue;
+ if(empty($stepResults[$step->id]['real'])) continue;
+ if(!in_array($step->id, $steps)) continue;
$bugSteps .= ($key + 1) . '. ' . $stepResults[$step->id]['real'] . "
";
}
@@ -763,6 +766,7 @@ class bugModel extends model
foreach($caseSteps as $key => $step)
{
if(!$step->expect) continue;
+ if(!in_array($step->id, $steps)) continue;
$bugSteps .= ($key + 1) . '. ' . $step->expect . "
";
}
diff --git a/module/common/control.php b/module/common/control.php
index af47345f04..43a485199d 100644
--- a/module/common/control.php
+++ b/module/common/control.php
@@ -259,7 +259,6 @@ class common extends control
}
/* Set module and method, then create link to it. */
- if(strtolower($module) == 'testcase' and strtolower($method) == 'createbug') ($module = 'bug') and ($method = 'create');
if(strtolower($module) == 'story' and strtolower($method) == 'createcase') ($module = 'testcase') and ($method = 'create');
if(strtolower($module) == 'bug' and strtolower($method) == 'tostory') ($module = 'story') and ($method = 'create');
if(strtolower($module) == 'bug' and strtolower($method) == 'createcase') ($module = 'testcase') and ($method = 'create');
diff --git a/module/testcase/control.php b/module/testcase/control.php
index 35e1822f93..4a2a4cdb07 100644
--- a/module/testcase/control.php
+++ b/module/testcase/control.php
@@ -379,6 +379,42 @@ class testcase extends control
$this->display();
}
+ /**
+ * Create bug.
+ *
+ * @param int $productID
+ * @param string $extras
+ * @access public
+ * @return void
+ */
+ public function createBug($productID, $extras = '')
+ {
+ parse_str(str_replace(array(',', ' '), array('&', ''), $extras));
+
+ $this->loadModel('testtask');
+ $case = '';
+ if($runID)
+ {
+ $case = $this->testtask->getRunById($runID)->case;
+ $results = $this->testtask->getResults($runID);
+ }
+ elseif($caseID)
+ {
+ $case = $this->testcase->getById($caseID);
+ $results = $this->testtask->getResults(0, $caseID);
+ }
+
+ if(!$case) die(js::error($this->lang->notFound) . js::locate('back', 'parent'));
+ if(empty($case->steps)) die(js::locate($this->createLink('bug', 'create', "product=$productID&extras=$extras")));
+
+ $this->view->title = $this->products[$productID] . $this->lang->colon . $this->lang->testcase->createBug;
+ $this->view->case = $case;
+ $this->view->result = reset($results);
+ $this->view->extras = $extras;
+ $this->view->productID = $productID;
+ $this->display();
+ }
+
/**
* View a test case.
*
diff --git a/module/testcase/lang/en.php b/module/testcase/lang/en.php
index f9bad8cf0f..48d38f5faa 100644
--- a/module/testcase/lang/en.php
+++ b/module/testcase/lang/en.php
@@ -45,6 +45,7 @@ $lang->testcase->allProduct = 'All product';
$lang->testcase->fromBug = 'From bug';
$lang->testcase->toBug = 'To bug';
$lang->testcase->changed = 'Changed';
+$lang->testcase->createBug = 'Create bug';
$lang->case = $lang->testcase; // For dao checking using. Because 'case' is a php keywords, so the module name is testcase, table name is still case.
$lang->testcase->stepID = 'ID';
diff --git a/module/testcase/lang/zh-cn.php b/module/testcase/lang/zh-cn.php
index 56e92dba67..37a0834bb9 100644
--- a/module/testcase/lang/zh-cn.php
+++ b/module/testcase/lang/zh-cn.php
@@ -45,6 +45,7 @@ $lang->testcase->allProduct = '所有产品';
$lang->testcase->fromBug = '来源Bug';
$lang->testcase->toBug = '生成Bug';
$lang->testcase->changed = '用例变更';
+$lang->testcase->createBug = '创建Bug';
$lang->case = $lang->testcase; // 用于DAO检查时使用。因为case是系统关键字,所以无法定义该模块为case,只能使用testcase,但表还是使用的case。
$lang->testcase->stepID = '编号';
diff --git a/module/testcase/view/browse.html.php b/module/testcase/view/browse.html.php
index 7fa8df6b48..67949a6e1e 100644
--- a/module/testcase/view/browse.html.php
+++ b/module/testcase/view/browse.html.php
@@ -89,7 +89,7 @@ js::set('confirmDelete', $lang->testcase->confirmDelete);
echo html::a("javascript:ajaxDelete(\"$deleteURL\",\"caseList\",confirmDelete)", '', '', "title='{$lang->testcase->delete}' class='btn-icon'");
}
- common::printIcon('testcase', 'createBug', "product=$case->product&extra=caseID=$case->id,version=$case->version,runID=", $case, 'list', 'bug');
+ common::printIcon('testcase', 'createBug', "product=$case->product&extra=caseID=$case->id,version=$case->version,runID=", $case, 'list', 'bug', '', 'iframe');
?>
diff --git a/module/testcase/view/createbug.html.php b/module/testcase/view/createbug.html.php
new file mode 100644
index 0000000000..84cdbef581
--- /dev/null
+++ b/module/testcase/view/createbug.html.php
@@ -0,0 +1,53 @@
+
+ * @package testcase
+ * @version $Id$
+ * @link http://www.zentao.net
+ */
+?>
+
+