Merge branch 'sprint/182_liumengyi_fixbug' into 'master'

* Fix bug #18481.

See merge request easycorp/zentaopms!1490
This commit is contained in:
孙广明
2022-01-19 03:17:59 +00:00
5 changed files with 13 additions and 6 deletions
+1
View File
@@ -1604,6 +1604,7 @@ class execution extends control
$this->view->rdUsers = $rdUsers;
$this->view->users = $this->user->getPairs('nodeleted|noclosed');
$this->view->allProjects = $this->project->getPairsByModel('all', 0, 'noclosed');
$this->view->project = $this->project->getById($execution->project);
$this->view->groups = $this->loadModel('group')->getPairs();
$this->view->allProducts = $allProducts;
$this->view->linkedProducts = $linkedProducts;
+1 -1
View File
@@ -139,7 +139,7 @@ function loadBranches(product)
if($('#productsBox .input-group:last select:first').val() != 0)
{
var length = $('#productsBox .input-group').size();
$('#productsBox .row').append('<div class="col-sm-4">' + $('#productsBox .col-sm-4:last').html() + '</div>');
$('#productsBox .row').append('<div class="col-sm-4">' + $('#productsBox .col-sm-4:last').html().replace('required', '') + '</div>');
if($('#productsBox .input-group:last select').size() >= 2) $('#productsBox .input-group:last select:last').remove();
$('#productsBox .input-group:last .chosen-container').remove();
$('#productsBox .input-group:last select:first').attr('name', 'products[' + length + ']').attr('id', 'products' + length);
+9 -3
View File
@@ -302,13 +302,13 @@ class executionModel extends model
if($project) $type = zget($this->config->execution->modelList, $project->model, 'sprint');
/* If the execution model is a stage, determine whether the product is linked. */
if($type == 'stage' and empty($this->post->products[0]))
if($type == 'stage' and empty(array_filter($this->post->products)))
{
dao::$errors['message'][] = $this->lang->execution->noLinkProduct;
return false;
}
if($type == 'kanban' and empty($this->post->products[0]))
if($type == 'kanban' and empty(array_filter($this->post->products)))
{
dao::$errors['message'][] = $this->lang->execution->kanbanNoLinkProduct;
return false;
@@ -470,12 +470,18 @@ class executionModel extends model
return false;
}
if($oldExecution->type == 'stage' and empty($this->post->products[0]))
if($oldExecution->type == 'stage' and empty(array_filter($this->post->products)))
{
dao::$errors['message'][] = $this->lang->execution->noLinkProduct;
return false;
}
if($oldExecution->type == 'kanban' and empty(array_filter($this->post->products)))
{
dao::$errors['message'][] = $this->lang->execution->kanbanNoLinkProduct;
return false;
}
/* Get the data from the post. */
$execution = fixer::input('post')
->setDefault('lastEditedBy', $this->app->user->account)
+1 -1
View File
@@ -144,7 +144,7 @@
<?php endforeach;?>
<?php endforeach;?>
<div class='col-sm-4'>
<div class="input-group">
<div class="input-group <?php if(in_array($project->model, array('kanban', 'waterfall'))) echo 'required';?>">
<?php echo html::select("products[$i]", $allProducts, '', "class='form-control chosen' onchange='loadBranches(this)'");?>
<span class='input-group-addon fix-border'></span>
</div>
+1 -1
View File
@@ -141,7 +141,7 @@
<?php $hasBranch = $product->type != 'normal' and isset($branchGroups[$product->id]);?>
<?php foreach($linkedBranches[$product->id] as $branchID => $branch):?>
<div class='col-sm-4'>
<div class="input-group<?php if($hasBranch) echo ' has-branch';?>">
<div class="input-group<?php if(in_array($project->model, array('kanban', 'waterfall')) and $i == 0) echo " required";if($hasBranch) echo ' has-branch';?>">
<?php echo html::select("products[$i]", $allProducts, $product->id, "class='form-control chosen' $class onchange='loadBranches(this)' data-last='" . $product->id . "' data-type='". $product->type ."'");?>
<span class='input-group-addon fix-border'></span>
<?php if($hasBranch) echo html::select("branch[$i]", $branchGroups[$product->id], $branchID, "class='form-control chosen' $class onchange=\"loadPlans('#products{$i}', this.value)\" data-last='" . $branchID . "'");?>