// Fix bug on auths for sub employees #PSFV-849
This commit is contained in:
+18
-15
@@ -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)
|
||||
|
||||
@@ -93,12 +93,13 @@
|
||||
function ifSuperAdmin(el)
|
||||
{
|
||||
var val = $(el).val();
|
||||
if(val == {$smarty.const._PS_ADMIN_PROFILE_})
|
||||
|
||||
if (!val || val == {$smarty.const._PS_ADMIN_PROFILE_})
|
||||
{
|
||||
$('.assoShop input[type=checkbox]').attr('disabled', 'disabled');
|
||||
$('.assoShop input[type=checkbox]').attr('disabled', true);
|
||||
$('.assoShop input[type=checkbox]').attr('checked', 'checked');
|
||||
}
|
||||
else
|
||||
$('.assoShop input[type=checkbox]').attr('disabled', '');
|
||||
$('.assoShop input[type=checkbox]').attr('disabled', false);
|
||||
}
|
||||
{/block}
|
||||
|
||||
@@ -26,7 +26,6 @@
|
||||
|
||||
<script type="text/javascript">
|
||||
$().ready(function() {
|
||||
// Click on "all shop"
|
||||
$('.input_all_shop').live('click', function() {
|
||||
var checked = $(this).prop('checked');
|
||||
$('.input_shop_group:not(:disabled)').attr('checked', checked);
|
||||
|
||||
Reference in New Issue
Block a user