Merge branch 'sprint/222_zhouxudong_62850' into 'sprint/222'
Sprint/222 zhouxudong 62850 See merge request easycorp/zentaopms!4779
This commit is contained in:
@@ -219,6 +219,40 @@ class project extends control
|
||||
echo json_encode($productsWithBranch);
|
||||
}
|
||||
|
||||
/**
|
||||
* Ajax get available budget.
|
||||
*
|
||||
* @param int $programID
|
||||
* @param int $selectedProgramID
|
||||
* @param int $budget
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function ajaxGetAvailableBudget($projectID, $selectedProgramID, $budget)
|
||||
{
|
||||
if(!empty($projectID))
|
||||
{
|
||||
$project = $this->project->getByID($projectID);
|
||||
$selectedProgram = $this->loadModel('program')->getByID($selectedProgramID);
|
||||
$budgetLeft = $this->program->getBudgetLeft($selectedProgram);
|
||||
$availableBudget = $project->parent == $selectedProgramID ? $budgetLeft + $project->budget : $budgetLeft;
|
||||
}
|
||||
else
|
||||
{
|
||||
$selectedProgram = $this->loadModel('program')->getByID($selectedProgramID);
|
||||
$availableBudget = $this->program->getBudgetLeft($selectedProgram);
|
||||
}
|
||||
|
||||
$tip = '';
|
||||
if($budget != 0 && $budget !== null && $budget > $availableBudget) $tip = "<span id='beyondBudgetTip' class='text-remind'>" . $this->lang->project->budgetOverrun . zget($this->lang->project->currencySymbol, $selectedProgram->budgetUnit) . $availableBudget . "</span>";
|
||||
|
||||
$placeholder = '';
|
||||
if($selectedProgram and $selectedProgram->budget != 0) $placeholder = $this->lang->project->parentBudget . zget($this->lang->project->currencySymbol, $selectedProgram->budgetUnit) . $availableBudget;
|
||||
|
||||
$tipList = array('tip' => $tip, 'placeholder' => $placeholder);
|
||||
echo json_encode($tipList);
|
||||
}
|
||||
|
||||
/**
|
||||
* Project index view.
|
||||
*
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
.future {display: inline-block;}
|
||||
.c-number {overflow: hidden; text-align: right !important; text-overflow: ellipsis; white-space: nowrap;}
|
||||
.text-remind {color: #ffa34d;}
|
||||
|
||||
@@ -21,3 +21,6 @@
|
||||
#productsBox .input-group-addon > div {display: inline-block !important;}
|
||||
#plansBox .row {display: inline-table; width: 102%;}
|
||||
#plansBox .col-sm-4 {float: none; display: inline-block; padding-right: 5px;}
|
||||
#dataform th {vertical-align: top; padding-top: 13px;}
|
||||
.futureBox {vertical-align: top !important; padding-top: 13px !important;}
|
||||
#linkPlan {padding-top: 25px !important;}
|
||||
|
||||
@@ -2,5 +2,7 @@
|
||||
#budgetUnit {border-left: 0px;}
|
||||
#plansBox .row {display: inline-table; width: 102%;}
|
||||
#plansBox .col-sm-4 {float: none; display: inline-block;}
|
||||
#dateRange {vertical-align: top; padding-top: 13px;}
|
||||
#dateRange, .futureBox {vertical-align: top !important; padding-top: 13px !important;}
|
||||
#endList {vertical-align: top; padding-top: 13px;}
|
||||
#dataform th {vertical-align: top; padding-top: 13px;}
|
||||
#linkPlan {padding-top: 25px !important;}
|
||||
|
||||
@@ -287,6 +287,7 @@ $(function()
|
||||
if($(this).prop('checked'))
|
||||
{
|
||||
$('#budget').val('').attr('disabled', 'disabled');
|
||||
if($('#beyondBudgetTip').length > 0) $('#beyondBudgetTip').remove();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -343,3 +344,33 @@ $(document).on('change', "#plansBox select[name^='plans']", function()
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
/**
|
||||
* Append prompt when the budget exceeds the parent project set.
|
||||
*
|
||||
* @param int $projectID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function budgetOverrunTips(projectID = 0)
|
||||
{
|
||||
var selectedProgramID = $('#parent').val();
|
||||
var budget = $('#budget').val();
|
||||
|
||||
if(selectedProgramID == 0)
|
||||
{
|
||||
if($('#beyondBudgetTip').length > 0) $('#beyondBudgetTip').remove();
|
||||
return false;
|
||||
}
|
||||
|
||||
$.get(createLink('project', 'ajaxGetAvailableBudget', 'projectID=' + projectID + "&selectedProgramID=" + selectedProgramID + "&budget=" + budget), function(data)
|
||||
{
|
||||
var data = JSON.parse(data);
|
||||
|
||||
if($('#beyondBudgetTip').length > 0) $('#beyondBudgetTip').remove();
|
||||
$('#budgetBox').after(data.tip);
|
||||
|
||||
if($('#budget').attr('placeholder')) $('#budget').removeAttr('placeholder')
|
||||
$('#budget').attr('placeholder', data.placeholder);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ $(function()
|
||||
{
|
||||
var programID = $(this).val();
|
||||
setAclList(programID);
|
||||
budgetOverrunTips(projectID);
|
||||
|
||||
/* Determine whether the project can change the project set. */
|
||||
link = createLink('project', 'ajaxCheckProduct', 'programID=' + programID + '&projectID=' + projectID);
|
||||
|
||||
@@ -196,6 +196,7 @@ $lang->project->unlinkExecutionMember = "The user participated in %s executions
|
||||
$lang->project->unlinkExecutionMembers = "The team members you are removing are also in the execution team of this project. Do you want to remove them from the execution team too?";
|
||||
$lang->project->productTip = 'After clicking New Product, the project will not be linked to the selected product.';
|
||||
$lang->project->noDevStage = 'There is no R&D stage under this project, or you do not have access permissions. The creation of builds is not supported at the moment.';
|
||||
$lang->project->budgetOverrun = "The project's budget has exceeded the remaining budget of the parent program:";
|
||||
|
||||
$lang->project->tenThousand = '';
|
||||
$lang->project->hundredMillion = 'Hundred Million';
|
||||
|
||||
@@ -196,6 +196,7 @@ $lang->project->unlinkExecutionMember = "The user participated in %s executions
|
||||
$lang->project->unlinkExecutionMembers = "The team members you are removing are also in the execution team of this project. Do you want to remove them from the execution team too?";
|
||||
$lang->project->productTip = 'After clicking New Product, the project will not be linked to the selected product.';
|
||||
$lang->project->noDevStage = 'There is no R&D stage under this project, or you do not have access permissions. The creation of builds is not supported at the moment.';
|
||||
$lang->project->budgetOverrun = "The project's budget has exceeded the remaining budget of the parent program:";
|
||||
|
||||
$lang->project->tenThousand = 'Ten Thousand';
|
||||
$lang->project->hundredMillion = 'Hundred Million';
|
||||
|
||||
@@ -196,6 +196,7 @@ $lang->project->unlinkExecutionMember = "The user participated in %s executions
|
||||
$lang->project->unlinkExecutionMembers = "The team members you are removing are also in the execution team of this project. Do you want to remove them from the execution team too?";
|
||||
$lang->project->productTip = 'After clicking New Product, the project will not be linked to the selected product.';
|
||||
$lang->project->noDevStage = "Il n'y a pas de phase R&D dans ce projet, ou vous n'avez pas la permission d'accès. La version ne peut pas être créée pour le moment.";
|
||||
$lang->project->budgetOverrun = "Le budget du projet a dépassé le budget restant du programme parent:";
|
||||
|
||||
$lang->project->tenThousand = '';
|
||||
$lang->project->hundredMillion = 'Hundred Million';
|
||||
|
||||
@@ -196,6 +196,7 @@ $lang->project->unlinkExecutionMember = "该用户参与了%s%s%s个{$lang->exe
|
||||
$lang->project->unlinkExecutionMembers = "移除的团队成员还参与了项目下的执行,是否同步从执行团队中移除?";
|
||||
$lang->project->productTip = '点击新建产品后,项目将不会关联已选中的产品。';
|
||||
$lang->project->noDevStage = '该项目下没有研发类型的阶段,或者您没有权限访问,暂时不支持创建版本。';
|
||||
$lang->project->budgetOverrun = '项目的预算已超出父项目集的剩余预算:';
|
||||
|
||||
$lang->project->tenThousand = '万';
|
||||
$lang->project->hundredMillion = '亿';
|
||||
|
||||
@@ -1111,7 +1111,7 @@ class projectModel extends model
|
||||
/* Judge products not empty. */
|
||||
if(empty($linkedProductsCount) and !isset($_POST['newProduct']))
|
||||
{
|
||||
dao::$errors[] = $this->lang->project->productNotEmpty;
|
||||
dao::$errors['products0'] = $this->lang->project->productNotEmpty;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,9 +68,9 @@
|
||||
<tr>
|
||||
<th><?php echo $lang->project->budget;?></th>
|
||||
<td>
|
||||
<div class='input-group'>
|
||||
<?php $placeholder = ($parentProgram and $parentProgram->budget != 0) ? 'placeholder=' . $lang->program->parentBudget . zget($lang->project->currencySymbol, $parentProgram->budgetUnit) . $availableBudget : '';?>
|
||||
<?php echo html::input('budget', '', "class='form-control' maxlength='10' " . (strpos($requiredFields, 'budget') !== false ? 'required ' : '') . $placeholder);?>
|
||||
<div id='budgetBox' class='input-group'>
|
||||
<?php $placeholder = ($parentProgram and $parentProgram->budget != 0) ? 'placeholder="' . $lang->program->parentBudget . zget($lang->project->currencySymbol, $parentProgram->budgetUnit) . $availableBudget . '"' : '';?>
|
||||
<?php echo html::input('budget', '', "class='form-control' onchange='budgetOverrunTips()' maxlength='10' " . (strpos($requiredFields, 'budget') !== false ? 'required ' : '') . $placeholder);?>
|
||||
<?php if($parentProgram):?>
|
||||
<span class='input-group-addon'><?php echo zget($budgetUnitList, $parentProgram->budgetUnit);?></span>
|
||||
<?php else:?>
|
||||
@@ -79,7 +79,7 @@
|
||||
<?php endif;?>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<td class='futureBox'>
|
||||
<div class="checkbox-primary c-future <?php echo strpos($requiredFields, 'budget') !== false ? 'hidden' : '';?>">
|
||||
<input type='checkbox' id='future' name='future' value='1' />
|
||||
<label for='future'><?php echo $lang->project->future;?></label>
|
||||
@@ -145,7 +145,7 @@
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->execution->linkPlan;?></th>
|
||||
<th id='linkPlan'><?php echo $lang->execution->linkPlan;?></th>
|
||||
<td colspan="3" id="plansBox">
|
||||
<div class='row'>
|
||||
<?php if($copyProjectID):?>
|
||||
|
||||
@@ -74,9 +74,9 @@
|
||||
<tr>
|
||||
<th><?php echo $lang->project->budget;?></th>
|
||||
<td>
|
||||
<div class='input-group'>
|
||||
<?php $placeholder = ($parentProgram and $parentProgram->budget != 0) ? 'placeholder=' . $lang->project->parentBudget . zget($lang->project->currencySymbol, $parentProgram->budgetUnit) . $availableBudget : '';?>
|
||||
<?php echo html::input('budget', $project->budget != 0 ? $project->budget : '', "class='form-control' maxlength='10' " . (strpos($requiredFields, 'budget') !== false ? 'required ' : '') . ($project->budget == 0 ? 'disabled ' : '') . $placeholder);?>
|
||||
<div id='budgetBox' class='input-group'>
|
||||
<?php $placeholder = ($parentProgram and $parentProgram->budget != 0) ? 'placeholder="' . $lang->project->parentBudget . zget($lang->project->currencySymbol, $parentProgram->budgetUnit) . $availableBudget . '"' : '';?>
|
||||
<?php echo html::input('budget', $project->budget != 0 ? $project->budget : '', "class='form-control' onchange='budgetOverrunTips($project->id)' maxlength='10' " . (strpos($requiredFields, 'budget') !== false ? 'required ' : '') . ($project->budget == 0 ? 'disabled ' : '') . $placeholder);?>
|
||||
<?php if($parentProgram):?>
|
||||
<span class='input-group-addon'><?php echo zget($budgetUnitList, $project->budgetUnit);?></span>
|
||||
<?php else:?>
|
||||
@@ -85,7 +85,7 @@
|
||||
<?php endif;?>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<td class='futureBox'>
|
||||
<div class='checkbox-primary'>
|
||||
<input type='checkbox' id='future' name='future' value='1' <?php if($project->budget == 0) echo 'checked';?> />
|
||||
<label for='future'><?php echo $lang->project->future;?></label>
|
||||
@@ -153,7 +153,7 @@
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->execution->linkPlan;?></th>
|
||||
<th id='linkPlan'><?php echo $lang->execution->linkPlan;?></th>
|
||||
<td id="plansBox" colspan="3">
|
||||
<div class='row'>
|
||||
<?php $i = 0;?>
|
||||
|
||||
Reference in New Issue
Block a user