// Code cleaning

This commit is contained in:
dMetzger
2012-09-20 13:16:01 +00:00
parent 0c56e308a0
commit eec5624768
4 changed files with 16 additions and 15 deletions

View File

@@ -293,10 +293,14 @@ abstract class ModuleGraphCore extends Module
protected static function getEmployee($employee = null, Context $context = null)
{
if (!$context)
$context = Context::getContext();
if (!$employee)
if (!Validate::isLoadedObject($employee))
{
if (!$context)
$context = Context::getContext();
if (!Validate::isLoadedObject($context->employee))
return false;
$employee = $context->employee;
}
if (empty($employee->stats_date_from) || empty($employee->stats_date_to)
|| $employee->stats_date_from == '0000-00-00' || $employee->stats_date_to == '0000-00-00')
@@ -317,8 +321,9 @@ abstract class ModuleGraphCore extends Module
public static function getDateBetween($employee = null)
{
$employee = ModuleGraph::getEmployee($employee);
return ' \''.$employee->stats_date_from.' 00:00:00\' AND \''.$employee->stats_date_to.' 23:59:59\' ';
if ($employee = ModuleGraph::getEmployee($employee))
return ' \''.$employee->stats_date_from.' 00:00:00\' AND \''.$employee->stats_date_to.' 23:59:59\' ';
return ' \''.date('Y-m').'-01 00:00:00\' AND \''.date('Y-m-t').' 23:59:59\' ';
}
public function getLang()