// Code cleaning

This commit is contained in:
dMetzger
2012-09-20 13:16:01 +00:00
parent 455585aebf
commit 84894cdbca
4 changed files with 16 additions and 15 deletions
+1 -1
View File
@@ -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';
+1 -1
View File
@@ -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)
+10 -5
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()
+4 -8
View File
@@ -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 = '
<script type="text/javascript" src="../../js/jquery/datepicker/ui/i18n/ui.datepicker-'.Db::getInstance()->getValue('SELECT iso_code FROM '._DB_PREFIX_.'lang WHERE `id_lang` = '.(int)$this->context->language->id).'.js"></script>
<script type="text/javascript">
$("#datepickerFrom").datepicker({
prevText:"",