Merge branch 'sprint/copyproject' into 'master'
Sprint/copyproject See merge request easycorp/zentaopms!4847
This commit is contained in:
@@ -655,8 +655,11 @@ class programplanModel extends model
|
||||
$parentACL = $parentStage->acl;
|
||||
}
|
||||
|
||||
$names = array_filter($names);
|
||||
if(count(array_unique($names)) != count($names)) return dao::$errors['message'][] = $this->lang->programplan->error->sameName;
|
||||
if(!$this->checkNameUnique($names))
|
||||
{
|
||||
dao::$errors['message'][] = $this->lang->programplan->error->sameName;
|
||||
return false;
|
||||
}
|
||||
|
||||
$datas = array();
|
||||
foreach($names as $key => $name)
|
||||
@@ -1174,6 +1177,20 @@ class programplanModel extends model
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check name unique.
|
||||
*
|
||||
* @param array $names
|
||||
* @access public
|
||||
* @return bool
|
||||
*/
|
||||
public function checkNameUnique($names)
|
||||
{
|
||||
$names = array_filter($names);
|
||||
if(count(array_unique($names)) != count($names)) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the stage set to milestone.
|
||||
*
|
||||
|
||||
@@ -571,7 +571,7 @@ class project extends control
|
||||
$this->view->availableBudget = $this->program->getBudgetLeft($parentProgram);
|
||||
$this->view->budgetUnitList = $this->project->getBudgetUnitList();
|
||||
|
||||
$this->display();
|
||||
$this->display('project', 'create');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -31,6 +31,16 @@ $(function()
|
||||
var products = new Array();
|
||||
var existedBranch = false;
|
||||
|
||||
/* Remove init tips. */
|
||||
$('#name').removeClass('has-info');
|
||||
$('#nameLabelInfo').remove();
|
||||
$('#code').removeClass('has-info');
|
||||
$('#codeLabelInfo').remove();
|
||||
$('#end').removeClass('has-info');
|
||||
$('#endLabelInfo').remove();
|
||||
$('#days').removeClass('has-info');
|
||||
$('#daysLabelInfo').remove();
|
||||
|
||||
/* Determine whether the products of the same branch are linked. */
|
||||
$("#productsBox select[name^='products']").each(function()
|
||||
{
|
||||
@@ -82,6 +92,18 @@ $(function()
|
||||
});
|
||||
|
||||
$(document).on('change', "select[id^='branch']", disableSelectedBranch);
|
||||
|
||||
if(copyProjectID > 0 && copyType != 'previous')
|
||||
{
|
||||
$('#name').addClass('has-info')
|
||||
$('#name').after('<div id="nameLabelInfo" class="text-info">' + nameTips + '</div>')
|
||||
$('#code').addClass('has-info')
|
||||
$('#code').after('<div id="codeLabelInfo" class="text-info">' + codeTips + '</div>')
|
||||
$('#end').addClass('has-info')
|
||||
$('#end').parent().after('<div id="endLabelInfo" class="text-info">' + endTips + '</div>')
|
||||
$('#days').addClass('has-info')
|
||||
$('#days').parent().after('<div id="daysLabelInfo" class="text-info">' + daysTips + '</div>')
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
@@ -307,7 +329,7 @@ $('#projectName').on('keyup', function()
|
||||
var name = $(this).val();
|
||||
name = name.replace(/\s+/g, '');
|
||||
link = createLink('project', 'ajaxGetCopyProjects');
|
||||
$.post(link, {name: name, cpoyProjectID : copyProjectID}, function(data)
|
||||
$.post(link, {name: name, cpoyProjectID: copyProjectID, model: model}, function(data)
|
||||
{
|
||||
$('#copyProjects').html(data);
|
||||
$('#copyProjects a').click(function()
|
||||
@@ -317,3 +339,32 @@ $('#projectName').on('keyup', function()
|
||||
});
|
||||
})
|
||||
})
|
||||
|
||||
/* Click remove tips. */
|
||||
$("#name").click(function()
|
||||
{
|
||||
$('#name').removeClass('has-info');
|
||||
$('#nameLabelInfo').remove();
|
||||
});
|
||||
$("#code").click(function()
|
||||
{
|
||||
$('#code').removeClass('has-info');
|
||||
$('#codeLabelInfo').remove();
|
||||
});
|
||||
$("#end").click(function()
|
||||
{
|
||||
$('#end').removeClass('has-info');
|
||||
$('#endLabelInfo').remove();
|
||||
});
|
||||
$("#days").click(function()
|
||||
{
|
||||
$('#days').removeClass('has-info');
|
||||
$('#daysLabelInfo').remove();
|
||||
});
|
||||
$("#endList input[type=radio]").click(function()
|
||||
{
|
||||
$('#end').removeClass('has-info');
|
||||
$('#endLabelInfo').remove();
|
||||
$('#days').removeClass('has-info');
|
||||
$('#daysLabelInfo').remove();
|
||||
});
|
||||
|
||||
@@ -331,4 +331,4 @@ $lang->project->childLongTime = "There are long-term projects in the child
|
||||
$lang->project->confirmUnlinkMember = "Do you want to remove this user from project?";
|
||||
|
||||
$lang->project->action = new stdclass();
|
||||
$lang->project->action->managed = '$date, managed by <strong>$actor</strong>. $extra' . "\n";
|
||||
$lang->project->action->managed = '$date, managed by <strong>$actor</strong>. $extra' . "\n";
|
||||
@@ -1093,6 +1093,7 @@ class projectModel extends model
|
||||
->stripTags($this->config->project->editor->create['id'], $this->config->allowedTags)
|
||||
->remove('products,branch,plans,delta,newProduct,productName,future,contactListMenu,teamMembers')
|
||||
->get();
|
||||
if(!isset($this->config->setCode) or $this->config->setCode == 1) unset($project->code);
|
||||
|
||||
$linkedProductsCount = 0;
|
||||
if(isset($_POST['products']))
|
||||
|
||||
@@ -35,7 +35,11 @@
|
||||
<h2><?php echo $createTitle;?></h2>
|
||||
<?php if(!commonModel::isTutorialMode()): ?>
|
||||
<div class="pull-right btn-toolbar">
|
||||
<?php if($config->edition != 'max' || $model == 'kanban'):?>
|
||||
<button type='button' class='btn btn-link' data-toggle='modal' data-target='#copyProjectModal'><?php echo html::icon($lang->icons['copy'], 'muted') . ' ' . $lang->project->copy;?></button>
|
||||
<?php else: ?>
|
||||
<button type='button' class='btn btn-link' data-toggle='modal' data-target='#maxCopyProjectModal'><?php echo html::icon($lang->icons['copy'], 'muted') . ' ' . $lang->project->copy;?></button>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 1.5 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 1011 B |
Binary file not shown.
|
After Width: | Height: | Size: 316 B |
Binary file not shown.
|
After Width: | Height: | Size: 1.1 KiB |
Reference in New Issue
Block a user