* Finish task #8521.
This commit is contained in:
@@ -30,6 +30,19 @@ function setCopyProject(copyProjectID)
|
||||
location.href = createLink('program', 'PRJCreate', 'model=' + model + '&programID=' + programID + '&from=' + from + '©ProjectID=' + copyProjectID);
|
||||
}
|
||||
|
||||
function addNewProduct(obj)
|
||||
{
|
||||
if($(obj).attr('checked'))
|
||||
{
|
||||
$('#productName').closest('tr').removeClass('hidden');
|
||||
}
|
||||
else
|
||||
{
|
||||
$('#productName').closest('tr').addClass('hidden');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function setAclList(programID)
|
||||
{
|
||||
if(programID != 0)
|
||||
@@ -66,7 +79,9 @@ function loadBranches(product)
|
||||
if($('#productsBox .input-group:last select:first').val() != 0)
|
||||
{
|
||||
var length = $('#productsBox .input-group').size();
|
||||
$('#productsBox .row').append('<div class="col-sm-4">' + $('#productsBox .col-sm-4:last').html() + '</div>');
|
||||
var $html = $('#productsBox .col-sm-4:last').html();
|
||||
$('#productsBox .col-sm-4:last').find('.input-group-addon').remove();
|
||||
$('#productsBox .row').append('<div class="col-sm-4">' + $html + '</div>');
|
||||
if($('#productsBox .input-group:last select').size() >= 2) $('#productsBox .input-group:last select:last').remove();
|
||||
$('#productsBox .input-group:last .chosen-container').remove();
|
||||
$('#productsBox .input-group:last select:first').attr('name', 'products[' + length + ']').attr('id', 'products' + length);
|
||||
|
||||
@@ -22,6 +22,7 @@ $lang->program->PRJManageView = 'Manage View';
|
||||
$lang->program->PRJManagePriv = 'Manage Privilege';
|
||||
$lang->program->PRJManageMembers = 'Manage Team';
|
||||
$lang->program->export = 'Export';
|
||||
$lang->program->addProduct = 'Add product';
|
||||
$lang->program->PRJManageGroupMember = 'Manage Group';
|
||||
$lang->program->PRJModuleSetting = 'List Settings';
|
||||
$lang->program->PRJModuleOpen = 'Program Name';
|
||||
|
||||
@@ -22,6 +22,7 @@ $lang->program->PRJManageView = 'Manage View';
|
||||
$lang->program->PRJManagePriv = 'Manage Privilege';
|
||||
$lang->program->PRJManageMembers = 'Manage Team';
|
||||
$lang->program->export = 'Export';
|
||||
$lang->program->addProduct = 'Add Product';
|
||||
$lang->program->PRJManageGroupMember = 'Manage Group';
|
||||
$lang->program->PRJModuleSetting = 'List Settings';
|
||||
$lang->program->PRJModuleOpen = 'Program Name';
|
||||
|
||||
@@ -22,6 +22,7 @@ $lang->program->PRJManageView = 'Manage View';
|
||||
$lang->program->PRJManagePriv = 'Manage Privilege';
|
||||
$lang->program->PRJManageMembers = 'Manage Team';
|
||||
$lang->program->export = 'Export';
|
||||
$lang->program->addProduct = 'Add product';
|
||||
$lang->program->PRJManageGroupMember = 'Manage Group';
|
||||
$lang->program->PRJModuleSetting = 'List Settings';
|
||||
$lang->program->PRJModuleOpen = 'Program Name';
|
||||
|
||||
@@ -22,6 +22,7 @@ $lang->program->PRJManageView = 'Manage View';
|
||||
$lang->program->PRJManagePriv = 'Manage Privilege';
|
||||
$lang->program->PRJManageMembers = 'Manage Team';
|
||||
$lang->program->export = 'Export';
|
||||
$lang->program->addProduct = 'Add product';
|
||||
$lang->program->PRJManageGroupMember = 'Manage Group';
|
||||
$lang->program->PRJModuleSetting = 'List Settings';
|
||||
$lang->program->PRJModuleOpen = 'Program Name';
|
||||
|
||||
@@ -22,6 +22,7 @@ $lang->program->PRJManageView = '项目维护视野';
|
||||
$lang->program->PRJManagePriv = '项目维护权限';
|
||||
$lang->program->PRJManageMembers = '项目团队';
|
||||
$lang->program->export = '导出';
|
||||
$lang->program->addProduct = '新建产品';
|
||||
$lang->program->PRJManageGroupMember = '维护分组用户';
|
||||
$lang->program->PRJModuleSetting = '列表设置';
|
||||
$lang->program->PRJModuleOpen = '显示项目集名';
|
||||
@@ -91,7 +92,7 @@ $lang->program->cv = 'CV%';
|
||||
$lang->program->PRJTeamCount = '项目成员';
|
||||
$lang->program->PRJLongTime = '长期';
|
||||
|
||||
$lang->program->productNotEmpty = '请关联产品或创建产品。';
|
||||
$lang->program->productNotEmpty = '请关联产品或创建产品。';
|
||||
|
||||
$lang->program->unitList[''] = '';
|
||||
$lang->program->unitList['yuan'] = '元';
|
||||
|
||||
@@ -1215,7 +1215,7 @@ class programModel extends model
|
||||
->join('whitelist', ',')
|
||||
->cleanInt('budget')
|
||||
->stripTags($this->config->program->editor->prjcreate['id'], $this->config->allowedTags)
|
||||
->remove('products,branch,plans,delta')
|
||||
->remove('products,branch,plans,delta,newProduct,productName')
|
||||
->get();
|
||||
|
||||
if($project->parent)
|
||||
@@ -1238,7 +1238,7 @@ class programModel extends model
|
||||
{
|
||||
if(!empty($product)) $linkedProductsCount++;
|
||||
}
|
||||
if(empty($linkedProductsCount))
|
||||
if(empty($linkedProductsCount) and !$this->post->productName)
|
||||
{
|
||||
dao::$errors[] = $this->lang->program->productNotEmpty;
|
||||
return false;
|
||||
@@ -1300,6 +1300,30 @@ class programModel extends model
|
||||
$this->dao->insert(TABLE_PROJECTPRODUCT)->data($projectProduct)->exec();
|
||||
}
|
||||
|
||||
/* If add product. */
|
||||
if(isset($this->post->newProduct))
|
||||
{
|
||||
/* If parent not empty, link products or create products. */
|
||||
$product = new stdclass();
|
||||
$product->name = $this->post->productName;
|
||||
$product->code = $this->post->productName;
|
||||
$product->acl = $project->acl = 'open' ? 'open' : 'private';
|
||||
$product->PO = $project->PM;
|
||||
$product->createdBy = $this->app->user->account;
|
||||
$product->createdDate = helper::now();
|
||||
$product->status = 'normal';
|
||||
|
||||
$this->dao->insert(TABLE_PRODUCT)->data($product)->exec();
|
||||
$productID = $this->dao->lastInsertId();
|
||||
if($product->acl != 'open') $this->loadModel('user')->updateUserView($productID, 'product');
|
||||
|
||||
$projectProduct = new stdclass();
|
||||
$projectProduct->project = $projectID;
|
||||
$projectProduct->product = $productID;
|
||||
|
||||
$this->dao->insert(TABLE_PROJECTPRODUCT)->data($projectProduct)->exec();
|
||||
}
|
||||
|
||||
/* Save order. */
|
||||
$this->dao->update(TABLE_PROJECT)->set('`order`')->eq($projectID * 5)->where('id')->eq($projectID)->exec();
|
||||
$this->file->updateObjectID($this->post->uid, $projectID, 'project');
|
||||
|
||||
@@ -49,7 +49,7 @@ else
|
||||
<div id='mainContent' class='main-content'>
|
||||
<div class='center-block'>
|
||||
<div class='main-header'>
|
||||
<h2><?php echo $lang->program->PRJCreate;?></h2>
|
||||
<h2><?php echo $lang->program->PRJCreate . ' - ' . zget($lang->program->modelList, $model, '');?></h2>
|
||||
<div class="pull-right btn-toolbar">
|
||||
<button type='button' class='btn btn-link' data-toggle='modal' data-target='#copyProjectModal'><?php echo html::icon($lang->icons['copy'], 'muted') . ' ' . $lang->program->PRJCopy;?></button>
|
||||
</div>
|
||||
@@ -57,12 +57,7 @@ else
|
||||
<form class='form-indicator main-form form-ajax' method='post' target='hiddenwin' id='dataform'>
|
||||
<table class='table table-form'>
|
||||
<tr>
|
||||
<th class='w-120px'><?php echo $lang->program->PRJTemplate;?></th>
|
||||
<td><?php echo zget($lang->program->modelList, $model, '');?></td><td></td><td>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->program->PGMParent;?></th>
|
||||
<th class='w-120px'><?php echo $lang->program->PGMParent;?></th>
|
||||
<td><?php echo html::select('parent', $programList, $programID, "class='form-control chosen' onchange='setParentProgram(this.value)'");?></td>
|
||||
<td>
|
||||
<icon class='icon icon-help' data-toggle='tooltip' data-placement='right' title=<?php echo $lang->program->PGMTips;?>></icon>
|
||||
@@ -77,6 +72,10 @@ else
|
||||
<th><?php echo $lang->program->PRJCode;?></th>
|
||||
<td><?php echo html::input('code', $code, "class='form-control' required");?></td><td></td><td></td>
|
||||
</tr>
|
||||
<tr class='hidden'>
|
||||
<th><?php echo $lang->product->name;?></th>
|
||||
<td><?php echo html::input('productName', '', "class='form-control' required");?></td><td></td><td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->project->manageProducts;?></th>
|
||||
<td class='text-left' id='productsBox' colspan="3">
|
||||
@@ -96,7 +95,7 @@ else
|
||||
<div class='col-sm-4 <?php if($programID) echo 'required';?>'>
|
||||
<div class='input-group'>
|
||||
<?php echo html::select("products[$i]", $allProducts, '', "class='form-control chosen' onchange='loadBranches(this)'");?>
|
||||
<span class='input-group-addon fix-border'></span>
|
||||
<span class='input-group-addon'><?php echo html::checkBox('newProduct', $lang->program->addProduct, '', "onchange=addNewProduct(this);");?></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -28,12 +28,7 @@
|
||||
<form class='form-indicator main-form form-ajax' method='post' target='hiddenwin' id='dataform'>
|
||||
<table class='table table-form'>
|
||||
<tr>
|
||||
<th class='w-120px'><?php echo $lang->program->PRJTemplate;?></th>
|
||||
<td><?php echo zget($lang->program->modelList, $project->model, '');?></td><td></td><td>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->program->PGMParent;?></th>
|
||||
<th class='w-120px'><?php echo $lang->program->PGMParent;?></th>
|
||||
<td><?php echo html::select('parent', $programList, $programID ? $programID : $project->parent, "class='form-control chosen' onchange='setParentProgram(this.value)'");?></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
|
||||
Reference in New Issue
Block a user