// Fix BO connection bug with employees auth

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@14808 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
rMalie
2012-04-23 12:25:06 +00:00
parent 278ec73d66
commit 54b39b1eaa
+29 -25
View File
@@ -101,41 +101,45 @@ try
$context->currency = new Currency(Configuration::get('PS_CURRENCY_DEFAULT'));
$shop_id = '';
Shop::setContext(Shop::CONTEXT_ALL);
if ($this->context->cookie->shopContext)
if ($context->employee->isLoggedBack())
{
$split = explode('-', $this->context->cookie->shopContext);
if (count($split) == 2)
$shop_id = '';
Shop::setContext(Shop::CONTEXT_ALL);
if ($context->cookie->shopContext)
{
if ($split[0] == 'g')
$split = explode('-', $context->cookie->shopContext);
if (count($split) == 2)
{
if ($this->context->employee->hasAuthOnShopGroup($split[1]))
Shop::setContext(Shop::CONTEXT_GROUP, $split[1]);
if ($split[0] == 'g')
{
if ($context->employee->hasAuthOnShopGroup($split[1]))
Shop::setContext(Shop::CONTEXT_GROUP, $split[1]);
else
{
$shop_id = $context->employee->getDefaultShopID();
Shop::setContext(Shop::CONTEXT_SHOP, $shop_id);
}
}
else if ($context->employee->hasAuthOnShop($split[1]))
{
$shop_id = $split[1];
Shop::setContext(Shop::CONTEXT_SHOP, $shop_id);
}
else
{
$shop_id = $this->context->employee->getDefaultShopID();
$shop_id = $context->employee->getDefaultShopID();
Shop::setContext(Shop::CONTEXT_SHOP, $shop_id);
}
}
else if ($this->context->employee->hasAuthOnShop($split[1]))
{
$shop_id = $split[1];
Shop::setContext(Shop::CONTEXT_SHOP, $shop_id);
}
else
{
$shop_id = $this->context->employee->getDefaultShopID();
Shop::setContext(Shop::CONTEXT_SHOP, $shop_id);
}
}
}
// Replace existing shop if necessary
if (!$shop_id)
$context->shop = new Shop(Configuration::get('PS_SHOP_DEFAULT'));
else if ($context->shop->id != $shop_id)
$context->shop = new Shop($shop_id);
// Replace existing shop if necessary
if (!$shop_id)
$context->shop = new Shop(Configuration::get('PS_SHOP_DEFAULT'));
else if ($context->shop->id != $shop_id)
$context->shop = new Shop($shop_id);
}
}
catch(PrestaShopException $e)
{