diff --git a/module/testcase/config.php b/module/testcase/config.php index 4750ade9e8..db1554b68d 100644 --- a/module/testcase/config.php +++ b/module/testcase/config.php @@ -24,10 +24,12 @@ $config->testcase->exportFields = ' pri, type, stage, status, lastRunResult, openedBy, openedDate, lastEditedBy, lastEditedDate, version,linkCase'; -$config->testcase->customCreateFields = 'stage,story,keywords'; +$config->testcase->customCreateFields = 'stage,story,keywords'; +$config->testcase->customBatchCreateFields = 'module,stage,story,precondition,keywords'; $config->testcase->custom = new stdclass(); -$config->testcase->custom->create = $config->testcase->customCreateFields; +$config->testcase->custom->create = $config->testcase->customCreateFields; +$config->testcase->custom->batchcreate = $config->testcase->customBatchCreateFields; global $lang; $config->testcase->search['module'] = 'testcase'; diff --git a/module/testcase/control.php b/module/testcase/control.php index cbd19d61dd..9cc2e200ab 100644 --- a/module/testcase/control.php +++ b/module/testcase/control.php @@ -351,28 +351,29 @@ class testcase extends control /* Set menu. */ $this->testcase->setMenu($this->products, $productID, $branch); - /* Init vars. */ - $type = 'feature'; - $title = ''; - - $title = $this->products[$productID] . $this->lang->colon . $this->lang->testcase->batchCreate; - $position[] = html::a($this->createLink('testcase', 'browse', "productID=$productID&branch=$branch"), $this->products[$productID]); - $position[] = $this->lang->testcase->common; - $position[] = $this->lang->testcase->batchCreate; - + /* Set story list. */ $story = $storyID ? $this->story->getByID($storyID) : ''; $storyList = $storyID ? array($storyID => $story->id . ':' . $story->title . '(' . $this->lang->story->pri . ':' . $story->pri . ',' . $this->lang->story->estimate . ':' . $story->estimate . ')') : array(''); - $this->view->title = $title; - $this->view->position = $position; + /* Set module option menu. */ + $moduleOptionMenu = $this->tree->getOptionMenu($productID, $viewType = 'case', $startModuleID = 0, $branch); + $moduleOptionMenu['ditto'] = $this->lang->testcase->ditto; + + /* Set custom. */ + foreach(explode(',', $this->config->testcase->customBatchCreateFields) as $field) $customFields[$field] = $this->lang->testcase->$field; + $this->view->customFields = $customFields; + $this->view->showFields = $this->config->testcase->custom->batchcreate; + + $this->view->title = $this->products[$productID] . $this->lang->colon . $this->lang->testcase->batchCreate; + $this->view->position[] = html::a($this->createLink('testcase', 'browse', "productID=$productID&branch=$branch"), $this->products[$productID]); + $this->view->position[] = $this->lang->testcase->common; + $this->view->position[] = $this->lang->testcase->batchCreate; $this->view->productID = $productID; $this->view->story = $story; $this->view->storyList = $storyList; $this->view->productName = $this->products[$productID]; - $this->view->moduleOptionMenu = $this->tree->getOptionMenu($productID, $viewType = 'case', $startModuleID = 0, $branch); + $this->view->moduleOptionMenu = $moduleOptionMenu; $this->view->currentModuleID = $currentModuleID; - $this->view->type = $type; - $this->view->title = $title; $this->view->branch = $branch; $this->view->branches = $this->loadModel('branch')->getPairs($productID); diff --git a/module/testcase/model.php b/module/testcase/model.php index e2c740439b..7e83fd3822 100644 --- a/module/testcase/model.php +++ b/module/testcase/model.php @@ -119,16 +119,19 @@ class testcaseModel extends model if($cases->type[$i] != '' and $cases->title[$i] != '') { $data[$i] = new stdclass(); - $data[$i]->product = $productID; - $data[$i]->branch = $branch; - $data[$i]->module = $cases->module[$i]; - $data[$i]->type = $cases->type[$i]; - $data[$i]->story = $storyID ? $storyID : $cases->story[$i]; - $data[$i]->title = $cases->title[$i]; - $data[$i]->openedBy = $this->app->user->account; - $data[$i]->openedDate = $now; - $data[$i]->status = 'normal'; - $data[$i]->version = 1; + $data[$i]->product = $productID; + $data[$i]->branch = $branch; + $data[$i]->module = $cases->module[$i]; + $data[$i]->type = $cases->type[$i]; + $data[$i]->stage = empty($cases->stage[$i]) ? '' : implode(',', $cases->stage[$i]); + $data[$i]->story = $storyID ? $storyID : $cases->story[$i]; + $data[$i]->title = $cases->title[$i]; + $data[$i]->precondition = $cases->precondition[$i]; + $data[$i]->keywords = $cases->keywords[$i]; + $data[$i]->openedBy = $this->app->user->account; + $data[$i]->openedDate = $now; + $data[$i]->status = 'normal'; + $data[$i]->version = 1; if(!$data[$i]->story) { $data[$i]->story = 0; @@ -158,6 +161,9 @@ class testcaseModel extends model unset($cases->type[$i]); unset($cases->story[$i]); unset($cases->title[$i]); + unset($cases->stage[$i]); + unset($cases->precondition[$i]); + unset($cases->keywords[$i]); } } } diff --git a/module/testcase/view/batchcreate.html.php b/module/testcase/view/batchcreate.html.php index 6f949b0242..be5777235f 100644 --- a/module/testcase/view/batchcreate.html.php +++ b/module/testcase/view/batchcreate.html.php @@ -25,26 +25,35 @@ icons['story']) . ' ' . $story->title ?> -