Merge branch 'sprint/170' of https://gitlab.zcorp.cc/easycorp/zentaopms into 170

This commit is contained in:
zhujinyong
2021-11-22 09:59:53 +08:00
7 changed files with 41 additions and 8 deletions
+28 -3
View File
@@ -435,7 +435,7 @@ class bug extends control
/* Get product, then set menu. */
$productID = $this->product->saveState($productID, $this->products);
$productInfo = $this->product->getById($productID);
$branches = $productInfo->type == 'normal' ? array() : $this->loadModel('branch')->getPairs($productID, 'active');
if($branch === '') $branch = (int)$this->cookie->preBranch;
/* Init vars. */
@@ -501,6 +501,20 @@ class bug extends control
$steps = $todo->desc;
$pri = $todo->pri;
}
/* Get branches. */
if($this->app->tab == 'execution' or $this->app->tab == 'project')
{
$objectID = $this->app->tab == 'project' ? $projectID : $executionID;
$productBranches = $productInfo->type != 'normal' ? $this->loadModel('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();
}
/* Replace the value of bug that needs to be replaced with the value of the object that is transferred to bug. */
if(isset($fromObject))
{
@@ -940,6 +954,17 @@ class bug extends control
$projectID = $this->lang->navGroup->bug == 'project' ? $this->session->project : 0;
if($this->app->tab == 'execution' or $this->app->tab == 'project')
{
$objectID = $this->app->tab == 'project' ? $bug->project : $bug->execution;
$productBranches = (isset($product->type) and $product->type != 'normal') ? $this->loadModel('execution')->getBranchByProduct($productID, $objectID) : array();
$branches = isset($productBranches[$productID]) ? $productBranches[$productID] : array();
}
else
{
$branches = (isset($product->type) and $product->type != 'normal') ? $this->loadModel('branch')->getPairs($productID) : array();
}
$this->view->bug = $bug;
$this->view->productID = $productID;
$this->view->product = $product;
@@ -948,9 +973,9 @@ class bug extends control
$this->view->projects = array(0 => '') + $this->product->getProjectPairsByProduct($productID, $bug->branch, $bug->project);
$this->view->moduleOptionMenu = $this->tree->getOptionMenu($productID, $viewType = 'bug', $startModuleID = 0, $bug->branch);
$this->view->currentModuleID = $currentModuleID;
$this->view->executions = array(0 => '') + $this->product->getExecutionPairsByProduct($bug->product, $bug->branch ? "0,{$bug->branch}" : 0, 'id_desc', $projectID);
$this->view->executions = array(0 => '') + $this->product->getExecutionPairsByProduct($bug->product, $bug->branch, 'id_desc', $bug->project);
$this->view->stories = $bug->execution ? $this->story->getExecutionStoryPairs($bug->execution) : $this->story->getProductStoryPairs($bug->product, $bug->branch);
$this->view->branches = $product->type == 'normal' ? array() : $this->loadModel('branch')->getPairs($bug->product);
$this->view->branches = $branches;
$this->view->tasks = $this->task->getExecutionTaskPairs($bug->execution);
$this->view->testtasks = $this->loadModel('testtask')->getPairs($bug->product, $bug->execution, $bug->testtask);
$this->view->users = $this->user->getPairs('nodeleted', "$bug->assignedTo,$bug->resolvedBy,$bug->closedBy,$bug->openedBy");
+3 -1
View File
@@ -492,7 +492,9 @@ function loadProductBranches(productID)
$('#branch').remove();
$('#branch_chosen').remove();
$('#branch').next('.picker').remove();
$.get(createLink('branch', 'ajaxGetBranches', "productID=" + productID), function(data)
var param = (typeof(tab) != 'undefined' && (tab == 'execution' || tab == 'project')) ? "productID=" + productID + "&oldBranch=0&param=&projectID=" + objectID : "productID=" + productID;
$.get(createLink('branch', 'ajaxGetBranches', param), function(data)
{
if(data)
{
+3
View File
@@ -26,6 +26,9 @@ js::set('isStepsTemplate', $isStepsTemplate);
js::set('oldProjectID', $projectID);
js::set('blockID', $blockID);
js::set('moduleID', $moduleID);
js::set('tab', $this->app->tab);
if($this->app->tab == 'execution') js::set('objectID', $executionID);
if($this->app->tab == 'project') js::set('objectID', $projectID);
?>
<div id="mainContent" class="main-content fade">
<div class="center-block">
+3
View File
@@ -26,6 +26,9 @@ js::set('oldOpenedBuild' , $bug->openedBuild);
js::set('oldResolvedBuild' , $bug->resolvedBuild);
js::set('systemMode' , $config->systemMode);
js::set('confirmUnlinkBuild' , sprintf($lang->bug->confirmUnlinkBuild, zget($resolvedBuilds, $bug->resolvedBuild)));
js::set('tab' , $this->app->tab);
if($this->app->tab == 'execution') js::set('objectID', $bug->execution);
if($this->app->tab == 'project') js::set('objectID', $bug->project);
?>
<div class='main-content' id='mainContent'>
+1 -1
View File
@@ -1323,7 +1323,7 @@ class executionModel extends model
{
$link = helper::createLink($module, $method, "productID=0&branch=0&extra=executionID=%s");
}
elseif(in_array($module, array('bug', 'case', 'testtask', 'testreport')) and $method == 'view')
elseif(in_array($module, array('bug', 'case', 'testtask', 'testreport')) and strpos(',view,edit,', ",$method,") !== false)
{
$link = helper::createLink('execution', $module, "executionID=%s");
}
+2 -2
View File
@@ -456,14 +456,14 @@ class testcase extends control
$product = $this->product->getById($productID);
if($this->app->tab == 'execution' or $this->app->tab == 'project')
{
$objectID = $this->app->tab == 'project' ? $this->session->project : $this->session->execution;
$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) : array();
$branches = (isset($product->type) and $product->type != 'normal') ? $this->loadModel('branch')->getPairs($productID, 'active') : array();
}
$this->view->customFields = $customFields;
+1 -1
View File
@@ -30,7 +30,7 @@ function loadBranches(product, branch, caseID)
if(typeof(branch) == 'undefined') branch = 0;
if(!branch) branch = 0;
moduleLink = createLink('tree', 'ajaxGetOptionMenu', 'productID=' + product + '&viewtype=case&branch=' + branch + '&rootModuleID=0&returnType=html&fieldID=' + caseID + '&needManage=true');
moduleLink = createLink('tree', 'ajaxGetOptionMenu', 'productID=' + product + '&viewtype=case&branch=' + branch + '&rootModuleID=0&returnType=html&fieldID=' + caseID);
$('#modules' + caseID).parent('td').load(moduleLink, function()
{
$("#modules" + caseID).attr('onchange', "loadStories("+ product + ", this.value, " + caseID + ")").chosen();