* Fix bug #13927.
This commit is contained in:
@@ -39,4 +39,28 @@ $(function()
|
||||
})
|
||||
|
||||
$('#isCat').change();
|
||||
|
||||
$('#budgetUnit').change(function()
|
||||
{
|
||||
if($(this).val() != oldBudgetUnit)
|
||||
{
|
||||
$('#currentUnit').text(budgetUnitList[$(this).val()]);
|
||||
$('#changeUnitTip').modal({show: true});
|
||||
}
|
||||
})
|
||||
|
||||
$('#cancel').click(function()
|
||||
{
|
||||
$('#isChangeUnit').val(false);
|
||||
$('#exchangeRate').val('');
|
||||
})
|
||||
|
||||
$('#confirm').click(function()
|
||||
{
|
||||
var exchangeRate = $('#rate').val();
|
||||
|
||||
$('#isChangeUnit').val(true);
|
||||
$('#exchangeRate').val(exchangeRate);
|
||||
$('#changeUnitTip').modal('hide');
|
||||
})
|
||||
});
|
||||
|
||||
@@ -52,6 +52,8 @@ $lang->program->beginGreateChild = "Child earliest begin: %s, parent begi
|
||||
$lang->program->endLetterChild = "Child latest end: %s, parent end date > = child latest end date.";
|
||||
$lang->program->closeErrorMessage = 'There are subprograms or projects that are not closed';
|
||||
$lang->program->confirmDelete = "Do you want to delete it?";
|
||||
$lang->program->confirmChangePRJUint = 'Do you want to update the budget unit of the project of the program? If yes, please the current exchange rate.';
|
||||
$lang->program->changePRJUnit = 'Update the budget unit of the project';
|
||||
$lang->program->hasChildren = 'It has child programs or projects. You cannot delete it.';
|
||||
$lang->program->readjustTime = 'Change the program begin&end date.';
|
||||
|
||||
|
||||
@@ -55,6 +55,8 @@ $lang->program->endLetterChild = "Child latest end: %s, parent end date
|
||||
$lang->program->closeErrorMessage = 'There are subprograms or projects that are not closed';
|
||||
$lang->program->hasChildren = 'The program has a child program or the project exists and can not be deleted.';
|
||||
$lang->program->confirmDelete = "Do you want to delete it?";
|
||||
$lang->program->confirmChangePRJUint = 'Do you want to update the budget unit of the project of the program? If yes, please the current exchange rate.';
|
||||
$lang->program->changePRJUnit = 'Update the budget unit of the project';
|
||||
$lang->program->readjustTime = 'Change the program begin&end date.';
|
||||
$lang->program->accessDenied = 'You have no access to the program.';
|
||||
|
||||
|
||||
@@ -52,6 +52,8 @@ $lang->program->beginGreateChild = "Child earliest begin: %s, parent begi
|
||||
$lang->program->endLetterChild = "Child latest end: %s, parent end date > = child latest end date.";
|
||||
$lang->program->closeErrorMessage = 'There are subprograms or projects that are not closed';
|
||||
$lang->program->confirmDelete = "Do you want to delete it?";
|
||||
$lang->program->confirmChangePRJUint = 'Do you want to update the budget unit of the project of the program? If yes, please the current exchange rate.';
|
||||
$lang->program->changePRJUnit = 'Update the budget unit of the project';
|
||||
$lang->program->hasChildren = 'It has child programs or projects. You cannot delete it.';
|
||||
$lang->program->readjustTime = 'Change the program begin&end date.';
|
||||
|
||||
|
||||
@@ -52,6 +52,8 @@ $lang->program->beginGreateChild = "Child earliest begin: %s, parent begi
|
||||
$lang->program->endLetterChild = "Child latest end: %s, parent end date > = child latest end date.";
|
||||
$lang->program->closeErrorMessage = 'There are subprograms or projects that are not closed';
|
||||
$lang->program->confirmDelete = "Do you want to delete it?";
|
||||
$lang->program->confirmChangePRJUint = 'Do you want to update the budget unit of the project of the program? If yes, please the current exchange rate.';
|
||||
$lang->program->changePRJUnit = 'Update the budget unit of the project';
|
||||
$lang->program->hasChildren = 'It has child programs or projects. You cannot delete it.';
|
||||
$lang->program->readjustTime = 'Change the program begin&end date.';
|
||||
|
||||
|
||||
@@ -55,6 +55,8 @@ $lang->program->endLetterChild = "子项目的最大完成日期:%s
|
||||
$lang->program->closeErrorMessage = '存在子项目集或项目为未关闭状态';
|
||||
$lang->program->hasChildren = '该项目集有子项目集或项目存在,不能删除。';
|
||||
$lang->program->confirmDelete = "您确定要删除吗?";
|
||||
$lang->program->confirmChangePRJUint = '是否同步更新项目集下项目的预算的单位?若确认更新,请填写今日汇率。';
|
||||
$lang->program->changePRJUnit = '更新项目预算单位';
|
||||
$lang->program->readjustTime = '重新调整项目集起止时间';
|
||||
$lang->program->accessDenied = '你无权访问该项目集';
|
||||
|
||||
|
||||
@@ -392,7 +392,7 @@ class programModel extends model
|
||||
->setIF($this->post->budget != 0, 'budget', round($this->post->budget, 2))
|
||||
->join('whitelist', ',')
|
||||
->stripTags($this->config->program->editor->edit['id'], $this->config->allowedTags)
|
||||
->remove('uid,delta,future')
|
||||
->remove('uid,delta,future,isChangeUnit,exchangeRate')
|
||||
->get();
|
||||
|
||||
$program = $this->loadModel('file')->processImgURL($program, $this->config->program->editor->edit['id'], $this->post->uid);
|
||||
@@ -447,6 +447,33 @@ class programModel extends model
|
||||
|
||||
if(!dao::isError())
|
||||
{
|
||||
/* If the program changes, the budget unit will be updated to the project and sub-programs simultaneously. */
|
||||
if($program->budgetUnit != $oldProgram->budgetUnit and $_POST['isChangeUnit'] == 'true')
|
||||
{
|
||||
$this->dao->update(TABLE_PROJECT)
|
||||
->set('budgetUnit')->eq($program->budgetUnit)
|
||||
->where('parent')->eq($programID)
|
||||
->andWhere('type')->eq('project')
|
||||
->exec();
|
||||
|
||||
if(!empty($_POST['exchangeRate']))
|
||||
{
|
||||
$projectBudgets = $this->dao->select('id,budget')->from(TABLE_PROJECT)
|
||||
->where('parent')->eq($programID)
|
||||
->andWhere('type')->eq('project')
|
||||
->andWhere('budget')->ne('')
|
||||
->fetchAll('id');
|
||||
|
||||
foreach($projectBudgets as $id => $budget)
|
||||
{
|
||||
$this->dao->update(TABLE_PROJECT)
|
||||
->set('budget')->eq($_POST['exchangeRate'] * $budget->budget)
|
||||
->where('id')->eq($id)
|
||||
->exec();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->file->updateObjectID($this->post->uid, $programID, 'project');
|
||||
$whitelist = explode(',', $program->whitelist);
|
||||
$this->loadModel('personnel')->updateWhitelist($whitelist, 'program', $programID);
|
||||
|
||||
@@ -18,6 +18,8 @@
|
||||
<?php js::set('parentBudget', $lang->program->parentBudget);?>
|
||||
<?php js::set('future', $lang->project->future);?>
|
||||
<?php js::set('programList', $programList);?>
|
||||
<?php js::set('budgetUnitList', $budgetUnitList);?>
|
||||
<?php js::set('oldBudgetUnit', $program->budgetUnit);?>
|
||||
<?php $aclList = $program->parent ? $lang->program->subAclList : $lang->program->aclList;?>
|
||||
<?php $requiredFields = $config->program->edit->requiredFields;?>
|
||||
<div id='mainContent' class='main-content'>
|
||||
@@ -47,10 +49,12 @@
|
||||
<?php $placeholder = ($parentProgram and $parentProgram->budget != 0) ? 'placeholder=' . $lang->program->parentBudget . zget($lang->project->currencySymbol, $parentProgram->budgetUnit) . $availableBudget : '';?>
|
||||
<?php echo html::input('budget', $program->budget != 0 ? $program->budget : '', "class='form-control' " . (strpos($requiredFields, 'budget') !== false ? 'required ' : '') . ($program->budget == 0 ? 'disabled ' : '') . $placeholder);?>
|
||||
<?php if($parentProgram):?>
|
||||
<span class='input-group-addon'><?php echo zget($budgetUnitList, $parentProgram->budgetUnit);?></span>
|
||||
<span class='input-group-addon'><?php echo zget($budgetUnitList, $program->budgetUnit);?></span>
|
||||
<?php else:?>
|
||||
<span class='input-group-addon'></span>
|
||||
<?php echo html::select('budgetUnit', $budgetUnitList, $program->budgetUnit, "class='form-control'");?>
|
||||
<?php echo html::hidden('isChangeUnit', false);?>
|
||||
<?php echo html::hidden('exchangeRate', '');?>
|
||||
<?php endif;?>
|
||||
</div>
|
||||
</td>
|
||||
@@ -113,4 +117,35 @@
|
||||
<div id='subAcl' class='hidden'>
|
||||
<?php echo nl2br(html::radio('acl', $lang->program->subAclList, $program->acl, "onclick='setWhite(this.value);'", 'block'));?>
|
||||
</div>
|
||||
|
||||
<div class="modal fade" id="changeUnitTip">
|
||||
<div class="modal-dialog mw-600px">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true"><i class="icon icon-close"></i></button>
|
||||
<h4 class="modal-title"><?php echo $lang->program->changePRJUnit;?></h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form method='post'>
|
||||
<table class='table table-form'>
|
||||
<tr>
|
||||
<td colspan='3'><div class='alert alert-info no-margin'><?php echo $lang->program->confirmChangePRJUint;?></div></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo '1' . zget($budgetUnitList, $program->budgetUnit);?></th>
|
||||
<td><div class='input-group'><span class='input-group-addon'><?php echo "=";?></span><?php echo html::input('rate', '', "class='form-control'");?> <span class='input-group-addon' id='currentUnit'></span></div></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan='3' class='text-center'>
|
||||
<?php echo html::commonButton($lang->confirm, "id='confirm'", 'btn btn-primary btn-wide');?>
|
||||
<?php echo html::commonButton($lang->cancel, "data-dismiss='modal' id='cancel'", 'btn btn-default btn-wide');?>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php include '../../common/view/footer.html.php';?>
|
||||
|
||||
Reference in New Issue
Block a user