Merge branch 'sprint/215_liumengyi_60395' into 'master'

* Finish task #60395.

See merge request easycorp/zentaopms!4450
This commit is contained in:
王怡栋
2022-07-11 07:56:19 +00:00
10 changed files with 39 additions and 25 deletions
+1 -1
View File
@@ -211,7 +211,7 @@ class branch extends control
public function ajaxGetDropMenu($productID, $branch, $module, $method, $extra = '')
{
parse_str($extra, $output);
$isQaModule = (strpos(',project,execution,', ",{$this->app->tab},") !== false and strpos(',bug,', ",$method,") !== false and !empty($productID)) ? true : false;
$isQaModule = (strpos(',project,execution,', ",{$this->app->tab},") !== false and strpos(',bug,testcase,', ",$method,") !== false and !empty($productID)) ? true : false;
$param = $isQaModule ? $extra : 0;
$param = isset($output['projectID']) ? $output['projectID'] : $param;
$branches = $this->branch->getPairs($productID, 'all', $param);
+6 -4
View File
@@ -1072,6 +1072,7 @@ class execution extends control
*
* @param int $executionID
* @param int $productID
* @param int $branchID
* @param string $type
* @param int $moduleID
* @param string $orderBy
@@ -1081,7 +1082,7 @@ class execution extends control
* @access public
* @return void
*/
public function testcase($executionID = 0, $productID = 0, $type = 'all', $moduleID = 0, $orderBy = 'id_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1)
public function testcase($executionID = 0, $productID = 0, $branchID = 0, $type = 'all', $moduleID = 0, $orderBy = 'id_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1)
{
$this->loadModel('testcase');
$this->loadModel('testtask');
@@ -1095,13 +1096,13 @@ class execution extends control
if(count($products) == 1) $productID = key($products);
$extra = $executionID;
$this->lang->modulePageNav = $this->product->select(array('0' => $this->lang->product->all) + $products, $productID, 'execution', 'testcase', $extra, 0, 0, '', false);
$this->lang->modulePageNav = $this->product->select(array('0' => $this->lang->product->all) + $products, $productID, 'execution', 'testcase', $extra, $branchID);
/* Load pager. */
$this->app->loadClass('pager', $static = true);
$pager = pager::init($recTotal, $recPerPage, $pageID);
$cases = $this->loadModel('testcase')->getExecutionCases($executionID, $productID, $moduleID, $orderBy, $pager, $type);
$cases = $this->loadModel('testcase')->getExecutionCases($executionID, $productID, $branchID, $moduleID, $orderBy, $pager, $type);
$this->loadModel('common')->saveQueryCondition($this->dao->get(), 'testcase', false);
$cases = $this->testcase->appendData($cases, 'case');
@@ -1116,7 +1117,7 @@ class execution extends control
}
else
{
$moduleTree = $this->tree->getTreeMenu($productID, 'case', 0, array('treeModel', 'createCaseLink'), array('executionID' => $executionID, 'productID' => $productID), 'all');
$moduleTree = $this->tree->getTreeMenu($productID, 'case', 0, array('treeModel', 'createCaseLink'), array('executionID' => $executionID, 'productID' => $productID), $branchID);
}
$tree = $moduleID ? $this->tree->getByID($moduleID) : '';
@@ -1133,6 +1134,7 @@ class execution extends control
$this->view->modules = $modules;
$this->view->moduleID = $moduleID;
$this->view->moduleName = $moduleID ? $tree->name : $this->lang->tree->all;
$this->view->branchID = $branchID;
$this->display();
}
+1
View File
@@ -1,3 +1,4 @@
.c-id, .c-pri {width: 50px;}
.c-result {width: 80px;}
#pageNav #dropMenu .col-left {padding-bottom: 0px;}
#currentBranch + #dropMenu .col-left {padding-bottom: 30px;}
+3 -3
View File
@@ -6,14 +6,14 @@
echo $moduleName;
if(!empty($moduleID))
{
$removeLink = $this->createLink('execution', 'testcase', "executionID=$executionID&productID=$productID&type=all&moduleID=0&orderBy=$orderBy&recTotal=0&recPerPage={$pager->recPerPage}");
$removeLink = $this->createLink('execution', 'testcase', "executionID=$executionID&productID=$productID&branchID=$branchID&type=all&moduleID=0&orderBy=$orderBy&recTotal=0&recPerPage={$pager->recPerPage}");
echo html::a($removeLink, "<i class='icon icon-sm icon-close'></i>", '', "class='text-muted' data-app='{$this->app->tab}'");
}
?>
</div>
</div>
<div class="btn-toolbar pull-left">
<?php echo html::a(inlink('testcase', "executionID=$executionID&productID=$productID&type=$type&moduleID=$moduleID&orderBy=$orderBy"), "<span class='text'>{$lang->execution->all}</span>", '', "class='btn btn-link btn-active-text'");?>
<?php echo html::a(inlink('testcase', "executionID=$executionID&productID=$productID&branchID=$branchID&type=$type&moduleID=$moduleID&orderBy=$orderBy"), "<span class='text'>{$lang->execution->all}</span>", '', "class='btn btn-link btn-active-text'");?>
</div>
<div class="btn-toolbar pull-right">
<?php if(common::canModify('execution', $execution)) echo html::a(helper::createLink('testcase', 'create', "productID=$productID&branch=0&moduleID=0&from=execution&param=$execution->id", '', '', '', true), "<i class='icon icon-plus'></i> " . $lang->testcase->create, '', "class='btn btn-primary' data-app='{$this->app->tab}'");?>
@@ -45,7 +45,7 @@
<?php else:?>
<form class='main-table' method='post' id='executionBugForm' data-ride="table">
<table class='table has-sort-head' id='bugList'>
<?php $vars = "executionID=$executionID&productID=$productID&type=$type&moduleID=$moduleID&orderBy=%s&recTotal={$pager->recTotal}&recPerPage={$pager->recPerPage}&pageID={$pager->pageID}";?>
<?php $vars = "executionID=$executionID&productID=$productID&branchID=$branchID&type=$type&moduleID=$moduleID&orderBy=%s&recTotal={$pager->recTotal}&recPerPage={$pager->recPerPage}&pageID={$pager->pageID}";?>
<thead>
<tr>
<th class='w-id'> <?php common::printOrderLink('id', $orderBy, $vars, $lang->idAB);?></th>
+6 -1
View File
@@ -2272,7 +2272,12 @@ class productModel extends model
elseif($module == 'project' and $method == 'testcase')
{
$params = explode(',', $extra);
return helper::createLink('project', 'testcase', "projectID={$params[0]}&productID=%s&branch=all&browseType={$params[1]}");
return helper::createLink('project', 'testcase', "projectID={$params[0]}&productID=%s&branch=" . ($branch ? "%s" : '0') . "&browseType={$params[1]}");
}
elseif($module == 'execution' and $method == 'testcase')
{
$params = explode(',', $extra);
return helper::createLink('execution', 'testcase', "executionID={$params[0]}&productID=%s" . ($branch ? "&branch=%s" : ''));
}
elseif($module == 'project' or $module == 'execution')
{
+2 -2
View File
@@ -1138,7 +1138,7 @@ class project extends control
* @access public
* @return void
*/
public function testcase($projectID = 0, $productID = 0, $branch = 'all', $browseType = 'all', $param = 0, $orderBy = 'id_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1)
public function testcase($projectID = 0, $productID = 0, $branch = 0, $browseType = 'all', $param = 0, $orderBy = 'id_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1)
{
$this->loadModel('product');
$this->session->set('bugList', $this->app->getURI(true), 'project');
@@ -1147,7 +1147,7 @@ class project extends control
$products = array('0' => $this->lang->product->all) + $this->product->getProducts($projectID, 'all', '', false);
$extra = "$projectID,$browseType";
$this->lang->modulePageNav = $this->product->select($products, $productID, 'project', 'testcase', $extra, $branch, 0, '', false);
$this->lang->modulePageNav = $this->product->select($products, $productID, 'project', 'testcase', $extra, $branch);
echo $this->fetch('testcase', 'browse', "productID=$productID&branch=$branch&browseType=$browseType&param=$param&orderBy=$orderBy&recTotal=$orderBy&recPerPage=$recPerPage&pageID=$pageID&projectID=$projectID");
}
+1 -2
View File
@@ -119,7 +119,6 @@ class testcase extends control
$this->products = count($linkedProducts) > 1 ? array('0' => $this->lang->product->all) + $linkedProducts : $linkedProducts;
$productID = count($linkedProducts) > 1 ? $productID : key($linkedProducts);
$branch = 'all';
$this->loadModel('project')->setMenu($projectID);
}
else
@@ -175,7 +174,7 @@ class testcase extends control
}
else
{
$moduleTree = $this->tree->getTreeMenu($productID, 'case', 0, array('treeModel', 'createCaseLink'), array('projectID' => $projectID, 'productID' => $productID), $projectID ? '' : $branch);
$moduleTree = $this->tree->getTreeMenu($productID, 'case', 0, array('treeModel', 'createCaseLink'), array('projectID' => $projectID, 'productID' => $productID), $branch);
}
$product = $this->product->getById($productID);
+1
View File
@@ -26,3 +26,4 @@ tbody > tr > td .icon-share {font-size: 9px;}
.table td.c-title > a:first-child {display: inline-block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;}
#importToLib .select-lib {width: 100px; text-align: right;}
#subHeader #currentBranch + #dropMenu .col-left {padding-bottom: 30px;}
+4 -1
View File
@@ -323,6 +323,7 @@ class testcaseModel extends model
*
* @param int $executionID
* @param int $productID
* @param int $branchID
* @param int $moduleID
* @param string $orderBy
* @param object $pager
@@ -330,7 +331,7 @@ class testcaseModel extends model
* @access public
* @return array
*/
public function getExecutionCases($executionID, $productID = 0, $moduleID = 0, $orderBy = 'id_desc', $pager = null, $browseType = '')
public function getExecutionCases($executionID, $productID = 0, $branchID = 0, $moduleID = 0, $orderBy = 'id_desc', $pager = null, $browseType = '')
{
if($browseType == 'needconfirm')
{
@@ -341,6 +342,7 @@ class testcaseModel extends model
->where('t1.project')->eq((int)$executionID)
->beginIF(!empty($productID))->andWhere('t1.product')->eq($productID)->fi()
->beginIF(!empty($moduleID))->andWhere('t4.path')->like("%,$moduleID,%")->fi()
->andWhere('t2.branch')->eq($branchID)
->andWhere('t2.deleted')->eq('0')
->andWhere('t3.version > t2.storyVersion')
->andWhere("t3.status")->eq('active')
@@ -356,6 +358,7 @@ class testcaseModel extends model
->beginIF($browseType != 'all' and $browseType != 'byModule')->andWhere('t2.status')->eq($browseType)->fi()
->beginIF(!empty($productID))->andWhere('t1.product')->eq($productID)->fi()
->beginIF(!empty($moduleID))->andWhere('t3.path')->like("%,$moduleID,%")->fi()
->andWhere('t2.branch')->eq($branchID)
->andWhere('t2.deleted')->eq('0')
->orderBy($orderBy)
->page($pager)
+14 -11
View File
@@ -407,7 +407,7 @@ class treeModel extends model
$executionID = zget($extra, 'executionID', 0);
$branches = array($branch => '');
$executionModules = array();
if($branch and empty($projectID) and empty($extra['executionID']))
if($branch and empty($projectID) and empty($executionID))
{
$branchName = $this->branch->getById($branch);
$branches = array($branch => $branchName);
@@ -425,12 +425,12 @@ class treeModel extends model
elseif(strpos(',case,bug,', ",$type,") !== false and $this->app->tab == 'execution')
{
if($product->type != 'normal' and $executionID) $branches += $this->branch->getPairs($product->id, 'noempty', $executionID);
if($onlyGetLinked) $executionModules = $this->getTaskTreeModules($executionID, true, $type, $type == 'bug' ? array('branchID' => $branch) : array());
if($onlyGetLinked) $executionModules = $this->getTaskTreeModules($executionID, true, $type, array('branchID' => $branch));
}
elseif(($type == 'story' and $this->app->rawModule == 'projectstory') or (strpos(',case,bug,', ",$type,") !== false and $this->app->tab == 'project'))
{
if($product->type != 'normal' and $projectID) $branches += $this->branch->getPairs($product->id, 'noempty', $projectID);
if($onlyGetLinked) $executionModules = $this->getTaskTreeModules($projectID, true, $type, $type == 'bug' ? array('branchID' => $branch) : array());
if($onlyGetLinked) $executionModules = $this->getTaskTreeModules($projectID, true, $type, $type == 'story' ? array() : array('branchID' => $branch));
}
/* Add for task #1945. check the module has case or no. */
@@ -694,9 +694,8 @@ class treeModel extends model
->andWhere('deleted')->eq(0)
->orderBy('grade desc, `order`, type')
->get();
$treeMenu = array();
$stmt = $this->dbh->query($query);
$extra['branchID'] = $branch;
$treeMenu = array();
$stmt = $this->dbh->query($query);
while($module = $stmt->fetch())
{
if(isset($executionModules[$module->id])) $this->buildTree($treeMenu, $module, 'bug', $userFunc, $extra, $branch);
@@ -786,7 +785,7 @@ class treeModel extends model
$stmt = $this->dbh->query($query);
while($module = $stmt->fetch())
{
if(isset($executionModules[$module->id])) $this->buildTree($treeMenu, $module, 'case', $userFunc, $extra);
if(isset($executionModules[$module->id])) $this->buildTree($treeMenu, $module, 'case', $userFunc, $extra, $branch);
}
$tree .= isset($treeMenu[0]) ? $treeMenu[0] : '';
}
@@ -979,8 +978,12 @@ class treeModel extends model
$paths = $this->dao->select('DISTINCT t3.' . $field)->from($table1)->alias('t1')
->leftJoin($table2)->alias('t2')->on('t1.' . $linkObject . ' = t2.id')
->leftJoin(TABLE_MODULE)->alias('t3')->on('t2.module = t3.id')
->where('t1.project')->eq($executionID)
->leftJoin(TABLE_PROJECT)->alias('t4')->on('t1.project = t4.id')
->where('(t1.project')->eq($executionID)
->orWhere('t4.project')->eq($executionID)->markRight(1)
->andWhere('t3.deleted')->eq(0)
->andWhere('t2.deleted')->eq(0)
->beginIF(isset($extra['branchID']))->andWhere('t2.branch')->eq(zget($extra, 'branchID', 0))->fi()
->fetchPairs();
}
elseif($linkObject == 'bug' and strpos(',project,execution,', ",{$this->app->tab},") !== false)
@@ -1236,9 +1239,9 @@ class treeModel extends model
{
$moduleName = strpos(',project,execution,', ",{$this->app->tab},") !== false ? $this->app->tab : 'testcase';
$methodName = strpos(',project,execution,', ",{$this->app->tab},") !== false ? 'testcase' : 'browse';
$param = $this->app->tab == 'project' ? "projectID={$this->session->project}&root={$module->root}&branch={$extra['branchID']}&" : "root={$module->root}&branch={$extra['branchID']}&";
$param = $this->app->tab == 'execution' ? "executionID={$extra['executionID']}&root={$module->root}&" : $param;
return html::a(helper::createLink($moduleName, $methodName, $param . "&type=byModule&param={$module->id}"), $module->name, '_self', "id='module{$module->id}' data-app='{$this->app->tab}' title='{$module->name}'");
$param = $this->app->tab == 'project' ? "projectID={$this->session->project}&" : "";
$param = $this->app->tab == 'execution' ? "executionID={$extra['executionID']}&" : $param;
return html::a(helper::createLink($moduleName, $methodName, $param . "root={$module->root}&branch={$extra['branchID']}&type=byModule&param={$module->id}"), $module->name, '_self', "id='module{$module->id}' data-app='{$this->app->tab}' title='{$module->name}'");
}
/**