* code for task#571

This commit is contained in:
chencongzhi520@gmail.com
2011-10-29 12:24:40 +00:00
parent 70c614623d
commit 39ea974c85
2 changed files with 7 additions and 7 deletions
+4 -6
View File
@@ -162,10 +162,13 @@ class testcase extends control
*/
public function create($productID, $moduleID = 0, $from = '', $param = 0)
{
$testcaseID = $from == 'testcase' ? $param : 0;
$bugID = $from == 'bug' ? $param : 0;
$this->loadModel('story');
if(!empty($_POST))
{
$this->testcase->create();
$this->testcase->create($bugID);
if(dao::isError()) die(js::error(dao::getError()));
$this->loadModel('action');
$this->action->create('case', $caseID, 'Opened');
@@ -185,16 +188,11 @@ class testcase extends control
$stage = '';
$pri = 0;
$storyID = 0;
$testcaseID = 0;
$bugID = 0;
$title = '';
$precondition = '';
$keywords = '';
$steps = array();
if($from == 'testcase') $testcaseID = $param;
if($from == 'bug') $bugID = $param;
/* If testcaseID large than 0, use this testcase as template. */
if($testcaseID > 0)
{
+3 -1
View File
@@ -35,10 +35,11 @@ class testcaseModel extends model
/**
* Create a case.
*
* @param int $bugID
* @access public
* @return void
*/
function create()
function create($bugID)
{
$now = helper::now();
$case = fixer::input('post')
@@ -46,6 +47,7 @@ class testcaseModel extends model
->add('openedDate', $now)
->add('status', 'normal')
->add('version', 1)
->add('fromBug', $bugID)
->setIF($this->post->story != false, 'storyVersion', $this->loadModel('story')->getVersion($this->post->story))
->remove('steps,expects,files,labels')
->setDefault('story', 0)