diff --git a/classes/Dispatcher.php b/classes/Dispatcher.php
index 64264c65a..7731aeed3 100644
--- a/classes/Dispatcher.php
+++ b/classes/Dispatcher.php
@@ -208,7 +208,7 @@ class DispatcherCore
$this->default_controller = 'adminhome';
$this->use_routes = false;
}
- else if (Tools::getValue('fc') == 'module')
+ elseif (Tools::getValue('fc') == 'module')
{
$this->front_controller = self::FC_MODULE;
$this->controller_not_found = 'pagenotfound';
diff --git a/classes/Referrer.php b/classes/Referrer.php
index b1bcf4c09..f7d7762ef 100644
--- a/classes/Referrer.php
+++ b/classes/Referrer.php
@@ -202,7 +202,7 @@ class ReferrerCore extends ObjectModel
* @param int $id_product
* @param int $employee
*/
- public function getStatsSales($id_product, $employe)
+ public function getStatsSales($id_product, $employee)
{
$join = $where = '';
if ($id_product)
diff --git a/classes/module/ModuleGraph.php b/classes/module/ModuleGraph.php
index 280ae8728..dfe214a6f 100644
--- a/classes/module/ModuleGraph.php
+++ b/classes/module/ModuleGraph.php
@@ -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()
diff --git a/modules/trackingfront/trackingfront.php b/modules/trackingfront/trackingfront.php
index c87a99be3..1182bf4da 100644
--- a/modules/trackingfront/trackingfront.php
+++ b/modules/trackingfront/trackingfront.php
@@ -155,18 +155,15 @@ class TrackingFront extends Module
public function displayAccount()
{
if (!isset($this->context->cookie->stats_date_from))
- $this->context->cookie->stats_date_from = date('Y-m-d');
+ $this->context->cookie->stats_date_from = date('Y-m-01');
if (!isset($this->context->cookie->stats_date_to))
$this->context->cookie->stats_date_to = date('Y-m-t');
- $fakeEmployee = new Employee();
- $fakeEmployee->stats_date_from = $this->context->cookie->stats_date_from;
- $fakeEmployee->stats_date_to = $this->context->cookie->stats_date_to;
- Referrer::refreshCache(array(array('id_referrer' => (int)($this->context->cookie->tracking_id))), $fakeEmployee);
+ Referrer::refreshCache(array(array('id_referrer' => (int)$this->context->cookie->tracking_id)));
$referrer = new Referrer((int)($this->context->cookie->tracking_id));
$this->smarty->assign('referrer', $referrer);
- $this->smarty->assign('datepickerFrom', $fakeEmployee->stats_date_from);
- $this->smarty->assign('datepickerTo', $fakeEmployee->stats_date_to);
+ $this->smarty->assign('datepickerFrom', $this->context->cookie->stats_date_from);
+ $this->smarty->assign('datepickerTo', $this->context->cookie->stats_date_to);
$displayTab = array(
'uniqs' => $this->l('Unique visitors'),
@@ -190,7 +187,6 @@ class TrackingFront extends Module
$productsArray[] = $product['id_product'];
$echo = '
-