* Code for task#45080.

This commit is contained in:
xieqiyu
2021-11-30 15:05:16 +08:00
parent 84baf0c896
commit 888fbfe73b
8 changed files with 76 additions and 44 deletions
+17 -13
View File
@@ -371,6 +371,20 @@ class testcase extends control
$this->qa->setMenu($this->products, $productID, $branch);
}
/* Set branch. */
$product = $this->product->getById($productID);
if($this->app->tab == 'execution' or $this->app->tab == 'project')
{
$objectID = $this->app->tab == 'project' ? $projectID : $executionID;
$productBranches = (isset($product->type) and $product->type != 'normal') ? $this->execution->getBranchByProduct($productID, $objectID) : array();
$branches = isset($productBranches[$productID]) ? $productBranches[$productID] : array();
$branch = key($branches);
}
else
{
$branches = (isset($product->type) and $product->type != 'normal') ? $this->loadModel('branch')->getPairs($productID, 'active') : array();
}
/* Init vars. */
$type = 'feature';
$stage = '';
@@ -456,18 +470,6 @@ class testcase extends control
/* Set custom. */
foreach(explode(',', $this->config->testcase->customCreateFields) as $field) $customFields[$field] = $this->lang->testcase->$field;
$product = $this->product->getById($productID);
if($this->app->tab == 'execution' or $this->app->tab == 'project')
{
$objectID = $this->app->tab == 'project' ? $projectID : $executionID;
$productBranches = (isset($product->type) and $product->type != 'normal') ? $this->execution->getBranchByProduct($productID, $objectID) : array();
$branches = isset($productBranches[$productID]) ? $productBranches[$productID] : array();
$branch = key($branches);
}
else
{
$branches = (isset($product->type) and $product->type != 'normal') ? $this->loadModel('branch')->getPairs($productID, 'active') : array();
}
$this->view->customFields = $customFields;
$this->view->showFields = $this->config->testcase->custom->createFields;
@@ -1720,7 +1722,9 @@ class testcase extends control
$queryID = (int)$queryID;
$product = $this->loadModel('product')->getById($productID);
$branches = array();
if($product->type != 'normal') $branches = array('0' => $this->lang->branch->main) + $this->loadModel('branch')->getPairs($productID, '', $projectID);
$this->loadModel('branch');
if($product->type != 'normal') $branches = array('0' => $this->lang->branch->main) + $this->branch->getPairs($productID, '', $projectID);
if($_POST)
{