From 67fc5d16007451bfa9a76c0af53be0d5d26275cf Mon Sep 17 00:00:00 2001 From: vChabot Date: Thu, 17 Nov 2011 17:22:15 +0000 Subject: [PATCH] [*] BO : You have now 3 new default groups. Unidentified group, guest group, and customer group. --- classes/Customer.php | 11 +- classes/Group.php | 50 ++++---- classes/GroupReduction.php | 103 ++++++++-------- config/defines.inc.php | 6 +- .../admin/AdminCustomersController.php | 3 +- controllers/admin/AdminGroupsController.php | 7 +- controllers/front/AuthController.php | 18 +++ install-dev/php/add_new_groups.php | 41 +++++++ install-dev/sql/db_settings_extends.sql | 116 +++++++++++++++++- install-dev/sql/db_settings_lite.sql | 18 ++- install-dev/sql/upgrade/1.5.0.1.sql | 15 ++- 11 files changed, 288 insertions(+), 100 deletions(-) create mode 100644 install-dev/php/add_new_groups.php diff --git a/classes/Customer.php b/classes/Customer.php index 180c47a61..58fc0ffb9 100644 --- a/classes/Customer.php +++ b/classes/Customer.php @@ -185,7 +185,10 @@ class CustomerCore extends ObjectModel $this->secure_key = md5(uniqid(rand(), true)); $this->last_passwd_gen = date('Y-m-d H:i:s', strtotime('-'.Configuration::get('PS_PASSWD_TIME_FRONT').'minutes')); if (empty($this->id_default_group)) - $this->id_default_group = 1; + if ($this->is_guest) + $this->id_default_group = 2; + else + $this->id_default_group = 3; /* Can't create a guest customer, if this feature is disabled */ if ($this->is_guest && !Configuration::get('PS_GUEST_CHECKOUT_ENABLED')) return false; @@ -524,7 +527,7 @@ class CustomerCore extends ObjectModel public static function getGroupsStatic($id_customer) { if (!Group::isFeatureActive()) - return array(1); + return array(3); if (!isset(self::$_customer_groups[$id_customer])) { @@ -560,7 +563,7 @@ class CustomerCore extends ObjectModel public static function getDefaultGroupId($id_customer) { if (!Group::isFeatureActive()) - return 1; + return 3; if (!isset(self::$_defaultGroupId[(int)$id_customer])) self::$_defaultGroupId[(int)$id_customer] = Db::getInstance()->getValue(' @@ -616,6 +619,8 @@ class CustomerCore extends ObjectModel $this->is_guest = 0; $this->passwd = Tools::encrypt($password); + $this->cleanGroups(); + $this->addGroups(array(3)); // add default customer group if ($this->update()) { $vars = array( diff --git a/classes/Group.php b/classes/Group.php index 83d9cd8d5..8af9ef41b 100644 --- a/classes/Group.php +++ b/classes/Group.php @@ -57,8 +57,8 @@ class GroupCore extends ObjectModel protected $table = 'group'; protected $identifier = 'id_group'; - protected static $_cacheReduction = array(); - protected static $_groupPriceDisplayMethod = array(); + protected static $cache_reduction = array(); + protected static $group_price_display_method = array(); protected $webserviceParameters = array(); @@ -66,9 +66,9 @@ class GroupCore extends ObjectModel { $this->validateFields(); if (isset($this->id)) - $fields['id_group'] = (int)($this->id); - $fields['reduction'] = (float)($this->reduction); - $fields['price_display_method'] = (int)($this->price_display_method); + $fields['id_group'] = (int)$this->id; + $fields['reduction'] = (float)$this->reduction; + $fields['price_display_method'] = (int)$this->price_display_method; $fields['date_add'] = pSQL($this->date_add); $fields['date_upd'] = pSQL($this->date_upd); @@ -87,7 +87,7 @@ class GroupCore extends ObjectModel return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS(' SELECT g.`id_group`, g.`reduction`, g.`price_display_method`, gl.`name` FROM `'._DB_PREFIX_.'group` g - LEFT JOIN `'._DB_PREFIX_.'group_lang` AS gl ON (g.`id_group` = gl.`id_group` AND gl.`id_lang` = '.(int)($id_lang).') + LEFT JOIN `'._DB_PREFIX_.'group_lang` AS gl ON (g.`id_group` = gl.`id_group` AND gl.`id_lang` = '.(int)$id_lang.') ORDER BY g.`id_group` ASC'); } @@ -112,44 +112,44 @@ class GroupCore extends ObjectModel public static function getReduction($id_customer = null) { - if (!isset(self::$_cacheReduction['customer'][(int)$id_customer])) - self::$_cacheReduction['customer'][(int)$id_customer] = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue(' + if (!isset(self::$cache_reduction['customer'][(int)$id_customer])) + self::$cache_reduction['customer'][(int)$id_customer] = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue(' SELECT `reduction` FROM `'._DB_PREFIX_.'group` - WHERE `id_group` = '.((int)$id_customer ? Customer::getDefaultGroupId((int)$id_customer) : 1)); - return self::$_cacheReduction['customer'][(int)$id_customer]; - } + WHERE `id_group` = '.((int)$id_customer ? Customer::getDefaultGroupId((int)$id_customer) : (int)Configuration::get('PS_CUSTOMER_GROUP'))); + return self::$cache_reduction['customer'][(int)$id_customer]; + } public static function getReductionByIdGroup($id_group) { - if (!isset(self::$_cacheReduction['group'][$id_group])) + if (!isset(self::$cache_reduction['group'][$id_group])) { - self::$_cacheReduction['group'][$id_group] = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue(' + self::$cache_reduction['group'][$id_group] = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue(' SELECT `reduction` FROM `'._DB_PREFIX_.'group` WHERE `id_group` = '.(int)$id_group); } - return self::$_cacheReduction['group'][$id_group]; + return self::$cache_reduction['group'][$id_group]; } public static function getPriceDisplayMethod($id_group) { - if (!isset(self::$_groupPriceDisplayMethod[$id_group])) - self::$_groupPriceDisplayMethod[$id_group] = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue(' + if (!isset(self::$group_price_display_method[$id_group])) + self::$group_price_display_method[$id_group] = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue(' SELECT `price_display_method` FROM `'._DB_PREFIX_.'group` WHERE `id_group` = '.(int)$id_group); - return self::$_groupPriceDisplayMethod[$id_group]; + return self::$group_price_display_method[$id_group]; } public static function getDefaultPriceDisplayMethod() { - return self::getPriceDisplayMethod(1); + return self::getPriceDisplayMethod((int)Configuration::get('PS_CUSTOMER_GROUP')); } - public function add($autodate = true, $nullValues = false) + public function add($autodate = true, $null_values = false) { - if (parent::add($autodate, $nullValues)) + if (parent::add($autodate, $null_values)) { Category::setNewGroupForHome((int)$this->id); @@ -176,9 +176,9 @@ class GroupCore extends ObjectModel // Refresh cache of feature detachable Configuration::updateGlobalValue('PS_GROUP_FEATURE_ACTIVE', self::isCurrentlyUsed()); - // Add default group (id 1) to customers without groups + // Add default group (id 3) to customers without groups Db::getInstance()->execute('INSERT INTO `'._DB_PREFIX_.'customer_group` ( - SELECT c.id_customer, 1 FROM `'._DB_PREFIX_.'customer` c + SELECT c.id_customer, '.(int)Configuration::get('PS_CUSTOMER_GROUP').' FROM `'._DB_PREFIX_.'customer` c LEFT JOIN `'._DB_PREFIX_.'customer_group` cg ON cg.id_customer = c.id_customer WHERE cg.id_customer IS NULL)'); @@ -190,7 +190,7 @@ class GroupCore extends ObjectModel IFNULL(( SELECT min(id_group) FROM `'._DB_PREFIX_.'customer_group` WHERE id_customer = cg.id_customer), - 1) + '.(int)Configuration::get('PS_CUSTOMER_GROUP').') WHERE `id_default_group` = '.(int)$this->id); return true; @@ -217,11 +217,11 @@ class GroupCore extends ObjectModel */ public static function isCurrentlyUsed($table = null, $has_active_column = false) { - // We don't use the parent method, for specific clause reason (id_group != 1) + // We don't use the parent method, for specific clause reason (id_group != 3) return (bool)Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue(' SELECT `id_group` FROM `'._DB_PREFIX_.'group` - WHERE `id_group` != 1 + WHERE `id_group` != '.(int)Configuration::get('PS_CUSTOMER_GROUP').' '); } diff --git a/classes/GroupReduction.php b/classes/GroupReduction.php index 007258066..a3c05dfca 100644 --- a/classes/GroupReduction.php +++ b/classes/GroupReduction.php @@ -1,6 +1,6 @@ 'isUnsignedId', 'id_category' => 'isUnsignedId', 'reduction' => 'isPrice'); + protected $fieldsRequired = array('id_group', 'id_category', 'reduction'); + protected $fieldsValidate = array('id_group' => 'isUnsignedId', 'id_category' => 'isUnsignedId', 'reduction' => 'isPrice'); - protected $table = 'group_reduction'; - protected $identifier = 'id_group_reduction'; + protected $table = 'group_reduction'; + protected $identifier = 'id_group_reduction'; + + protected static $reduction_cache = array(); - protected static $reductionCache = array(); - public function getFields() { $this->validateFields(); - $fields['id_group'] = (int)($this->id_group); - $fields['id_category'] = (int)($this->id_category); - $fields['reduction'] = (float)($this->reduction); + $fields['id_group'] = (int)$this->id_group; + $fields['id_category'] = (int)$this->id_category; + $fields['reduction'] = (float)$this->reduction; return $fields; } - public function add($autodate = true, $nullValues = false) + public function add($autodate = true, $null_values = false) { - return (parent::add($autodate, $nullValues) AND $this->_setCache()); + return (parent::add($autodate, $null_values) && $this->_setCache()); } - public function update($nullValues = false) + public function update($null_values = false) { - return (parent::update($nullValues) AND $this->_updateCache()); + return (parent::update($null_values) && $this->_updateCache()); } public function delete() @@ -63,21 +63,21 @@ class GroupReductionCore extends ObjectModel $resource = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS(' SELECT p.`id_product` FROM `'._DB_PREFIX_.'product` p - WHERE p.`id_category_default` = '.(int)($this->id_category) + WHERE p.`id_category_default` = '.(int)$this->id_category , false); - + while ($row = Db::getInstance()->nextRow($resource)) { - $query = 'DELETE FROM `'._DB_PREFIX_.'product_group_reduction_cache` WHERE `id_product` = '.(int)($row['id_product']); + $query = 'DELETE FROM `'._DB_PREFIX_.'product_group_reduction_cache` WHERE `id_product` = '.(int)$row['id_product']; if (Db::getInstance()->execute($query) === false) return false; - } + } return (parent::delete()); } protected function _clearCache() { - return Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'product_group_reduction_cache` WHERE `id_group` = '.(int)($this->id_group)); + return Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'product_group_reduction_cache` WHERE `id_group` = '.(int)$this->id_group); } protected function _setCache() @@ -85,16 +85,16 @@ class GroupReductionCore extends ObjectModel $resource = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS(' SELECT p.`id_product` FROM `'._DB_PREFIX_.'product` p - WHERE p.`id_category_default` = '.(int)($this->id_category) + WHERE p.`id_category_default` = '.(int)$this->id_category , false); - + $query = 'INSERT INTO `'._DB_PREFIX_.'product_group_reduction_cache` (`id_product`, `id_group`, `reduction`) VALUES '; $updated = false; while ($row = Db::getInstance()->nextRow($resource)) { - $query .= '('.(int)($row['id_product']).', '.(int)($this->id_group).', '.(float)($this->reduction).'), '; + $query .= '('.(int)$row['id_product'].', '.(int)$this->id_group.', '.(float)$this->reduction.'), '; $updated = true; - } + } if ($updated) return (Db::getInstance()->execute(rtrim($query, ', '))); @@ -106,14 +106,14 @@ class GroupReductionCore extends ObjectModel $resource = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS(' SELECT p.`id_product` FROM `'._DB_PREFIX_.'product` p - WHERE p.`id_category_default` = '.(int)($this->id_category) + WHERE p.`id_category_default` = '.(int)$this->id_category , false); - + while ($row = Db::getInstance()->nextRow($resource)) { $query = 'UPDATE `'._DB_PREFIX_.'product_group_reduction_cache` - SET `reduction` = '.(float)($this->reduction).' - WHERE `id_product` = '.(int)($row['id_product']).' AND `id_group` = '.(int)($this->id_group); + SET `reduction` = '.(float)$this->reduction.' + WHERE `id_product` = '.(int)$row['id_product'].' AND `id_group` = '.(int)$this->id_group; if (Db::getInstance()->execute($query) === false) return false; } @@ -122,30 +122,33 @@ class GroupReductionCore extends ObjectModel public static function getGroupReductions($id_group, $id_lang) { + $lang = $id_lang.Context::getContext()->shop->addSqlRestrictionOnLang('cl'); return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS(' SELECT gr.`id_group_reduction`, gr.`id_group`, gr.`id_category`, gr.`reduction`, cl.`name` AS category_name FROM `'._DB_PREFIX_.'group_reduction` gr - LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON (cl.`id_category` = gr.`id_category` AND cl.`id_lang` = '.(int)$id_lang.Context::getContext()->shop->addSqlRestrictionOnLang('cl').') - WHERE `id_group` = '.(int)($id_group) + LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON (cl.`id_category` = gr.`id_category` AND cl.`id_lang` = '.(int)$lang.') + WHERE `id_group` = '.(int)$id_group ); } public static function getValueForProduct($id_product, $id_group) { - if (!isset(self::$reductionCache[$id_product.'-'.$id_group])) - self::$reductionCache[$id_product.'-'.$id_group] = Db::getInstance()->getValue('SELECT `reduction` - FROM `'._DB_PREFIX_.'product_group_reduction_cache` - WHERE `id_product` = '.(int)($id_product).' AND `id_group` = '.(int)($id_group)); - return self::$reductionCache[$id_product.'-'.$id_group]; + if (!isset(self::$reduction_cache[$id_product.'-'.$id_group])) + self::$reduction_cache[$id_product.'-'.$id_group] = Db::getInstance()->getValue(' + SELECT `reduction` + FROM `'._DB_PREFIX_.'product_group_reduction_cache` + WHERE `id_product` = '.(int)$id_product.' AND `id_group` = '.(int)$id_group); + return self::$reduction_cache[$id_product.'-'.$id_group]; } public static function doesExist($id_group, $id_category) { - return (bool)Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('SELECT `id_group` - FROM `'._DB_PREFIX_.'group_reduction` - WHERE `id_group` = '.(int)($id_group).' AND `id_category` = '.(int)($id_category)); + return (bool)Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue(' + SELECT `id_group` + FROM `'._DB_PREFIX_.'group_reduction` + WHERE `id_group` = '.(int)$id_group.' AND `id_category` = '.(int)$id_category); } - + public static function getGroupByCategoryId($id_category) { return Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow(' @@ -153,7 +156,7 @@ class GroupReductionCore extends ObjectModel FROM `'._DB_PREFIX_.'group_reduction` gr WHERE `id_category` = '.(int)$id_category , false); -} + } public static function getGroupReductionByCategoryId($id_category) { @@ -171,26 +174,26 @@ class GroupReductionCore extends ObjectModel FROM `'._DB_PREFIX_.'product_group_reduction_cache` pgr WHERE pgr.`id_product` = '.(int)$id_product ); - + if (Db::getInstance()->NumRows() == 0) $query = 'INSERT INTO `'._DB_PREFIX_.'product_group_reduction_cache` (`id_product`, `id_group`, `reduction`) - VALUES ('.(int)($id_product).', '.(int)($id_group).', '.(float)($reduction).')'; + VALUES ('.(int)$id_product.', '.(int)$id_group.', '.(float)$reduction.')'; else $query = 'UPDATE `'._DB_PREFIX_.'product_group_reduction_cache` - SET `reduction` = '.(float)($reduction).' - WHERE `id_product` = '.(int)($id_product).' AND `id_group` = '.(int)($id_group); + SET `reduction` = '.(float)$reduction.' + WHERE `id_product` = '.(int)$id_product.' AND `id_group` = '.(int)$id_group; return (Db::getInstance()->execute($query)); } - + public static function deleteProductReduction($id_product) { - $query = 'DELETE FROM `'._DB_PREFIX_.'product_group_reduction_cache` WHERE `id_product` = '.(int)($id_product); + $query = 'DELETE FROM `'._DB_PREFIX_.'product_group_reduction_cache` WHERE `id_product` = '.(int)$id_product; if (Db::getInstance()->execute($query) === false) return false; return true; } - + public static function duplicateReduction($id_product_old, $id_product) { $row = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow(' @@ -200,15 +203,15 @@ class GroupReductionCore extends ObjectModel ); if (!$row) return true; - + $query = 'INSERT INTO `'._DB_PREFIX_.'product_group_reduction_cache` (`id_product`, `id_group`, `reduction`) VALUES '; - $query .= '('.(int)($id_product).', '.(int)($row['id_group']).', '.(float)($row['reduction']).')'; + $query .= '('.(int)$id_product.', '.(int)$row['id_group'].', '.(float)$row['reduction'].')'; return (Db::getInstance()->execute($query)); } - + public static function deleteCategory($id_category) { - $query = 'DELETE FROM `'._DB_PREFIX_.'group_reduction` WHERE `id_category` = '.(int)($id_category); + $query = 'DELETE FROM `'._DB_PREFIX_.'group_reduction` WHERE `id_category` = '.(int)$id_category; if (Db::getInstance()->execute($query) === false) return false; return true; diff --git a/config/defines.inc.php b/config/defines.inc.php index d5fcafe24..9f6397917 100755 --- a/config/defines.inc.php +++ b/config/defines.inc.php @@ -120,7 +120,11 @@ define('_PS_ADMIN_PROFILE_', 1); define('_STOCK_MOVEMENT_ORDER_REASON_', 3); define('_STOCK_MOVEMENT_MISSING_REASON_', 4); -define('_PS_DEFAULT_CUSTOMER_GROUP_', 1); +/** + * @deprecated 1.5.0.1 + * @see Group::CUSTOMER + */ +define('_PS_DEFAULT_CUSTOMER_GROUP_', 3); define('_PS_CACHEFS_DIRECTORY_', _PS_ROOT_DIR_.'/cache/cachefs/'); diff --git a/controllers/admin/AdminCustomersController.php b/controllers/admin/AdminCustomersController.php index f90a2fb9a..8ea6ab5e2 100644 --- a/controllers/admin/AdminCustomersController.php +++ b/controllers/admin/AdminCustomersController.php @@ -399,11 +399,12 @@ class AdminCustomersControllerCore extends AdminController $messages[$i]['date_add'] = Tools::displayDate($messages[$i]['date_add'], $this->context->language->id, true); } - $groups = Group::getGroups($this->default_form_language, true); + $groups = $customer->getGroups(); $total_groups = count($groups); for ($i = 0; $i < $total_groups; $i++) { $group = new Group($groups[$i]); + $groups[$i] = array(); $groups[$i]['id_group'] = $group->id; $groups[$i]['name'] = $group->name[$this->default_form_language]; } diff --git a/controllers/admin/AdminGroupsController.php b/controllers/admin/AdminGroupsController.php index 5ed377001..af8d8842d 100644 --- a/controllers/admin/AdminGroupsController.php +++ b/controllers/admin/AdminGroupsController.php @@ -43,7 +43,8 @@ class AdminGroupsController extends AdminController WHERE jc.`deleted` != 1 AND jcg.`id_group` = a.`id_group`) AS nb'; - $this->_listSkipDelete = array(1); + $groups_to_keep = array(Configuration::get('PS_UNIDENTIFIED_GROUP'), Configuration::get('PS_GUEST_GROUP'), Configuration::get('PS_CUSTOMER_GROUP')); + $this->_listSkipDelete = $groups_to_keep; $this->fieldsDisplay = array( 'id_group' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25), @@ -52,8 +53,8 @@ class AdminGroupsController extends AdminController 'nb' => array('title' => $this->l('Members'), 'width' => 25, 'align' => 'center'), 'date_add' => array('title' => $this->l('Creation date'), 'width' => 60, 'type' => 'date', 'align' => 'right')); - $this->addRowActionSkipList('delete', array(1)); - //$this->addRowActionSkipList('delete', array(Group::UNINDENTIFIED, Group::GUEST, Group::CUSTOMER)); + //$this->addRowActionSkipList('delete', array(1)); + $this->addRowActionSkipList('delete', $groups_to_keep); parent::__construct(); } diff --git a/controllers/front/AuthController.php b/controllers/front/AuthController.php index 3c2099e48..e1e7441fc 100644 --- a/controllers/front/AuthController.php +++ b/controllers/front/AuthController.php @@ -347,9 +347,18 @@ class AuthControllerCore extends FrontController { if (!$customer->is_guest) { + $customer->cleanGroups(); + // we add the guest customer in the default customer group + $customer->addGroups(array((int)Configuration::get('PS_CUSTOMER_GROUP'))); if (!$this->sendConfirmationMail($customer)) $this->errors[] = Tools::displayError('Cannot send email'); } + else + { + $customer->cleanGroups(); + // we add the guest customer in the guest customer group + $customer->addGroups(array((int)Configuration::get('PS_GUEST_GROUP'))); + } $this->updateContext($customer); @@ -470,9 +479,18 @@ class AuthControllerCore extends FrontController { if (!$customer->is_guest) { + $customer->cleanGroups(); + // we add the guest customer in the default customer group + $customer->addGroups(array((int)Configuration::get('PS_CUSTOMER_GROUP'))); if (!$this->sendConfirmationMail($customer)) $this->errors[] = Tools::displayError('Cannot send email'); } + else + { + $customer->cleanGroups(); + // we add the guest customer in the guest customer group + $customer->addGroups(array((int)Configuration::get('PS_GUEST_GROUP'))); + } $this->updateContext($customer); $this->context->cart->id_address_delivery = Address::getFirstCustomerAddressId((int)$customer->id); $this->context->cart->id_address_invoice = Address::getFirstCustomerAddressId((int)$customer->id); diff --git a/install-dev/php/add_new_groups.php b/install-dev/php/add_new_groups.php new file mode 100644 index 000000000..7486becef --- /dev/null +++ b/install-dev/php/add_new_groups.php @@ -0,0 +1,41 @@ + +* @copyright 2007-2011 PrestaShop SA +* @version Release: $Revision: 6844 $ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +function add_new_groups($french, $standard) +{ + Db::getInstance()->execute('INSERT INTO `'._DB_PREFIX_.'group` (`id_group`, `date_add`, `date_upd`) VALUES (NULL, NOW(), NOW())'); + $last_id = Db::getInstance()->Insert_ID(); + $languages = Language::getLanguages(false); + $sql = ''; + foreach ($languages as $lang) + if (strtolower($lang['iso_code']) == 'fr') + $sql .= '('.(int)$last_id.', '.(int)$lang['id_lang'].', "'.pSQL($french).'"),'; + else + $sql .= '('.(int)$last_id.', '.(int)$lang['id_lang'].', "'.pSQL($standard).'"),'; + $sql = substr($sql, 0, strlen($sql) - 1); + DB::getInstance()->execute('INSERT INTO `'._DB_PREFIX_.'group_lang` (`id_group`, `id_lang`, `name`) VALUES '.$sql); +} \ No newline at end of file diff --git a/install-dev/sql/db_settings_extends.sql b/install-dev/sql/db_settings_extends.sql index eeeb893b7..4c65d3a20 100644 --- a/install-dev/sql/db_settings_extends.sql +++ b/install-dev/sql/db_settings_extends.sql @@ -2,7 +2,7 @@ SET NAMES 'utf8'; /* Carrier */ INSERT INTO `PREFIX_carrier` (`id_carrier`, `id_reference`, `id_tax_rules_group`, `name`, `active`, `deleted`, `shipping_handling`, `is_free`, `position`) VALUES (2, 2, 1, 'My carrier', 1, 0, 1, 0, 1); -INSERT INTO `PREFIX_carrier_group` (`id_carrier`, `id_group`) VALUES (2, 1); +INSERT INTO `PREFIX_carrier_group` (`id_carrier`, `id_group`) VALUES (2, 2), (2, 3); INSERT INTO `PREFIX_carrier_shop` (`id_carrier`, `id_shop`) VALUES (2, 1); INSERT INTO `PREFIX_carrier_lang` (`id_carrier`, `id_lang`, `delay`) VALUES (2, 1, 'Delivery next day!'),(2, 2, 'Livraison le lendemain !'),(2, 3, '¡Entrega día siguiente!'),(2, 4, 'Zustellung am nächsten Tag!'),(2, 5, 'Consegna il giorno dopo!'); INSERT INTO `PREFIX_carrier_zone` (`id_carrier`, `id_zone`) VALUES (2, 1),(2, 2); @@ -159,11 +159,11 @@ INSERT INTO `PREFIX_range_weight` (`id_range_weight`, `id_carrier`, `delimiter1` INSERT INTO `PREFIX_delivery` (`id_delivery`, `id_range_price`, `id_range_weight`, `id_carrier`, `id_zone`, `price`) VALUES (1, NULL, 1, 2, 1, 5.00),(2, NULL, 1, 2, 2, 5.00),(4, 1, NULL, 2, 1, 5.00),(5, 1, NULL, 2, 2, 5.00); -INSERT INTO `PREFIX_customer_group` (`id_customer`, `id_group`) VALUES (1, 1); -INSERT INTO `PREFIX_category_group` (`id_category`, `id_group`) VALUES (2, 1),(3, 1),(4, 1); +INSERT INTO `PREFIX_customer_group` (`id_customer`, `id_group`) VALUES (1, 3); +INSERT INTO `PREFIX_category_group` (`id_category`, `id_group`) VALUES (2, 1),(3, 1),(4, 1),(2, 2),(3, 2),(4, 2),(2, 3),(3, 3),(4, 3); INSERT INTO `PREFIX_customer` (`id_customer`, `id_gender`, `id_default_group`, `secure_key`, `email`, `passwd`, `birthday`, `lastname`, `newsletter`, `optin`, `firstname`, `active`, `is_guest`, `date_add`, `date_upd`) - VALUES (1, 1, 1, '47ce86627c1f3c792a80773c5d2deaf8', 'pub@prestashop.com', 'ad807bdf0426766c05c64041124d30ce', '1970-01-15', 'DOE', 1, 1, 'John', 1, 0, NOW(), NOW()); + VALUES (1, 1, 3, '47ce86627c1f3c792a80773c5d2deaf8', 'pub@prestashop.com', 'ad807bdf0426766c05c64041124d30ce', '1970-01-15', 'DOE', 1, 1, 'John', 1, 0, NOW(), NOW()); INSERT INTO `PREFIX_connections` (`id_connections`, `id_guest`, `id_page`, `ip_address`, `date_add`, `http_referer`) VALUES (1, 1, 1, '2130706433', NOW(), 'http://www.prestashop.com'); INSERT INTO `PREFIX_guest` (`id_guest`, `id_operating_system`, `id_web_browser`, `id_customer`, `javascript`, `screen_resolution_x`, `screen_resolution_y`, `screen_color`, `sun_java`, `adobe_flash`, `adobe_director`, `apple_quicktime`, `real_player`, `windows_media`, `accept_language`) @@ -474,7 +474,7 @@ 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, 1),(4, 1),(6, 1); +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), @@ -1225,7 +1225,111 @@ INSERT INTO `PREFIX_group_module_restriction` (`id_group`, `id_module`, `authori ("1", "52", "1"), ("1", "53", "1"), ("1", "54", "1"), -("1", "55", "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_stock_available` (`id_stock_available`, `id_product`, `id_product_attribute`, `id_shop`, `quantity`, `depends_on_stock`, `out_of_stock`) VALUES (1, 2, 7, 1, 10, 0, 2), diff --git a/install-dev/sql/db_settings_lite.sql b/install-dev/sql/db_settings_lite.sql index 84a9f01d9..9069821cb 100644 --- a/install-dev/sql/db_settings_lite.sql +++ b/install-dev/sql/db_settings_lite.sql @@ -319,7 +319,7 @@ INSERT INTO `PREFIX_configuration` (`id_configuration`, `name`, `value`, `date_a (143, 'PS_VIRTUAL_PROD_FEATURE_ACTIVE', '0', NOW(), NOW()), (144, 'PS_CUSTOMIZATION_FEATURE_ACTIVE', '0', NOW(), NOW()), (145, 'PS_CART_RULE_FEATURE_ACTIVE', '0', NOW(), NOW()), -(146, 'PS_GROUP_FEATURE_ACTIVE', '0', NOW(), NOW()), +(146, 'PS_GROUP_FEATURE_ACTIVE', '1', NOW(), NOW()), (147, 'PS_PACK_FEATURE_ACTIVE', '0', NOW(), NOW()), (148, 'PS_ALIAS_FEATURE_ACTIVE', '1', NOW(), NOW()), (149, 'PS_CARRIER_DEFAULT', '1', NOW(), NOW()), @@ -334,7 +334,10 @@ INSERT INTO `PREFIX_configuration` (`id_configuration`, `name`, `value`, `date_a (158, 'PS_STOCK_MVT_TRANSFER_FROM', '6', NOW(), NOW()), (159, 'PS_CARRIER_DEFAULT_ORDER', '0', NOW(), NOW()), (160, 'PS_STOCK_MVT_SUPPLY_ORDER', '8', NOW(), NOW()), -(161, 'PS_STOCK_CUSTOMER_ORDER_REASON', '3', NOW(), NOW()); +(161, 'PS_STOCK_CUSTOMER_ORDER_REASON', '3', NOW(), NOW()), +(162, 'PS_UNIDENTIFIED_GROUP', '1', NOW(), NOW()), +(163, 'PS_GUEST_GROUP', '2', NOW(), NOW()), +(164, 'PS_CUSTOMER_GROUP', '3', NOW(), NOW()); INSERT INTO `PREFIX_configuration_lang` (`id_configuration`, `id_lang`, `value`, `date_upd`) VALUES (36, 1, 'IN', NOW()),(36, 2, 'FA', NOW()),(36, 3, 'CU', NOW()),(36, 4, 'FA', NOW()),(36, 5, 'FA', NOW()), @@ -1344,7 +1347,7 @@ INSERT INTO `PREFIX_cms_category` (`id_cms_category`, `id_parent`, `level_depth` /* Carrier */ INSERT INTO `PREFIX_carrier` (`id_carrier`, `id_reference`, `id_tax_rules_group`, `name`, `active`, `deleted`, `shipping_handling`, `position`) VALUES (1, 1, 0, 0, 1, 0, 0, 0); -INSERT INTO `PREFIX_carrier_group` (`id_carrier`, `id_group`) VALUES (1, 1); +INSERT INTO `PREFIX_carrier_group` (`id_carrier`, `id_group`) (SELECT 1, `id_group` FROM `PREFIX_group`); INSERT INTO `PREFIX_carrier_lang` (`id_carrier`, `id_lang`, `delay`) VALUES (1, 1, 'Pick up in-store'),(1, 2, 'Retrait au magasin'),(1, 3, 'Recogida en la tienda'),(1, 4, 'Abholung im Geschäft'),(1, 5, 'Ritiro in magazzino'); @@ -1432,12 +1435,15 @@ INSERT INTO `PREFIX_timezone` (`name`) VALUES ('Africa/Abidjan'),('Africa/Accra' ('US/East-Indiana'),('US/Eastern'),('US/Hawaii'),('US/Indiana-Starke'),('US/Michigan'),('US/Mountain'),('US/Pacific'),('US/Pacific-New'),('US/Samoa'), ('UTC'),('W-SU'),('WET'),('Zulu'); -INSERT INTO `PREFIX_group` (`id_group`, `reduction`, `date_add`, `date_upd`) VALUES (1, 0, NOW(), NOW()); +INSERT INTO `PREFIX_group` (`id_group`, `reduction`, `date_add`, `date_upd`) VALUES (1, 0, NOW(), NOW()), (2, 0, NOW(), NOW()), (3, 0, NOW(), NOW()); -INSERT INTO `PREFIX_group_lang` (`id_group`, `id_lang`, `name`) VALUES (1, 1, 'Default'),(1, 2, 'Défaut'),(1, 3, 'Predeterminado'),(1, 4, 'Default'),(1, 5, 'Default'); +INSERT INTO `PREFIX_group_lang` (`id_group`, `id_lang`, `name`) VALUES +(1, 1, 'Unidentified'),(1, 2, 'Non identifié'),(1, 3, 'Unidentified'),(1, 4, 'Unidentified'),(1, 5, 'Unidentified'), +(2, 1, 'Guest'),(2, 2, 'Invité'),(2, 3, 'Guest'),(2, 4, 'Guest'),(2, 5, 'Guest'), +(3, 1, 'Default'),(3, 2, 'Défaut'),(3, 3, 'Predeterminado'),(3, 4, 'Default'),(3, 5, 'Default'); INSERT INTO `PREFIX_group_group_shop` (`id_group`, `id_group_shop`) (SELECT `id_group`, 1 FROM `PREFIX_group`); -INSERT INTO `PREFIX_category_group` (`id_category`, `id_group`) VALUES (1, 1); +INSERT INTO `PREFIX_category_group` (`id_category`, `id_group`) (SELECT 1, `id_group` FROM `PREFIX_group`); INSERT INTO `PREFIX_stock_mvt_reason` (`id_stock_mvt_reason`, `sign`, `date_add`, `date_upd`) VALUES (1, 1, NOW(), NOW()), diff --git a/install-dev/sql/upgrade/1.5.0.1.sql b/install-dev/sql/upgrade/1.5.0.1.sql index 1b968b97f..12e6173b3 100644 --- a/install-dev/sql/upgrade/1.5.0.1.sql +++ b/install-dev/sql/upgrade/1.5.0.1.sql @@ -499,6 +499,7 @@ ALTER TABLE `PREFIX_tax` ADD COLUMN `account_number` VARCHAR(64) NOT NULL; /* PHP:add_new_tab(AdminCMS, fr:Pages CMS|es:CMS pages|en:CMS pages|de:CMS pages|it:CMS pages, -1); */; UPDATE `PREFIX_quick_access` SET `link` = 'index.php?controller=AdminCategories&addcategory' WHERE `id_quick_access` = 3; + UPDATE `PREFIX_quick_access` SET `link` = 'index.php?controller=AdminProducts&addproduct' WHERE `id_quick_access` = 4; UPDATE `PREFIX_access` SET `view` = '1' WHERE `id_profile` = 5 AND `id_tab` = 95; @@ -510,19 +511,19 @@ INSERT INTO `PREFIX_access` (`id_profile`, `id_tab`, `view`, `add`, `edit`, `del INSERT INTO `PREFIX_access` ( `id_profile` , `id_tab` , `view` , `add` , `edit` , `delete` ) ( SELECT `id_profile`, 93, 1, 1, 1, 1 FROM `PREFIX_profile` WHERE `id_profile` != 1 AND `id_profile` != 2 -) +); INSERT INTO `PREFIX_access` ( `id_profile` , `id_tab` , `view` , `add` , `edit` , `delete` ) ( SELECT `id_profile`, 94, 1, 1, 1, 1 FROM `PREFIX_profile` WHERE `id_profile` != 1 AND `id_profile` != 2 -) +); INSERT INTO `PREFIX_access` ( `id_profile` , `id_tab` , `view` , `add` , `edit` , `delete` ) ( SELECT `id_profile`, 101, 1, 1, 1, 1 FROM `PREFIX_profile` WHERE `id_profile` != 1 AND `id_profile` != 2 -) +); INSERT INTO `PREFIX_access` ( `id_profile` , `id_tab` , `view` , `add` , `edit` , `delete` ) ( SELECT `id_profile`, 102, 1, 1, 1, 1 FROM `PREFIX_profile` WHERE `id_profile` != 1 AND `id_profile` != 2 -) +); INSERT INTO `PREFIX_access` ( `id_profile` , `id_tab` , `view` , `add` , `edit` , `delete` ) ( SELECT `id_profile`, 103, 1, 1, 1, 1 FROM `PREFIX_profile` WHERE `id_profile` != 1 AND `id_profile` != 2 -) +); INSERT INTO `PREFIX_access` ( `id_profile` , `id_tab` , `view` , `add` , `edit` , `delete` ) ( SELECT `id_profile`, 104, 1, 1, 1, 1 FROM `PREFIX_profile` WHERE `id_profile` != 1 AND `id_profile` != 2 ) @@ -539,3 +540,7 @@ INSERT INTO `PREFIX_access` (`id_profile`, `id_tab`, `view`, `add`, `edit`, `del INSERT INTO `PREFIX_access` (`id_profile`, `id_tab`, `view`, `add`, `edit`, `delete`) VALUES ('4', '106', '1', '1', '1', '1'); INSERT INTO `PREFIX_access` (`id_profile`, `id_tab`, `view`, `add`, `edit`, `delete`) VALUES ('5', '106', '0', '0', '0', '0'); +INSERT INTO `PREFIX_configuration` (`name`, `value`, `date_add`, `date_upd`) ('PS_CUSTOMER_GROUP', '1', NOW(), NOW()); + +/* PHP:add_new_groups('Non identifié', 'Unidentified'); */; +/* PHP:add_new_groups('Invité', 'Guest'); */;