// Fix bug on auths for sub employees #PSFV-849

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@14804 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
rMalie
2012-04-23 09:38:24 +00:00
parent a8569d1496
commit 60a140c91f
7 changed files with 104 additions and 80 deletions
+18 -15
View File
@@ -103,30 +103,33 @@ try
$shop_id = '';
Shop::setContext(Shop::CONTEXT_ALL);
if ($context->cookie->shopContext)
if ($this->context->cookie->shopContext)
{
$split = explode('-', $context->cookie->shopContext);
$split = explode('-', $this->context->cookie->shopContext);
if (count($split) == 2)
{
if ($split[0] == 'g')
Shop::setContext(Shop::CONTEXT_GROUP, $split[1]);
{
if ($this->context->employee->hasAuthOnShopGroup($split[1]))
Shop::setContext(Shop::CONTEXT_GROUP, $split[1]);
else
{
$shop_id = $this->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::setContext(Shop::CONTEXT_SHOP, $split[1]);
$shop_id = $split[1];
$shop_id = $this->context->employee->getDefaultShopID();
Shop::setContext(Shop::CONTEXT_SHOP, $shop_id);
}
}
}
else if ($context->employee->id_profile == _PS_ADMIN_PROFILE_)
$shop_id = '';
else if (Shop::getTotalShops(false) != Employee::getTotalEmployeeShopById((int)$context->employee->id))
{
$shops = Employee::getEmployeeShopById((int)$context->employee->id);
if (count($shops))
$shop_id = (int)$shops[0];
}
else
Employee::getEmployeeShopAccess((int)$context->employee->id);
// Replace existing shop if necessary
if (!$shop_id)