Merge branch 'sprint/master_zhouxudong_code'
This commit is contained in:
@@ -704,49 +704,6 @@ class program extends control
|
||||
echo $html;
|
||||
}
|
||||
|
||||
/**
|
||||
* Ajax get budget left.
|
||||
*
|
||||
* @param int $programID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function ajaxGetBudgetLeft($programID)
|
||||
{
|
||||
$program = $this->program->getByID($programID);
|
||||
$budgetLeft = $this->program->getBudgetLeft($program);
|
||||
echo number_format($budgetLeft, 2);
|
||||
}
|
||||
|
||||
/**
|
||||
* Ajax get available budget.
|
||||
*
|
||||
* @param int $programID
|
||||
* @param int $selectedProgramID
|
||||
* @param int $budget
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function ajaxGetAvailableBudget($programID, $selectedProgramID, $budget)
|
||||
{
|
||||
if(!empty($programID))
|
||||
{
|
||||
$program = $this->program->getByID($programID);
|
||||
$selectedProgram = $this->program->getByID($selectedProgramID);
|
||||
$budgetLeft = $this->program->getBudgetLeft($selectedProgram);
|
||||
$availableBudget = $program->parent == $selectedProgramID ? $budgetLeft + $program->budget : $budgetLeft;
|
||||
}
|
||||
else
|
||||
{
|
||||
$selectedProgram = $this->program->getByID($selectedProgramID);
|
||||
$availableBudget = $this->program->getBudgetLeft($selectedProgram);
|
||||
}
|
||||
|
||||
$tips = '';
|
||||
if($budget != 0 && $budget !== null && $budget > $availableBudget) $tips = "<span id='beyondBudgetTip' class='text-remind'>" . $this->lang->program->budgetOverrun . zget($this->lang->project->currencySymbol, $selectedProgram->budgetUnit) . $availableBudget . "</span>";
|
||||
echo json_encode($tips);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update program order.
|
||||
*
|
||||
|
||||
+118
-4
@@ -93,6 +93,7 @@ function computeWorkDays(currentID)
|
||||
{
|
||||
computeEndDate();
|
||||
}
|
||||
outOfDateTip();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -111,6 +112,7 @@ function computeEndDate(delta)
|
||||
if(delta == 999)
|
||||
{
|
||||
$('#end').val(longTime);
|
||||
outOfDateTip();
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -294,15 +296,18 @@ $(function()
|
||||
*/
|
||||
function setBudgetTipsAndAclList(parentID)
|
||||
{
|
||||
var selectedProgramID = $('#parent').val();
|
||||
|
||||
if(parentID != 0)
|
||||
{
|
||||
$.get(createLink('program', 'ajaxGetBudgetLeft', "ProgramID=" + parentID), function(budgetLeft)
|
||||
$.get(createLink('project', 'ajaxGetObjectInfo', "objectType=program&objectID=" + parentID + "&selectedProgramID=" + selectedProgramID), function(data)
|
||||
{
|
||||
var data = JSON.parse(data);
|
||||
parentProgram = programList[parentID];
|
||||
programBudget = parentProgram.budget;
|
||||
PGMBudgetUnit = currencySymbol[parentProgram.budgetUnit];
|
||||
|
||||
budgetNotes = programBudget != 0 ? (PGMParentBudget + PGMBudgetUnit + budgetLeft) : '';
|
||||
budgetNotes = programBudget != 0 ? (PGMParentBudget + PGMBudgetUnit + data.availableBudget) : '';
|
||||
$('#budget').attr('placeholder', budgetNotes);
|
||||
});
|
||||
$('.aclBox').html($('#subPGMAcl').html());
|
||||
@@ -315,6 +320,113 @@ function setBudgetTipsAndAclList(parentID)
|
||||
|
||||
if(typeof(programID) == 'undefined') programID = 0;
|
||||
budgetOverrunTips();
|
||||
outOfDateTip();
|
||||
}
|
||||
|
||||
/**
|
||||
* compare childlish date.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function compareChildDate()
|
||||
{
|
||||
if(page == 'create') return;
|
||||
|
||||
var end = $('#end').val();
|
||||
var begin = $('#begin').val();
|
||||
var selectedProgramID = $('#parent').val();
|
||||
if($('#dateTip').length > 0) $('#dateTip').remove();
|
||||
|
||||
if(end == longTime) end = LONG_TIME;
|
||||
if(end.length > 0 && begin.length > 0)
|
||||
{
|
||||
var programEnd = new Date(end);
|
||||
var programBegin = new Date(begin);
|
||||
|
||||
$.get(createLink('project', 'ajaxGetObjectInfo', 'objectType=program&objectID=' + programID + '&selectedProgramID=' + selectedProgramID), function(data)
|
||||
{
|
||||
var childInfo = JSON.parse(data);
|
||||
if(childInfo.maxChildEnd == '' || childInfo.minChildBegin == '') return;
|
||||
|
||||
var childBegin = new Date(childInfo.minChildBegin);
|
||||
var childEnd = new Date(childInfo.maxChildEnd);
|
||||
if(programBegin <= childBegin && programEnd >= childEnd) return;
|
||||
|
||||
var dateTip = '';
|
||||
if(programBegin > childBegin && programEnd >= childEnd)
|
||||
{
|
||||
dateTip = "<span id='dateTip' class='text-remind'>" + beginGreateChild + childInfo.minChildBegin + "</span>";
|
||||
}
|
||||
else if(programEnd < childEnd && programBegin <= childBegin)
|
||||
{
|
||||
dateTip = "<span id='dateTip' class='text-remind'>" + endLetterChild + childInfo.maxChildEnd + "</span>";
|
||||
}
|
||||
else
|
||||
{
|
||||
dateTip = "<span id='dateTip' class='text-remind'>" + dateExceedChild + childInfo.minChildBegin + "~" + childInfo.maxChildEnd + "</span>";
|
||||
}
|
||||
|
||||
$('#dateBox').after(dateTip);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The date is out of the range of the parent project set, and a prompt is given.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function outOfDateTip()
|
||||
{
|
||||
var end = $('#end').val();
|
||||
var begin = $('#begin').val();
|
||||
if($('#dateTip').length > 0) $('#dateTip').remove();
|
||||
|
||||
if(end == longTime) end = LONG_TIME;
|
||||
if(end.length > 0 && begin.length > 0)
|
||||
{
|
||||
var selectedProgramID = $('#parent').val();
|
||||
var programEnd = new Date(end);
|
||||
var programBegin = new Date(begin);
|
||||
|
||||
if(selectedProgramID == 0)
|
||||
{
|
||||
compareChildDate();
|
||||
return;
|
||||
}
|
||||
|
||||
if(typeof(programID) == 'undefined') programID = 0;
|
||||
$.get(createLink('project', 'ajaxGetObjectInfo', 'objectType=program&objectID=' + programID + "&selectedProgramID=" + selectedProgramID), function(data)
|
||||
{
|
||||
var dateTip = '';
|
||||
var data = JSON.parse(data);
|
||||
var parentEnd = new Date(data.selectedProgramEnd);
|
||||
var parentBegin = new Date(data.selectedProgramBegin);
|
||||
|
||||
if(programBegin >= parentBegin && programEnd <= parentEnd)
|
||||
{
|
||||
compareChildDate();
|
||||
return;
|
||||
}
|
||||
|
||||
if(programBegin < parentBegin && programEnd <= parentEnd && programEnd >= parentBegin)
|
||||
{
|
||||
dateTip = "<span id='dateTip' class='text-remind'>" + beginLetterParent + data.selectedProgramBegin + "</span>";
|
||||
}
|
||||
else if(programEnd > parentEnd && programBegin >= parentBegin && programBegin <= parentEnd)
|
||||
{
|
||||
dateTip = "<span id='dateTip' class='text-remind'>" + endGreaterParent + data.selectedProgramEnd + "</span>";
|
||||
}
|
||||
else
|
||||
{
|
||||
dateTip = "<span id='dateTip' class='text-remind'>" + dateExceedParent + data.selectedProgramBegin + "~" + data.selectedProgramEnd + "</span>";
|
||||
}
|
||||
|
||||
$('#dateBox').after(dateTip);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -334,11 +446,13 @@ function budgetOverrunTips()
|
||||
}
|
||||
|
||||
if(typeof(programID) == 'undefined') programID = 0;
|
||||
$.get(createLink('program', 'ajaxGetAvailableBudget', 'programID=' + programID + "&selectedProgramID=" + selectedProgramID + "&budget=" + budget), function(data)
|
||||
$.get(createLink('project', 'ajaxGetObjectInfo', 'objectType=program&objectID=' + programID + "&selectedProgramID=" + selectedProgramID), function(data)
|
||||
{
|
||||
var data = JSON.parse(data);
|
||||
|
||||
var tip = "";
|
||||
if(budget !=0 && budget !== null && budget > data.availableBudget) var tip = "<span id='beyondBudgetTip' class='text-remind'>" + budgetOverrun + currencySymbol[data.budgetUnit] + data.availableBudget + "</span>"
|
||||
if($('#beyondBudgetTip').length > 0) $('#beyondBudgetTip').remove();
|
||||
$('#budgetBox').after(data);
|
||||
$('#budgetBox').after(tip);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -100,10 +100,12 @@ $lang->program->noProgram = 'No program.';
|
||||
$lang->program->showClosed = 'Closed programs.';
|
||||
$lang->program->tips = 'If a parent program is selected, the products under the parent program can be associated. If no program is selected for the project, a product with the same name as the project is created and associated with the project by default.';
|
||||
$lang->program->confirmBatchUnlink = "Do you want to batch unlink these stakeholders?";
|
||||
$lang->program->beginLetterParent = 'The start date of the program should be ≥ the start date of the parent program: %s.';
|
||||
$lang->program->endGreaterParent = 'The finish date of the program should be ≤ the finish date of the parent program: %s.';
|
||||
$lang->program->beginGreateChild = 'The start date of the parent program should be ≤the minimum start time of the %s: %s.';
|
||||
$lang->program->endLetterChild = 'The finish time of the parent program should be ≥ the maximum finish time of the %s: %s.';
|
||||
$lang->program->beginLetterParent = 'The start date of the program was < the start date of the parent program:';
|
||||
$lang->program->endGreaterParent = 'The finish date of the program was > the finish date of the parent program:';
|
||||
$lang->program->dateExceedParent = 'The start and finish date of the program was > the start and finish date of the parent program:';
|
||||
$lang->program->beginGreateChild = 'The start date of the program was > the minimum start date of the subprogram or project:';
|
||||
$lang->program->endLetterChild = 'The finish date of the program was < the maximum finish date of the subprogram or project:';
|
||||
$lang->program->dateLetterChild = 'The start and finish date of the program no longer include the date scope of the subprogram or project:';
|
||||
$lang->program->closeErrorMessage = 'There are subprograms or projects that are not closed';
|
||||
$lang->program->hasChildren = 'It has child programs or projects. You cannot delete it.';
|
||||
$lang->program->hasProduct = 'It has products. You cannot delete it.';
|
||||
|
||||
@@ -100,10 +100,12 @@ $lang->program->noProgram = 'No program.';
|
||||
$lang->program->showClosed = 'Closed';
|
||||
$lang->program->tips = 'If a parent program is selected, the products under the parent program can be associated. If no program is selected for the project, a product with the same name as the project is created and associated with the project by default.';
|
||||
$lang->program->confirmBatchUnlink = "Do you want to batch unlink these stakeholders?";
|
||||
$lang->program->beginLetterParent = 'The start date of the program should be ≥ the start date of the parent program: %s.';
|
||||
$lang->program->endGreaterParent = 'The finish date of the program should be ≤ the finish date of the parent program: %s.';
|
||||
$lang->program->beginGreateChild = 'The start date of the parent program should be ≤the minimum start time of the %s: %s.';
|
||||
$lang->program->endLetterChild = 'The finish time of the parent program should be ≥ the maximum finish time of the %s: %s.';
|
||||
$lang->program->beginLetterParent = 'The start date of the program was < the start date of the parent program:';
|
||||
$lang->program->endGreaterParent = 'The finish date of the program was > the finish date of the parent program:';
|
||||
$lang->program->dateExceedParent = 'The start and finish date of the program was > the start and finish date of the parent program:';
|
||||
$lang->program->beginGreateChild = 'The start date of the program was > the minimum start date of the subprogram or project:';
|
||||
$lang->program->endLetterChild = 'The finish date of the program was < the maximum finish date of the subprogram or project:';
|
||||
$lang->program->dateLetterChild = 'The start and finish date of the program no longer include the date scope of the subprogram or project:';
|
||||
$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->hasProduct = 'The program has products exist and can not be deleted.';
|
||||
|
||||
@@ -100,10 +100,12 @@ $lang->program->noProgram = 'No program.';
|
||||
$lang->program->showClosed = 'Closed programs.';
|
||||
$lang->program->tips = 'If a parent program is selected, the products under the parent program can be associated. If no program is selected for the project, a product with the same name as the project is created and associated with the project by default.';
|
||||
$lang->program->confirmBatchUnlink = "Do you want to batch unlink these stakeholders?";
|
||||
$lang->program->beginLetterParent = 'La date de début du programme doit être ≥ à la date de début du programme parent: %s.';
|
||||
$lang->program->endGreaterParent = 'La date de fin du programme doit être ≤ à la date de fin du programme parent: %s.';
|
||||
$lang->program->beginGreateChild = 'La date de début du programme parent doit être ≤ à la date de début minimum du %s: %s.';
|
||||
$lang->program->endLetterChild = 'Le temps de fin du programme parent doit être ≥ au temps de fin maximum du %s: %s.';
|
||||
$lang->program->beginLetterParent = 'La date de début du programme était < à la date de début du programme parent:';
|
||||
$lang->program->endGreaterParent = 'La date de fin du programme était > à la date de fin du programme parent:';
|
||||
$lang->program->dateExceedParent = 'La date de début et de fin du programme était > à la date de début et de fin du programme parent:';
|
||||
$lang->program->beginGreateChild = 'La date de début du programme était > à la date minimale de début du sous-programme ou du projet:';
|
||||
$lang->program->endLetterChild = 'La date de fin du programme était < à la de fin maximale du sous-programme ou du projet:';
|
||||
$lang->program->dateLetterChild = 'La date de début et de fin du programme ne correspond plus la date du sous-programme ou du projet:';
|
||||
$lang->program->closeErrorMessage = 'There are subprograms or projects that are not closed';
|
||||
$lang->program->hasChildren = 'It has child programs or projects. You cannot delete it.';
|
||||
$lang->program->hasProduct = 'It has products. You cannot delete it.';
|
||||
|
||||
@@ -100,10 +100,12 @@ $lang->program->noProgram = '暂时没有项目集';
|
||||
$lang->program->showClosed = '显示已关闭';
|
||||
$lang->program->tips = '选择了父项目集,则可关联该父项目集下的产品。如果项目未选择任何项目集,则系统会默认创建一个和该项目同名的产品并关联该项目。';
|
||||
$lang->program->confirmBatchUnlink = "您确定要批量移除这些干系人吗?";
|
||||
$lang->program->beginLetterParent = '项目集开始日期应大于等于父项目集的开始日期:%s。';
|
||||
$lang->program->endGreaterParent = '项目集完成日期应小于等于父项目集的完成日期:%s。';
|
||||
$lang->program->beginGreateChild = '父项目集的开始日期应小于等于%s的最小开始时间:%s。';
|
||||
$lang->program->endLetterChild = '父项目集的完成时间应大于等于%s的最大完成时间:%s。';
|
||||
$lang->program->beginLetterParent = '项目集的开始日期已小于父项目集的开始日期:';
|
||||
$lang->program->endGreaterParent = '项目集的完成日期已大于父项目集的完成日期:';
|
||||
$lang->program->dateExceedParent = '项目集的起止日期已超出父项目集的起止日期';
|
||||
$lang->program->beginGreateChild = '项目集的开始日期已大于子项目集或项目的最小开始日期:';
|
||||
$lang->program->endLetterChild = '项目集的完成日期已小于子项目集或项目的最大完成日期:';
|
||||
$lang->program->dateExceedChild = '项目集的起止日期已不包含子项目集或项目的日期范围';
|
||||
$lang->program->closeErrorMessage = '存在子项目集或项目为未关闭状态';
|
||||
$lang->program->hasChildren = '该项目集有子项目集或项目存在,不能删除。';
|
||||
$lang->program->hasProduct = '该项目集有产品存在,不能删除。';
|
||||
|
||||
@@ -35,10 +35,18 @@
|
||||
<?php js::set('holders', $lang->execution->placeholder);?>
|
||||
<?php js::set('errorSameProducts', $lang->project->errorSameProducts);?>
|
||||
<?php js::set('longTime', $lang->program->longTime);?>
|
||||
<?php js::set('LONG_TIME', LONG_TIME);?>
|
||||
<?php js::set('currencySymbol', $lang->project->currencySymbol);?>
|
||||
<?php js::set('PGMParentBudget', $lang->program->parentBudget);?>
|
||||
<?php js::set('future', $lang->project->future);?>
|
||||
<?php js::set('programList', $programList);?>
|
||||
<?php js::set('budgetOverrun', $lang->project->budgetOverrun);?>
|
||||
<?php js::set('currencySymbol', $lang->project->currencySymbol)?>
|
||||
<?php js::set('parentBudget', $lang->program->parentBudget);?>
|
||||
<?php js::set('beginLetterParent', $lang->program->beginLetterParent);?>
|
||||
<?php js::set('endGreaterParent', $lang->program->endGreaterParent);?>
|
||||
<?php js::set('dateExceedParent', $lang->program->dateExceedParent);?>
|
||||
<?php js::set('page', $this->app->getMethodName());?>
|
||||
<?php $aclList = $parentProgram ? $lang->program->subAclList : $lang->program->aclList;?>
|
||||
<?php $requiredFields = $config->program->create->requiredFields;?>
|
||||
<div id='mainContent' class='main-content'>
|
||||
@@ -90,10 +98,10 @@
|
||||
<tr>
|
||||
<th id="dateRange"><?php echo $lang->project->dateRange;?></th>
|
||||
<td>
|
||||
<div class='input-group'>
|
||||
<div id='dateBox' class='input-group'>
|
||||
<?php echo html::input('begin', date('Y-m-d'), "class='form-control form-date' onchange='computeWorkDays();' placeholder='" . $lang->project->begin . "' required");?>
|
||||
<span class='input-group-addon'><?php echo $lang->project->to;?></span>
|
||||
<?php echo html::input('end', '', "class='form-control form-date' placeholder='" . $lang->project->end . "' required");?>
|
||||
<?php echo html::input('end', '', "class='form-control form-date' onchange='outOfDateTip();' placeholder='" . $lang->project->end . "' required");?>
|
||||
</div>
|
||||
</td>
|
||||
<td id="endList" colspan='2'><?php echo html::radio('delta', $lang->program->endList, '', "onclick='computeEndDate(this.value)'");?></td>
|
||||
|
||||
@@ -12,6 +12,8 @@
|
||||
?>
|
||||
<?php include '../../common/view/header.html.php';?>
|
||||
<?php include '../../common/view/kindeditor.html.php';?>
|
||||
<?php js::set('LONG_TIME', LONG_TIME);?>
|
||||
<?php js::set('page', $this->app->getMethodName());?>
|
||||
<?php js::set('weekend', $config->execution->weekend);?>
|
||||
<?php js::set('longTime', $lang->program->longTime);?>
|
||||
<?php js::set('currencySymbol', $lang->project->currencySymbol);?>
|
||||
@@ -25,6 +27,15 @@
|
||||
<?php js::set('exRateNum', sprintf($lang->error->float, $lang->program->exchangeRate));?>
|
||||
<?php js::set('exRateNotNegative', $lang->program->exRateNotNegative);?>
|
||||
<?php js::set('programID', $program->id);?>
|
||||
<?php js::set('budgetOverrun', $lang->project->budgetOverrun);?>
|
||||
<?php js::set('currencySymbol', $lang->project->currencySymbol)?>
|
||||
<?php js::set('parentBudget', $lang->program->parentBudget);?>
|
||||
<?php js::set('beginLetterParent', $lang->program->beginLetterParent);?>
|
||||
<?php js::set('endGreaterParent', $lang->program->endGreaterParent);?>
|
||||
<?php js::set('dateExceedParent', $lang->program->dateExceedParent);?>
|
||||
<?php js::set('beginGreateChild', $lang->program->beginGreateChild);?>
|
||||
<?php js::set('endLetterChild', $lang->program->endLetterChild);?>
|
||||
<?php js::set('dateExceedChild', $lang->program->dateExceedChild);?>
|
||||
<?php $aclList = $program->parent ? $lang->program->subAclList : $lang->program->aclList;?>
|
||||
<?php $requiredFields = $config->program->edit->requiredFields;?>
|
||||
<div id='mainContent' class='main-content'>
|
||||
@@ -73,12 +84,12 @@
|
||||
<tr>
|
||||
<th id="dateRange"><?php echo $lang->project->dateRange;?></th>
|
||||
<td>
|
||||
<div class='input-group'>
|
||||
<?php echo html::input('begin', $program->begin, "class='form-control form-date' placeholder='" . $lang->project->begin . "' required");?>
|
||||
<div id='dateBox' class='input-group'>
|
||||
<?php echo html::input('begin', $program->begin, "class='form-control form-date' onchange='outOfDateTip();' placeholder='" . $lang->project->begin . "' required");?>
|
||||
<span class='input-group-addon'><?php echo $lang->project->to;?></span>
|
||||
<?php
|
||||
$end = $program->end == LONG_TIME ? $lang->program->longTime : $program->end;
|
||||
echo html::input('end', $end, "class='form-control form-date' placeholder='" . $lang->project->end . "' required");
|
||||
echo html::input('end', $end, "class='form-control form-date' onchange='outOfDateTip();' placeholder='" . $lang->project->end . "' required");
|
||||
?>
|
||||
</div>
|
||||
</td>
|
||||
|
||||
+29
-19
@@ -220,37 +220,47 @@ class project extends control
|
||||
}
|
||||
|
||||
/**
|
||||
* Ajax get available budget.
|
||||
* Ajax: Get selected object's information.
|
||||
*
|
||||
* @param int $programID
|
||||
* @param str $objectType
|
||||
* @param int $objectID
|
||||
* @param int $selectedProgramID
|
||||
* @param int $budget
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function ajaxGetAvailableBudget($projectID, $selectedProgramID, $budget)
|
||||
public function ajaxGetObjectInfo($objectType, $objectID, $selectedProgramID)
|
||||
{
|
||||
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
|
||||
if($selectedProgramID)
|
||||
{
|
||||
$selectedProgram = $this->loadModel('program')->getByID($selectedProgramID);
|
||||
$availableBudget = $this->program->getBudgetLeft($selectedProgram);
|
||||
if($selectedProgram->budget) $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>";
|
||||
if(!empty($objectID))
|
||||
{
|
||||
$object = $objectType == 'project' ? $this->project->getByID($objectID) : $this->loadModel('program')->getByID($objectID);
|
||||
|
||||
$placeholder = '';
|
||||
if($selectedProgram and $selectedProgram->budget != 0) $placeholder = $this->lang->project->parentBudget . zget($this->lang->project->currencySymbol, $selectedProgram->budgetUnit) . $availableBudget;
|
||||
if(isset($availableBudget)) $availableBudget = $object->parent == $selectedProgramID ? $availableBudget + $object->budget : $availableBudget;
|
||||
|
||||
$tipList = array('tip' => $tip, 'placeholder' => $placeholder);
|
||||
echo json_encode($tipList);
|
||||
if($objectType == 'program')
|
||||
{
|
||||
$minChildBegin = $this->dao->select('begin as minBegin')->from(TABLE_PROGRAM)->where('id')->ne($objectID)->andWhere('deleted')->eq(0)->andWhere('path')->like("%,{$objectID},%")->orderBy('begin_asc')->fetch('minBegin');
|
||||
$maxChildEnd = $this->dao->select('end as maxEnd')->from(TABLE_PROGRAM)->where('id')->ne($objectID)->andWhere('deleted')->eq(0)->andWhere('path')->like("%,{$objectID},%")->andWhere('end')->ne('0000-00-00')->orderBy('end_desc')->fetch('maxEnd');
|
||||
}
|
||||
}
|
||||
|
||||
$data = array();
|
||||
if(isset($selectedProgram))
|
||||
{
|
||||
$data['selectedProgramBegin'] = $selectedProgram->begin;
|
||||
$data['selectedProgramEnd'] = $selectedProgram->end;
|
||||
$data['budgetUnit'] = $selectedProgram->budgetUnit;
|
||||
}
|
||||
if(isset($availableBudget)) $data['availableBudget'] = $availableBudget;
|
||||
if(isset($minChildBegin)) $data['minChildBegin'] = $minChildBegin;
|
||||
if(isset($maxChildEnd)) $data['maxChildEnd'] = $maxChildEnd;
|
||||
|
||||
echo json_encode($data);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+59
-32
@@ -95,6 +95,7 @@ function computeWorkDays(currentID)
|
||||
{
|
||||
computeEndDate();
|
||||
}
|
||||
outOfDateTip();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -115,6 +116,7 @@ function computeEndDate(delta)
|
||||
$('#end').val(longTime).trigger('mousedown');
|
||||
$('#daysBox').addClass('hidden');
|
||||
$('#days').val(0).trigger('mousedown');
|
||||
outOfDateTip();
|
||||
return false;
|
||||
}
|
||||
$('#daysBox').removeClass('hidden');
|
||||
@@ -297,35 +299,6 @@ $(function()
|
||||
});
|
||||
})
|
||||
|
||||
/**
|
||||
* Set budget tips and acl list.
|
||||
*
|
||||
* @param int $parentProgramID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function setBudgetTipsAndAclList(programID)
|
||||
{
|
||||
if(programID != 0)
|
||||
{
|
||||
$.get(createLink('project', 'ajaxGetBudgetLeft', "programID=" + programID), function(budgetLeft)
|
||||
{
|
||||
parentProgram = PGMList[programID];
|
||||
projectBudget = parentProgram.budget;
|
||||
PGMBudgetUnit = currencySymbol[parentProgram.budgetUnit];
|
||||
|
||||
budgetNotes = projectBudget != 0 ? (PGMParentBudget + PGMBudgetUnit + budgetLeft) : '';
|
||||
$('#budget').attr('placeholder', budgetNotes);
|
||||
});
|
||||
$('.aclBox').html($('#subPGMAcl').html());
|
||||
}
|
||||
else
|
||||
{
|
||||
$('#budget').removeAttr('placeholder');
|
||||
$('.aclBox').html($('#PGMAcl').html());
|
||||
}
|
||||
}
|
||||
|
||||
$(document).on('change', "#plansBox select[name^='plans']", function()
|
||||
{
|
||||
var $plan = $(this);
|
||||
@@ -365,14 +338,68 @@ function budgetOverrunTips()
|
||||
}
|
||||
|
||||
if(typeof(projectID) == 'undefined') projectID = 0;
|
||||
$.get(createLink('project', 'ajaxGetAvailableBudget', 'projectID=' + projectID + "&selectedProgramID=" + selectedProgramID + "&budget=" + budget), function(data)
|
||||
$.get(createLink('project', 'ajaxGetObjectInfo', 'objectType=project&objectID=' + projectID + "&selectedProgramID=" + selectedProgramID), function(data)
|
||||
{
|
||||
var data = JSON.parse(data);
|
||||
if(typeof(data.availableBudget) == 'undefined') return;
|
||||
|
||||
var tip = "";
|
||||
if(budget != 0 && budget !== null && budget > data.availableBudget) tip = "<span id='beyondBudgetTip' class='text-remind'>" + budgetOverrun + currencySymbol[data.budgetUnit] + data.availableBudget.toFixed(2) + "</span>"
|
||||
if($('#beyondBudgetTip').length > 0) $('#beyondBudgetTip').remove();
|
||||
$('#budgetBox').after(data.tip);
|
||||
$('#budgetBox').after(tip);
|
||||
|
||||
var placeholder = '';
|
||||
if(selectedProgramID) placeholder = parentBudget + currencySymbol[data.budgetUnit] + data.availableBudget.toFixed(2);
|
||||
if($('#budget').attr('placeholder')) $('#budget').removeAttr('placeholder')
|
||||
$('#budget').attr('placeholder', data.placeholder);
|
||||
$('#budget').attr('placeholder', placeholder);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
*The date is out of the range of the parent project set, and a prompt is given.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function outOfDateTip()
|
||||
{
|
||||
var end = $('#end').val();
|
||||
var begin = $('#begin').val();
|
||||
if($('#dateTip').length > 0) $('#dateTip').remove();
|
||||
|
||||
if(end == longTime) end = LONG_TIME;
|
||||
if(end.length > 0 && begin.length > 0)
|
||||
{
|
||||
var selectedProgramID = $('#parent').val();
|
||||
|
||||
if(selectedProgramID == 0) return;
|
||||
|
||||
if(typeof(projectID) == 'undefined') projectID = 0;
|
||||
$.get(createLink('project', 'ajaxGetObjectInfo', 'objectType=project&objectID=' + projectID + '&selectedProgramID=' + selectedProgramID), function(data)
|
||||
{
|
||||
var data = JSON.parse(data);
|
||||
var parentEnd = new Date(data.selectedProgramEnd);
|
||||
var parentBegin = new Date(data.selectedProgramBegin);
|
||||
var projectEnd = new Date(end);
|
||||
var projectBegin = new Date(begin);
|
||||
|
||||
if(projectBegin >= parentBegin && projectEnd <= parentEnd) return;
|
||||
|
||||
var dateTip = "";
|
||||
if(projectBegin < parentBegin && projectEnd <= parentEnd && projectEnd >= parentBegin)
|
||||
{
|
||||
dateTip = "<span id='dateTip' class='text-remind'>" + beginLetterParent + data.selectedProgramBegin + "</span>";
|
||||
}
|
||||
else if(projectEnd > parentEnd && projectBegin >= parentBegin && projectBegin <= parentEnd)
|
||||
{
|
||||
dateTip = "<span id='dateTip' class='text-remind'>" + endGreaterParent + data.selectedProgramEnd + "</span>";
|
||||
}
|
||||
else
|
||||
{
|
||||
dateTip = "<span id='dateTip' class='text-remind'>" + dateExceedParent + data.selectedProgramBegin + "~" + data.selectedProgramEnd + "</span>";
|
||||
}
|
||||
|
||||
$('#dateBox').after(dateTip);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,6 @@ $(function()
|
||||
{
|
||||
var programID = $(this).val();
|
||||
setAclList(programID);
|
||||
budgetOverrunTips();
|
||||
|
||||
/* Determine whether the project can change the project set. */
|
||||
link = createLink('project', 'ajaxCheckProduct', 'programID=' + programID + '&projectID=' + projectID);
|
||||
@@ -58,6 +57,9 @@ $(function()
|
||||
|
||||
if(!changed) $("#parent").val(oldParent).trigger("chosen:updated");
|
||||
oldParent = $('#parent').val();
|
||||
|
||||
budgetOverrunTips();
|
||||
outOfDateTip();
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -320,9 +320,10 @@ $lang->project->confirmDelete = "Do you want to delete [%s]?";
|
||||
$lang->project->cannotChangeToCat = "It is not empty, so you cannot change it to a parent.";
|
||||
$lang->project->cannotCancelCat = "It has child projects, so you cannot unmark the parent.";
|
||||
$lang->project->parentBeginEnd = "Parent begin&end date: %s ~ %s";
|
||||
$lang->project->parentBudget = "The budget of the parent project: ";
|
||||
$lang->project->beginLetterParent = "The begin date of the parent project: %s. It cannot be < the begin date of its parent project.";
|
||||
$lang->project->endGreaterParent = "The end date of the parent project: %s. It cannot be > the end date of its parent project.";
|
||||
$lang->project->parentBudget = "The budget of the parent program: ";
|
||||
$lang->project->beginLetterParent = "The start date of the project was < the minimum start date of the parent program:";
|
||||
$lang->project->endGreaterParent = "The finish date of the project was > the maximum finish date of the parent program:";
|
||||
$lang->project->dateExceedParent = "The start and finish date of the project was > the start and finish date of the parent program:";
|
||||
$lang->project->beginGreateChild = 'The start date of the project should be ≥ the start date of program: %s.';
|
||||
$lang->project->endLetterChild = 'The finish date of the project should be ≤ the finish date of program: %s.';
|
||||
$lang->project->begigLetterExecution = 'The start date of project should be ≤ the minimum start date of the execution: %s.';
|
||||
|
||||
@@ -320,9 +320,10 @@ $lang->project->confirmDelete = 'Do you want to delete \"%s\"?';
|
||||
$lang->project->cannotChangeToCat = "The project has contents, so you cannot it to a parent project.";
|
||||
$lang->project->cannotCancelCat = "There are child projects of this project. You cannot cancel the parent project mark.";
|
||||
$lang->project->parentBeginEnd = "The begin and end date of the parent project: %s ~ %s";
|
||||
$lang->project->parentBudget = "The budget of the parent project: ";
|
||||
$lang->project->beginLetterParent = "The begin date of the parent project: %s. It cannot be < the begin date of its parent project.";
|
||||
$lang->project->endGreaterParent = "The end date of the parent project: %s. It cannot be > the end date of its parent project.";
|
||||
$lang->project->parentBudget = "The budget of the parent program: ";
|
||||
$lang->project->beginLetterParent = "The start date of the project was < the minimum start date of the parent program:";
|
||||
$lang->project->endGreaterParent = "The finish date of the project was > the maximum finish date of the parent program:";
|
||||
$lang->project->dateExceedParent = "The start and finish date of the project was > the start and finish date of the parent program:";
|
||||
$lang->project->beginGreateChild = 'The start date of the project should be ≥ the start date of program: %s.';
|
||||
$lang->project->endLetterChild = 'The finish date of the project should be ≤ the finish date of program: %s.';
|
||||
$lang->project->begigLetterExecution = 'The start date of project should be ≤ the minimum start date of the execution: %s.';
|
||||
|
||||
@@ -321,8 +321,9 @@ $lang->project->cannotChangeToCat = "It is not empty, so you cannot change it
|
||||
$lang->project->cannotCancelCat = "It has child projects, so you cannot unmark the parent.";
|
||||
$lang->project->parentBeginEnd = "Parent begin&end date: %s ~ %s";
|
||||
$lang->project->parentBudget = "The budget of the parent project: ";
|
||||
$lang->project->beginLetterParent = "The begin date of the parent project: %s. It cannot be < the begin date of its parent project.";
|
||||
$lang->project->endGreaterParent = "The end date of the parent project: %s. It cannot be > the end date of its parent project.";
|
||||
$lang->project->beginLetterParent = "La date de début du projet était < à la date minimale de début du programme parent:";
|
||||
$lang->project->endGreaterParent = "La date de fin du projet était > à la date de fin maximale du programme parent:";
|
||||
$lang->project->dateExceedParent = "La date de début et de fin du project était > à la date de début et de fin du programme parent:";
|
||||
$lang->project->beginGreateChild = 'La date de début du projets "%s" doit être ≥ à la date de début du programme "%s" : %s.';
|
||||
$lang->project->endLetterChild = 'La date de fin du projets doit être ≤ à la date de fin du programme: %s.';
|
||||
$lang->project->begigLetterExecution = 'La date de début du projet "%s" doit être ≤ à la date de début minimum d\'excution: %s';
|
||||
|
||||
@@ -320,9 +320,10 @@ $lang->project->confirmDelete = '您确定删除项目“%s”吗?';
|
||||
$lang->project->cannotChangeToCat = "该项目已经有实际的内容,无法修改为父项目";
|
||||
$lang->project->cannotCancelCat = "该项目下已经有子项目,无法取消父项目标记";
|
||||
$lang->project->parentBeginEnd = "父项目起止时间:%s ~ %s";
|
||||
$lang->project->parentBudget = "父项目预算:";
|
||||
$lang->project->beginLetterParent = "父项目的开始日期:%s,开始日期不能小于父项目的开始日期";
|
||||
$lang->project->endGreaterParent = "父项目的完成日期:%s,完成日期不能大于父项目的完成日期";
|
||||
$lang->project->parentBudget = "父项目集预算:";
|
||||
$lang->project->beginLetterParent = "项目的开始日期已小于父项目集的最小开始日期:";
|
||||
$lang->project->endGreaterParent = "项目的完成日期已大于父项目集的最大完成日期:";
|
||||
$lang->project->dateExceedParent = "项目的起止日期已超出父项目集的起止日期:";
|
||||
$lang->project->beginGreateChild = '项目的开始日期应大于等于项目集的最小开始日期:%s';
|
||||
$lang->project->endLetterChild = '项目的完成日期应小于等于项目集的最大完成日期:%s';
|
||||
$lang->project->begigLetterExecution = '项目的开始日期应小于等于执行的最小开始日期:%s';
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
<?php include '../../common/view/header.html.php';?>
|
||||
<?php include '../../common/view/kindeditor.html.php';?>
|
||||
<?php js::import($jsRoot . 'misc/date.js');?>
|
||||
<?php js::set('LONG_TIME', LONG_TIME);?>
|
||||
<?php js::set('model', $model);?>
|
||||
<?php js::set('programID', $programID);?>
|
||||
<?php js::set('copyProjectID', $copyProjectID);?>
|
||||
@@ -26,6 +27,12 @@
|
||||
<?php js::set('selectedBranchID', $branchID);?>
|
||||
<?php js::set('productName', $lang->product->name);?>
|
||||
<?php js::set('manageProducts', $lang->project->manageProducts);?>
|
||||
<?php js::set('budgetOverrun', $lang->project->budgetOverrun);?>
|
||||
<?php js::set('currencySymbol', $lang->project->currencySymbol)?>
|
||||
<?php js::set('parentBudget', $lang->project->parentBudget);?>
|
||||
<?php js::set('beginLetterParent', $lang->project->beginLetterParent);?>
|
||||
<?php js::set('endGreaterParent', $lang->project->endGreaterParent);?>
|
||||
<?php js::set('dateExceedParent', $lang->project->dateExceedParent);?>
|
||||
<?php $requiredFields = $config->project->create->requiredFields;?>
|
||||
<?php js::set('requiredFields', $requiredFields);?>
|
||||
<div id='mainContent' class='main-content'>
|
||||
@@ -93,7 +100,7 @@
|
||||
<tr>
|
||||
<th id="dateRange"><?php echo $lang->project->dateRange;?></th>
|
||||
<td>
|
||||
<div class='input-group'>
|
||||
<div id='dateBox' class='input-group'>
|
||||
<?php echo html::input('begin', date('Y-m-d'), "class='form-control form-date' onchange='computeWorkDays();' placeholder='" . $lang->project->begin . "' required");?>
|
||||
<span class='input-group-addon'><?php echo $lang->project->to;?></span>
|
||||
<?php echo html::input('end', '', "class='form-control form-date' onchange='computeWorkDays();' placeholder='" . $lang->project->end . "' required");?>
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
<?php include '../../common/view/kindeditor.html.php';?>
|
||||
<?php js::import($jsRoot . 'misc/date.js');?>
|
||||
<?php js::set('weekend', $config->execution->weekend);?>
|
||||
<?php js::set('LONG_TIME', LONG_TIME);?>
|
||||
<?php js::set('errorSameProducts', $lang->project->errorSameProducts);?>
|
||||
<?php js::set('errorSameBranches', $lang->project->errorSameBranches);?>
|
||||
<?php js::set('errorSamePlans', $lang->project->errorSamePlans);?>
|
||||
@@ -30,6 +31,12 @@
|
||||
<?php $requiredFields = $config->project->edit->requiredFields;?>
|
||||
<?php js::set('requiredFields', $requiredFields);?>
|
||||
<?php js::set('budget', $project->budget);?>
|
||||
<?php js::set('budgetOverrun', $lang->project->budgetOverrun);?>
|
||||
<?php js::set('currencySymbol', $lang->project->currencySymbol)?>
|
||||
<?php js::set('parentBudget', $lang->project->parentBudget);?>
|
||||
<?php js::set('beginLetterParent', $lang->project->beginLetterParent);?>
|
||||
<?php js::set('endGreaterParent', $lang->project->endGreaterParent);?>
|
||||
<?php js::set('dateExceedParent', $lang->project->dateExceedParent);?>
|
||||
<div id='mainContent' class='main-content'>
|
||||
<div class='center-block'>
|
||||
<div class='main-header'>
|
||||
@@ -95,7 +102,7 @@
|
||||
<tr>
|
||||
<th id="dateRange"><?php echo $lang->project->dateRange;?></th>
|
||||
<td>
|
||||
<div class='input-group'>
|
||||
<div id='dateBox' class='input-group'>
|
||||
<?php echo html::input('begin', $project->begin, "class='form-control form-date' onchange='computeWorkDays();' placeholder='" . $lang->project->begin . "' required");?>
|
||||
<span class='input-group-addon'><?php echo $lang->project->to;?></span>
|
||||
<?php
|
||||
|
||||
@@ -17,7 +17,7 @@ include '../../common/view/chosen.html.php';
|
||||
$formId = 'searchForm-' . uniqid('');
|
||||
?>
|
||||
<style>
|
||||
.btn-active-text .text {font-weight: 400; font-size: 14px;}
|
||||
#save-query .text {font-weight: 400; font-size: 14px;}
|
||||
#selectPeriod {padding: 4px 0; height: 197px; min-width: 120px}
|
||||
#selectPeriod > .dropdown-header {background: #f1f1f1; display: block; text-align: center; padding: 4px 0; line-height: 20px; margin: 5px 10px; font-size: 14px; border-radius: 2px; color: #333; font-size: 12px}
|
||||
#groupAndOr {display: inline-block;}
|
||||
|
||||
Reference in New Issue
Block a user