Merge branch 'zentaopms_239_task_#71568' into 'zentaopms_239'
* Finish task #71568. See merge request easycorp/zentaopms!5791
This commit is contained in:
@@ -280,7 +280,7 @@ class branch extends control
|
||||
$branchTagOption[$oldBranch] = $oldBranch == BRANCH_MAIN ? $branch : ($branch->name . ($branch->status == 'closed' ? ' (' . $this->lang->branch->statusList['closed'] . ')' : ''));
|
||||
}
|
||||
|
||||
return print(html::select('branch', $branchTagOption, $oldBranch, "class='form-control' onchange='loadBranch(this)'"));
|
||||
return print(html::select('branch', $branchTagOption, $oldBranch, "class='form-control' onchange='loadBranch(this)' data-last='{$oldBranch}'"));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -76,16 +76,15 @@ class programModel extends model
|
||||
if($programID)
|
||||
{
|
||||
$program = $this->getByID($programID);
|
||||
$path = explode(',', $program->path);
|
||||
$path = array_filter($path);
|
||||
$path = array_filter(explode(',', $program->path));
|
||||
$programID = current($path);
|
||||
}
|
||||
|
||||
/* When mode equals assign and programID equals 0, you can query the standalone product. */
|
||||
if(!empty($append) and is_array($append)) $append = implode(',', $append);
|
||||
$views = empty($append) ? $this->app->user->view->products : $this->app->user->view->products . ",$append";
|
||||
|
||||
$views = empty($append) ? $this->app->user->view->products : $this->app->user->view->products . ",$append";
|
||||
$products = $this->dao->select('*')->from(TABLE_PRODUCT)
|
||||
return $this->dao->select('*')->from(TABLE_PRODUCT)
|
||||
->where('deleted')->eq(0)
|
||||
->andWhere('vision')->eq($this->config->vision)
|
||||
->beginIF($shadow !== 'all')->andWhere('shadow')->eq((int)$shadow)->fi()
|
||||
@@ -93,7 +92,6 @@ class programModel extends model
|
||||
->beginIF(strpos($status, 'noclosed') !== false)->andWhere('status')->ne('closed')->fi()
|
||||
->beginIF(!$this->app->user->admin)->andWhere('id')->in($views)->fi()
|
||||
->fetchPairs('id', 'name');
|
||||
return $products;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+16
-18
@@ -280,7 +280,7 @@ class project extends control
|
||||
$data['selectedProgramPath'] = explode(',', $selectedProgram->path);
|
||||
}
|
||||
|
||||
$allProducts = array(0 => '') + $this->program->getProductPairs($selectedProgramID, 'assign', 'noclosed');
|
||||
$allProducts = array(0 => '') + $this->program->getProductPairs(0, 'all', 'noclosed');
|
||||
$data['allProducts'] = html::select("products[0]", $allProducts, '', "class='form-control chosen' onchange='loadBranches(this)'");
|
||||
$data['plans'] = html::select('plans[][][]', '', '', 'class=\'form-control chosen\' multiple');
|
||||
|
||||
@@ -540,25 +540,24 @@ class project extends control
|
||||
}
|
||||
}
|
||||
|
||||
if($this->app->tab == 'program' and $programID) $this->loadModel('program')->setMenu($programID);
|
||||
if($this->app->tab == 'doc') unset($this->lang->doc->menu->project['subMenu']);
|
||||
if($this->app->tab == 'program' and $programID) $this->loadModel('program')->setMenu($programID);
|
||||
if($this->app->tab == 'product' and !empty($output['productID'])) $this->loadModel('product')->setMenu($output['productID']);
|
||||
if($this->app->tab == 'doc') unset($this->lang->doc->menu->project['subMenu']);
|
||||
$this->session->set('projectModel', $model);
|
||||
|
||||
$extra = str_replace(array(',', ' '), array('&', ''), $extra);
|
||||
parse_str($extra, $output);
|
||||
|
||||
$name = '';
|
||||
$code = '';
|
||||
$team = '';
|
||||
$whitelist = '';
|
||||
$acl = 'private';
|
||||
$auth = 'extend';
|
||||
$hasProduct = 1;
|
||||
|
||||
$name = '';
|
||||
$code = '';
|
||||
$team = '';
|
||||
$whitelist = '';
|
||||
$acl = 'private';
|
||||
$auth = 'extend';
|
||||
$hasProduct = 1;
|
||||
$shadow = 0;
|
||||
$products = array();
|
||||
$productPlans = array();
|
||||
$shadow = 0;
|
||||
$parentProgram = $this->loadModel('program')->getByID($programID);
|
||||
|
||||
if($copyProjectID)
|
||||
@@ -567,12 +566,12 @@ class project extends control
|
||||
$name = $copyProject->name;
|
||||
$code = $copyProject->code;
|
||||
$team = $copyProject->team;
|
||||
$whitelist = $copyProject->whitelist;
|
||||
$acl = $copyProject->acl;
|
||||
$auth = $copyProject->auth;
|
||||
$whitelist = $copyProject->whitelist;
|
||||
$hasProduct = $copyProject->hasProduct;
|
||||
$programID = $copyProject->parent;
|
||||
$model = $copyProject->model;
|
||||
$hasProduct = $copyProject->hasProduct;
|
||||
$products = $this->product->getProducts($copyProjectID);
|
||||
|
||||
if(!$copyProject->hasProduct) $shadow = 1;
|
||||
@@ -598,14 +597,13 @@ class project extends control
|
||||
$this->config->executionCommonList[$this->app->getClientLang()][0] :
|
||||
$this->config->executionCommonList[$this->app->getClientLang()][1];
|
||||
|
||||
$this->view->title = $this->lang->project->create;
|
||||
|
||||
$this->view->title = $this->lang->project->create;
|
||||
$this->view->gobackLink = (isset($output['from']) and $output['from'] == 'global') ? $this->createLink('project', 'browse') : '';
|
||||
$this->view->pmUsers = $this->loadModel('user')->getPairs('noclosed|nodeleted|pmfirst');
|
||||
$this->view->users = $this->user->getPairs('noclosed|nodeleted');
|
||||
$this->view->copyProjects = $this->project->getPairsByModel($model);
|
||||
$this->view->products = $products;
|
||||
$this->view->allProducts = array('0' => '') + $this->program->getProductPairs($programID, 'assign', 'noclosed', '', $shadow);
|
||||
$this->view->allProducts = array('0' => '') + $this->program->getProductPairs(0, 'all', 'noclosed', '', $shadow);
|
||||
$this->view->productPlans = array('0' => '') + $productPlans;
|
||||
$this->view->branchGroups = $this->loadModel('branch')->getByProducts(array_keys($products), 'noclosed');
|
||||
$this->view->programID = $programID;
|
||||
@@ -713,7 +711,7 @@ class project extends control
|
||||
$productPlans = array(0 => '');
|
||||
$branches = $this->project->getBranchesByProject($projectID);
|
||||
$linkedProductIdList = empty($branches) ? '' : array_keys($branches);
|
||||
$allProducts = $this->program->getProductPairs($project->parent, 'assign', 'noclosed', $linkedProductIdList);
|
||||
$allProducts = $this->program->getProductPairs(0, 'all', 'noclosed', $linkedProductIdList);
|
||||
$linkedProducts = $this->loadModel('product')->getProducts($projectID, 'all', '', true, $linkedProductIdList);
|
||||
$parentProject = $this->program->getByID($project->parent);
|
||||
$plans = $this->productplan->getGroupByProduct(array_keys($linkedProducts), 'skipParent|unexpired');
|
||||
|
||||
+50
-21
@@ -66,37 +66,66 @@ $(function()
|
||||
adjustProductBoxMargin();
|
||||
adjustPlanBoxMargin();
|
||||
|
||||
/* 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");
|
||||
$(this).siblings('div').find('span').attr('title', tip);
|
||||
}
|
||||
});
|
||||
var current = $(this).val();
|
||||
var last = $(this).attr('data-last');
|
||||
var lastBranch = $(this).attr('data-lastBranch');
|
||||
|
||||
$("#productsBox select[name^='branch']").each(function()
|
||||
{
|
||||
var branchID = $(this).attr('data-last');
|
||||
var isExistedBranch = $.inArray(branchID, unmodifiableBranches);
|
||||
if(isExistedBranch != -1)
|
||||
$(this).attr('data-last', current);
|
||||
|
||||
var $branch = $(this).closest('.has-branch').find("[name^='branch']");
|
||||
if($branch !== undefined)
|
||||
{
|
||||
var $product = $(this).closest('.has-branch').find("[name^='products']");
|
||||
if($.inArray($product.val(), unmodifiableProducts) != -1)
|
||||
var branchID = $branch.val();
|
||||
$(this).attr('data-lastBranch', branchID);
|
||||
}
|
||||
else
|
||||
{
|
||||
$(this).removeAttr('data-lastBranch');
|
||||
}
|
||||
|
||||
if(current != last && $.inArray(last, unmodifiableProducts) != -1)
|
||||
{
|
||||
if(lastBranch)
|
||||
{
|
||||
if((branchID == 0 && unmodifiableMainBranches[$product.val()]) || branchID != 0)
|
||||
if($.inArray(lastBranch, unmodifiableBranches) != -1)
|
||||
{
|
||||
$(this).prop('disabled', true).trigger("chosen:updated");
|
||||
$product.prop('disabled', true).trigger("chosen:updated");
|
||||
$product.siblings('div').find('span').attr('title', tip);
|
||||
if((lastBranch == 0 && unmodifiableMainBranches[last]) || lastBranch != 0)
|
||||
{
|
||||
bootbox.alert(unLinkProductTip.replace("%s", allProducts[last]));
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
bootbox.alert(unLinkProductTip.replace("%s", allProducts[last]));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$(document).on('change', '[name*=branch]', function()
|
||||
{
|
||||
var current = $(this).val();
|
||||
var last = $(this).attr('data-last');
|
||||
$(this).attr('data-last', current);
|
||||
|
||||
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)
|
||||
{
|
||||
if((last == 0 && unmodifiableMainBranches[productID]) || last != 0)
|
||||
{
|
||||
bootbox.alert(unLinkProductTip.replace("%s", branchGroups[productID][last]));
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
/* If end is longtime, set the default date to today */
|
||||
var today = $.zui.formatDate(new Date(), 'yyyy-MM-dd');
|
||||
if($('#end').val() == longTime) $('#end').val(today).datetimepicker('update').val(longTime);
|
||||
|
||||
@@ -211,6 +211,7 @@ $lang->project->noDevStage = 'There is no R&D stage under this proje
|
||||
$lang->project->budgetOverrun = "The project's budget exceeds the remaining budget of the parent program:";
|
||||
$lang->project->disabledInputTip = 'Please cancel %s first';
|
||||
$lang->project->linkRepoFailed = 'Failed to link projects and code repositories.';
|
||||
$lang->project->unLinkProductTip = 'Are you sure you want to unlink %s? (Does not affect linked requirements)';
|
||||
|
||||
$lang->project->tenThousand = '';
|
||||
$lang->project->hundredMillion = 'Hundred Million';
|
||||
|
||||
@@ -211,6 +211,7 @@ $lang->project->noDevStage = 'There is no R&D stage under this proje
|
||||
$lang->project->budgetOverrun = "The project's budget exceeds the remaining budget of the parent program:";
|
||||
$lang->project->disabledInputTip = 'Please cancel %s first';
|
||||
$lang->project->linkRepoFailed = 'Failed to link projects and code repositories.';
|
||||
$lang->project->unLinkProductTip = 'Are you sure you want to unlink %s? (Does not affect linked requirements)';
|
||||
|
||||
$lang->project->tenThousand = 'Ten Thousand';
|
||||
$lang->project->hundredMillion = 'Hundred Million';
|
||||
|
||||
@@ -210,6 +210,7 @@ $lang->project->noDevStage = "Il n'y a pas de phase R&D dans ce proj
|
||||
$lang->project->budgetOverrun = "Le budget du projet a dépassé le budget restant du programme parent:";
|
||||
$lang->project->disabledInputTip = 'Please cancel %s first';
|
||||
$lang->project->linkRepoFailed = 'Failed to link projects and code repositories.';
|
||||
$lang->project->unLinkProductTip = 'Are you sure you want to unlink %s? (Does not affect linked requirements)';
|
||||
|
||||
$lang->project->tenThousand = '';
|
||||
$lang->project->hundredMillion = 'Hundred Million';
|
||||
|
||||
@@ -211,6 +211,7 @@ $lang->project->noDevStage = '该项目下没有研发类型的阶
|
||||
$lang->project->budgetOverrun = '项目的预算超出了父项目集的剩余预算:';
|
||||
$lang->project->disabledInputTip = '请先取消%s';
|
||||
$lang->project->linkRepoFailed = '关联代码库失败';
|
||||
$lang->project->unLinkProductTip = "您确认要取消与%s的关联关系吗?(不影响已关联的需求)";
|
||||
|
||||
$lang->project->tenThousand = '万';
|
||||
$lang->project->hundredMillion = '亿';
|
||||
|
||||
@@ -37,6 +37,9 @@
|
||||
<?php js::set('beginLetterParent', $lang->project->beginLetterParent);?>
|
||||
<?php js::set('endGreaterParent', $lang->project->endGreaterParent);?>
|
||||
<?php js::set('ignore', $lang->project->ignore);?>
|
||||
<?php js::set('allProducts', $allProducts);?>
|
||||
<?php js::set('branchGroups', $branchGroups);?>
|
||||
<?php js::set('unLinkProductTip', $lang->project->unLinkProductTip);?>
|
||||
<div id='mainContent' class='main-content'>
|
||||
<div class='center-block'>
|
||||
<div class='main-header'>
|
||||
@@ -152,7 +155,7 @@
|
||||
<?php foreach($linkedBranches[$product->id] as $branchID => $branch):?>
|
||||
<div class='col-sm-4' style="padding-right: 6px;">
|
||||
<div class="input-group<?php if($hasBranch) echo ' has-branch';?>">
|
||||
<?php echo html::select("products[$i]", $allProducts, $product->id, "class='form-control chosen' onchange='loadBranches(this)' data-last='" . $product->id . "' data-type='" . $product->type . "'");?>
|
||||
<?php echo html::select("products[$i]", $allProducts, $product->id, "class='form-control chosen' 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' onchange=\"loadPlans('#products{$i}', this.value)\" data-last='" . $branchID . "'");?>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user