* Fix bug of task #59477.
This commit is contained in:
@@ -1907,7 +1907,6 @@ class testcase extends control
|
||||
$this->view->productID = $productID;
|
||||
$this->view->branch = $branch;
|
||||
$this->view->cases = $this->testsuite->getCanImportCases($productID, $libID, $branch, $orderBy, $pager, $browseType, $queryID);
|
||||
$this->view->modules = $this->loadModel('tree')->getOptionMenu($productID, 'case', 0, $branch === 'all' ? 0 : (int)$branch);
|
||||
$this->view->libModules = $this->tree->getOptionMenu($libID, 'caselib');
|
||||
$this->view->pager = $pager;
|
||||
$this->view->orderBy = $orderBy;
|
||||
|
||||
@@ -1622,7 +1622,7 @@ class testcaseModel extends model
|
||||
unset($case->id);
|
||||
|
||||
$branch = isset($case->branch) ? $case->branch : 0;
|
||||
if(isset($caseModules[$branch][$case->fromCaseID]) and !isset($caseModules[$branch][$case->fromCaseID][$case->module]))
|
||||
if(empty($caseModules[$branch][$case->fromCaseID][$case->module]))
|
||||
{
|
||||
$imported .= "$case->fromCaseID,";
|
||||
continue;
|
||||
|
||||
@@ -48,6 +48,18 @@
|
||||
<tbody>
|
||||
<?php $i = 0;?>
|
||||
<?php foreach($cases as $id => $case):?>
|
||||
<?php
|
||||
$caseBranches = $branches;
|
||||
$caseBranch = $branch;
|
||||
foreach($caseBranches as $branchID => $branchName)
|
||||
{
|
||||
if(empty($canImportModules[$branchID][$case->id]))
|
||||
{
|
||||
unset($caseBranches[$branchID]);
|
||||
if($caseBranch == $branchID) $caseBranch = key($caseBranches);
|
||||
}
|
||||
}
|
||||
?>
|
||||
<tr id='<?php echo $case->id;?>'>
|
||||
<td class='c-id'>
|
||||
<div class="checkbox-primary">
|
||||
@@ -57,16 +69,16 @@
|
||||
<?php printf('%03d', $case->id);?>
|
||||
</td>
|
||||
<?php if($product->type != 'normal'):?>
|
||||
<?php if($i > 0) $branches['ditto'] = $lang->testcase->ditto;?>
|
||||
<td><?php echo html::select("branch[{$case->id}]", $branches, $i == 0 ? $branch : 'ditto', "class='form-control' onchange='updateModules($productID, this.value, $case->id)'")?></td>
|
||||
<?php if($i > 0) $caseBranches['ditto'] = $lang->testcase->ditto;?>
|
||||
<td><?php echo html::select("branch[{$case->id}]", $caseBranches, $i == 0 ? $caseBranch : 'ditto', "class='form-control' onchange='updateModules($productID, this.value, $case->id)'")?></td>
|
||||
<?php endif;?>
|
||||
<td><span class='label-pri <?php echo 'label-pri-' . $case->pri;?>' title='<?php echo zget($lang->testcase->priList, $case->pri, $case->pri);?>'><?php echo $case->pri == '0' ? '' : zget($lang->testcase->priList, $case->pri, $case->pri);?></span></td>
|
||||
<td class='text-left nobr'><?php if(!common::printLink('testcase', 'view', "caseID=$case->id", $case->title)) echo $case->title;?></td>
|
||||
<?php $libModule = zget($libModules, $case->module, '');?>
|
||||
<td class='text-left' title='<?php echo $libModule?>'><?php echo $libModule;?></td>
|
||||
<td class='text-left' data-module='<?php echo $case->module?>' style='overflow:visible'>
|
||||
<?php if($i > 0) $modules['ditto'] = $lang->testcase->ditto;?>
|
||||
<?php echo html::select("module[{$case->id}]", isset($canImportModules[$branch][$case->id]) ? $canImportModules[$branch][$case->id] : $modules, $i == 0 ? 0 : 'ditto', "class='form-control chosen'");?>
|
||||
<?php if($i == 0) unset($canImportModules[$caseBranch][$case->id]['ditto']);?>
|
||||
<?php echo html::select("module[{$case->id}]", $canImportModules[$caseBranch][$case->id], $i == 0 ? 0 : 'ditto', "class='form-control chosen'");?>
|
||||
</td>
|
||||
<td><?php echo zget($lang->testcase->typeList, $case->type);?></td>
|
||||
</tr>
|
||||
|
||||
+16
-10
@@ -351,18 +351,17 @@ class testsuiteModel extends model
|
||||
if(!$withAllLib) $query .= " AND `lib` = '$libID'";
|
||||
}
|
||||
|
||||
$caseModules = $this->getCanImportModules($productID, $libID, $branch === 'all' ? 0 : (int)$branch);
|
||||
|
||||
$importedCaseIdList = array();
|
||||
foreach($caseModules as $caseID => $modules)
|
||||
{
|
||||
if(empty($modules)) $importedCaseIdList[$caseID] = $caseID;
|
||||
}
|
||||
$this->loadModel('branch');
|
||||
$product = $this->loadModel('product')->getById($productID);
|
||||
$branches = $product->type != 'normal' ? array(BRANCH_MAIN => $this->lang->branch->main) + $this->branch->getPairs($productID, 'active') : array(0);
|
||||
$canImport = array();
|
||||
foreach($branches as $branchID => $branchName) $canImport += $this->getCanImportModules($productID, $libID, $branchID);
|
||||
|
||||
return $this->dao->select('*')->from(TABLE_CASE)->where('deleted')->eq(0)
|
||||
->beginIF($browseType != 'bysearch')->andWhere('lib')->eq($libID)->fi()
|
||||
->beginIF($browseType == 'bysearch')->andWhere($query)->fi()
|
||||
->andWhere('id')->notIn($importedCaseIdList)
|
||||
->andWhere('id')->in(array_keys($canImport))
|
||||
->andWhere('product')->eq(0)
|
||||
->orderBy($orderBy)
|
||||
->page($pager)
|
||||
@@ -389,11 +388,18 @@ class testsuiteModel extends model
|
||||
->fetchGroup('fromCaseID', 'module');
|
||||
foreach($importedModules as $fromCaseID => $modules) $importedModules[$fromCaseID] = array_combine(array_keys($modules), array_keys($modules));
|
||||
|
||||
$modules = $this->loadModel('tree')->getOptionMenu($productID, 'case', 0, $branch);
|
||||
$modules['ditto'] = $this->lang->testcase->ditto;
|
||||
$libCases = $this->loadModel('caselib')->getLibCases($libID, 'all');
|
||||
|
||||
$modules = $this->loadModel('tree')->getOptionMenu($productID, 'case', 0, $branch);
|
||||
|
||||
$canImportModules = array();
|
||||
foreach($importedModules as $caseID => $caseModules) $canImportModules[$caseID] = array_diff_key($modules, $importedModules[$caseID]);
|
||||
foreach($libCases as $caseID => $case)
|
||||
{
|
||||
$caseModules = !empty($importedModules[$caseID]) ? $importedModules[$caseID] : array();
|
||||
$canImportModules[$caseID] = array_diff_key($modules, $caseModules);
|
||||
if(!empty($canImportModules[$caseID])) $canImportModules[$caseID]['ditto'] = $this->lang->testcase->ditto;
|
||||
if(empty($canImportModules[$caseID])) unset($canImportModules[$caseID]);
|
||||
}
|
||||
|
||||
return $canImportModules;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user