// Remove bad _SQL_USE_SLAVE_ uses + normalize Db->executeS(), Db->execute() and Db->numRows() names
This commit is contained in:
@@ -33,7 +33,7 @@ function show_countries($id_lang, $nb_by_line = 7)
|
||||
|
||||
$output = '<style type="text/css">.country{cursor: pointer;} .country:hover{text-decoration: underline;}</style>
|
||||
<script type="text/javascript">$(document).ready(_registerClickOnCountry);</script>';
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('SELECT cl.`id_country`, `name`, `iso_code` FROM `'._DB_PREFIX_.'country_lang` cl
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('SELECT cl.`id_country`, `name`, `iso_code` FROM `'._DB_PREFIX_.'country_lang` cl
|
||||
LEFT JOIN `'._DB_PREFIX_.'country` c ON c.`id_country` = cl.`id_country`
|
||||
WHERE `id_lang` = \''.(int)($id_lang).'\' ORDER BY `name` ASC;');
|
||||
$separator = 0;
|
||||
@@ -56,7 +56,7 @@ function show_buttons($id_lang, $id_country)
|
||||
$output = '<script type="text/javascript">$(document).ready(_registerClickButtons);</script>
|
||||
<span id="selectinfo" style="text-align: center;"></span> ';
|
||||
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('SELECT cl.`id_country`, `name`, `iso_code`, `x`, `y` FROM `'._DB_PREFIX_.'country_lang` cl
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('SELECT cl.`id_country`, `name`, `iso_code`, `x`, `y` FROM `'._DB_PREFIX_.'country_lang` cl
|
||||
LEFT JOIN `'._DB_PREFIX_.'country` c ON c.`id_country` = cl.`id_country`
|
||||
LEFT JOIN `'._DB_PREFIX_.'location_coords` lc ON c.`id_country` = lc.`id_country`
|
||||
WHERE `id_lang` = \''.(int)($id_lang).'\' AND cl.`id_country`= \''.(int)($id_country).'\';');
|
||||
@@ -80,8 +80,8 @@ function insert_coords($id_lang, $id_country, $x, $y)
|
||||
{
|
||||
if (!is_numeric($id_lang) || !is_numeric($id_country) || !is_numeric($x) || !is_numeric($y))
|
||||
return ("error");
|
||||
Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'location_coords` WHERE `id_country` = \''.$id_country.'\';');
|
||||
if (!Db::getInstance()->Execute('INSERT INTO `'._DB_PREFIX_.'location_coords` (`x`, `y`, `id_country`) VALUES (\''.(int)($x).'\', \''.(int)($y).'\', \''.(int)($id_country).'\');'))
|
||||
Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'location_coords` WHERE `id_country` = \''.$id_country.'\';');
|
||||
if (!Db::getInstance()->execute('INSERT INTO `'._DB_PREFIX_.'location_coords` (`x`, `y`, `id_country`) VALUES (\''.(int)($x).'\', \''.(int)($y).'\', \''.(int)($id_country).'\');'))
|
||||
echo("error while inserting data<br />");
|
||||
return (show_countries($id_lang));
|
||||
}
|
||||
|
||||
@@ -70,13 +70,13 @@ function drawCircles($image)
|
||||
|
||||
function getTotalElements()
|
||||
{
|
||||
$result = Db::getInstance()->ExecuteS('SELECT COUNT(`id_address`) as total FROM `'._DB_PREFIX_.'address` WHERE deleted = 0 AND id_customer IS NOT NULL AND id_customer != 0');
|
||||
$result = Db::getInstance()->executeS('SELECT COUNT(`id_address`) as total FROM `'._DB_PREFIX_.'address` WHERE deleted = 0 AND id_customer IS NOT NULL AND id_customer != 0');
|
||||
return (isset($result[0]) ? $result[0]['total'] : 0);
|
||||
}
|
||||
|
||||
function getCoords()
|
||||
{
|
||||
return (Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('SELECT `x`, `y`, COUNT(`id_address`) AS total
|
||||
return (Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('SELECT `x`, `y`, COUNT(`id_address`) AS total
|
||||
FROM `'._DB_PREFIX_.'address` a
|
||||
LEFT JOIN `'._DB_PREFIX_.'location_coords` lc ON lc.`id_country`=a.`id_country`
|
||||
WHERE deleted = 0 AND id_customer IS NOT NULL AND id_customer != 0
|
||||
|
||||
@@ -86,7 +86,7 @@ class StatsGeoLocation extends Module
|
||||
|
||||
if ( !parent::install() OR !$this->registerHook('AdminStatsModules'))
|
||||
return false;
|
||||
if (!Db::getInstance()->Execute('
|
||||
if (!Db::getInstance()->execute('
|
||||
CREATE TABLE `'._DB_PREFIX_.'location_coords` (
|
||||
`id_location_coords` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`x` int(4) NOT NULL,
|
||||
@@ -98,7 +98,7 @@ class StatsGeoLocation extends Module
|
||||
|
||||
$flag = 0;
|
||||
$query = 'INSERT INTO `'._DB_PREFIX_.'location_coords` (`x`, `y`, `id_country`) VALUES ';
|
||||
$result = Db::getInstance()->ExecuteS('SELECT `id_country`, `iso_code` FROM `'._DB_PREFIX_.'country`;');
|
||||
$result = Db::getInstance()->executeS('SELECT `id_country`, `iso_code` FROM `'._DB_PREFIX_.'country`;');
|
||||
foreach ($result as $index => $row)
|
||||
{
|
||||
if (isset($countries[$row['iso_code']]))
|
||||
@@ -109,14 +109,14 @@ class StatsGeoLocation extends Module
|
||||
$flag = 1;
|
||||
}
|
||||
}
|
||||
return Db::getInstance()->Execute($query.';');
|
||||
return Db::getInstance()->execute($query.';');
|
||||
}
|
||||
|
||||
function uninstall()
|
||||
{
|
||||
if (!parent::uninstall())
|
||||
return false;
|
||||
return (Db::getInstance()->Execute('DROP TABLE `'._DB_PREFIX_.'location_coords`'));
|
||||
return (Db::getInstance()->execute('DROP TABLE `'._DB_PREFIX_.'location_coords`'));
|
||||
}
|
||||
|
||||
function hookAdminStatsModules()
|
||||
|
||||
Reference in New Issue
Block a user