* adjust for export with branch.
This commit is contained in:
+21
-14
@@ -836,17 +836,22 @@ class testcase extends control
|
||||
*/
|
||||
public function export($productID, $orderBy, $taskID = 0)
|
||||
{
|
||||
$product = $this->loadModel('product')->getById($productID);
|
||||
if($product->type != 'normal') $this->lang->testcase->branch = $this->lang->product->branchName[$product->type];
|
||||
if($_POST)
|
||||
{
|
||||
$caseLang = $this->lang->testcase;
|
||||
$caseConfig = $this->config->testcase;
|
||||
|
||||
/* Create field lists. */
|
||||
$fields = $this->post->exportFields ? $this->post->exportFields : explode(',', $caseConfig->exportFields);
|
||||
$fields = $this->post->exportFields ? $this->post->exportFields : explode(',', $caseConfig->exportFields);
|
||||
foreach($fields as $key => $fieldName)
|
||||
{
|
||||
$fieldName = trim($fieldName);
|
||||
$fields[$fieldName] = isset($caseLang->$fieldName) ? $caseLang->$fieldName : $fieldName;
|
||||
if(!($product->type == 'normal' and $fieldName == 'branch'))
|
||||
{
|
||||
$fields[$fieldName] = isset($caseLang->$fieldName) ? $caseLang->$fieldName : $fieldName;
|
||||
}
|
||||
unset($fields[$key]);
|
||||
}
|
||||
|
||||
@@ -884,6 +889,7 @@ class testcase extends control
|
||||
/* Get users, products and projects. */
|
||||
$users = $this->loadModel('user')->getPairs('noletter');
|
||||
$products = $this->loadModel('product')->getPairs('nocode');
|
||||
$branches = $this->loadModel('branch')->getPairs($productID);
|
||||
|
||||
/* Get related objects id lists. */
|
||||
$relatedModuleIdList = array();
|
||||
@@ -938,6 +944,7 @@ class testcase extends control
|
||||
|
||||
/* fill some field with useful value. */
|
||||
if(isset($products[$case->product])) $case->product = $products[$case->product] . "(#$case->product)";
|
||||
if(isset($branches[$case->branch])) $case->branch = $branches[$case->branch] . "(#$case->branch)";
|
||||
if(isset($relatedModules[$case->module])) $case->module = $relatedModules[$case->module] . "(#$case->module)";
|
||||
if(isset($relatedStories[$case->story])) $case->story = $relatedStories[$case->story] . "(#$case->story)";
|
||||
|
||||
@@ -990,6 +997,9 @@ class testcase extends control
|
||||
{
|
||||
if($_POST)
|
||||
{
|
||||
$product = $this->loadModel('product')->getById($productID);
|
||||
|
||||
if($product->type != 'normal') $fields['branch'] = $this->lang->product->branchName[$product->type];
|
||||
$fields['module'] = $this->lang->testcase->module;
|
||||
$fields['title'] = $this->lang->testcase->title;
|
||||
$fields['stepDesc'] = $this->lang->testcase->stepDesc;
|
||||
@@ -1005,6 +1015,10 @@ class testcase extends control
|
||||
$fields['typeValue'] = $this->lang->testcase->lblTypeValue;
|
||||
$fields['stageValue'] = $this->lang->testcase->lblStageValue;
|
||||
$fields['statusValue'] = $this->lang->testcase->lblStatusValue;
|
||||
if($product->type != 'normal') $fields['branchValue'] = $this->lang->product->branchName[$product->type];
|
||||
|
||||
$branches = $this->loadModel('branch')->getPairs($productID);
|
||||
foreach($branches as $branchID => $branchName) $branches[$branchID] = $branchName . "(#$branchID)";
|
||||
|
||||
$modules = $this->loadModel('tree')->getOptionMenu($productID, 'case');
|
||||
$rows = array();
|
||||
@@ -1020,6 +1034,7 @@ class testcase extends control
|
||||
$row->typeValue = join("\n", $this->lang->testcase->typeList);
|
||||
$row->stageValue = join("\n", $this->lang->testcase->stageList);
|
||||
$row->statusValue = join("\n", $this->lang->testcase->statusList);
|
||||
if($product->type != 'normal') $row->branchValue = join("\n", $branches);
|
||||
}
|
||||
$rows[] = $row;
|
||||
}
|
||||
@@ -1053,7 +1068,7 @@ class testcase extends control
|
||||
|
||||
$fileName = $this->file->savePath . $file['pathname'];
|
||||
$rows = $this->file->parseCSV($fileName);
|
||||
$fields = $this->testcase->getImportFields();
|
||||
$fields = $this->testcase->getImportFields($productID);
|
||||
$fields = array_flip($fields);
|
||||
$header = array();
|
||||
foreach($rows[0] as $i => $rowValue)
|
||||
@@ -1123,7 +1138,7 @@ class testcase extends control
|
||||
$caseConfig = $this->config->testcase;
|
||||
$modules = $this->loadModel('tree')->getOptionMenu($productID, 'case', 0, $branch);
|
||||
$stories = $this->loadModel('story')->getProductStoryPairs($productID, $branch);
|
||||
$fields = $this->testcase->getImportFields();
|
||||
$fields = $this->testcase->getImportFields($productID);
|
||||
$fields = array_flip($fields);
|
||||
|
||||
$rows = $this->loadModel('file')->parseCSV($file);
|
||||
@@ -1151,16 +1166,7 @@ class testcase extends control
|
||||
{
|
||||
if(!isset($data[$key])) continue;
|
||||
$cellValue = $data[$key];
|
||||
if($field == 'story')
|
||||
{
|
||||
$case->$field = 0;
|
||||
if(strrpos($cellValue, '(#') !== false)
|
||||
{
|
||||
$id = trim(substr($cellValue, strrpos($cellValue,'(#') + 2), ')');
|
||||
$case->$field = $id;
|
||||
}
|
||||
}
|
||||
elseif($field == 'module')
|
||||
if($field == 'story' or $field == 'module' or $field == 'branch')
|
||||
{
|
||||
$case->$field = 0;
|
||||
if(strrpos($cellValue, '(#') !== false)
|
||||
@@ -1248,6 +1254,7 @@ class testcase extends control
|
||||
$this->view->caseData = $caseData;
|
||||
$this->view->stepData = $stepData;
|
||||
$this->view->productID = $productID;
|
||||
$this->view->branches = $this->loadModel('branch')->getPairs($productID);
|
||||
$this->view->branch = $branch;
|
||||
$this->view->product = $this->products[$productID];
|
||||
$this->display();
|
||||
|
||||
Reference in New Issue
Block a user