* Finish task #43901.
This commit is contained in:
@@ -207,15 +207,25 @@ class branch extends control
|
||||
* @param int $productID
|
||||
* @param int $oldBranch
|
||||
* @param string $param
|
||||
* @param int $projectID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function ajaxGetBranches($productID, $oldBranch = 0, $param = '')
|
||||
public function ajaxGetBranches($productID, $oldBranch = 0, $param = '', $projectID = 0)
|
||||
{
|
||||
$product = $this->loadModel('product')->getById($productID);
|
||||
if(empty($product) or $product->type == 'normal') die();
|
||||
|
||||
$branches = $this->branch->getPairs($productID, $param);
|
||||
if($projectID)
|
||||
{
|
||||
$projectProducts = $this->loadModel('project')->getBranchesByProject($projectID);
|
||||
foreach($branches as $branchID => $branchName)
|
||||
{
|
||||
if(!isset($projectProducts[$productID][$branchID])) unset($branches[$branchID]);
|
||||
}
|
||||
}
|
||||
|
||||
if($oldBranch) $branches = array($oldBranch => $branches[$oldBranch]);
|
||||
die(html::select('branch', $branches, '', "class='form-control' onchange='loadBranch(this)'"));
|
||||
}
|
||||
|
||||
+135
-75
@@ -1275,18 +1275,38 @@ class execution extends control
|
||||
$productPlans = array();
|
||||
if($copyExecutionID)
|
||||
{
|
||||
$copyExecution = $this->dao->select('*')->from(TABLE_EXECUTION)->where('id')->eq($copyExecutionID)->fetch();
|
||||
$name = $copyExecution->name;
|
||||
$code = $copyExecution->code;
|
||||
$team = $copyExecution->team;
|
||||
$acl = $copyExecution->acl;
|
||||
$whitelist = $copyExecution->whitelist;
|
||||
$projectID = $copyExecution->project;
|
||||
$products = $this->execution->getProducts($copyExecutionID);
|
||||
foreach($products as $product)
|
||||
$copyExecution = $this->dao->select('*')->from(TABLE_EXECUTION)->where('id')->eq($copyExecutionID)->fetch();
|
||||
$name = $copyExecution->name;
|
||||
$code = $copyExecution->code;
|
||||
$team = $copyExecution->team;
|
||||
$acl = $copyExecution->acl;
|
||||
$whitelist = $copyExecution->whitelist;
|
||||
$projectID = $copyExecution->project;
|
||||
$products = $this->execution->getProducts($copyExecutionID);
|
||||
$branches = $this->project->getBranchesByProject($copyExecutionID);
|
||||
$plans = $this->loadModel('productplan')->getGroupByProduct(array_keys($products));
|
||||
$projectProducts = $this->loadModel('project')->getBranchesByProject($projectID);
|
||||
$branchGroups = $this->loadModel('branch')->getByProducts(array_keys($products), 'noclosed');
|
||||
foreach($branchGroups as $productID => $branchPairs)
|
||||
{
|
||||
$productPlans[$product->id] = $this->loadModel('productplan')->getPairs($product->id);
|
||||
foreach($branchPairs as $branchID => $branchName)
|
||||
{
|
||||
if(!isset($projectProducts[$productID][$branchID])) unset($branchGroups[$productID][$branchID]);
|
||||
}
|
||||
}
|
||||
|
||||
$linkedBranches = array();
|
||||
foreach($products as $productID => $product)
|
||||
{
|
||||
foreach($branches[$productID] as $branchID => $branch)
|
||||
{
|
||||
$linkedBranches[$productID][$branchID] = $branchID;
|
||||
$productPlans[$productID][$branchID] = isset($plans[$productID][$branchID]) ? $plans[$productID][$branchID] : array();
|
||||
}
|
||||
}
|
||||
|
||||
$this->view->branches = $branches;
|
||||
$this->view->linkedBranches = $linkedBranches;
|
||||
}
|
||||
|
||||
if(!empty($planID))
|
||||
@@ -1297,7 +1317,7 @@ class execution extends control
|
||||
->where('t1.id')->eq($plan->product)
|
||||
->fetchAll('id');
|
||||
|
||||
$productPlan = $this->loadModel('productplan')->getPairs($plan->product, 0, 'unexpired');
|
||||
$productPlan = $this->loadModel('productplan')->getPairs($plan->product, $plan->branch, 'unexpired');
|
||||
}
|
||||
|
||||
if(!empty($_POST))
|
||||
@@ -1322,9 +1342,12 @@ class execution extends control
|
||||
$planID = '';
|
||||
if(isset($_POST['plans']))
|
||||
{
|
||||
foreach($_POST['plans'] as $planID)
|
||||
foreach($_POST['plans'] as $plans)
|
||||
{
|
||||
if(!empty($planID)) break;
|
||||
foreach($plans as $planID)
|
||||
{
|
||||
if(!empty($planID)) break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1355,34 +1378,35 @@ class execution extends control
|
||||
$rdUsers = $this->user->getPairs('noclosed|nodeleted|devfirst', '', $this->config->maxCount);
|
||||
if(!empty($this->config->user->moreLink)) $this->config->moreLinks["RD"] = $this->config->user->moreLink;
|
||||
|
||||
$this->view->title = (($this->app->tab == 'execution') and ($this->config->systemMode == 'new')) ? $this->lang->execution->createExec : $this->lang->execution->create;
|
||||
$this->view->position[] = $this->view->title;
|
||||
$this->view->gobackLink = (isset($output['from']) and $output['from'] == 'global') ? $this->createLink('execution', 'all') : '';
|
||||
$this->view->executions = array('' => '') + $this->execution->getList($projectID);
|
||||
$this->view->groups = $this->loadModel('group')->getPairs();
|
||||
$this->view->allProducts = array(0 => '') + $this->loadModel('product')->getProductPairsByProject($projectID, 'noclosed');
|
||||
$this->view->acl = $acl;
|
||||
$this->view->plan = $plan;
|
||||
$this->view->name = $name;
|
||||
$this->view->code = $code;
|
||||
$this->view->team = $team;
|
||||
$this->view->teams = array(0 => '') + $this->execution->getTeamPairsByProject((int)$projectID);
|
||||
$this->view->allProjects = array(0 => '') + $this->project->getPairsByModel();
|
||||
$this->view->executionID = $executionID;
|
||||
$this->view->productID = $productID;
|
||||
$this->view->projectID = $projectID;
|
||||
$this->view->products = $products;
|
||||
$this->view->productPlan = array(0 => '') + $productPlan;
|
||||
$this->view->productPlans = array(0 => '') + $productPlans;
|
||||
$this->view->whitelist = $whitelist;
|
||||
$this->view->copyExecutionID = $copyExecutionID;
|
||||
$this->view->branchGroups = $this->loadModel('branch')->getByProducts(array_keys($products));
|
||||
$this->view->poUsers = $poUsers;
|
||||
$this->view->pmUsers = $pmUsers;
|
||||
$this->view->qdUsers = $qdUsers;
|
||||
$this->view->rdUsers = $rdUsers;
|
||||
$this->view->users = $this->loadModel('user')->getPairs('nodeleted|noclosed');
|
||||
$this->view->from = $this->app->tab;
|
||||
$this->view->title = (($this->app->tab == 'execution') and ($this->config->systemMode == 'new')) ? $this->lang->execution->createExec : $this->lang->execution->create;
|
||||
$this->view->position[] = $this->view->title;
|
||||
$this->view->gobackLink = (isset($output['from']) and $output['from'] == 'global') ? $this->createLink('execution', 'all') : '';
|
||||
$this->view->executions = array('' => '') + $this->execution->getList($projectID);
|
||||
$this->view->groups = $this->loadModel('group')->getPairs();
|
||||
$this->view->allProducts = array(0 => '') + $this->loadModel('product')->getProductPairsByProject($projectID, 'noclosed');
|
||||
$this->view->acl = $acl;
|
||||
$this->view->plan = $plan;
|
||||
$this->view->name = $name;
|
||||
$this->view->code = $code;
|
||||
$this->view->team = $team;
|
||||
$this->view->teams = array(0 => '') + $this->execution->getTeamPairsByProject((int)$projectID);
|
||||
$this->view->allProjects = array(0 => '') + $this->project->getPairsByModel();
|
||||
$this->view->executionID = $executionID;
|
||||
$this->view->productID = $productID;
|
||||
$this->view->projectID = $projectID;
|
||||
$this->view->products = $products;
|
||||
$this->view->multiBranchProducts = $this->loadModel('product')->getMultiBranchPairs();
|
||||
$this->view->productPlan = array(0 => '') + $productPlan;
|
||||
$this->view->productPlans = array(0 => '') + $productPlans;
|
||||
$this->view->whitelist = $whitelist;
|
||||
$this->view->copyExecutionID = $copyExecutionID;
|
||||
$this->view->branchGroups = isset($branchGroups) ? $branchGroups : $this->loadModel('branch')->getByProducts(array_keys($products), 'noclosed');
|
||||
$this->view->poUsers = $poUsers;
|
||||
$this->view->pmUsers = $pmUsers;
|
||||
$this->view->qdUsers = $qdUsers;
|
||||
$this->view->rdUsers = $rdUsers;
|
||||
$this->view->users = $this->loadModel('user')->getPairs('nodeleted|noclosed');
|
||||
$this->view->from = $this->app->tab;
|
||||
$this->display();
|
||||
}
|
||||
|
||||
@@ -1434,14 +1458,19 @@ class execution extends control
|
||||
}
|
||||
|
||||
/* Link the plan stories. */
|
||||
$newPlans = $this->dao->select('plan')->from(TABLE_PROJECTPRODUCT)->where('project')->eq($executionID)->andWhere('plan')->ne(0)->fetchPairs('plan');
|
||||
$newPlans = array();
|
||||
foreach($_POST['plans'] as $plans)
|
||||
{
|
||||
foreach($plans as $planID) $newPlans[$planID] = $planID;
|
||||
}
|
||||
|
||||
$diffResult = array_diff($oldPlans, $newPlans);
|
||||
$diffResult = array_merge($diffResult, array_diff($newPlans, $oldPlans));
|
||||
if(!empty($newPlans) and !empty($diffResult))
|
||||
{
|
||||
$projectID = $this->dao->select('project')->from(TABLE_EXECUTION)->where('id')->eq($executionID)->fetch('project');
|
||||
$this->loadModel('productplan')->linkProject($executionID, $_POST['plans']);
|
||||
$this->productplan->linkProject($projectID, $_POST['plans']);
|
||||
$this->loadModel('productplan')->linkProject($executionID, $newPlans);
|
||||
$this->productplan->linkProject($projectID, $newPlans);
|
||||
}
|
||||
|
||||
$this->executeHooks($executionID);
|
||||
@@ -1466,28 +1495,39 @@ class execution extends control
|
||||
$executionProsucts = $this->execution->getProducts($execution->project, true, 'noclosed');
|
||||
foreach($executionProsucts as $product) $allProducts[$product->id] = $product->name;
|
||||
|
||||
$linkedProducts = $this->execution->getProducts($execution->id);
|
||||
$linkedBranches = array();
|
||||
$this->loadModel('productplan');
|
||||
$productPlans = array(0 => '');
|
||||
$linkedBranches = array();
|
||||
$linkedProducts = $this->execution->getProducts($executionID);
|
||||
$branches = $this->project->getBranchesByProject($executionID);
|
||||
$plans = $this->productplan->getGroupByProduct(array_keys($linkedProducts));
|
||||
$executionStories = $this->project->getStoriesByProject($executionID);
|
||||
$projectProducts = $this->loadModel('project')->getBranchesByProject($execution->project);
|
||||
$branchGroups = $this->loadModel('branch')->getByProducts(array_keys($linkedProducts), 'noclosed');
|
||||
foreach($branchGroups as $productID => $branchPairs)
|
||||
{
|
||||
foreach($branchPairs as $branchID => $branchName)
|
||||
{
|
||||
if(!isset($projectProducts[$productID][$branchID])) unset($branchGroups[$productID][$branchID]);
|
||||
}
|
||||
}
|
||||
|
||||
/* If the story of the product which linked the execution, you don't allow to remove the product. */
|
||||
$unmodifiableProducts = array();
|
||||
$unmodifiableBranches = array();
|
||||
foreach($linkedProducts as $productID => $linkedProduct)
|
||||
{
|
||||
$executionStories = $this->dao->select('*')->from(TABLE_PROJECTSTORY)->where('project')->eq($executionID)->andWhere('product')->eq($productID)->fetchAll('story');
|
||||
if(!empty($executionStories)) array_push($unmodifiableProducts, $productID);
|
||||
}
|
||||
|
||||
foreach($linkedProducts as $product)
|
||||
{
|
||||
if(!isset($allProducts[$product->id])) $allProducts[$product->id] = $product->name;
|
||||
if($product->branch) $linkedBranches[$product->branch] = $product->branch;
|
||||
}
|
||||
|
||||
$this->loadModel('productplan');
|
||||
$productPlans = array(0 => '');
|
||||
foreach($linkedProducts as $product)
|
||||
{
|
||||
$productPlans[$product->id] = $this->productplan->getPairs($product->id);
|
||||
if(!isset($allProducts[$productID])) $allProducts[$productID] = $linkedProduct->name;
|
||||
foreach($branches[$productID] as $branchID => $branch)
|
||||
{
|
||||
$linkedBranches[$productID][$branchID] = $branchID;
|
||||
$productPlans[$productID][$branchID] = isset($plans[$productID][$branchID]) ? $plans[$productID][$branchID] : array();
|
||||
if(!empty($executionStories[$productID][$branchID]))
|
||||
{
|
||||
array_push($unmodifiableProducts, $productID);
|
||||
array_push($unmodifiableBranches, $branchID);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->loadModel('user');
|
||||
@@ -1516,9 +1556,13 @@ class execution extends control
|
||||
$this->view->groups = $this->loadModel('group')->getPairs();
|
||||
$this->view->allProducts = $allProducts;
|
||||
$this->view->linkedProducts = $linkedProducts;
|
||||
$this->view->linkedBranches = $linkedBranches;
|
||||
$this->view->branches = $branches;
|
||||
$this->view->unmodifiableProducts = $unmodifiableProducts;
|
||||
$this->view->unmodifiableBranches = $unmodifiableBranches;
|
||||
$this->view->multiBranchProducts = $this->loadModel('product')->getMultiBranchPairs();
|
||||
$this->view->productPlans = $productPlans;
|
||||
$this->view->branchGroups = $this->loadModel('branch')->getByProducts(array_keys($linkedProducts), '', $linkedBranches);
|
||||
$this->view->branchGroups = $branchGroups;
|
||||
$this->display();
|
||||
}
|
||||
|
||||
@@ -2243,23 +2287,37 @@ class execution extends control
|
||||
$position[] = html::a($browseExecutionLink, $execution->name);
|
||||
$position[] = $this->lang->execution->manageProducts;
|
||||
|
||||
$allProducts = $this->config->systemMode == 'classic' ? $this->product->getPairs('noclosed') : $this->product->getProductPairsByProject($execution->project);
|
||||
$linkedProducts = $this->execution->getProducts($execution->id);
|
||||
$linkedBranches = array();
|
||||
$allProducts = $this->config->systemMode == 'classic' ? $this->product->getPairs('noclosed') : $this->product->getProductPairsByProject($execution->project);
|
||||
$linkedProducts = $this->execution->getProducts($execution->id);
|
||||
$linkedBranches = array();
|
||||
$branches = $this->project->getBranchesByProject($executionID);
|
||||
$executionStories = $this->project->getStoriesByProject($executionID);
|
||||
$projectProducts = $this->loadModel('project')->getBranchesByProject($execution->project);
|
||||
$branchGroups = $this->loadModel('branch')->getByProducts(array_keys($linkedProducts), 'noclosed');
|
||||
foreach($branchGroups as $productID => $branchPairs)
|
||||
{
|
||||
foreach($branchPairs as $branchID => $branchName)
|
||||
{
|
||||
if(!isset($projectProducts[$productID][$branchID])) unset($branchGroups[$productID][$branchID]);
|
||||
}
|
||||
}
|
||||
|
||||
/* If the story of the product which linked the execution, you don't allow to remove the product. */
|
||||
$unmodifiableProducts = array();
|
||||
$unmodifiableBranches = array();
|
||||
foreach($linkedProducts as $productID => $linkedProduct)
|
||||
{
|
||||
$executionStories = $this->dao->select('*')->from(TABLE_PROJECTSTORY)->where('project')->eq($executionID)->andWhere('product')->eq($productID)->fetchAll('story');
|
||||
if(!empty($executionStories)) array_push($unmodifiableProducts, $productID);
|
||||
}
|
||||
|
||||
// Merge allProducts and linkedProducts for closed product.
|
||||
foreach($linkedProducts as $product)
|
||||
{
|
||||
if(!isset($allProducts[$product->id])) $allProducts[$product->id] = $product->name;
|
||||
if(!empty($product->branch)) $linkedBranches[$product->branch] = $product->branch;
|
||||
$linkedBranches[$productID] = array();
|
||||
if(!isset($allProducts[$productID])) $allProducts[$productID] = $linkedProduct->name;
|
||||
foreach($branches[$productID] as $branchID => $branch)
|
||||
{
|
||||
$linkedBranches[$productID][$branchID] = $branchID;
|
||||
if(!empty($executionStories[$productID][$branchID]))
|
||||
{
|
||||
array_push($unmodifiableProducts, $productID);
|
||||
array_push($unmodifiableBranches, $branchID);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Assign. */
|
||||
@@ -2269,7 +2327,9 @@ class execution extends control
|
||||
$this->view->execution = $execution;
|
||||
$this->view->linkedProducts = $linkedProducts;
|
||||
$this->view->unmodifiableProducts = $unmodifiableProducts;
|
||||
$this->view->branchGroups = $this->loadModel('branch')->getByProducts(array_keys($allProducts), 'ignoreNormal', $linkedBranches);
|
||||
$this->view->unmodifiableBranches = $unmodifiableBranches;
|
||||
$this->view->linkedBranches = $linkedBranches;
|
||||
$this->view->branchGroups = $branchGroups;
|
||||
|
||||
$this->display();
|
||||
}
|
||||
|
||||
@@ -127,7 +127,7 @@ function loadBranches(product)
|
||||
$('#productsBox select').each(function()
|
||||
{
|
||||
var $product = $(product);
|
||||
if($product.val() != 0 && $product.val() == $(this).val() && $product.attr('id') != $(this).attr('id'))
|
||||
if($product.val() != 0 && $product.val() == $(this).val() && $product.attr('id') != $(this).attr('id') && !multiBranchProducts[$product.val()])
|
||||
{
|
||||
alert(errorSameProducts);
|
||||
$product.val(0);
|
||||
@@ -152,8 +152,9 @@ function loadBranches(product)
|
||||
if($inputgroup.find('select').size() >= 2) $inputgroup.removeClass('has-branch').find('select:last').remove();
|
||||
if($inputgroup.find('.chosen-container').size() >= 2) $inputgroup.find('.chosen-container:last').remove();
|
||||
|
||||
var projectID = $('#project').val();
|
||||
var index = $inputgroup.find('select:first').attr('id').replace('products' , '');
|
||||
$.get(createLink('branch', 'ajaxGetBranches', "productID=" + $(product).val()), function(data)
|
||||
$.get(createLink('branch', 'ajaxGetBranches', "productID=" + $(product).val() + "&oldBranch=0¶m=active&projectID=" + projectID), function(data)
|
||||
{
|
||||
if(data)
|
||||
{
|
||||
@@ -182,7 +183,7 @@ function loadPlans(product, branchID)
|
||||
if(data)
|
||||
{
|
||||
if($("div#plan" + index).size() == 0) $("#plansBox .row").append('<div class="col-sm-4" id="plan' + index + '"></div>');
|
||||
$("div#plan" + index).html(data).find('select').attr('name', 'plans[' + productID + ']').attr('id', 'plans' + productID).chosen();
|
||||
$("div#plan" + index).html(data).find('select').attr('name', 'plans[' + productID + '][' + branchID + ']').attr('id', 'plans' + productID).chosen();
|
||||
|
||||
adjustPlanBoxMargin();
|
||||
}
|
||||
|
||||
@@ -78,6 +78,42 @@ $(function()
|
||||
|
||||
var acl = $("[name^='acl']:checked").val();
|
||||
setWhite(acl);
|
||||
|
||||
$('#submit').click(function()
|
||||
{
|
||||
var products = [];
|
||||
var existedBranch = false;
|
||||
|
||||
/* Determine whether the products of the same branch are linked. */
|
||||
$("#productsBox select[name^='products']").each(function()
|
||||
{
|
||||
var productID = $(this).val();
|
||||
products[productID] = new Array();
|
||||
if(multiBranchProducts[productID])
|
||||
{
|
||||
$("#productsBox select[name^='branch']").each(function()
|
||||
{
|
||||
var branchID = $(this).val();
|
||||
if(products[productID][branchID])
|
||||
{
|
||||
existedBranch = true;
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
products[productID][branchID] = branchID;
|
||||
}
|
||||
})
|
||||
if(existedBranch) return false;
|
||||
}
|
||||
})
|
||||
|
||||
if(existedBranch)
|
||||
{
|
||||
bootbox.alert(errorSameBranches);
|
||||
return false;
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
function showLifeTimeTips()
|
||||
|
||||
@@ -4,22 +4,70 @@ $().ready(function()
|
||||
{
|
||||
$('#products0').removeAttr("disabled");
|
||||
$('#branch0').removeAttr("disabled");
|
||||
});
|
||||
var products = [];
|
||||
var existedBranch = false;
|
||||
|
||||
/* Determine whether the products of the same branch are linked. */
|
||||
$("#productsBox select[name^='products']").each(function()
|
||||
{
|
||||
var productID = $(this).val();
|
||||
products[productID] = new Array();
|
||||
if(multiBranchProducts[productID])
|
||||
{
|
||||
$("#productsBox select[name^='branch']").each(function()
|
||||
{
|
||||
var branchID = $(this).val();
|
||||
if(products[productID][branchID])
|
||||
{
|
||||
existedBranch = true;
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
products[productID][branchID] = branchID;
|
||||
}
|
||||
})
|
||||
if(existedBranch) return false;
|
||||
}
|
||||
})
|
||||
|
||||
if(existedBranch)
|
||||
{
|
||||
bootbox.alert(errorSameBranches);
|
||||
return false;
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
$(function()
|
||||
{
|
||||
/* If the story of the product which linked the execution under the project, you don't allow to remove the product. */
|
||||
$("#productsBox select").each(function()
|
||||
$("#productsBox select[name^='products']").each(function()
|
||||
{
|
||||
var isExisted = $.inArray($(this).attr('data-last'), unmodifiableProducts);
|
||||
if(isExisted != -1)
|
||||
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");
|
||||
$(this).siblings('div').find('span').attr('title', tip);
|
||||
}
|
||||
});
|
||||
|
||||
$("#productsBox select[name^='branch']").each(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)
|
||||
{
|
||||
$(this).prop('disabled', true).trigger("chosen:updated");
|
||||
$product.prop('disabled', true).trigger("chosen:updated");
|
||||
$product.siblings('div').find('span').attr('title', tip);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
oldProject = $("#project").val();
|
||||
$('#project').change(function()
|
||||
{
|
||||
|
||||
@@ -328,6 +328,7 @@ $lang->execution->notAllowedUnlinkStory = "This {$lang->SRCommon} is linke
|
||||
$lang->execution->notAllowRemoveProducts = "The story of this product is linked with the {$lang->executionCommon}. Unlink it before doing any action.";
|
||||
$lang->execution->errorNoLinkedProducts = "No {$lang->productCommon} is linked to {$lang->executionCommon}. You will be directed to {$lang->productCommon} page to link one.";
|
||||
$lang->execution->errorSameProducts = "{$lang->executionCommon} cannot be linked to the same {$lang->productCommon} twice.";
|
||||
$lang->execution->errorSameBranches = "{$lang->executionCommon} cannot be linked to the same branch twice";
|
||||
$lang->execution->errorBegin = "The start time of {$lang->executionCommon} cannot be less than the start time of the project %s.";
|
||||
$lang->execution->errorEnd = "The end time of {$lang->executionCommon} cannot be greater than the end time %s of the project.";
|
||||
$lang->execution->accessDenied = "Your access to {$lang->executionCommon} is denied!";
|
||||
|
||||
@@ -328,6 +328,7 @@ $lang->execution->notAllowedUnlinkStory = "该{$lang->SRCommon}已经与
|
||||
$lang->execution->notAllowRemoveProducts = "该{$lang->productCommon}中的{$lang->SRCommon}已与该{$lang->executionCommon}进行了关联,请取消关联后再操作。";
|
||||
$lang->execution->errorNoLinkedProducts = "该{$lang->executionCommon}没有关联的{$lang->productCommon},系统将转到{$lang->productCommon}关联页面";
|
||||
$lang->execution->errorSameProducts = "{$lang->executionCommon}不能关联多个相同的{$lang->productCommon}。";
|
||||
$lang->execution->errorSameBranches = "{$lang->executionCommon}不能关联多个相同的分支。";
|
||||
$lang->execution->errorBegin = "{$lang->executionCommon}的开始时间不能小于所属项目的开始时间%s。";
|
||||
$lang->execution->errorEnd = "{$lang->executionCommon}的截止时间不能大于所属项目的结束时间%s。";
|
||||
$lang->execution->accessDenied = "您无权访问该{$lang->executionCommon}!";
|
||||
|
||||
@@ -525,7 +525,7 @@ class executionModel extends model
|
||||
->exec();
|
||||
|
||||
$changedAccounts = array();
|
||||
$teamMembers = array();
|
||||
$teamMembers = array();
|
||||
foreach($this->config->execution->ownerFields as $ownerField)
|
||||
{
|
||||
$owner = zget($execution, $ownerField, '');
|
||||
@@ -542,7 +542,7 @@ class executionModel extends model
|
||||
$this->dao->replace(TABLE_TEAM)->data($member)->exec();
|
||||
|
||||
$changedAccounts[$owner] = $owner;
|
||||
$teamMembers[$ownerField] = $member;
|
||||
$teamMembers[$ownerField] = $member;
|
||||
}
|
||||
if($execution->project) $this->addProjectMembers($execution->project, $teamMembers);
|
||||
|
||||
@@ -1817,10 +1817,13 @@ class executionModel extends model
|
||||
foreach($products as $i => $productID)
|
||||
{
|
||||
if(empty($productID)) continue;
|
||||
if(isset($existedProducts[$productID])) continue;
|
||||
if(!isset($existedProducts[$productID])) $existedProducts[$productID] = array();
|
||||
|
||||
$oldPlan = 0;
|
||||
$branch = isset($branches[$i]) ? $branches[$i] : 0;
|
||||
|
||||
if(isset($existedProducts[$productID][$branch])) continue;
|
||||
|
||||
if(isset($oldProducts[$productID][$branch]))
|
||||
{
|
||||
$oldProduct = $oldProducts[$productID][$branch];
|
||||
@@ -1831,9 +1834,9 @@ class executionModel extends model
|
||||
$data->project = $executionID;
|
||||
$data->product = $productID;
|
||||
$data->branch = $branch;
|
||||
$data->plan = isset($plans[$productID]) ? $plans[$productID] : $oldPlan;
|
||||
$data->plan = isset($plans[$productID][$branch]) ? $plans[$productID][$branch] : $oldPlan;
|
||||
$this->dao->insert(TABLE_PROJECTPRODUCT)->data($data)->exec();
|
||||
$existedProducts[$productID] = true;
|
||||
$existedProducts[$productID][$branch] = true;
|
||||
}
|
||||
|
||||
$oldProductKeys = array_keys($oldProducts);
|
||||
|
||||
@@ -34,11 +34,13 @@
|
||||
<?php js::set('weekend', $config->execution->weekend);?>
|
||||
<?php js::set('holders', $lang->execution->placeholder);?>
|
||||
<?php js::set('errorSameProducts', $lang->execution->errorSameProducts);?>
|
||||
<?php js::set('errorSameBranches', $lang->execution->errorSameBranches);?>
|
||||
<?php js::set('productID', empty($productID) ? 0 : $productID);?>
|
||||
<?php js::set('isStage', false);?>
|
||||
<?php js::set('copyExecutionID', $copyExecutionID);?>
|
||||
<?php js::set('systemMode', $config->systemMode);?>
|
||||
<?php js::set('projectCommon', $lang->project->common);?>
|
||||
<?php js::set('multiBranchProducts', $multiBranchProducts);?>
|
||||
<div id='mainContent' class='main-content'>
|
||||
<div class='center-block'>
|
||||
<div class='main-header'>
|
||||
@@ -132,12 +134,14 @@
|
||||
<?php elseif($copyExecutionID):?>
|
||||
<?php $i = 0;?>
|
||||
<?php foreach($products as $product):?>
|
||||
<?php $plans = zget($productPlans, $product->id, array(0 => ''));?>
|
||||
<div class="col-sm-4" id="plan<?php echo $i;?>"><?php echo html::select("plans[" . $product->id . "]", $plans, '', "class='form-control chosen'");?></div>
|
||||
<?php foreach($linkedBranches[$product->id] as $branchID => $branch):?>
|
||||
<?php $plans = $productPlans[$product->id][$branchID];?>
|
||||
<div class="col-sm-4" id="plan<?php echo $i;?>"><?php echo html::select("plans[{$product->id}][$branchID]", $plans, $branches[$product->id][$branchID]->plan, "class='form-control chosen'");?></div>
|
||||
<?php $i++;?>
|
||||
<?php endforeach;?>
|
||||
<?php endforeach;?>
|
||||
<?php else:?>
|
||||
<div class="col-sm-4" id="plan0"><?php echo html::select("plans[]", $productPlan, '', "class='form-control chosen'");?></div>
|
||||
<div class="col-sm-4" id="plan0"><?php echo html::select("plans[][]", $productPlan, '', "class='form-control chosen'");?></div>
|
||||
<?php js::set('currentPlanID', '')?>
|
||||
<?php endif;?>
|
||||
</div>
|
||||
|
||||
@@ -116,16 +116,24 @@
|
||||
<div class='row'>
|
||||
<?php $i = 0;?>
|
||||
<?php foreach($linkedProducts as $product):?>
|
||||
<?php $hasBranch = $product->type != 'normal' and isset($branchGroups[$product->id]);?>
|
||||
<?php foreach($linkedBranches[$product->id] as $branchID => $branch):?>
|
||||
<div class='col-sm-4'>
|
||||
<?php $hasBranch = $product->type != 'normal' and isset($branchGroups[$product->id]);?>
|
||||
<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 . "'");?>
|
||||
<?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], $product->branch, "class='form-control chosen' $class onchange=\"loadPlans('#products{$i}', this.value)\"");?>
|
||||
<?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>
|
||||
</div>
|
||||
<?php if(in_array($product->id, $unmodifiableProducts)) echo html::hidden("products[$i]", $product->id);?>
|
||||
<?php $i++;?>
|
||||
<?php
|
||||
if(in_array($product->id, $unmodifiableProducts) and in_array($branchID, $unmodifiableBranches))
|
||||
{
|
||||
echo html::hidden("products[$i]", $product->id);
|
||||
echo html::hidden("branch[$i]", $branchID);
|
||||
}
|
||||
$i++;
|
||||
?>
|
||||
<?php endforeach;?>
|
||||
<?php endforeach;?>
|
||||
<div class='col-sm-4'>
|
||||
<div class="input-group">
|
||||
@@ -142,10 +150,12 @@
|
||||
<div class='row'>
|
||||
<?php $i = 0;?>
|
||||
<?php foreach($linkedProducts as $product):?>
|
||||
<?php $plans = zget($productPlans, $product->id, array(0 => ''));?>
|
||||
<div class="col-sm-4" id="plan<?php echo $i;?>"><?php echo html::select("plans[" . $product->id . "]", $plans, $product->plan, "class='form-control chosen'");?></div>
|
||||
<?php foreach($linkedBranches[$product->id] as $branchID => $branch):?>
|
||||
<?php $plans = $productPlans[$product->id][$branchID];?>
|
||||
<div class="col-sm-4" id="plan<?php echo $i;?>"><?php echo html::select("plans[{$product->id}][{$branchID}]", $plans, $branches[$product->id][$branchID]->plan, "class='form-control chosen'");?></div>
|
||||
<?php $i++;?>
|
||||
<?php endforeach;?>
|
||||
<?php endforeach;?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -171,7 +181,10 @@
|
||||
</div>
|
||||
<?php js::set('weekend', $config->execution->weekend);?>
|
||||
<?php js::set('errorSameProducts', $lang->execution->errorSameProducts);?>
|
||||
<?php js::set('errorSameBranches', $lang->execution->errorSameBranches);?>
|
||||
<?php js::set('unmodifiableProducts',$unmodifiableProducts);?>
|
||||
<?php js::set('unmodifiableBranches', $unmodifiableBranches)?>
|
||||
<?php js::set('multiBranchProducts', $multiBranchProducts);?>
|
||||
<?php js::set('tip', $lang->execution->notAllowRemoveProducts);?>
|
||||
<?php js::set('confirmSyncStories', $lang->execution->confirmSyncStories);?>
|
||||
<?php include '../../common/view/footer.html.php';?>
|
||||
|
||||
@@ -22,23 +22,30 @@
|
||||
<div class='detail'>
|
||||
<div class='detail-title'><?php echo $lang->execution->linkedProducts;?></div>
|
||||
<div class='detail-content row'>
|
||||
<?php $i = 0;?>
|
||||
<?php $class = $execution->grade == 2 ? "disabled='disabled'" : '';?>
|
||||
<?php foreach($allProducts as $productID => $productName):?>
|
||||
<?php if(isset($linkedProducts[$productID])):?>
|
||||
<?php $isDisabled = in_array($productID, $unmodifiableProducts) ? "disabled='disabled'" : '';?>
|
||||
<?php foreach($linkedBranches[$productID] as $branchID):?>
|
||||
<?php $isDisabled = (in_array($productID, $unmodifiableProducts) and in_array($branchID, $unmodifiableBranches)) ? "disabled='disabled'" : '';?>
|
||||
<?php $title = in_array($productID, $unmodifiableProducts) ? $lang->execution->notAllowRemoveProducts : $productName;?>
|
||||
<?php $checked = 'checked';?>
|
||||
<div class='col-sm-4'>
|
||||
<div class='product <?php echo $checked . (isset($branchGroups[$productID]) ? ' has-branch' : '')?>'>
|
||||
<div class="checkbox-primary" title='<?php echo $title;?>'>
|
||||
<?php echo "<input type='checkbox' name='products[$productID]' value='$productID' $checked $class id='products{$productID}' $isDisabled>";?>
|
||||
<?php echo "<input type='checkbox' name='products[$i]' value='$productID' $checked $class id='products{$productID}' $isDisabled>";?>
|
||||
<label class='text-ellipsis checkbox-inline' for='<?php echo 'products' . $productID;?>' title='<?php echo $productName;?>'><?php echo $productName;?></label>
|
||||
</div>
|
||||
<?php if(isset($branchGroups[$productID])) echo html::select("branch[$productID]", $branchGroups[$productID], $linkedProducts[$productID]->branch, "class='form-control chosen' $class");?>
|
||||
<?php if(isset($branchGroups[$productID])) echo html::select("branch[$i]", $branchGroups[$productID], $branchID, "class='form-control chosen' $class $isDisabled");?>
|
||||
</div>
|
||||
</div>
|
||||
<?php if(!empty($isDisabled)) echo html::hidden("products[$productID]", $productID);?>
|
||||
<?php unset($allProducts[$productID]);?>
|
||||
<?php if(!empty($isDisabled)) echo html::hidden("products[$i]", $productID);?>
|
||||
<?php if(!empty($isDisabled)) echo html::hidden("branch[$i]", $branchID);?>
|
||||
<?php if(!isset($branchGroups[$productID])) unset($allProducts[$productID]);?>
|
||||
<?php if(isset($branchGroups[$productID][$branchID])) unset($branchGroups[$productID][$branchID]);?>
|
||||
<?php if(isset($branchGroups[$productID]) and empty($branchGroups[$productID])) unset($allProducts[$productID]);?>
|
||||
<?php $i++;?>
|
||||
<?php endforeach;?>
|
||||
<?php endif;?>
|
||||
<?php endforeach;?>
|
||||
</div>
|
||||
|
||||
@@ -542,7 +542,7 @@ class project extends control
|
||||
$unmodifiableBranches = array();
|
||||
foreach($linkedProducts as $productID => $linkedProduct)
|
||||
{
|
||||
if(!isset($allProducts[$productID])) $allProducts[$productID] = $product->name;
|
||||
if(!isset($allProducts[$productID])) $allProducts[$productID] = $linkedProduct->name;
|
||||
foreach($branches[$productID] as $branchID => $branch)
|
||||
{
|
||||
$linkedBranches[$productID][$branchID] = $branchID;
|
||||
@@ -1716,8 +1716,8 @@ class project extends control
|
||||
$unmodifiableBranches = array();
|
||||
foreach($linkedProducts as $productID => $linkedProduct)
|
||||
{
|
||||
if(!isset($allProducts[$productID])) $allProducts[$productID] = $product->name;
|
||||
$linkedBranches[$productID] = array();
|
||||
if(!isset($allProducts[$productID])) $allProducts[$productID] = $linkedProduct->name;
|
||||
foreach($branches[$productID] as $branchID => $branch)
|
||||
{
|
||||
$linkedBranches[$productID][$branchID] = $branchID;
|
||||
|
||||
Reference in New Issue
Block a user