This commit is contained in:
liumengyi
2022-08-11 10:08:06 +08:00
parent b5d1558689
commit 845b829aaa
2 changed files with 21 additions and 6 deletions
+20 -5
View File
@@ -1384,22 +1384,37 @@ class execution extends control
$this->loadModel('kanban');
$this->app->loadClass('date');
$minDate = !helper::isZeroDate($execution->openedDate) ? $execution->openedDate : $execution->begin;
$maxDate = !helper::isZeroDate($execution->closedDate) ? $execution->closedDate : helper::today();
$minDate = !helper::isZeroDate($execution->openedDate) ? date('Y-m-d', strtotime($execution->openedDate)) : date('Y-m-d', strtotime($execution->begin));
$maxDate = !helper::isZeroDate($execution->closedDate) ? date('Y-m-d', strtotime($execution->closedDate)) : helper::today();
if(!empty($_POST))
{
$begin = htmlspecialchars($this->post->begin, ENT_QUOTES);
$end = htmlspecialchars($this->post->end, ENT_QUOTES);
if(empty($begin)) return $this->sendError(sprintf($this->lang->error->notempty, $this->lang->execution->charts->cfd->begin));
if(empty($end)) return $this->sendError(sprintf($this->lang->error->notempty, $this->lang->execution->charts->cfd->end));
$dateError = array();
if(empty($begin)) $dateError[] = sprintf($this->lang->error->notempty, $this->lang->execution->charts->cfd->begin);
if(empty($end)) $dateError[] = sprintf($this->lang->error->notempty, $this->lang->execution->charts->cfd->end);
if(empty($dateError))
{
if($begin < $minDate) $dateError[] = sprintf($this->lang->error->gt, $this->lang->execution->charts->cfd->begin, $minDate);
if($begin > $maxDate) $dateError[] = sprintf($this->lang->error->lt, $this->lang->execution->charts->cfd->begin, $maxDate);
if($end < $minDate) $dateError[] = sprintf($this->lang->error->gt, $this->lang->execution->charts->cfd->end, $minDate);
if($end > $maxDate) $dateError[] = sprintf($this->lang->error->lt, $this->lang->execution->charts->cfd->end, $maxDate);
}
if(!empty($dateError))
{
foreach($dateError as $index => $error) $dateError[$index] = str_replace(array('。', '.'), array('', ''), $error) . '<br/>';
return $this->sendError($dateError);
}
if($begin >= $end) return $this->sendError($this->lang->execution->charts->cfd->errorBegin);
if(date("Y-m-d", strtotime("-3 months", strtotime($end))) > $begin) return $this->sendError($this->lang->execution->charts->cfd->errorDateRange);
$this->execution->computeCFD($executionID);
$this->execution->checkCFDData($executionID, $begin);
return print(js::locate($this->createLink('execution', 'cfd', "executionID=$executionID&type=$type&withWeekend=$withWeekend&begin=" . helper::safe64Encode(urlencode($begin)) . "&end=" . helper::safe64Encode(urlencode($end))), 'parent'));
return $this->send(array('result' => 'success', 'locate' => $this->createLink('execution', 'cfd', "executionID=$executionID&type=$type&withWeekend=$withWeekend&begin=" . helper::safe64Encode(urlencode($begin)) . "&end=" . helper::safe64Encode(urlencode($end)))));
}
if($begin and $end)
+1 -1
View File
@@ -37,7 +37,7 @@
<?php echo html::select('type', $lang->execution->cfdTypeList, $type, "class='form-control chosen'");?>
</div>
<div id="cfdDateSelect">
<form method='post' target='hiddenwin' class='not-watch'>
<form method='post' class='form-ajax not-watch'>
<div class='input-group'>
<?php echo html::input('begin', $begin, "class='form-control form-date' onchange='$(\"#datePreview\").removeClass(\"hidden\")' placeholder='" . $lang->execution->charts->cfd->begin . "'");?>
<span class='input-group-addon'><?php echo $lang->project->to;?></span>