// norm fix
// rename Shop::has_dependency() in Shop::hasDependency()
This commit is contained in:
@@ -1993,7 +1993,7 @@ class AdminControllerCore extends Controller
|
|||||||
|
|
||||||
/* Cache */
|
/* Cache */
|
||||||
$this->_lang = (int)$id_lang;
|
$this->_lang = (int)$id_lang;
|
||||||
$this->_orderBy = $order_by;
|
$this->_orderBy = substr($order_by, strpos($order_by, '.') + 1);
|
||||||
$this->_orderWay = Tools::strtoupper($order_way);
|
$this->_orderWay = Tools::strtoupper($order_way);
|
||||||
|
|
||||||
/* SQL table : orders, but class name is Order */
|
/* SQL table : orders, but class name is Order */
|
||||||
@@ -2061,7 +2061,11 @@ class AdminControllerCore extends Controller
|
|||||||
if (isset($this->_having))
|
if (isset($this->_having))
|
||||||
$having_clause .= $this->_having.' ';
|
$having_clause .= $this->_having.' ';
|
||||||
}
|
}
|
||||||
|
if (strpos($order_by, '.') > 0)
|
||||||
|
{
|
||||||
|
$order_by = explode('.', $order_by);
|
||||||
|
$order_by = pSQL($order_by[0]).'.`'.pSQL($order_by[1]).'`';
|
||||||
|
}
|
||||||
$sql = 'SELECT SQL_CALC_FOUND_ROWS
|
$sql = 'SELECT SQL_CALC_FOUND_ROWS
|
||||||
'.($this->_tmpTableFilter ? ' * FROM (SELECT ' : '').'
|
'.($this->_tmpTableFilter ? ' * FROM (SELECT ' : '').'
|
||||||
'.($this->lang ? 'b.*, ' : '').'a.*'.(isset($this->_select) ? ', '.$this->_select.' ' : '').$select_shop.'
|
'.($this->lang ? 'b.*, ' : '').'a.*'.(isset($this->_select) ? ', '.$this->_select.' ' : '').$select_shop.'
|
||||||
@@ -2074,7 +2078,7 @@ class AdminControllerCore extends Controller
|
|||||||
(isset($this->_filter) ? $this->_filter : '').$where_shop.'
|
(isset($this->_filter) ? $this->_filter : '').$where_shop.'
|
||||||
'.(isset($this->_group) ? $this->_group.' ' : '').'
|
'.(isset($this->_group) ? $this->_group.' ' : '').'
|
||||||
'.$having_clause.'
|
'.$having_clause.'
|
||||||
ORDER BY '.(($order_by == $this->identifier) ? 'a.' : '').'`'.pSQL($order_by).'` '.pSQL($order_way).
|
ORDER BY '.(($order_by == $this->identifier) ? 'a.' : '').pSQL($order_by).' '.pSQL($order_way).
|
||||||
($this->_tmpTableFilter ? ') tmpTable WHERE 1'.$this->_tmpTableFilter : '').
|
($this->_tmpTableFilter ? ') tmpTable WHERE 1'.$this->_tmpTableFilter : '').
|
||||||
(($use_limit === true) ? ' LIMIT '.(int)$start.','.(int)$limit : '');
|
(($use_limit === true) ? ' LIMIT '.(int)$start.','.(int)$limit : '');
|
||||||
|
|
||||||
|
|||||||
@@ -154,7 +154,7 @@ class ShopCore extends ObjectModel
|
|||||||
|
|
||||||
public function delete()
|
public function delete()
|
||||||
{
|
{
|
||||||
if (Shop::has_dependency($this->id) || !$res = parent::delete())
|
if (Shop::hasDependency($this->id) || !$res = parent::delete())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
foreach (Shop::getAssoTables() as $table_name => $row)
|
foreach (Shop::getAssoTables() as $table_name => $row)
|
||||||
@@ -185,7 +185,7 @@ class ShopCore extends ObjectModel
|
|||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public static function has_dependency($id_shop)
|
public static function hasDependency($id_shop)
|
||||||
{
|
{
|
||||||
$has_dependency = false;
|
$has_dependency = false;
|
||||||
$nbr_customer = (int)Db::getInstance()->getValue('
|
$nbr_customer = (int)Db::getInstance()->getValue('
|
||||||
@@ -228,7 +228,6 @@ class ShopCore extends ObjectModel
|
|||||||
*/
|
*/
|
||||||
public static function initialize()
|
public static function initialize()
|
||||||
{
|
{
|
||||||
|
|
||||||
// Get list of excluded uri
|
// Get list of excluded uri
|
||||||
$dirname = dirname(__FILE__);
|
$dirname = dirname(__FILE__);
|
||||||
$directories = scandir($dirname.'/../');
|
$directories = scandir($dirname.'/../');
|
||||||
@@ -293,7 +292,7 @@ class ShopCore extends ObjectModel
|
|||||||
if (!Validate::isLoadedObject($default_shop))
|
if (!Validate::isLoadedObject($default_shop))
|
||||||
throw new PrestaShopException('Shop not found');
|
throw new PrestaShopException('Shop not found');
|
||||||
|
|
||||||
$url = 'http://'.$default_shop->domain.$default_shop->getBaseURI().'index.php'.'?'.$_SERVER['QUERY_STRING'];
|
$url = 'http://'.$default_shop->domain.$default_shop->getBaseURI().'index.php?'.$_SERVER['QUERY_STRING'];
|
||||||
header('location: '.$url);
|
header('location: '.$url);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
@@ -391,7 +390,7 @@ class ShopCore extends ObjectModel
|
|||||||
{
|
{
|
||||||
if (defined('_PS_ADMIN_DIR_'))
|
if (defined('_PS_ADMIN_DIR_'))
|
||||||
return Shop::getContextGroupID();
|
return Shop::getContextGroupID();
|
||||||
return (isset($this->id_group_shop)) ? (int)$this->id_group_shop : NULL;
|
return (isset($this->id_group_shop)) ? (int)$this->id_group_shop : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -662,8 +661,8 @@ class ShopCore extends ObjectModel
|
|||||||
$sql = sprintf('
|
$sql = sprintf('
|
||||||
SELECT `id_shop`, `%s`
|
SELECT `id_shop`, `%s`
|
||||||
FROM `'._DB_PREFIX_.'%s_shop`
|
FROM `'._DB_PREFIX_.'%s_shop`
|
||||||
WHERE `%s` = %d'
|
WHERE `%s` = %d',
|
||||||
, $identifier, $table, $identifier, $id);
|
$identifier, $table, $identifier, $id);
|
||||||
|
|
||||||
return Db::getInstance()->executeS($sql);
|
return Db::getInstance()->executeS($sql);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user