// Improve multishop_context in AdminController and rename shop->getListOfID() by Shop::getContextListShopID()

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@13615 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
rMalie
2012-02-27 09:49:19 +00:00
parent 275ec90ef0
commit 1c2f174bdb
14 changed files with 59 additions and 44 deletions
@@ -39,7 +39,7 @@ class AdminAccountingManagementControllerCore extends AdminController
$shop = array();
$error = '';
if (count($this->context->shop->getListOfID()) > 1)
if (count(Shop::getContextListShopID()) > 1)
$error = $this->l('Please select the shop you want to configure');
else
{
@@ -158,7 +158,7 @@ class AdminInvoicesControllerCore extends AdminController
) id_order_state
FROM '._DB_PREFIX_.'order_invoice oi
LEFT JOIN '._DB_PREFIX_.'orders o ON (oi.id_order = o.id_order)
WHERE o.id_shop IN('.implode(', ', $this->context->shop->getListOfID()).')
WHERE o.id_shop IN('.implode(', ', Shop::getContextListShopID()).')
GROUP BY id_order_state
');
@@ -77,7 +77,7 @@ class AdminModulesPositionsControllerCore extends AdminController
// Adding vars...
else
{
if (!$module->registerHook($hook->name, Context::getContext()->shop->getListOfID()))
if (!$module->registerHook($hook->name, Shop::getContextListShopID()))
$this->errors[] = Tools::displayError('An error occurred while transplanting module to hook.');
else
{
@@ -89,7 +89,7 @@ class AdminModulesPositionsControllerCore extends AdminController
if (!Validate::isFileName($except))
$this->errors[] = Tools::displayError('No valid value for field exceptions');
if (!$this->errors && !$module->registerExceptions($id_hook, $exceptions, Context::getContext()->shop->getListOfID()))
if (!$this->errors && !$module->registerExceptions($id_hook, $exceptions, Shop::getContextListShopID()))
$this->errors[] = Tools::displayError('An error occurred while transplanting module to hook.');
}
@@ -150,7 +150,7 @@ class AdminModulesPositionsControllerCore extends AdminController
$this->errors[] = Tools::displayError('No valid value for field exceptions');
// Add files exceptions
if (!$module->editExceptions($id_hook, $exceptions, Context::getContext()->shop->getListOfID()))
if (!$module->editExceptions($id_hook, $exceptions, Shop::getContextListShopID()))
$this->errors[] = Tools::displayError('An error occurred while transplanting module to hook.');
else
Tools::redirectAdmin(self::$currentIndex.'&conf=16'.($this->display_key ? '&show_modules='.$this->display_key : '').'&token='.$this->token);
@@ -176,8 +176,8 @@ class AdminModulesPositionsControllerCore extends AdminController
$this->errors[] = Tools::displayError('Hook cannot be loaded.');
else
{
if (!$module->unregisterHook($id_hook, Context::getContext()->shop->getListOfID())
|| !$module->unregisterExceptions($id_hook, Context::getContext()->shop->getListOfID()))
if (!$module->unregisterHook($id_hook, Shop::getContextListShopID())
|| !$module->unregisterExceptions($id_hook, Shop::getContextListShopID()))
$this->errors[] = Tools::displayError('An error occurred while deleting module from hook.');
else
Tools::redirectAdmin(self::$currentIndex.'&conf=17'.($this->display_key ? '&show_modules='.$this->display_key : '').'&token='.$this->token);
@@ -309,7 +309,7 @@ class AdminModulesPositionsControllerCore extends AdminController
FROM '._DB_PREFIX_.'hook_module
WHERE id_module = '.$id_module.'
AND id_hook = '.$id_hook.'
AND id_shop IN('.implode(', ', Context::getContext()->shop->getListOfID()).')';
AND id_shop IN('.implode(', ', Shop::getContextListShopID()).')';
if (!Db::getInstance()->getValue($sql))
Tools::redirectAdmin(self::$currentIndex.'&token='.$this->token);
@@ -2468,7 +2468,7 @@ class AdminProductsControllerCore extends AdminController
$error = '';
$detail = array();
if (count($this->context->shop->getListOfID()) > 1)
if (count(Shop::getContextListShopID()) > 1)
$error = $this->l('Please select the shop you want to configure');
else
{
@@ -166,7 +166,7 @@ class AdminReferrersControllerCore extends AdminController
(sa.cache_orders*base_fee) as fee1, (sa.cache_sales*percent_fee/100) as fee2';
$this->_join = '
LEFT JOIN `'._DB_PREFIX_.'referrer_shop` sa
ON (sa.'.$this->identifier.' = a.'.$this->identifier.' AND sa.id_shop IN ('.implode(', ', $this->context->shop->getListOfID()).'))';
ON (sa.'.$this->identifier.' = a.'.$this->identifier.' AND sa.id_shop IN ('.implode(', ', Shop::getContextListShopID()).'))';
$this->_group = 'GROUP BY sa.id_referrer';