// Hide checkbox in configuration multishop when employee manage only 1 shop #PSCFV-2649
This commit is contained in:
@@ -836,6 +836,7 @@ class AdminControllerCore extends Controller
|
||||
|
||||
$languages = Language::getLanguages(false);
|
||||
|
||||
$hide_multishop_checkbox = (Shop::getTotalShops(false, null) < 2) ? true : false;
|
||||
foreach ($this->fields_options as $category_data)
|
||||
{
|
||||
if (!isset($category_data['fields']))
|
||||
@@ -862,7 +863,7 @@ class AdminControllerCore extends Controller
|
||||
foreach ($fields as $field => $values)
|
||||
{
|
||||
// We don't validate fields with no visibility
|
||||
if (Shop::isFeatureActive() && isset($values['visibility']) && ($values['visibility'] > Shop::getContext()))
|
||||
if (!$hide_multishop_checkbox && Shop::isFeatureActive() && isset($values['visibility']) && $values['visibility'] > Shop::getContext())
|
||||
continue;
|
||||
|
||||
// Check if field is required
|
||||
@@ -897,10 +898,10 @@ class AdminControllerCore extends Controller
|
||||
{
|
||||
foreach ($fields as $key => $options)
|
||||
{
|
||||
if (Shop::isFeatureActive() && isset($options['visibility']) && $options['visibility'] > Shop::getContext())
|
||||
if (!$hide_multishop_checkbox && Shop::isFeatureActive() && isset($options['visibility']) && $options['visibility'] > Shop::getContext())
|
||||
continue;
|
||||
|
||||
if (Shop::isFeatureActive() && Shop::getContext() != Shop::CONTEXT_ALL && empty($options['no_multishop_checkbox']) && empty($_POST['multishopOverrideOption'][$key]))
|
||||
if (!$hide_multishop_checkbox && Shop::isFeatureActive() && Shop::getContext() != Shop::CONTEXT_ALL && empty($options['no_multishop_checkbox']) && empty($_POST['multishopOverrideOption'][$key]))
|
||||
{
|
||||
Configuration::deleteFromContext($key);
|
||||
continue;
|
||||
|
||||
@@ -52,6 +52,7 @@ class HelperOptionsCore extends Helper
|
||||
$languages = Language::getLanguages(false);
|
||||
|
||||
$use_multishop = false;
|
||||
$hide_multishop_checkbox = (Shop::getTotalShops(false, null) < 2) ? true : false;
|
||||
foreach ($option_list as $category => $category_data)
|
||||
{
|
||||
if (!is_array($category_data))
|
||||
@@ -66,7 +67,7 @@ class HelperOptionsCore extends Helper
|
||||
$category_data['hide_multishop_checkbox'] = true;
|
||||
foreach ($category_data['fields'] as $key => $field)
|
||||
{
|
||||
if (empty($field['no_multishop_checkbox']))
|
||||
if (empty($field['no_multishop_checkbox']) && !$hide_multishop_checkbox)
|
||||
$category_data['hide_multishop_checkbox'] = false;
|
||||
|
||||
// Set field value unless explicitly denied
|
||||
|
||||
Reference in New Issue
Block a user