* Fix the issue of creating build.

This commit is contained in:
tianshujie98
2020-12-04 10:19:43 +08:00
parent 2e7632cb40
commit c8a5eb24e4
11 changed files with 48 additions and 5 deletions

View File

@@ -149,7 +149,7 @@ class buildModel extends model
$buildQuery = $this->session->projectBuildQuery;
/* Distinguish between repeated fields. */
$fields = array('id' => '`id`', 'name' => '`name`', 'product' => '`product`', 'desc' => '`desc`');
$fields = array('id' => '`id`', 'name' => '`name`', 'product' => '`product`', 'desc' => '`desc`', 'project' => '`project`');
foreach($fields as $field)
{
if(strpos($this->session->projectBuildQuery, $field) !== false)

View File

@@ -800,7 +800,6 @@ class productModel extends model
->fetchAll('id');
$project = $this->loadModel('program')->getPRJByID($this->session->PRJ);
$executionList = array('0' => '');
/* The waterfall project needs to show the hierarchy and remove the parent stage. */
if($project->model == 'waterfall')

View File

@@ -2941,10 +2941,12 @@ class projectModel extends model
* @param array $products
* @param int $queryID
* @param string $actionURL
* @param array $projects
* @param string $type projectBuild
* @access public
* @return void
*/
public function buildProjectBuildSearchForm($products, $queryID, $actionURL)
public function buildProjectBuildSearchForm($products, $queryID, $actionURL, $projects = '', $type = '')
{
$this->loadModel('build');
@@ -2953,6 +2955,11 @@ class projectModel extends model
$this->config->build->search['actionURL'] = $actionURL;
$this->config->build->search['queryID'] = $queryID;
$this->config->build->search['params']['product']['values'] = $products;
if($type == 'projectBuild')
{
$this->config->build->search['fields']['project'] = $this->lang->projectCommon;
$this->config->build->search['params']['project'] = array('operator' => '=', 'control' => 'select', 'values' => array('' => '') + $projects);
}
$this->loadModel('search')->setSearchParams($this->config->build->search);
}

View File

@@ -28,11 +28,13 @@ class projectBuild extends control
$products = $this->project->getProducts($projectID, false);
$products = array('' => '') + $products;
$projects = $this->project->getExecutionsByProject((int)$projectID, 'all', '', true);
/* Build the search form. */
$type = strtolower($type);
$queryID = ($type == 'bysearch') ? (int)$param : 0;
$actionURL = $this->createLink('projectbuild', 'browse', "projectID=$projectID&type=bysearch&queryID=myQueryID");
$this->project->buildProjectBuildSearchForm($products, $queryID, $actionURL);
$this->project->buildProjectBuildSearchForm($products, $queryID, $actionURL, $projects, 'projectBuild');
if($type == 'bysearch')
{
@@ -62,6 +64,7 @@ class projectBuild extends control
$this->view->product = $type == 'product' ? $param : 'all';
$this->view->project = $project;
$this->view->products = $products;
$this->view->projects = $projects;
$this->view->type = $type;
$this->display();

View File

@@ -1,3 +1,11 @@
$(function()
{
$('#createBuildButton').on('click', function()
{
var projectID = $('#project').val();
parent.location.href = createLink('build', 'create', 'projectID=' + projectID);
})
});
/**
* Change product.
*

View File

@@ -1,3 +1,5 @@
<?php
$lang->projectbuild->common = 'Project Build';
$lang->projectbuild->browse = 'Build List';
$lang->projectbuild->project = "Please select {$lang->projectCommon}";

View File

@@ -1,3 +1,5 @@
<?php
$lang->projectbuild->common = 'Project Build';
$lang->projectbuild->browse = 'Build List';
$lang->projectbuild->project = "Please select {$lang->projectCommon}";

View File

@@ -1,3 +1,5 @@
<?php
$lang->projectbuild->common = 'Project Build';
$lang->projectbuild->browse = 'Build List';
$lang->projectbuild->project = "Please select {$lang->projectCommon}";

View File

@@ -1,3 +1,5 @@
<?php
$lang->projectbuild->common = 'Project Build';
$lang->projectbuild->browse = 'Build List';
$lang->projectbuild->project = "Please select {$lang->projectCommon}";

View File

@@ -1,3 +1,5 @@
<?php
$lang->projectbuild->common = '项目版本';
$lang->projectbuild->browse = '版本列表';
$lang->projectbuild->project = "请选择所属{$lang->projectCommon}";

View File

@@ -36,7 +36,7 @@
<p>
<span class="text-muted"><?php echo $lang->build->noBuild;?></span>
<?php if(common::canModify('project', $project) and common::hasPriv('build', 'create')):?>
<?php echo html::a($this->createLink('build', 'create', "project=$project->id"), "<i class='icon icon-plus'></i> " . $lang->build->create, '', "class='btn btn-info'");?>
<?php echo html::a('#projects', "<i class='icon icon-plus'></i> " . $lang->build->create, '', "data-toggle='modal' class='btn btn-info'");?>
<?php endif;?>
</p>
</div>
@@ -94,4 +94,20 @@
</div>
<?php endif;?>
</div>
<div class="modal fade" id="projects">
<div class="modal-dialog mw-500px">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true"><i class="icon icon-close"></i></button>
<h4 class="modal-title"><?php echo $lang->projectbuild->project;?></h4>
</div>
<div class="modal-body">
<div class='input-group'>
<?php echo html::select('projects', $projects, '', "class='form-control chosen' id=project");?>
<span class='input-group-btn'><?php echo html::commonButton($lang->build->create, "id='createBuildButton'", 'btn btn-primary');?></span>
</div>
</div>
</div>
</div>
</div>
<?php include '../../common/view/footer.html.php';?>