* Resolved feedback #1514,add execution linkage when project empty.

This commit is contained in:
孔令茂
2022-11-29 13:20:50 +00:00
parent e3d103a251
commit 0b298bf63c
3 changed files with 44 additions and 7 deletions
+15
View File
@@ -2315,6 +2315,21 @@ class bug extends control
return print(html::select('assignedTo', $allUsers, $selectedUser, 'class="form-control"'));
}
/**
* AJAX: get a project by execution id.
*
* @param string $executionID
* @access public
* @return string
*/
public function ajaxGetProjectByExecutionID($executionID)
{
$execution = $this->loadModel('execution')->getByID($executionID);
$projectPairs = $this->loadModel('project')->getPairsByIdList($execution->project);
return print(html::select('project', $projectPairs, array_keys($projectPairs), 'class="form-control"'));
}
/**
* AJAX: get actions of a bug. for web app.
*
+29 -3
View File
@@ -294,7 +294,7 @@ function loadProductStories(productID)
function loadProductProjects(productID)
{
required = $('#project_chosen').hasClass('required');
branch = $('#branch').val();
branch = $('#branch').val();
if(typeof(branch) == 'undefined') branch = 0;
link = createLink('product', 'ajaxGetProjects', 'productID=' + productID + '&branch=' + branch + '&projectID=' + oldProjectID);
$('#projectBox').load(link, function()
@@ -466,7 +466,9 @@ function loadProductBuilds(productID)
*/
function loadExecutionRelated(executionID)
{
executionID = parseInt(executionID);
executionID = parseInt(executionID);
currentProjectID = $('#project').val() == 'undefined' ? 0 : $('#project').val();
if(executionID)
{
loadExecutionTasks(executionID);
@@ -474,10 +476,10 @@ function loadExecutionRelated(executionID)
loadExecutionBuilds(executionID);
loadAssignedTo(executionID, $('#assignedTo').val());
loadTestTasks($('#product').val(), executionID);
if(currentProjectID ==0) loadProjectByExecutionID(executionID);
}
else
{
var currentProjectID = $('#project').val() == 'undefined' ? 0 : $('#project').val();
var currentProductID = $('#product').val();
$('#taskIdBox').innerHTML = '<select id="task"></select>'; // Reset the task.
@@ -496,6 +498,30 @@ function loadExecutionRelated(executionID)
}
}
/**
* Load a project by execution id.
*
* @param executionID $executionID
* @access public
* @return void
*/
function loadProjectByExecutionID(executionID)
{
link = createLink('bug', 'ajaxGetProjectByExecutionID', 'executionID=' + executionID);
required = $('#project_chosen').hasClass('required');
$.post(link, function(data)
{
if(!data) data = '<select id="project" name="project" class="form-control"></select>';
$('#project').replaceWith(data);
$('#project_chosen').remove();
$('#project').next('.picker').remove();
$("#project").chosen();
if(required) $('#project_chosen').addClass('required');
})
}
/**
* Load execution tasks.
*
-4
View File
@@ -81,8 +81,6 @@ class bugModel extends model
->remove('files,labels,uid,oldTaskID,contactListMenu,region,lane,ticket')
->get();
if($bug->execution != 0) $bug->project = $this->dao->select('project')->from(TABLE_EXECUTION)->where('id')->eq($bug->execution)->fetch('project');
/* Check repeat bug. */
$result = $this->loadModel('common')->removeDuplicate('bug', $bug, "product={$bug->product}");
if($result and $result['stop']) return array('status' => 'exists', 'id' => $result['duplicate']);
@@ -219,8 +217,6 @@ class bugModel extends model
if(isset($data->lanes[$i])) $bug->laneID = $data->lanes[$i];
if($bug->execution != 0) $bug->project = $this->dao->select('project')->from(TABLE_EXECUTION)->where('id')->eq($bug->execution)->fetch('project');
/* Assign the bug to the person in charge of the module. */
if(!empty($moduleOwners[$bug->module]))
{