// removing group_module_restriction table to set every restrictions in an only table : module_group

This commit is contained in:
vChabot
2011-12-05 16:17:42 +00:00
parent 24f1625f4b
commit 635e4f6ae3
9 changed files with 199 additions and 214 deletions
@@ -20,7 +20,7 @@
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2011 PrestaShop SA
* @version Release: $Revision: 6844 $
* @version Release: $Revision: 10056 $
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
@@ -33,15 +33,19 @@ function add_default_restrictions_modules_groups()
$modules = Db::getInstance()->executeS('
SELECT m.*
FROM `'._DB_PREFIX_.'module` m');
$shops = Db::getInstance()->executeS('
SELECT `id_shop`
FROM `'._DB_PREFIX_.'shop`');
foreach ($groups as $group)
{
if (!is_array($modules))
return false;
else
{
$sql = 'INSERT INTO `'._DB_PREFIX_.'group_module_restriction` (`id_group`, `id_module`, `authorized`) VALUES ';
$sql = 'INSERT INTO `'._DB_PREFIX_.'module_group` (`id_module`, `id_shop`, `id_group`) VALUES ';
foreach ($modules as $mod)
$sql .= '("'.(int)$group['id_group'].'", "'.(int)$mod['id_module'].'", "1"),';
foreach ($shops as $s)
$sql .= '("'.(int)$mod['id_module'].'", "'.(int)$s.'", "'.(int)$group['id_group'].'"),';
// removing last comma to avoid SQL error
$sql = substr($sql, 0, strlen($sql) - 1);
Db::getInstance()->execute($sql);
-7
View File
@@ -2020,13 +2020,6 @@ PRIMARY KEY (`id_scene`, `id_shop`),
KEY `id_shop` (`id_shop`)
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
CREATE TABLE `PREFIX_group_module_restriction` (
`id_group` INT(11) UNSIGNED NOT NULL ,
`id_module` INT(11) UNSIGNED NOT NULL ,
`authorized` tinyint(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`id_group`,`id_module`)
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
CREATE TABLE `PREFIX_stock_mvt` (
`id_stock_mvt` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
`id_stock` INT(11) UNSIGNED NOT NULL,
+154 -158
View File
@@ -650,7 +650,6 @@ INSERT INTO `PREFIX_cms_block_lang` (`id_cms_block`, `id_lang`, `name`) VALUES (
/* Currency/Country module */
INSERT INTO `PREFIX_module_currency` (`id_module`, `id_currency`) VALUES (3, 1),(3, 2),(3, 3),(4, 1),(4, 2),(4, 3),(6, 1),(6, 2),(6, 3);
INSERT INTO `PREFIX_module_group` (`id_module`, `id_group`) VALUES (3, 2),(4, 2),(6, 2),(3, 3),(4, 3),(6, 3);
INSERT INTO `PREFIX_module_country` (`id_module`, `id_country`) VALUES (3, 1),(3, 2),(3, 3),(3, 4),(3, 5),(3, 6),(3, 7),(3, 8),
(3, 9),(3, 10),(3, 11),(3, 12),(3, 13),(3, 14),(3, 15),(3, 16),(3, 17),(3, 18),(3, 19),(3, 20),(3, 21),(3, 22),(3, 23),(3, 24),
@@ -1351,163 +1350,160 @@ INSERT INTO `PREFIX_store` (`id_store`, `id_country`, `id_state`, `name`, `addre
INSERT INTO `PREFIX_store_shop` (`id_store`, `id_shop`) (SELECT `id_store`, 1 FROM `PREFIX_store`);
INSERT INTO `PREFIX_group_module_restriction` (`id_group`, `id_module`, `authorized`) VALUES
("1", "1", "1"),
("1", "2", "1"),
("1", "3", "1"),
("1", "4", "1"),
("1", "5", "1"),
("1", "6", "1"),
("1", "7", "1"),
("1", "8", "1"),
("1", "9", "1"),
("1", "10", "1"),
("1", "11", "1"),
("1", "12", "1"),
("1", "13", "1"),
("1", "14", "1"),
("1", "15", "1"),
("1", "16", "1"),
("1", "17", "1"),
("1", "18", "1"),
("1", "19", "1"),
("1", "20", "1"),
("1", "21", "1"),
("1", "22", "1"),
("1", "24", "1"),
("1", "25", "1"),
("1", "26", "1"),
("1", "27", "1"),
("1", "28", "1"),
("1", "30", "1"),
("1", "31", "1"),
("1", "32", "1"),
("1", "33", "1"),
("1", "34", "1"),
("1", "35", "1"),
("1", "36", "1"),
("1", "37", "1"),
("1", "39", "1"),
("1", "40", "1"),
("1", "41", "1"),
("1", "42", "1"),
("1", "43", "1"),
("1", "44", "1"),
("1", "45", "1"),
("1", "46", "1"),
("1", "47", "1"),
("1", "48", "1"),
("1", "49", "1"),
("1", "50", "1"),
("1", "51", "1"),
("1", "52", "1"),
("1", "53", "1"),
("1", "54", "1"),
("1", "55", "1"),
("2", "1", "1"),
("2", "2", "1"),
("2", "3", "1"),
("2", "4", "1"),
("2", "5", "1"),
("2", "6", "1"),
("2", "7", "1"),
("2", "8", "1"),
("2", "9", "1"),
("2", "10", "1"),
("2", "11", "1"),
("2", "12", "1"),
("2", "13", "1"),
("2", "14", "1"),
("2", "15", "1"),
("2", "16", "1"),
("2", "17", "1"),
("2", "18", "1"),
("2", "19", "1"),
("2", "20", "1"),
("2", "21", "1"),
("2", "22", "1"),
("2", "24", "1"),
("2", "25", "1"),
("2", "26", "1"),
("2", "27", "1"),
("2", "28", "1"),
("2", "30", "1"),
("2", "31", "1"),
("2", "32", "1"),
("2", "33", "1"),
("2", "34", "1"),
("2", "35", "1"),
("2", "36", "1"),
("2", "37", "1"),
("2", "39", "1"),
("2", "40", "1"),
("2", "41", "1"),
("2", "42", "1"),
("2", "43", "1"),
("2", "44", "1"),
("2", "45", "1"),
("2", "46", "1"),
("2", "47", "1"),
("2", "48", "1"),
("2", "49", "1"),
("2", "50", "1"),
("2", "51", "1"),
("2", "52", "1"),
("2", "53", "1"),
("2", "54", "1"),
("2", "55", "1"),
("3", "1", "1"),
("3", "2", "1"),
("3", "3", "1"),
("3", "4", "1"),
("3", "5", "1"),
("3", "6", "1"),
("3", "7", "1"),
("3", "8", "1"),
("3", "9", "1"),
("3", "10", "1"),
("3", "11", "1"),
("3", "12", "1"),
("3", "13", "1"),
("3", "14", "1"),
("3", "15", "1"),
("3", "16", "1"),
("3", "17", "1"),
("3", "18", "1"),
("3", "19", "1"),
("3", "20", "1"),
("3", "21", "1"),
("3", "22", "1"),
("3", "24", "1"),
("3", "25", "1"),
("3", "26", "1"),
("3", "27", "1"),
("3", "28", "1"),
("3", "30", "1"),
("3", "31", "1"),
("3", "32", "1"),
("3", "33", "1"),
("3", "34", "1"),
("3", "35", "1"),
("3", "36", "1"),
("3", "37", "1"),
("3", "39", "1"),
("3", "40", "1"),
("3", "41", "1"),
("3", "42", "1"),
("3", "43", "1"),
("3", "44", "1"),
("3", "45", "1"),
("3", "46", "1"),
("3", "47", "1"),
("3", "48", "1"),
("3", "49", "1"),
("3", "50", "1"),
("3", "51", "1"),
("3", "52", "1"),
("3", "53", "1"),
("3", "54", "1"),
("3", "55", "1");
INSERT INTO `PREFIX_module_group` (`id_group`, `id_module`) VALUES
("1", "1"),
("1", "2"),
("1", "5"),
("1", "7"),
("1", "8"),
("1", "9"),
("1", "10"),
("1", "11"),
("1", "12"),
("1", "13"),
("1", "14"),
("1", "15"),
("1", "16"),
("1", "17"),
("1", "18"),
("1", "19"),
("1", "20"),
("1", "21"),
("1", "22"),
("1", "24"),
("1", "25"),
("1", "26"),
("1", "27"),
("1", "28"),
("1", "30"),
("1", "31"),
("1", "32"),
("1", "33"),
("1", "34"),
("1", "35"),
("1", "36"),
("1", "37"),
("1", "39"),
("1", "40"),
("1", "41"),
("1", "42"),
("1", "43"),
("1", "44"),
("1", "45"),
("1", "46"),
("1", "47"),
("1", "48"),
("1", "49"),
("1", "50"),
("1", "51"),
("1", "52"),
("1", "53"),
("1", "54"),
("1", "55"),
("2", "1"),
("2", "2"),
("2", "3"),
("2", "4"),
("2", "5"),
("2", "6"),
("2", "7"),
("2", "8"),
("2", "9"),
("2", "10"),
("2", "11"),
("2", "12"),
("2", "13"),
("2", "14"),
("2", "15"),
("2", "16"),
("2", "17"),
("2", "18"),
("2", "19"),
("2", "20"),
("2", "21"),
("2", "22"),
("2", "24"),
("2", "25"),
("2", "26"),
("2", "27"),
("2", "28"),
("2", "30"),
("2", "31"),
("2", "32"),
("2", "33"),
("2", "34"),
("2", "35"),
("2", "36"),
("2", "37"),
("2", "39"),
("2", "40"),
("2", "41"),
("2", "42"),
("2", "43"),
("2", "44"),
("2", "45"),
("2", "46"),
("2", "47"),
("2", "48"),
("2", "49"),
("2", "50"),
("2", "51"),
("2", "52"),
("2", "53"),
("2", "54"),
("2", "55"),
("3", "1"),
("3", "2"),
("3", "3"),
("3", "4"),
("3", "5"),
("3", "6"),
("3", "7"),
("3", "8"),
("3", "9"),
("3", "10"),
("3", "11"),
("3", "12"),
("3", "13"),
("3", "14"),
("3", "15"),
("3", "16"),
("3", "17"),
("3", "18"),
("3", "19"),
("3", "20"),
("3", "21"),
("3", "22"),
("3", "24"),
("3", "25"),
("3", "26"),
("3", "27"),
("3", "28"),
("3", "30"),
("3", "31"),
("3", "32"),
("3", "33"),
("3", "34"),
("3", "35"),
("3", "36"),
("3", "37"),
("3", "39"),
("3", "40"),
("3", "41"),
("3", "42"),
("3", "43"),
("3", "44"),
("3", "45"),
("3", "46"),
("3", "47"),
("3", "48"),
("3", "49"),
("3", "50"),
("3", "51"),
("3", "52"),
("3", "53"),
("3", "54"),
("3", "55");
INSERT INTO `PREFIX_stock_available` (`id_stock_available`, `id_product`, `id_product_attribute`, `id_shop`, `id_group_shop`, `quantity`, `depends_on_stock`, `out_of_stock`) VALUES
(1, 2, 7, 1, 1, 10, 0, 2),