*Fixbug 21115
This commit is contained in:
@@ -305,6 +305,14 @@ class executionModel extends model
|
||||
$type = 'sprint';
|
||||
if($project) $type = zget($this->config->execution->modelList, $project->model, 'sprint');
|
||||
|
||||
/*Judge workdays is legitimate. */
|
||||
$workdays = helper::diffDate($_POST['end'], $_POST['begin']);
|
||||
if($_POST['days'] > $workdays)
|
||||
{
|
||||
dao::$errors['days'] = sprintf($this->lang->project->workdaysExceed, $workdays);
|
||||
return false;
|
||||
}
|
||||
|
||||
/* If the execution model is a stage, determine whether the product is linked. */
|
||||
$products = array_filter($this->post->products);
|
||||
if(empty($products))
|
||||
@@ -451,6 +459,14 @@ class executionModel extends model
|
||||
return false;
|
||||
}
|
||||
|
||||
/*Judge workdays is legitimate. */
|
||||
$this->app->loadLang('project');
|
||||
$workdays = helper::diffDate($_POST['end'], $_POST['begin']);
|
||||
if($_POST['days'] > $workdays)
|
||||
{
|
||||
dao::$errors['days'] = sprintf($this->lang->project->workdaysExceed, $workdays);
|
||||
return false;
|
||||
}
|
||||
$products = array_filter($this->post->products);
|
||||
$noLinkTip = $oldExecution->type != 'kanban' ? $this->lang->execution->noLinkProduct : $this->lang->execution->kanbanNoLinkProduct;
|
||||
if(empty($products))
|
||||
@@ -643,6 +659,15 @@ class executionModel extends model
|
||||
$codeList[$executionCode] = $executionCode;
|
||||
}
|
||||
|
||||
/*Judge workdays is legitimate. */
|
||||
$workdays = helper::diffDate($data->ends[$executionID], $data->begins[$executionID]);
|
||||
if($data->dayses[$executionID] > $workdays)
|
||||
{
|
||||
$this->app->loadLang('project');
|
||||
dao::$errors['days'][] = 'execution#' . $executionID . sprintf($this->lang->project->workdaysExceed, $workdays);
|
||||
return false;
|
||||
}
|
||||
|
||||
foreach($extendFields as $extendField)
|
||||
{
|
||||
$executions[$executionID]->{$extendField->field} = $this->post->{$extendField->field}[$executionID];
|
||||
|
||||
@@ -58,6 +58,7 @@ function computeDaysDelta(date1, date2)
|
||||
* @return void
|
||||
*/
|
||||
function computeWorkDays(currentID)
|
||||
|
||||
{
|
||||
isBactchEdit = false;
|
||||
if(currentID)
|
||||
@@ -113,8 +114,14 @@ function computeEndDate(delta)
|
||||
if(delta == 999)
|
||||
{
|
||||
$('#end').val(longTime);
|
||||
$('#daysBox').addClass('hidden');
|
||||
$('#days').val(0);
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
$('#daysBox').removeClass('hidden');
|
||||
}
|
||||
|
||||
beginDate = convertStringToDate(beginDate);
|
||||
if((delta == 7 || delta == 14) && (beginDate.getDay() == 1))
|
||||
|
||||
@@ -57,6 +57,7 @@ $lang->project->unlinkMember = 'Remove Member';
|
||||
$lang->project->copyTeamTitle = 'Select a project team to copy';
|
||||
$lang->project->daysGreaterProject = 'Days cannot be greater than days of project『%s』';
|
||||
$lang->project->errorHours = 'Hours/Day cannot be greater than『24』';
|
||||
$lang->project->workdaysExceed = 'Available working day must not exceed『%s』days';
|
||||
|
||||
/* Fields. */
|
||||
$lang->project->common = 'Project';
|
||||
|
||||
@@ -57,7 +57,7 @@ $lang->project->unlinkMember = '移除成员';
|
||||
$lang->project->copyTeamTitle = '选择一个项目团队来复制';
|
||||
$lang->project->daysGreaterProject = '可用工日不能大于项目的可用工日『%s』';
|
||||
$lang->project->errorHours = '可用工时/天不能大于『24』';
|
||||
$lang->project->workdaysExceed = '可用工作日不超过『%s』天';
|
||||
$lang->project->workdaysExceed = '可用工作日不能超过『%s』天';
|
||||
|
||||
/* Fields. */
|
||||
$lang->project->common = '项目';
|
||||
|
||||
@@ -848,12 +848,10 @@ class projectModel extends model
|
||||
}
|
||||
|
||||
/*Judge workdays is legitimate. */
|
||||
$date1 = date_create($project->begin);
|
||||
$date2 = date_create($project->end);
|
||||
$workdays = date_diff($date1, $date2);
|
||||
if($project->days > $workdays->days)
|
||||
$workdays = helper::diffDate($project->end, $project->begin);
|
||||
if($project->days > $workdays)
|
||||
{
|
||||
dao::$errors['days'] = sprintf($this->lang->project->workdaysExceed, $workdays->days);
|
||||
dao::$errors['days'] = sprintf($this->lang->project->workdaysExceed, $workdays);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1097,6 +1095,14 @@ class projectModel extends model
|
||||
return false;
|
||||
}
|
||||
|
||||
/*Judge workdays is legitimate. */
|
||||
$workdays = helper::diffDate($project->end, $project->begin);
|
||||
if($project->days > $workdays)
|
||||
{
|
||||
dao::$errors['days'] = sprintf($this->lang->project->workdaysExceed, $workdays);
|
||||
return false;
|
||||
}
|
||||
|
||||
$project = $this->loadModel('file')->processImgURL($project, $this->config->project->editor->edit['id'], $this->post->uid);
|
||||
|
||||
$requiredFields = $this->config->project->edit->requiredFields;
|
||||
|
||||
Reference in New Issue
Block a user