* Code for task#60640
This commit is contained in:
@@ -1389,6 +1389,7 @@ class execution extends control
|
||||
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'));
|
||||
}
|
||||
|
||||
|
||||
@@ -138,5 +138,5 @@ $(function()
|
||||
});
|
||||
|
||||
$("#end, #begin").datetimepicker('setEndDate', today)
|
||||
$('.datetimepicker-days table tfoot tr th').html(dateRangeTip).removeClass('today');
|
||||
$('.datetimepicker-days table tfoot').append('<tr><th colspan="7">' + dateRangeTip + '</th></tr>');
|
||||
});
|
||||
|
||||
@@ -3072,6 +3072,42 @@ class executionModel extends model
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check whether there is data on the specified date of execution, and there is no data with the latest date added.
|
||||
*
|
||||
* @param int $executionID
|
||||
* @param string $date
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function checkCFDData($executionID, $date)
|
||||
{
|
||||
$today = helper::today();
|
||||
if($date >= $today) return;
|
||||
|
||||
$checkData = $this->dao->select("date, `count` AS value, `name`")->from(TABLE_CFD)
|
||||
->where('execution')->eq((int)$executionID)
|
||||
->andWhere('date')->eq($date)
|
||||
->orderBy('date DESC, id asc')->fetchGroup('name', 'date');
|
||||
if(!$checkData)
|
||||
{
|
||||
$closetoDate = $this->dao->select("max(date) as date")->from(TABLE_CFD)->where('execution')->eq((int)$executionID)->andWhere('date')->lt($date)->fetch('date');
|
||||
if($closetoDate)
|
||||
{
|
||||
$copyData = $this->dao->select("*")->from(TABLE_CFD)
|
||||
->where('execution')->eq((int)$executionID)
|
||||
->andWhere('date')->eq($closetoDate)
|
||||
->fetchAll();
|
||||
foreach($copyData as $data)
|
||||
{
|
||||
unset($data->id);
|
||||
$data->date = $date;
|
||||
$this->dao->replace(TABLE_CFD)->data($data)->exec();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Fix burn for first day.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user