[-] MO : statsnewsletter - SQL error

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@8635 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
fBrignoli
2011-09-19 10:02:59 +00:00
parent d2cb63d1e3
commit 067342db32
+10 -9
View File
@@ -1,6 +1,6 @@
<?php <?php
/* /*
* 2007-2011 PrestaShop * 2007-2011 PrestaShop
* *
* NOTICE OF LICENSE * NOTICE OF LICENSE
* *
@@ -42,9 +42,9 @@ class StatsNewsletter extends ModuleGraph
$this->version = 1.0; $this->version = 1.0;
$this->author = 'PrestaShop'; $this->author = 'PrestaShop';
$this->need_instance = 0; $this->need_instance = 0;
parent::__construct(); parent::__construct();
$this->displayName = $this->l('Newsletter'); $this->displayName = $this->l('Newsletter');
$this->description = $this->l('Display the newsletter registrations'); $this->description = $this->l('Display the newsletter registrations');
} }
@@ -87,19 +87,20 @@ class StatsNewsletter extends ModuleGraph
$sql = 'SELECT COUNT(*) as visitors $sql = 'SELECT COUNT(*) as visitors
FROM '._DB_PREFIX_.'newsletter FROM '._DB_PREFIX_.'newsletter
WHERE '.$this->sqlShopRestriction().' WHERE 1
'.$this->sqlShopRestriction().'
AND `newsletter_date_add` BETWEEN '.ModuleGraph::getDateBetween(); AND `newsletter_date_add` BETWEEN '.ModuleGraph::getDateBetween();
$result2 = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow($sql); $result2 = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow($sql);
return array('customers' => $result1['customers'], 'visitors' => $result2['visitors'], 'both' => $result1['customers'] + $result2['visitors']); return array('customers' => $result1['customers'], 'visitors' => $result2['visitors'], 'both' => $result1['customers'] + $result2['visitors']);
} }
protected function getData($layers) protected function getData($layers)
{ {
$this->_titles['main'][0] = $this->l('Newsletter statistics'); $this->_titles['main'][0] = $this->l('Newsletter statistics');
$this->_titles['main'][1] = $this->l('Customers'); $this->_titles['main'][1] = $this->l('Customers');
$this->_titles['main'][2] = $this->l('Visitors'); $this->_titles['main'][2] = $this->l('Visitors');
$this->_titles['main'][3] = $this->l('Both'); $this->_titles['main'][3] = $this->l('Both');
$this->_query = 'SELECT newsletter_date_add $this->_query = 'SELECT newsletter_date_add
FROM `'._DB_PREFIX_.'customer` FROM `'._DB_PREFIX_.'customer`
WHERE 1 WHERE 1
@@ -113,7 +114,7 @@ class StatsNewsletter extends ModuleGraph
AND `newsletter_date_add` BETWEEN '; AND `newsletter_date_add` BETWEEN ';
$this->setDateGraph($layers, true); $this->setDateGraph($layers, true);
} }
protected function setAllTimeValues($layers) protected function setAllTimeValues($layers)
{ {
$result1 = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS($this->_query.$this->getDate()); $result1 = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS($this->_query.$this->getDate());
@@ -126,7 +127,7 @@ class StatsNewsletter extends ModuleGraph
foreach ($this->_values[2] as $key => $zerofill) foreach ($this->_values[2] as $key => $zerofill)
$this->_values[2][$key] = $this->_values[0][$key] + $this->_values[1][$key]; $this->_values[2][$key] = $this->_values[0][$key] + $this->_values[1][$key];
} }
protected function setYearValues($layers) protected function setYearValues($layers)
{ {
$result1 = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS($this->_query.$this->getDate()); $result1 = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS($this->_query.$this->getDate());
@@ -139,7 +140,7 @@ class StatsNewsletter extends ModuleGraph
foreach ($this->_values[2] as $key => $zerofill) foreach ($this->_values[2] as $key => $zerofill)
$this->_values[2][$key] = $this->_values[0][$key] + $this->_values[1][$key]; $this->_values[2][$key] = $this->_values[0][$key] + $this->_values[1][$key];
} }
protected function setMonthValues($layers) protected function setMonthValues($layers)
{ {
$result1 = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS($this->_query.$this->getDate()); $result1 = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS($this->_query.$this->getDate());