* Finish task #71573.

This commit is contained in:
daitingting
2022-10-20 07:53:20 +00:00
parent 986ca160d1
commit 90701e792b
3 changed files with 38 additions and 20 deletions
+21
View File
@@ -10,6 +10,27 @@ $(function()
{
var $cb = $(this);
$cb.closest('.product').toggleClass('checked', $cb.prop('checked'));
if($cb.prop('checked')) return true;
var productID = String($cb.val());
if($.inArray(productID, unmodifiableProducts) != -1)
{
var $branch = $cb.closest('.product').find('[name^=branch]');
if($branch.length)
{
var branchID = String($branch.val());
if($.inArray(branchID, unmodifiableBranches) != -1 && linkedStoryIDList[productID][branchID])
{
bootbox.alert(tip.replace('%s', linkedStoryIDList[productID][branchID]));
}
}
else
{
bootbox.alert(tip.replace('%s', linkedStoryIDList[productID][0]));
}
}
});
$("select[id^=branch]").change(function()
+10 -10
View File
@@ -1160,7 +1160,7 @@ class executionModel extends model
}
/* The total workload of the first stage should not exceed 100%. */
if($type == 'create' or (empty($oldExecution) and $oldExecution->grade == 1))
if($type == 'create' or (!empty($oldExecution) and $oldExecution->grade == 1))
{
$oldPercentTotal = $this->dao->select('SUM(t2.percent) as total')->from(TABLE_PROJECTPRODUCT)->alias('t1')
->leftJoin(TABLE_EXECUTION)->alias('t2')->on('t1.project=t2.id')
@@ -1174,7 +1174,7 @@ class executionModel extends model
if($type == 'create') $percentTotal = $percent + $oldPercentTotal;
if(!empty($oldExecution) and $oldExecution->grade == 1) $percentTotal = $oldPercentTotal - $oldExecution->percent + $this->post->percent;
if($percentTotal >100)
if($percentTotal > 100)
{
dao::$errors['percent'] = sprintf($this->lang->execution->workloadTotal, $oldPercentTotal . '%');
return false;
@@ -4774,16 +4774,16 @@ class executionModel extends model
}
/**
** Set stage tree path.
**
** @param int $executionID
** @access public
** @return bool
**/
* Set stage tree path.
*
* @param int $executionID
* @access public
* @return bool
*/
public function setTreePath($executionID)
{
$execution = $this->dao->select('id,type,parent,path,grade')->from(TABLE_PROJECT)->where('id')->eq($executionID)->fetch();
$parent = $this->dao->select('id,type,parent,path,grade')->from(TABLE_PROJECT)->where('id')->eq($execution->parent)->fetch();
$execution = $this->dao->select('id, type, parent, path, grade')->from(TABLE_PROJECT)->where('id')->eq($executionID)->fetch();
$parent = $this->dao->select('id, type, parent, path, grade')->from(TABLE_PROJECT)->where('id')->eq($execution->parent)->fetch();
if($parent->type == 'project')
{
+7 -10
View File
@@ -11,6 +11,10 @@
*/
?>
<?php include '../../common/view/header.html.php';?>
<?php js::set('unmodifiableProducts',$unmodifiableProducts);?>
<?php js::set('unmodifiableBranches', $unmodifiableBranches)?>
<?php js::set('linkedStoryIDList', $linkedStoryIDList)?>
<?php js::set('tip', $lang->execution->notAllowRemoveProducts);?>
<div id='mainMenu' class='clearfix'>
<div class='btn-toolbar pull-left'>
<span class='btn btn-link btn-active-text'><span class='text'><?php echo $lang->execution->manageProducts;?></span></span>
@@ -23,25 +27,18 @@
<div class='detail-title'><?php echo $lang->execution->linkedProducts;?></div>
<div class='detail-content row'>
<?php $i = 0;?>
<?php $attr = '';?>
<?php foreach($allProducts as $productID => $productName):?>
<?php if(isset($linkedProducts[$productID])):?>
<?php foreach($linkedBranches[$productID] as $branchID):?>
<?php if((in_array($productID, $unmodifiableProducts) and in_array($branchID, $unmodifiableBranches)) and !empty($linkedStoryIDList[$productID][$branchID])) $attr = "disabled='disabled'";?>
<?php if((!(in_array($productID, $unmodifiableProducts) and in_array($branchID, $unmodifiableBranches)) or empty($linkedStoryIDList[$productID][$branchID]))) $attr = '';?>
<?php if($execution->grade == '2' and ($linkedProducts[$productID]->type == 'normal' or $branchID == 0)) $attr = "disabled='disabled'";?>
<?php $title = (in_array($productID, $unmodifiableProducts) and in_array($branchID, $unmodifiableBranches) and !empty($linkedStoryIDList[$productID][$branchID])) ? sprintf($lang->execution->notAllowRemoveProducts, $linkedStoryIDList[$productID][$branchID]) : $productName;?>
<?php $checked = 'checked';?>
<div class='col-sm-4'>
<div class='product <?php echo $checked . (isset($allBranches[$productID]) ? ' has-branch' : '')?>'>
<div class="checkbox-primary" title='<?php echo $title;?>'>
<?php echo "<input type='checkbox' name='products[$i]' value='$productID' $checked $attr id='products{$productID}'>";?>
<div class='product checked <?php echo (isset($allBranches[$productID]) ? ' has-branch' : '')?>'>
<div class="checkbox-primary" title='<?php echo $productName;?>'>
<?php echo "<input type='checkbox' name='products[$i]' value='$productID' checked id='products{$productID}'>";?>
<label class='text-ellipsis checkbox-inline' for='<?php echo 'products' . $productID;?>' title='<?php echo $productName;?>'><?php echo $productName;?></label>
</div>
<?php if(isset($allBranches[$productID][$branchID])) echo html::select("branch[$i]", $allBranches[$productID], $branchID, "class='form-control chosen' disabled='disabled'");?>
</div>
</div>
<?php if(!empty($attr)) echo html::hidden("products[$i]", $productID);?>
<?php echo html::hidden("branch[$i]", $branchID);?>
<?php if(!isset($branchGroups[$productID])) unset($allProducts[$productID]);?>
<?php if(isset($branchGroups[$productID][$branchID])) unset($branchGroups[$productID][$branchID]);?>