From 5312afc3d3307d99dcf5e87c78309bd3d816d1dd Mon Sep 17 00:00:00 2001 From: dMetzger Date: Fri, 24 Aug 2012 09:10:30 +0000 Subject: [PATCH] [-] BO : super admins are now added to all shops #PSCFV-3561 --- classes/shop/Shop.php | 1 + controllers/admin/AdminEmployeesController.php | 15 +++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/classes/shop/Shop.php b/classes/shop/Shop.php index 8b30c4522..bb3211086 100644 --- a/classes/shop/Shop.php +++ b/classes/shop/Shop.php @@ -219,6 +219,7 @@ class ShopCore extends ObjectModel { $res = parent::add($autodate, $null_values); Shop::cacheShops(true); + Db::getInstance()->Execute('INSERT INTO '._DB_PREFIX_.'employee_shop (id_employee, id_shop) (SELECT id_employee, '.(int)$this->id.' FROM '._DB_PREFIX_.'employee WHERE id_profile = '.(int)_PS_ADMIN_PROFILE_.')'); return $res; } diff --git a/controllers/admin/AdminEmployeesController.php b/controllers/admin/AdminEmployeesController.php index 3da3bc6d3..f1db7b095 100644 --- a/controllers/admin/AdminEmployeesController.php +++ b/controllers/admin/AdminEmployeesController.php @@ -411,6 +411,21 @@ class AdminEmployeesControllerCore extends AdminController $_GET[$key][$row['id_shop']] = 1; } } + + if ($_POST['id_profile'] == _PS_ADMIN_PROFILE_) + { + $result = Db::getInstance()->executeS('SELECT id_shop FROM '._DB_PREFIX_.'shop'); + foreach ($result as $row) + { + $key = 'checkBoxShopAsso_'.$this->table; + if (!isset($_POST[$key])) + $_POST[$key] = array(); + if (!isset($_GET[$key])) + $_GET[$key] = array(); + $_POST[$key][$row['id_shop']] = 1; + $_GET[$key][$row['id_shop']] = 1; + } + } if ($employee->isLastAdmin()) {