diff --git a/admin-dev/functions.php b/admin-dev/functions.php
index 9418ff362..605aae742 100644
--- a/admin-dev/functions.php
+++ b/admin-dev/functions.php
@@ -419,10 +419,19 @@ function generateShopList()
foreach ($tree as $gID => $group_data)
{
$disabled = ($group_data['totalShops'] != count($group_data['shops'])) ? 'disabled="disabled"' : '';
- $html .= '';
- foreach ($group_data['shops'] as $sID => $shopData)
- if ($shopData['active'])
- $html .= '';
+
+ if ($context->controller->multishop_context & Shop::CONTEXT_GROUP)
+ $html .= '';
+ else
+ $html .= '';
}
$html .= '';
diff --git a/admin-dev/themes/default/template/header.tpl b/admin-dev/themes/default/template/header.tpl
index 2dc227f23..5a94d754e 100644
--- a/admin-dev/themes/default/template/header.tpl
+++ b/admin-dev/themes/default/template/header.tpl
@@ -218,7 +218,7 @@
{/if}
- {if $display_header && $is_multishop && $display_multishop_toolbar}
+ {if $display_header && $is_multishop && ($multishop_context & Shop::CONTEXT_GROUP || $multishop_context & Shop::CONTEXT_SHOP)}
{l s='Multishop configuration for'}
{$shop_list}
diff --git a/classes/controller/AdminController.php b/classes/controller/AdminController.php
index fa8b61b77..c8c827f10 100644
--- a/classes/controller/AdminController.php
+++ b/classes/controller/AdminController.php
@@ -255,10 +255,7 @@ class AdminControllerCore extends Controller
*/
public $controller_name;
- /**
- * @var bool Display or not the multishop toolbar for this controller
- */
- public $display_multishop_toolbar = true;
+ public $multishop_context;
public function __construct()
{
@@ -268,6 +265,8 @@ class AdminControllerCore extends Controller
parent::__construct();
+ $this->multishop_context = Shop::CONTEXT_ALL | Shop::CONTEXT_GROUP | Shop::CONTEXT_SHOP;
+
$this->bo_theme = ((Validate::isLoadedObject($this->context->employee) && $this->context->employee->bo_theme) ? $this->context->employee->bo_theme : 'default');
$this->context->smarty->setTemplateDir(_PS_BO_ALL_THEMES_DIR_.$this->bo_theme.'/template');
@@ -1303,7 +1302,7 @@ class AdminControllerCore extends Controller
'tabs' => $tabs,
'install_dir_exists' => file_exists(_PS_ADMIN_DIR_.'/../install'),
'is_multishop' => $is_multishop,
- 'display_multishop_toolbar' => $this->display_multishop_toolbar,
+ 'multishop_context' => $this->multishop_context,
'pic_dir' => _THEME_PROD_PIC_DIR_,
'controller_name' => Tools::getValue('controller'),
));
@@ -1939,7 +1938,7 @@ class AdminControllerCore extends Controller
$where_shop = $this->context->shop->addSqlRestriction($this->shopShareDatas, 'a', $this->shopLinkType);
}
- if ($this->display_multishop_toolbar)
+ if ($this->multishop_context)
{
$assos = Shop::getAssoTables();
$assos_group = GroupShop::getAssoTables();
diff --git a/classes/shop/Shop.php b/classes/shop/Shop.php
index 67a77e72c..52b45a545 100644
--- a/classes/shop/Shop.php
+++ b/classes/shop/Shop.php
@@ -110,7 +110,7 @@ class ShopCore extends ObjectModel
*/
const CONTEXT_SHOP = 1;
const CONTEXT_GROUP = 2;
- const CONTEXT_ALL = 3;
+ const CONTEXT_ALL = 4;
/**
* Some data can be shared between shops, like customers or orders
diff --git a/controllers/admin/AdminCurrenciesController.php b/controllers/admin/AdminCurrenciesController.php
index 10933b04f..6dbb92ee9 100644
--- a/controllers/admin/AdminCurrenciesController.php
+++ b/controllers/admin/AdminCurrenciesController.php
@@ -27,8 +27,6 @@
class AdminCurrenciesControllerCore extends AdminController
{
- public $display_multishop_toolbar = false;
-
public function __construct()
{
$this->table = 'currency';
@@ -82,6 +80,8 @@ class AdminCurrenciesControllerCore extends AdminController
)
);
parent::__construct();
+
+ $this->multishop_context = Shop::CONTEXT_ALL;
}
public function renderList()
diff --git a/controllers/admin/AdminGroupShopController.php b/controllers/admin/AdminGroupShopController.php
index e74a924af..2f0f17b28 100644
--- a/controllers/admin/AdminGroupShopController.php
+++ b/controllers/admin/AdminGroupShopController.php
@@ -27,8 +27,6 @@
class AdminGroupShopControllerCore extends AdminController
{
- public $display_multishop_toolbar = false;
-
public function __construct()
{
$this->table = 'group_shop';
@@ -69,6 +67,8 @@ class AdminGroupShopControllerCore extends AdminController
);
parent::__construct();
+
+ $this->multishop_context = null;
}
public function renderForm()
diff --git a/controllers/admin/AdminHomeController.php b/controllers/admin/AdminHomeController.php
index f0d012f29..2e15f4fe3 100644
--- a/controllers/admin/AdminHomeController.php
+++ b/controllers/admin/AdminHomeController.php
@@ -29,7 +29,11 @@ class AdminHomeControllerCore extends AdminController
{
const TIPS_TIMEOUT = 5;
- public $display_multishop_toolbar = false;
+ public function __construct()
+ {
+ parent::__construct();
+ $this->multishop_context = null;
+ }
protected function _displayOptimizationTips()
{
diff --git a/controllers/admin/AdminShopController.php b/controllers/admin/AdminShopController.php
index e2ac52d92..9c6984fd1 100755
--- a/controllers/admin/AdminShopController.php
+++ b/controllers/admin/AdminShopController.php
@@ -28,8 +28,6 @@
class AdminShopControllerCore extends AdminController
{
- public $display_multishop_toolbar = false;
-
public function __construct()
{
$this->context = Context::getContext();
@@ -92,7 +90,10 @@ class AdminShopControllerCore extends AdminController
'submit' => array()
)
);
+
parent::__construct();
+
+ $this->multishop_context ^= Shop::CONTEXT_SHOP;
}
public function initToolbar()
diff --git a/controllers/admin/AdminShopUrlController.php b/controllers/admin/AdminShopUrlController.php
index 3540b8106..31a16079e 100644
--- a/controllers/admin/AdminShopUrlController.php
+++ b/controllers/admin/AdminShopUrlController.php
@@ -27,8 +27,6 @@
class AdminShopUrlControllerCore extends AdminController
{
- public $display_multishop_toolbar = false;
-
public function __construct()
{
$this->table = 'shop_url';
@@ -90,6 +88,8 @@ class AdminShopUrlControllerCore extends AdminController
$this->bulk_actions = array('delete' => array('text' => $this->l('Delete selected'), 'confirm' => $this->l('Delete selected items?')));
parent::__construct();
+
+ $this->multishop_context = null;
}
public function renderList()
diff --git a/controllers/admin/AdminStockConfigurationController.php b/controllers/admin/AdminStockConfigurationController.php
index 870fb5e4f..055ecfa42 100644
--- a/controllers/admin/AdminStockConfigurationController.php
+++ b/controllers/admin/AdminStockConfigurationController.php
@@ -39,7 +39,6 @@ class AdminStockConfigurationControllerCore extends AdminController
$this->table = 'stock_mvt_reason';
$this->className = 'StockMvtReason';
$this->lang = true;
- $this->display_multishop_toolbar = false;
// defines fields
$this->fieldsDisplay = array(
@@ -122,6 +121,8 @@ class AdminStockConfigurationControllerCore extends AdminController
);
parent::__construct();
+
+ $this->multishop_context = null;
}
public function init()
diff --git a/controllers/admin/AdminStockCoverController.php b/controllers/admin/AdminStockCoverController.php
index 70b9c99a8..92d284a81 100644
--- a/controllers/admin/AdminStockCoverController.php
+++ b/controllers/admin/AdminStockCoverController.php
@@ -40,7 +40,6 @@ class AdminStockCoverControllerCore extends AdminController
$this->className = 'Product';
$this->lang = true;
$this->colorOnBackground = true;
- $this->display_multishop_toolbar = false;
$this->fieldsDisplay = array(
'reference' => array(
@@ -104,6 +103,8 @@ class AdminStockCoverControllerCore extends AdminController
array_unshift($this->stock_cover_warehouses, array('id_warehouse' => -1, 'name' => $this->l('All Warehouses')));
parent::__construct();
+
+ $this->multishop_context = null;
}
/**
diff --git a/controllers/admin/AdminStockInstantStateController.php b/controllers/admin/AdminStockInstantStateController.php
index 4eeaf2b7d..0ff4c1613 100644
--- a/controllers/admin/AdminStockInstantStateController.php
+++ b/controllers/admin/AdminStockInstantStateController.php
@@ -38,7 +38,6 @@ class AdminStockInstantStateControllerCore extends AdminController
$this->table = 'stock';
$this->className = 'Stock';
$this->lang = false;
- $this->display_multishop_toolbar = false;
$this->fieldsDisplay = array(
'reference' => array(
@@ -103,6 +102,8 @@ class AdminStockInstantStateControllerCore extends AdminController
array_unshift($this->stock_instant_state_warehouses, array('id_warehouse' => -1, 'name' => $this->l('All Warehouses')));
parent::__construct();
+
+ $this->multishop_context = null;
}
/**
diff --git a/controllers/admin/AdminStockManagementController.php b/controllers/admin/AdminStockManagementController.php
index 8b613d384..c2ddb8f7f 100644
--- a/controllers/admin/AdminStockManagementController.php
+++ b/controllers/admin/AdminStockManagementController.php
@@ -36,7 +36,6 @@ class AdminStockManagementControllerCore extends AdminController
$this->table = 'product';
$this->className = 'Product';
$this->lang = true;
- $this->display_multishop_toolbar = false;
$this->fieldsDisplay = array(
'reference' => array(
@@ -72,6 +71,8 @@ class AdminStockManagementControllerCore extends AdminController
parent::__construct();
+ $this->multishop_context = null;
+
// overrides confirmation messages specifically for this controller
$this->_conf = array(
1 => $this->l('The product was successfully added to stock'),
diff --git a/controllers/admin/AdminStockMvtController.php b/controllers/admin/AdminStockMvtController.php
index 06204b983..b2832f121 100644
--- a/controllers/admin/AdminStockMvtController.php
+++ b/controllers/admin/AdminStockMvtController.php
@@ -37,7 +37,6 @@ class AdminStockMvtControllerCore extends AdminController
$this->className = 'StockMvt';
$this->identifier = 'id_stock_mvt';
$this->lang = false;
- $this->display_multishop_toolbar = false;
$this->list_no_link = true;
$this->displayInformation($this->l('This interface allows you to display the stock movements for a selected warehouse.').'
');
@@ -116,6 +115,8 @@ class AdminStockMvtControllerCore extends AdminController
);
parent::__construct();
+
+ $this->multishop_context = null;
}
/**
diff --git a/controllers/admin/AdminSupplyOrdersController.php b/controllers/admin/AdminSupplyOrdersController.php
index 084f52822..5b4069b57 100644
--- a/controllers/admin/AdminSupplyOrdersController.php
+++ b/controllers/admin/AdminSupplyOrdersController.php
@@ -44,7 +44,6 @@ class AdminSupplyOrdersControllerCore extends AdminController
$this->identifier = 'id_supply_order';
$this->lang = false;
$this->is_template_list = false;
- $this->display_multishop_toolbar = false;
$this->addRowAction('updatereceipt');
$this->addRowAction('changestate');
@@ -114,6 +113,8 @@ class AdminSupplyOrdersControllerCore extends AdminController
array_unshift($this->warehouses, array('id_warehouse' => -1, 'name' => $this->l('All Warehouses')));
parent::__construct();
+
+ $this->multishop_context = null;
}
/**