// Hide checkbox in configuration multishop when employee manage only 1 shop #PSCFV-2649

This commit is contained in:
rMalie
2012-06-04 07:49:20 +00:00
parent 05173238ef
commit 4eff1b110b
3 changed files with 7 additions and 5 deletions
@@ -68,7 +68,7 @@
<input type="hidden" name="{$key}" value="{$field['value']}" />
{else}
<div style="clear: both; padding-top:15px;" id="conf_id_{$key}" {if $field['is_invisible']} class="isInvisible"{/if}>
{if $field['multishop_default'] && empty($field['no_multishop_checkbox'])}
{if !$categoryData['hide_multishop_checkbox'] && $field['multishop_default'] && empty($field['no_multishop_checkbox'])}
<div class="preference_default_multishop">
<input type="checkbox" name="multishopOverrideOption[{$key}]" value="1" {if !$field['is_disabled']}checked="checked"{/if} onclick="checkMultishopDefaultValue(this, '{$key}')" />
</div>
+4 -3
View File
@@ -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;
+2 -1
View File
@@ -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