* Fix bug of task #84592.

This commit is contained in:
liumengyi
2023-02-15 08:58:18 +00:00
parent fd6df950a8
commit b9ae54ede7
2 changed files with 28 additions and 11 deletions
+23 -6
View File
@@ -143,9 +143,8 @@
</td>
</tr>
<?php endif;?>
<?php if($execution->type != 'stage' or ($execution->type == 'stage' and !in_array($execution->attribute, array('request', 'design', 'review')))): ?>
<?php if($project->model != 'waterfall' and $project->model != 'waterfallplus'): ?>
<?php $hidden = 'hide'?>
<?php $attr = ($project->model == 'waterfall' or $project->model == 'waterfallplus') ? 'disabled="disabled"' : '';?>
<?php if(!empty($project->hasProduct)) $hidden = ''?>
<?php if($linkedProducts):?>
<?php $i = 0;?>
@@ -161,7 +160,7 @@
<div class='input-group <?php if($hasBranch) echo ' has-branch';?>'>
<span class='input-group-addon'><?php echo $lang->product->common;?></span>
<?php $disabled = ($execution->type == 'stage' and !$execution->division) ? "disabled='disabled'" : '';?>
<?php echo html::select("products[$i]", $allProducts, $product->id, "class='form-control chosen' $disabled $attr onchange='loadBranches(this)' data-last='" . $product->id . "' data-type='" . $product->type . "'");?>
<?php echo html::select("products[$i]", $allProducts, $product->id, "class='form-control chosen' $disabled onchange='loadBranches(this)' data-last='" . $product->id . "' data-type='" . $product->type . "'");?>
<?php if($execution->type == 'stage' and !$execution->division) echo html::hidden("products[$i]", $product->id);?>
</div>
</div>
@@ -169,7 +168,7 @@
<div class='input-group required'>
<span class='input-group-addon fix-border'><?php echo $lang->product->branchName['branch'];?></span>
<?php $branchIdList = join(',', $product->branches);?>
<?php echo html::select("branch[$i][]", isset($branchGroups[$product->id]) ? $branchGroups[$product->id] : array(), $branchIdList, "class='form-control chosen' $attr multiple onchange=\"loadPlans('#products{$i}', this)\"");?>
<?php echo html::select("branch[$i][]", isset($branchGroups[$product->id]) ? $branchGroups[$product->id] : array(), $branchIdList, "class='form-control chosen' multiple onchange=\"loadPlans('#products{$i}', this)\"");?>
</div>
</div>
</div>
@@ -177,8 +176,8 @@
<div class="col-sm-6">
<div class='input-group' <?php echo "id='plan$i'";?>>
<span class='input-group-addon'><?php echo $lang->product->plan;?></span>
<?php echo html::select("plans[$product->id][]", isset($productPlans[$product->id]) ? $productPlans[$product->id] : array(), $product->plans, "class='form-control chosen' $attr multiple");?>
<?php if(!($execution->type == 'stage' and !$execution->division) and $project->model != 'waterfall' and $project->model != 'waterfallplus'):?>
<?php echo html::select("plans[$product->id][]", isset($productPlans[$product->id]) ? $productPlans[$product->id] : array(), $product->plans, "class='form-control chosen' multiple");?>
<?php if(!($execution->type == 'stage' and !$execution->division)):?>
<div class='input-group-btn'>
<a href='javascript:;' onclick='addNewLine(this)' class='btn btn-link addLine'><i class='icon-plus'></i></a>
<a href='javascript:;' onclick='removeLine(this)' class='btn btn-link removeLine' <?php if($i == 0) echo "style='visibility: hidden'";?>><i class='icon-close'></i></a>
@@ -226,6 +225,24 @@
</td>
</tr>
<?php endif; ?>
<?php elseif(($execution->type == 'stage' and !in_array($execution->attribute, array('request', 'design', 'review'))) or $execution->type != 'stage'): ?>
<tr>
<th><?php echo $lang->execution->manageProducts;?></th>
<td colspan='2'>
<div class="row row-grid">
<?php if($linkedProducts):?>
<?php foreach($linkedProducts as $productID => $product):?>
<?php foreach($product->branches as $branchID):?>
<?php $branchName = isset($branchGroups[$productID][$branchID]) ? '/' . $branchGroups[$productID][$branchID] : '';?>
<div class="col-xs-4" title="<?php echo $product->name . $branchName;?>">
<?php echo "<i class='icon icon-product text-muted'></i> " . $product->name . $branchName;?>
</div>
<?php endforeach;?>
<?php endforeach;?>
<?php endif;?>
</div>
</td>
</tr>
<?php else: ?>
<?php echo html::hidden("products[]", key($linkedProducts));?>
<?php endif; ?>
+5 -5
View File
@@ -297,7 +297,7 @@ function loadBranches(product)
}
});
(chosenProducts.length > 1 && model == 'waterfall') ? $('.division').removeClass('hide') : $('.division').addClass('hide');
(chosenProducts.length > 1 && (model == 'waterfall' || model == 'waterfallplus')) ? $('.division').removeClass('hide') : $('.division').addClass('hide');
var $tableRow = $(product).closest('.table-row');
var index = $tableRow.find('select:first').attr('id').replace('products' , '');
@@ -362,15 +362,15 @@ function loadPlans(product, branch)
/**
* Add new line for link product.
*
* @param obj $obj
*
* @param obj $obj
* @access public
* @return void
*/
function addNewLine(obj)
{
var newLine = $(obj).closest('tr').clone();
var index = 0;
var index = 0;
$(".productsBox select[name^='products']").each(function()
{
var id = $(this).attr('id').replace('products' , '');
@@ -403,7 +403,7 @@ function removeLine(obj)
{
$(obj).closest('tr').remove();
disableSelectedProduct();
if($("select[name^='products']").length < 2) $('.division').addClass('hide');
if($("select[name^='products']").length < 2) $('.division').addClass('hide');
}
/**