* Finish task #71572.

This commit is contained in:
daitingting
2022-10-20 01:41:01 +00:00
parent 9719597cbf
commit 6750bed454
5 changed files with 49 additions and 28 deletions
+1 -1
View File
@@ -142,7 +142,7 @@ function loadBranches(product)
if(typeof(projectID) == 'undefined') projectID = 0;
var index = $inputgroup.find('select:first').attr('id').replace('products' , '');
$.get(createLink('branch', 'ajaxGetBranches', "productID=" + $(product).val() + "&oldBranch=&param=active&projectID=" + projectID + "&withMainBranch=true"), function(data)
$.get(createLink('branch', 'ajaxGetBranches', "productID=" + $(product).val() + "&oldBranch=0&param=active&projectID=" + projectID + "&withMainBranch=true"), function(data)
{
if(data)
{
+43 -20
View File
@@ -37,33 +37,56 @@ $().ready(function()
$(function()
{
/* If the story of the product which linked the execution under the project, you don't allow to remove the product. */
$("#productsBox select[name^='products']").each(function()
$(document).on('change', '[name*=products]', function()
{
var isExistedProduct = $.inArray($(this).attr('data-last'), unmodifiableProducts);
var productType = $(this).attr('data-type');
if(isExistedProduct != -1 && productType == 'normal')
{
$(this).prop('disabled', true).trigger("chosen:updated");
var current = $(this).val();
var last = $(this).attr('data-last');
var lastBranch = $(this).attr('data-lastBranch');
var productTip = tip.replace('%s', linkedStoryIDList[$(this).attr('data-last')][0]);
$(this).siblings('div').find('span').attr('title', productTip);
$(this).attr('data-last', current);
var $branch = $(this).closest('.has-branch').find("[name^='branch']");
if($branch.length)
{
var branchID = $branch.val();
$(this).attr('data-lastBranch', branchID);
}
else
{
$(this).removeAttr('data-lastBranch');
}
if(current != last && $.inArray(last, unmodifiableProducts) != -1)
{
if(lastBranch)
{
if($.inArray(lastBranch, unmodifiableBranches) != -1)
{
if(linkedStoryIDList[last][lastBranch]) bootbox.alert(tip.replace('%s', linkedStoryIDList[last][lastBranch]));
}
}
else
{
bootbox.alert(tip.replace('%s', linkedStoryIDList[last][0]));
}
}
});
$("#productsBox select[name^='branch']").each(function()
$(document).on('change', '[name*=branch]', function()
{
var isExistedBranch = $.inArray($(this).attr('data-last'), unmodifiableBranches);
if(isExistedBranch != -1)
{
var $product = $(this).closest('.has-branch').find("[name^='products']");
if($.inArray($product.val(), unmodifiableProducts) != -1 && linkedStoryIDList[$product.val()][$(this).attr('data-last')])
{
$(this).prop('disabled', true).trigger("chosen:updated");
$product.prop('disabled', true).trigger("chosen:updated");
var current = $(this).val();
var last = $(this).attr('data-last');
$(this).attr('data-last', current);
var productTip = tip.replace('%s', linkedStoryIDList[$product.val()][$(this).attr('data-last')]);
$product.siblings('div').find('span').attr('title', productTip);
var $product = $(this).closest('.has-branch').find("[name^='products']");
$product.attr('data-lastBranch', current);
if($.inArray(last, unmodifiableBranches) != -1)
{
var productID = $product.val();
if($.inArray(productID, unmodifiableProducts) != -1 && linkedStoryIDList[productID][last])
{
bootbox.alert(tip.replace('%s', linkedStoryIDList[productID][last]));
}
}
});
+1 -1
View File
@@ -152,7 +152,7 @@
<?php foreach($linkedBranches[$product->id] as $branchID => $branch):?>
<div class='col-sm-4'>
<div class="input-group<?php 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 ."'");?>
<?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 ."' data-lastBranch='" . $branchID . "'");?>
<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 . "'");?>
</div>
+3 -5
View File
@@ -11,18 +11,16 @@ $(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)
if($branch.length)
{
var branchID = String($branch.val());
console.log(productID);
console.log(unmodifiableMainBranches);
console.log($.inArray(productID, unmodifiableMainBranches));
if((branchID == BRANCH_MAIN && unmodifiableMainBranches[productID]) || (branchID != BRANCH_MAIN && $.inArray(branchID, unmodifiableBranches) != -1))
{
bootbox.alert(unLinkProductTip.replace("%s", branchGroups[productID][branchID]));
+1 -1
View File
@@ -916,7 +916,7 @@ class projectModel extends model
*/
public function getProjectExecutionPairs()
{
return $this->dao->select('project, id')->from(TABLE_PROJECT)->where('type')->eq('sprint')->andWhere('multiple')->eq('0')->andWhere('deleted')->eq('0')->fetchPairs();
return $this->dao->select('project, id')->from(TABLE_PROJECT)->andWhere('multiple')->eq('0')->andWhere('deleted')->eq('0')->fetchPairs();
}
/**