From d725739d4caba078939bb521cfe747d5f357ebcc Mon Sep 17 00:00:00 2001 From: mMarinetti Date: Wed, 18 Jan 2012 10:02:57 +0000 Subject: [PATCH] // normalization / minor fix in php upgrader files --- .../upgrade/php/add_missing_rewrite_value.php | 18 +-- .../upgrade/php/add_module_to_hook.php | 12 +- install-new/upgrade/php/add_new_tab.php | 2 +- install-new/upgrade/php/add_order_state.php | 26 ++-- ...add_required_customization_field_flag.php} | 6 +- .../php/alter_productcomments_guest_index.php | 7 +- .../attribute_group_clean_combinations.php | 47 ++++++ install-new/upgrade/php/cms_block.php | 2 +- ...r.php => configuration_double_cleaner.php} | 4 +- ...onverter.php => convert_product_price.php} | 8 +- .../upgrade/php/country_to_timezone.php | 2 +- .../upgrade/php/deactivate_custom_modules.php | 14 +- ...verynumber.php => delivery_number_set.php} | 6 +- ...ory.php => ecotax_tax_application_fix.php} | 17 +-- install-new/upgrade/php/generate_ntree.php | 20 ++- .../upgrade/php/generate_tax_rules.php | 140 +++++++++++------- .../upgrade/php/gridextjs_deprecated.php | 4 +- ...ure.php => group_reduction_column_fix.php} | 16 +- .../upgrade/php/id_currency_country_fix.php | 33 +++++ ...voicenumber.php => invoice_number_set.php} | 6 +- .../{utf8.php => latin1_database_to_utf8.php} | 18 ++- .../php/migrate_block_info_to_cms_block.php | 82 ++++++++-- ...module_tools.php => moduleReinstaller.php} | 2 +- .../upgrade/php/regenerate_level_depth.php | 8 +- install-new/upgrade/php/reorderpositions.php | 52 +++++-- .../php/setAllGroupsOnHomeCategory.php | 47 ++++++ ...category.php => set_discount_category.php} | 10 +- ...ymentmodule.php => set_payment_module.php} | 6 +- ...group.php => set_payment_module_group.php} | 4 +- install-new/upgrade/php/shop_url.php | 13 +- .../upgrade/php/update_carrier_url.php | 2 +- .../php/update_feature_detachable_cache.php~ | 50 +++++++ .../upgrade/php/update_for_13version.php | 9 +- .../upgrade/php/update_module_followup.php | 5 +- .../upgrade/php/update_module_loyalty.php | 14 +- ...emodulessql.php => update_modules_sql.php} | 19 ++- .../upgrade/php/update_order_canada.php | 68 ++++++--- .../upgrade/php/update_order_details.php | 6 +- .../php/update_products_ecotax_v133.php | 2 +- 39 files changed, 583 insertions(+), 224 deletions(-) rename install-new/upgrade/php/{customizations.php => add_required_customization_field_flag.php} (89%) create mode 100644 install-new/upgrade/php/attribute_group_clean_combinations.php rename install-new/upgrade/php/{confcleaner.php => configuration_double_cleaner.php} (94%) rename install-new/upgrade/php/{price_converter.php => convert_product_price.php} (87%) rename install-new/upgrade/php/{deliverynumber.php => delivery_number_set.php} (92%) rename install-new/upgrade/php/{setallgroupsonhomecategory.php => ecotax_tax_application_fix.php} (72%) mode change 100755 => 100644 rename install-new/upgrade/php/{database_structure.php => group_reduction_column_fix.php} (67%) create mode 100644 install-new/upgrade/php/id_currency_country_fix.php rename install-new/upgrade/php/{invoicenumber.php => invoice_number_set.php} (91%) rename install-new/upgrade/php/{utf8.php => latin1_database_to_utf8.php} (93%) rename install-new/upgrade/php/{module_tools.php => moduleReinstaller.php} (96%) create mode 100755 install-new/upgrade/php/setAllGroupsOnHomeCategory.php rename install-new/upgrade/php/{setdiscountcategory.php => set_discount_category.php} (84%) rename install-new/upgrade/php/{setpaymentmodule.php => set_payment_module.php} (94%) rename install-new/upgrade/php/{setpaymentmodulegroup.php => set_payment_module_group.php} (95%) create mode 100644 install-new/upgrade/php/update_feature_detachable_cache.php~ rename install-new/upgrade/php/{updatemodulessql.php => update_modules_sql.php} (70%) diff --git a/install-new/upgrade/php/add_missing_rewrite_value.php b/install-new/upgrade/php/add_missing_rewrite_value.php index 0c7eeb5bf..817b9524f 100644 --- a/install-new/upgrade/php/add_missing_rewrite_value.php +++ b/install-new/upgrade/php/add_missing_rewrite_value.php @@ -20,7 +20,7 @@ * * @author PrestaShop SA * @copyright 2007-2011 PrestaShop SA -* @version Release: $Revision: 6844 $ +* @version Release: $Revision: 7373 $ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ @@ -35,12 +35,12 @@ function add_missing_rewrite_value() AND m.`page` != "index" '); if (sizeof($pages) && is_array($pages)) - foreach ($pages as $page) - { - Db::getInstance()->execute(' - UPDATE `'._DB_PREFIX_.'meta_lang` - SET `url_rewrite` = "'.pSQL(Tools::str2url($page['title'])).'" - WHERE `id_meta` = '.(int)$page['id_meta'].' - AND `id_lang` = '.(int)$page['id_lang']); - } + foreach ($pages as $page) + { + Db::getInstance()->execute(' + UPDATE `'._DB_PREFIX_.'meta_lang` + SET `url_rewrite` = "'.pSQL(Tools::str2url($page['title'])).'" + WHERE `id_meta` = '.(int)$page['id_meta'].' + AND `id_lang` = '.(int)$page['id_lang']); + } } \ No newline at end of file diff --git a/install-new/upgrade/php/add_module_to_hook.php b/install-new/upgrade/php/add_module_to_hook.php index 078fb9952..d5d2a1487 100644 --- a/install-new/upgrade/php/add_module_to_hook.php +++ b/install-new/upgrade/php/add_module_to_hook.php @@ -20,29 +20,29 @@ * * @author PrestaShop SA * @copyright 2007-2011 PrestaShop SA -* @version Release: $Revision: 6844 $ +* @version Release: $Revision: 12447 $ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ function add_module_to_hook($module_name, $hook_name) { - $result = false; + $res = true; $id_module = Db::getInstance()->getValue(' SELECT `id_module` FROM `'._DB_PREFIX_.'module` - WHERE `name` = \''.pSQL($module_name).'\'' + WHERE `name` = "'.$module_name.'"' ); if ((int)$id_module > 0) { $id_hook = Db::getInstance()->getValue(' - SELECT `id_hook` FROM `'._DB_PREFIX_.'hook` WHERE `name` = \''.pSQL($hook_name).'\' + SELECT `id_hook` FROM `'._DB_PREFIX_.'hook` WHERE `name` = "'.$hook_name.'" '); if ((int)$id_hook > 0) { - $result = Db::getInstance()->execute(' + $res &= Db::getInstance()->execute(' INSERT IGNORE INTO `'._DB_PREFIX_.'hook_module` (`id_module`, `id_hook`, `position`) VALUES ( '.(int)$id_module.', @@ -53,6 +53,6 @@ function add_module_to_hook($module_name, $hook_name) } } - return $result; + return $res; } diff --git a/install-new/upgrade/php/add_new_tab.php b/install-new/upgrade/php/add_new_tab.php index 3f44c165f..25b3e666f 100644 --- a/install-new/upgrade/php/add_new_tab.php +++ b/install-new/upgrade/php/add_new_tab.php @@ -20,7 +20,7 @@ * * @author PrestaShop SA * @copyright 2007-2011 PrestaShop SA -* @version Release: $Revision: 7450 $ +* @version Release: $Revision: 12447 $ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ diff --git a/install-new/upgrade/php/add_order_state.php b/install-new/upgrade/php/add_order_state.php index 2cf0c6a69..aa0c79c50 100644 --- a/install-new/upgrade/php/add_order_state.php +++ b/install-new/upgrade/php/add_order_state.php @@ -27,6 +27,7 @@ function add_order_state($conf_name, $name, $invoice, $send_email, $color, $unremovable, $logable, $delivery, $template = null) { + $res = true; $name_lang = array(); $template_lang = array(); foreach (explode('|', $name) AS $item) @@ -42,22 +43,29 @@ function add_order_state($conf_name, $name, $invoice, $send_email, $color, $unre $template_lang[$temp[0]] = $temp[1]; } - Db::getInstance()->execute(' + $res &= Db::getInstance()->execute(' INSERT INTO `'._DB_PREFIX_.'order_state` (`invoice`, `send_email`, `color`, `unremovable`, `logable`, `delivery`) - VALUES ('.(int)$invoice.', '.(int)$send_email.', \''.pSQL($color).'\', '.(int)$unremovable.', '.(int)$logable.', '.(int)$delivery.')'); + VALUES ('.(int)$invoice.', '.(int)$send_email.', "'.$color.'", '.(int)$unremovable.', '.(int)$logable.', '.(int)$delivery.')'); $id_order_state = Db::getInstance()->getValue(' SELECT MAX(`id_order_state`) - FROM `'._DB_PREFIX_.'order_state` - '); + FROM `'._DB_PREFIX_.'order_state`'); - foreach (Language::getLanguages() AS $lang) + $languages = Db::getInstance()->executeS('SELECT * FROM `'._DB_PREFIX_.'lang`'); + foreach ($languages AS $lang) { - Db::getInstance()->execute(' + $iso_code = $lang['iso_code']; + $iso_code_name = isset($name_lang[$iso_code])?$iso_code:'en'; + $iso_code_template = isset($template_lang[$iso_code])?$iso_code:'en'; + $name = isset($name_lang[$iso_code]) ? $name_lang[$iso_code] : $name_lang['en']; + $template = isset($template_lang[$iso_code]) ? $template_lang[$iso_code] : ''; + + $res &= Db::getInstance()->execute(' INSERT IGNORE INTO `'._DB_PREFIX_.'order_state_lang` (`id_lang`, `id_order_state`, `name`, `template`) - VALUES ('.(int)$lang['id_lang'].', '.(int)$id_order_state.', \''.pSQL(isset($name_lang[$lang['iso_code']]) ? $name_lang[$lang['iso_code']] : $name_lang['en']).'\', \''.pSQL(isset($template_lang[$lang['iso_code']]) ? $template_lang[$lang['iso_code']] : (isset($template_lang['en']) ? $template_lang['en'] : '')).'\') + VALUES ('.(int)$lang['id_lang'].', '.(int)$id_order_state.', "'. $name .'", "'. $template .'") '); } - Configuration::updateValue($conf_name, $id_order_state); -} \ No newline at end of file + $res &= Db::getInstance()->getValue('REPLACE INTO `'._DB_PREFIX_.'configuration` + (name, value) VALUES ("'.$conf_name.'", "'.$id_order_state.'"'); +} diff --git a/install-new/upgrade/php/customizations.php b/install-new/upgrade/php/add_required_customization_field_flag.php similarity index 89% rename from install-new/upgrade/php/customizations.php rename to install-new/upgrade/php/add_required_customization_field_flag.php index 0cc176c62..85924e2f6 100644 --- a/install-new/upgrade/php/customizations.php +++ b/install-new/upgrade/php/add_required_customization_field_flag.php @@ -20,7 +20,7 @@ * * @author PrestaShop SA * @copyright 2007-2011 PrestaShop SA -* @version Release: $Revision: 6844 $ +* @version Release: $Revision$ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ @@ -29,14 +29,14 @@ define('_CONTAINS_REQUIRED_FIELD_', 2); function add_required_customization_field_flag() { - if (($result = Db::getInstance()->executeS('SELECT `id_product` FROM `'._DB_PREFIX_.'customization_field` WHERE `required` = 1')) === false) + if (($result = Db::getInstance()->ExecuteS('SELECT `id_product` FROM `'._DB_PREFIX_.'customization_field` WHERE `required` = 1')) === false) return false; if (Db::getInstance()->numRows()) { $productIds = array(); foreach ($result AS $row) $productIds[] = (int)($row['id_product']); - if (!Db::getInstance()->execute('UPDATE `'._DB_PREFIX_.'product` SET `customizable` = '._CONTAINS_REQUIRED_FIELD_.' WHERE `id_product` IN ('.implode(', ', $productIds).')')) + if (!Db::getInstance()->Execute('UPDATE `'._DB_PREFIX_.'product` SET `customizable` = '._CONTAINS_REQUIRED_FIELD_.' WHERE `id_product` IN ('.implode(', ', $productIds).')')) return false; } return true; diff --git a/install-new/upgrade/php/alter_productcomments_guest_index.php b/install-new/upgrade/php/alter_productcomments_guest_index.php index 56324547b..edfe8fe74 100644 --- a/install-new/upgrade/php/alter_productcomments_guest_index.php +++ b/install-new/upgrade/php/alter_productcomments_guest_index.php @@ -27,9 +27,10 @@ function alter_productcomments_guest_index() { - Configuration::loadConfiguration(); - $productcomments = Module::getInstanceByName('productcomments'); - if (!$productcomments->id) + $id_productcomments = Db::getInstance()->getValue('SELECT id_module + FROM `'._DB_PREFIX_.'module` WHERE name = "productcomments"'); + + if (!$id_productcomments) return; DB::getInstance()->Execute(' diff --git a/install-new/upgrade/php/attribute_group_clean_combinations.php b/install-new/upgrade/php/attribute_group_clean_combinations.php new file mode 100644 index 000000000..e7caf033b --- /dev/null +++ b/install-new/upgrade/php/attribute_group_clean_combinations.php @@ -0,0 +1,47 @@ + +* @copyright 2007-2011 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +function attribute_group_clean_combinations() +{ + $attributeCombinations = Db::getInstance()->ExecuteS('SELECT + pac.`id_attribute`, pa.`id_product_attribute` + FROM `'._DB_PREFIX_.'product_attribute` pa + LEFT JOIN `'._DB_PREFIX_.'product_attribute_combination` pac + ON (pa.`id_product_attribute` = pac.`id_product_attribute`)'); + $toRemove = array(); + foreach ($attributeCombinations AS $attributeCombination) + if ((int)($attributeCombination['id_attribute']) == 0) + $toRemove[] = (int)($attributeCombination['id_product_attribute']); + + if (!empty($toRemove)) + { + $res = Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'product_attribute` + WHERE `id_product_attribute` IN ('.implode(', ', $toRemove).')'); + return $res; + } + return true; +} diff --git a/install-new/upgrade/php/cms_block.php b/install-new/upgrade/php/cms_block.php index 242d95de3..979f76d08 100644 --- a/install-new/upgrade/php/cms_block.php +++ b/install-new/upgrade/php/cms_block.php @@ -20,7 +20,7 @@ * * @author PrestaShop SA * @copyright 2007-2011 PrestaShop SA -* @version Release: $Revision: 6844 $ +* @version Release: $Revision: 6594 $ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ diff --git a/install-new/upgrade/php/confcleaner.php b/install-new/upgrade/php/configuration_double_cleaner.php similarity index 94% rename from install-new/upgrade/php/confcleaner.php rename to install-new/upgrade/php/configuration_double_cleaner.php index 81cf63364..9be2f2b9e 100644 --- a/install-new/upgrade/php/confcleaner.php +++ b/install-new/upgrade/php/configuration_double_cleaner.php @@ -20,14 +20,14 @@ * * @author PrestaShop SA * @copyright 2007-2011 PrestaShop SA -* @version Release: $Revision: 6844 $ +* @version Release: $Revision$ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ function configuration_double_cleaner() { - $result = Db::getInstance()->executeS(' + $result = Db::getInstance()->ExecuteS(' SELECT name, MIN(id_configuration) AS minid FROM '._DB_PREFIX_.'configuration GROUP BY name diff --git a/install-new/upgrade/php/price_converter.php b/install-new/upgrade/php/convert_product_price.php similarity index 87% rename from install-new/upgrade/php/price_converter.php rename to install-new/upgrade/php/convert_product_price.php index 7e1e1e1ca..903b153b9 100644 --- a/install-new/upgrade/php/price_converter.php +++ b/install-new/upgrade/php/convert_product_price.php @@ -20,7 +20,7 @@ * * @author PrestaShop SA * @copyright 2007-2011 PrestaShop SA -* @version Release: $Revision: 6844 $ +* @version Release: $Revision$ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ @@ -32,8 +32,10 @@ function convert_product_price() $taxRates = array(); foreach ($taxes as $data) $taxRates[$data['id_tax']] = (float)($data['rate']) / 100; - $results = DB::getInstance()->executeS('SELECT `id_product`, `price`, `id_tax` FROM `'._DB_PREFIX_.'product`'); - foreach ($results as $row) + $resource = DB::getInstance()->ExecuteS('SELECT `id_product`, `price`, `id_tax` FROM `'._DB_PREFIX_.'product`', false); + if (!$resource) + die(mysql_error()); + while ($row = DB::getInstance()->nextRow($resource)) if ($row['id_tax']) { $price = $row['price'] * (1 + $taxRates[$row['id_tax']]); diff --git a/install-new/upgrade/php/country_to_timezone.php b/install-new/upgrade/php/country_to_timezone.php index 40f619a34..93533119c 100644 --- a/install-new/upgrade/php/country_to_timezone.php +++ b/install-new/upgrade/php/country_to_timezone.php @@ -1,6 +1,6 @@ modules; foreach ($nativeModules as $nativeModulesType) diff --git a/install-new/upgrade/php/deliverynumber.php b/install-new/upgrade/php/delivery_number_set.php similarity index 92% rename from install-new/upgrade/php/deliverynumber.php rename to install-new/upgrade/php/delivery_number_set.php index d4b51f315..1fbb6a4cc 100644 --- a/install-new/upgrade/php/deliverynumber.php +++ b/install-new/upgrade/php/delivery_number_set.php @@ -20,7 +20,7 @@ * * @author PrestaShop SA * @copyright 2007-2011 PrestaShop SA -* @version Release: $Revision: 6844 $ +* @version Release: $Revision$ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ @@ -31,7 +31,7 @@ function delivery_number_set() $number = 1; // Update each order with a number - $result = Db::getInstance()->executeS(' + $result = Db::getInstance()->ExecuteS(' SELECT id_order FROM '._DB_PREFIX_.'orders ORDER BY id_order'); @@ -44,7 +44,7 @@ function delivery_number_set() $oS = new OrderState((int)($row2['id_order_state']), Configuration::get('PS_LANG_DEFAULT')); if ($oS->delivery) { - Db::getInstance()->execute('UPDATE '._DB_PREFIX_.'orders SET delivery_number = '.(int)($number++).', `delivery_date` = `date_add` WHERE id_order = '.(int)($order->id)); + Db::getInstance()->Execute('UPDATE '._DB_PREFIX_.'orders SET delivery_number = '.(int)($number++).', `delivery_date` = `date_add` WHERE id_order = '.(int)($order->id)); break ; } } diff --git a/install-new/upgrade/php/setallgroupsonhomecategory.php b/install-new/upgrade/php/ecotax_tax_application_fix.php old mode 100755 new mode 100644 similarity index 72% rename from install-new/upgrade/php/setallgroupsonhomecategory.php rename to install-new/upgrade/php/ecotax_tax_application_fix.php index 58818a37d..e582493d4 --- a/install-new/upgrade/php/setallgroupsonhomecategory.php +++ b/install-new/upgrade/php/ecotax_tax_application_fix.php @@ -20,21 +20,14 @@ * * @author PrestaShop SA * @copyright 2007-2011 PrestaShop SA -* @version Release: $Revision: 6844 $ +* @version Release: $Revision$ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ -function setAllGroupsOnHomeCategory() +function ecotax_tax_application_fix() { - $results = Group::getGroups(Configuration::get('PS_LANG_DEFAULT')); - $groups = array(); - foreach ($results AS $result) - $groups[] = $result['id_group']; - if (is_array($groups) && sizeof($groups)) - { - $category = new Category(1); - $category->cleanGroups(); - $category->addGroups($groups); - } + if (!Db::getInstance()->execute('SELECT `ecotax_tax_rate` FROM `'._DB_PREFIX_.'order_detail` LIMIT 1')) + return Db::getInstance()->execute('ALTER TABLE `'._DB_PREFIX_.'order_detail` ADD `ecotax_tax_rate` DECIMAL(5, 3) NOT NULL AFTER `ecotax`'); + return true; } diff --git a/install-new/upgrade/php/generate_ntree.php b/install-new/upgrade/php/generate_ntree.php index 5ebc37d7b..fb228cb19 100644 --- a/install-new/upgrade/php/generate_ntree.php +++ b/install-new/upgrade/php/generate_ntree.php @@ -27,5 +27,23 @@ function generate_ntree() { - Category::regenerateEntireNtree(); + $categories = Db::getInstance()->ExecuteS('SELECT id_category, id_parent FROM '._DB_PREFIX_.'category ORDER BY id_parent ASC, position ASC'); + $categoriesArray = array(); + foreach ($categories AS $category) + $categoriesArray[(int)$category['id_parent']]['subcategories'][(int)$category['id_category']] = 1; + $n = 1; + generate_ntree_subTree($categoriesArray, 1, $n); +} + +function generate_ntree_subTree(&$categories, $id_category, &$n) +{ + $left = (int)$n++; + if (isset($categories[(int)$id_category]['subcategories'])) + foreach (array_keys($categories[(int)$id_category]['subcategories']) AS $id_subcategory) + generate_ntree_subTree($categories, (int)$id_subcategory, $n); + $right = (int)$n++; + + Db::getInstance()->Execute('UPDATE '._DB_PREFIX_.'category + SET nleft = '.(int)$left.', nright = '.(int)$right.' + WHERE id_category = '.(int)$id_category.' LIMIT 1'); } diff --git a/install-new/upgrade/php/generate_tax_rules.php b/install-new/upgrade/php/generate_tax_rules.php index a107d12ce..044ff4a63 100644 --- a/install-new/upgrade/php/generate_tax_rules.php +++ b/install-new/upgrade/php/generate_tax_rules.php @@ -1,87 +1,117 @@ +* @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 generate_tax_rules() { - $taxes = Tax::getTaxes(Configuration::get('PS_LANG_DEFAULT'), true); - $countries = Country::getCountries(Configuration::get('PS_LANG_DEFAULT')); + $ps_lang_default = Db::getInstance()->getValue('SELECT value FROM `'._DB_PREFIX_.'configuration` + WHERE name="PS_LANG_DEFAULT"'); + $taxes = Db::getInstance('SELECT * from `'._DB_PREFIX_.'tax` WHERE active = 1'); - foreach ($taxes AS $tax) - { - $insert = ''; - $id_tax = $tax['id_tax']; - - $group = new TaxRulesGroup(); - $group->active = 1; - $group->name = 'Rule '.$tax['rate'].'%'; - $group->save(); - $id_tax_rules_group = $group->id; + foreach ($taxes AS $tax) + { + $insert = ''; + $id_tax = $tax['id_tax']; + $row = array( + 'active' => 1, + 'id_tax' => $id_tax, + 'name' => 'Rule '.$tax['rate'].'%', + ); + Db::getInstance()->AutoExecute(_DB_PREFIX_.'category_group', $row, 'INSERT'); + $id_tax_rules_group = Db::getInstance()->insert_id; - $countries = Db::getInstance()->executeS(' - SELECT * FROM `'._DB_PREFIX_.'country` c - LEFT JOIN `'._DB_PREFIX_.'zone` z ON (c.`id_zone` = z.`id_zone`) - LEFT JOIN `'._DB_PREFIX_.'tax_zone` tz ON (tz.`id_zone` = z.`id_zone`) - WHERE `id_tax` = '.(int)$id_tax - ); - if ($countries) - { - foreach ($countries AS $country) - { - $res = Db::getInstance()->execute(' + $countries = Db::getInstance()->ExecuteS(' + SELECT * FROM `'._DB_PREFIX_.'country` c + LEFT JOIN `'._DB_PREFIX_.'zone` z ON (c.`id_zone` = z.`id_zone`) + LEFT JOIN `'._DB_PREFIX_.'tax_zone` tz ON (tz.`id_zone` = z.`id_zone`) + WHERE `id_tax` = '.(int)$id_tax + ); + if ($countries) + { + foreach ($countries AS $country) + { + $res = Db::getInstance()->Execute(' INSERT INTO `'._DB_PREFIX_.'tax_rule` (`id_tax_rules_group`, `id_country`, `id_state`, `state_behavior`, `id_tax`) VALUES ( - '.(int)$group->id.', + '.(int)$id_tax_rules_group.', '.(int)$country['id_country'].', 0, 0, '.(int)$id_tax. ')'); - } - } + } + } - $states = Db::getInstance()->executeS(' - SELECT * FROM `'._DB_PREFIX_.'states s - LEFT JOIN `'._DB_PREFIX_.'tax_state ts ON (ts.`id_state` = s.`id_state`) - WHERE `id_tax` = '.(int)$id_tax - ); + $states = Db::getInstance()->ExecuteS(' + SELECT * FROM `'._DB_PREFIX_.'states s + LEFT JOIN `'._DB_PREFIX_.'tax_state ts ON (ts.`id_state` = s.`id_state`) + WHERE `id_tax` = '.(int)$id_tax + ); - if ($states) - { - foreach ($states AS $state) - { - if (!in_array($state['tax_behavior'], array(PS_PRODUCT_TAX, PS_STATE_TAX, PS_BOTH_TAX))) - $tax_behavior = PS_PRODUCT_TAX; - else - $tax_behavior = $state['tax_behavior']; + if ($states) + { + foreach ($states AS $state) + { + if (!in_array($state['tax_behavior'], array(PS_PRODUCT_TAX, PS_STATE_TAX, PS_BOTH_TAX))) + $tax_behavior = PS_PRODUCT_TAX; + else + $tax_behavior = $state['tax_behavior']; $res = Db::getInstance()->execute(' INSERT INTO `'._DB_PREFIX_.'tax_rule` (`id_tax_rules_group`, `id_country`, `id_state`, `state_behavior`, `id_tax`) VALUES ( - '.(int)$group->id.', + '.(int)$id_tax_rules_group.', '.(int)$state['id_country'].', '.(int)$state['id_state'].', '.(int)$tax_behavior.', '.(int)$id_tax. ')'); - } - } + } + } - Db::getInstance()->execute(' - UPDATE `'._DB_PREFIX_.'product` - SET `id_tax_rules_group` = '.(int)$group->id.' - WHERE `id_tax` = '.(int)$id_tax - ); + Db::getInstance()->execute(' + UPDATE `'._DB_PREFIX_.'product` + SET `id_tax_rules_group` = '.(int)$id_tax_rules_group.' + WHERE `id_tax` = '.(int)$id_tax + ); - Db::getInstance()->execute(' - UPDATE `'._DB_PREFIX_.'carrier` - SET `id_tax_rules_group` = '.(int)$group->id.' - WHERE `id_tax` = '.(int)$id_tax - ); + Db::getInstance()->execute(' + UPDATE `'._DB_PREFIX_.'carrier` + SET `id_tax_rules_group` = '.(int)$id_tax_rules_group.' + WHERE `id_tax` = '.(int)$id_tax + ); - if (Configuration::get('SOCOLISSIMO_OVERCOST_TAX') == $id_tax) - Configuration::updateValue('SOCOLISSIMO_OVERCOST_TAX', $group->id); - } + $socolissimo_overcost_tax = Db::getInstance()->getValue('SELECT value FROM `'._DB_PREFIX_.'configuration` + WHERE name="SOCOLISSIMO_OVERCOST_TAX"'); + if ($socolissimo_overcost_tax == $id_tax) + $res &= Db::getInstance()->getValue('REPLACE INTO `'._DB_PREFIX_.'configuration` + (name, value) VALUES ("PS_POUET", "'.$id_tax_rules_group.'"'); + } } diff --git a/install-new/upgrade/php/gridextjs_deprecated.php b/install-new/upgrade/php/gridextjs_deprecated.php index 82b635efe..b467353b4 100644 --- a/install-new/upgrade/php/gridextjs_deprecated.php +++ b/install-new/upgrade/php/gridextjs_deprecated.php @@ -20,7 +20,7 @@ * * @author PrestaShop SA * @copyright 2007-2011 PrestaShop SA -* @version Release: $Revision: 6844 $ +* @version Release: $Revision: 8238 $ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ @@ -42,6 +42,6 @@ function gridextjs_deprecated() if (file_exists($gridextjs_path)) return rename($gridextjs_path, str_replace('gridextjs', 'gridextjs.deprecated', $gridextjs_path)); - return true; + return true; } diff --git a/install-new/upgrade/php/database_structure.php b/install-new/upgrade/php/group_reduction_column_fix.php similarity index 67% rename from install-new/upgrade/php/database_structure.php rename to install-new/upgrade/php/group_reduction_column_fix.php index 1cccf5456..8c12da142 100644 --- a/install-new/upgrade/php/database_structure.php +++ b/install-new/upgrade/php/group_reduction_column_fix.php @@ -20,7 +20,7 @@ * * @author PrestaShop SA * @copyright 2007-2011 PrestaShop SA -* @version Release: $Revision: 6844 $ +* @version Release: $Revision$ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ @@ -31,17 +31,3 @@ function group_reduction_column_fix() return Db::getInstance()->execute('ALTER TABLE `'._DB_PREFIX_.'order_detail` ADD `group_reduction` DECIMAL(10, 2) NOT NULL AFTER `reduction_amount`'); return true; } - -function ecotax_tax_application_fix() -{ - if (!Db::getInstance()->execute('SELECT `ecotax_tax_rate` FROM `'._DB_PREFIX_.'order_detail` LIMIT 1')) - return Db::getInstance()->execute('ALTER TABLE `'._DB_PREFIX_.'order_detail` ADD `ecotax_tax_rate` DECIMAL(5, 3) NOT NULL AFTER `ecotax`'); - return true; -} - -function id_currency_country_fix() -{ - if (!Db::getInstance()->execute('SELECT `id_currency` FROM `'._DB_PREFIX_.'country` LIMIT 1')) - return Db::getInstance()->execute('ALTER TABLE `'._DB_PREFIX_.'country` ADD `id_currency` INT NOT NULL DEFAULT \'0\' AFTER `id_zone`'); - return true; -} \ No newline at end of file diff --git a/install-new/upgrade/php/id_currency_country_fix.php b/install-new/upgrade/php/id_currency_country_fix.php new file mode 100644 index 000000000..d91303fe8 --- /dev/null +++ b/install-new/upgrade/php/id_currency_country_fix.php @@ -0,0 +1,33 @@ + +* @copyright 2007-2011 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +function id_currency_country_fix() +{ + if (!Db::getInstance()->execute('SELECT `id_currency` FROM `'._DB_PREFIX_.'country` LIMIT 1')) + return Db::getInstance()->execute('ALTER TABLE `'._DB_PREFIX_.'country` ADD `id_currency` INT NOT NULL DEFAULT \'0\' AFTER `id_zone`'); + return true; +} diff --git a/install-new/upgrade/php/invoicenumber.php b/install-new/upgrade/php/invoice_number_set.php similarity index 91% rename from install-new/upgrade/php/invoicenumber.php rename to install-new/upgrade/php/invoice_number_set.php index e1f3af103..8a409ddd2 100644 --- a/install-new/upgrade/php/invoicenumber.php +++ b/install-new/upgrade/php/invoice_number_set.php @@ -20,7 +20,7 @@ * * @author PrestaShop SA * @copyright 2007-2011 PrestaShop SA -* @version Release: $Revision: 6844 $ +* @version Release: $Revision$ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ @@ -31,7 +31,7 @@ function invoice_number_set() $number = 1; // Update each order with a number - $result = Db::getInstance()->executeS(' + $result = Db::getInstance()->ExecuteS(' SELECT id_order FROM '._DB_PREFIX_.'orders ORDER BY id_order'); @@ -44,7 +44,7 @@ function invoice_number_set() $oS = new OrderState((int)($row2['id_order_state']), Configuration::get('PS_LANG_DEFAULT')); if ($oS->invoice) { - Db::getInstance()->execute('UPDATE '._DB_PREFIX_.'orders SET invoice_number = '.(int)($number++).', `invoice_date` = `date_add` WHERE id_order = '.(int)($order->id)); + Db::getInstance()->Execute('UPDATE '._DB_PREFIX_.'orders SET invoice_number = '.(int)($number++).', `invoice_date` = `date_add` WHERE id_order = '.(int)($order->id)); break ; } } diff --git a/install-new/upgrade/php/utf8.php b/install-new/upgrade/php/latin1_database_to_utf8.php similarity index 93% rename from install-new/upgrade/php/utf8.php rename to install-new/upgrade/php/latin1_database_to_utf8.php index 09136ffe1..d9d38349d 100644 --- a/install-new/upgrade/php/utf8.php +++ b/install-new/upgrade/php/latin1_database_to_utf8.php @@ -20,13 +20,15 @@ * * @author PrestaShop SA * @copyright 2007-2011 PrestaShop SA -* @version Release: $Revision: 6844 $ +* @version Release: $Revision$ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ -if(!defined('_PS_MAGIC_QUOTES_GPC_')) -define('_PS_MAGIC_QUOTES_GPC_', get_magic_quotes_gpc()); +if (!defined('_PS_MAGIC_QUOTES_GPC_')) + define('_PS_MAGIC_QUOTES_GPC_', get_magic_quotes_gpc()); +if (!defined('_PS_MYSQL_REAL_ESCAPE_STRING_')) + define('_PS_MYSQL_REAL_ESCAPE_STRING_', function_exists('mysql_real_escape_string')); function latin1_database_to_utf8() { @@ -70,7 +72,7 @@ function latin1_database_to_utf8() array('name' => 'order_state_lang', 'id' => 'id_order_state', 'lang' => true, 'fields' => array('name', 'template')), array('name' => 'product', 'id' => 'id_product', 'fields' => array('ean13', 'reference')), array('name' => 'product_attribute', 'id' => 'id_product_attribute', 'fields' => array('reference', 'ean13')), - array('name' => 'product_download', 'id' => 'id_product_download', 'fields' => array('display_filename', 'filename')), + array('name' => 'product_download', 'id' => 'id_product_download', 'fields' => array('display_filename', 'physically_filename')), array('name' => 'product_lang', 'id' => 'id_product', 'lang' => true, 'fields' => array('description', 'description_short', 'link_rewrite', 'meta_description', 'meta_keywords', 'meta_title', 'name', 'availability')), array('name' => 'profile_lang', 'id' => 'id_profile', 'lang' => true, 'fields' => array('name')), array('name' => 'quick_access', 'id' => 'id_quick_access', 'fields' => array('link')), @@ -86,7 +88,7 @@ function latin1_database_to_utf8() foreach ($tables AS $table) { /* Latin1 datas' selection */ - if (!Db::getInstance()->execute('SET NAMES latin1')) + if (!Db::getInstance()->Execute('SET NAMES latin1')) echo 'Cannot change the sql encoding to latin1!'; $query = 'SELECT `'.$table['id'].'`'; foreach ($table['fields'] AS $field) @@ -94,7 +96,7 @@ function latin1_database_to_utf8() if (isset($table['lang']) AND $table['lang']) $query .= ', `id_lang`'; $query .= ' FROM `'._DB_PREFIX_.$table['name'].'`'; - $latin1Datas = Db::getInstance()->executeS($query); + $latin1Datas = Db::getInstance()->ExecuteS($query); if ($latin1Datas === false) { $warningExist = true; @@ -109,7 +111,7 @@ function latin1_database_to_utf8() if (Db::getInstance()->NumRows()) { /* Utf-8 datas' restitution */ - if (!Db::getInstance()->execute('SET NAMES utf8')) + if (!Db::getInstance()->Execute('SET NAMES utf8')) echo 'Cannot change the sql encoding to utf8!'; foreach ($latin1Datas AS $latin1Data) { @@ -120,7 +122,7 @@ function latin1_database_to_utf8() $query .= ' WHERE `'.$table['id'].'` = '.(int)($latin1Data[$table['id']]); if (isset($table['lang']) AND $table['lang']) $query .= ' AND `id_lang` = '.(int)($latin1Data['id_lang']); - if (!Db::getInstance()->execute($query)) + if (!Db::getInstance()->Execute($query)) { $warningExist = true; $requests .= ' diff --git a/install-new/upgrade/php/migrate_block_info_to_cms_block.php b/install-new/upgrade/php/migrate_block_info_to_cms_block.php index b723119ce..f8fbc54ab 100644 --- a/install-new/upgrade/php/migrate_block_info_to_cms_block.php +++ b/install-new/upgrade/php/migrate_block_info_to_cms_block.php @@ -26,22 +26,87 @@ */ function migrate_block_info_to_cms_block() -{ +{ + $res = true; + + $languages = Db::getInstance()->executeS('SELECT * FROM `'._DB_PREFIX_.'lang`'); //get ids cms of block information $id_blockinfos = Db::getInstance()->getValue('SELECT id_module FROM `'._DB_PREFIX_.'module` WHERE name = \'blockinfos\''); //get ids cms of block information - $ids_cms = Db::getInstance()->executeS('SELECT * FROM `'._DB_PREFIX_.'block_cms` WHERE `id_block` = '.(int)$id_blockinfos); + $ids_cms = Db::getInstance()->executeS('SELECT id_cms FROM `'._DB_PREFIX_.'block_cms` WHERE `id_block` = '.(int)$id_blockinfos); //check if block info is installed and active if (sizeof($ids_cms)) { //install module blockcms - if (Module::getInstanceByName('blockcms')->install()) + // Module::getInstanceByName('blockcms')->install() + // 1) from module + $ps_lang_default = Db::getInstance()->getValue('SELECT value + FROM `'._DB_PREFIX_.'configuration` + WHERE name="PS_LANG_DEFAULT"'); + // 2) parent::install() + $result = Db::getInstance()->AutoExecute(_DB_PREFIX_.'module', + array('name' => 'blockcms', 'active' => 1), 'INSERT'); + $id_module = Db::getInstance()->insert_Id(); + // 3) hooks + $hooks = array('leftColumn', 'rightColumn', 'footer', 'header'); + foreach($hooks as $hook_name) { + // do not pSql hook_name + $row = Db::getInstance()->getRow('SELECT h.id_hook, '.$id_module.' as id_module, MAX(hm.position)+1 as position + FROM `'._DB_PREFIX_.'hook_module` hm + LEFT JOIN `'._DB_PREFIX_.'hook` h on hm.id_hook=h.id_hook + WHERE h.name = "'.$hook_name.'" group by id_hook'); + $res &= Db::getInstance()->AutoExecute(_DB_PREFIX_.'hook_module', $row, 'INSERT'); + } + + // module install + $res &= Db::getInstance()->Execute(' + CREATE TABLE IF NOT EXISTS `'._DB_PREFIX_.'cms_block`( + `id_cms_block` int(10) unsigned NOT NULL auto_increment, + `id_cms_category` int(10) unsigned NOT NULL, + `location` tinyint(1) unsigned NOT NULL, + `position` int(10) unsigned NOT NULL default \'0\', + `display_store` tinyint(1) unsigned NOT NULL default \'1\', + PRIMARY KEY (`id_cms_block`) + ) ENGINE='._MYSQL_ENGINE_.' DEFAULT CHARSET=utf8'); + $res &= Db::getInstance()->Execute(' + INSERT INTO `'._DB_PREFIX_.'cms_block` (`id_cms_category`, `location`, `position`) VALUES(1, 0, 0)'); + $res &= Db::getInstance()->Execute(' + CREATE TABLE IF NOT EXISTS `'._DB_PREFIX_.'cms_block_lang`( + `id_cms_block` int(10) unsigned NOT NULL, + `id_lang` int(10) unsigned NOT NULL, + `name` varchar(40) NOT NULL default \'\', + PRIMARY KEY (`id_cms_block`, `id_lang`) + ) ENGINE='._MYSQL_ENGINE_.' DEFAULT CHARSET=utf8'); + + $query_lang = 'INSERT INTO `'._DB_PREFIX_.'cms_block_lang` (`id_cms_block`, `id_lang`) VALUES'; + foreach ($languages AS $language) + $query_lang .= '(1, '.(int)($language['id_lang']).'),'; + $query_lang = rtrim($query_lang, ','); + $res &= Db::getInstance()->Execute($query_lang); + + $res &= Db::getInstance()->Execute(' + CREATE TABLE IF NOT EXISTS `'._DB_PREFIX_.'cms_block_page`( + `id_cms_block_page` int(10) unsigned NOT NULL auto_increment, + `id_cms_block` int(10) unsigned NOT NULL, + `id_cms` int(10) unsigned NOT NULL, + `is_category` tinyint(1) unsigned NOT NULL, + PRIMARY KEY (`id_cms_block_page`) + ) ENGINE='._MYSQL_ENGINE_.' DEFAULT CHARSET=utf8'); + + $res &= Db::getInstance()->getValue('REPLACE INTO `'._DB_PREFIX_.'configuration` + (name, value) VALUES ("FOOTER_CMS", "")'); + $res &= Db::getInstance()->getValue('REPLACE INTO `'._DB_PREFIX_.'configuration` + (name, value) VALUES ("FOOTER_BLOCK_ACTIVATION", "1")'); + $res &= Db::getInstance()->getValue('REPLACE INTO `'._DB_PREFIX_.'configuration` + (name, value) VALUES ("FOOTER_POWEREDBY", "1")'); + //add new block in new cms block - Db::getInstance()->execute('INSERT INTO `'._DB_PREFIX_.'cms_block` (`id_cms_category`, `name`, `location`, `position`) VALUES( 1, \'\', 0, 0)'); - $id_block = Db::getInstance()->Insert_ID(); + $res &= Db::getInstance()->execute('INSERT INTO `'._DB_PREFIX_.'cms_block` + (`id_cms_category`, `name`, `location`, `position`) + VALUES( 1, "", 0, 0)'); + $id_block = Db::getInstance()->insert_id(); - $languages = Language::getLanguages(false); foreach($languages AS $language) Db::getInstance()->execute('INSERT INTO `'._DB_PREFIX_.'cms_block_lang` (`id_cms_block`, `id_lang`, `name`) VALUES ('.(int)$id_block.', '.(int)$language['id_lang'].', \'Information\')'); @@ -51,7 +116,4 @@ function migrate_block_info_to_cms_block() } else return true; - } - else - return true; -} \ No newline at end of file +} diff --git a/install-new/upgrade/php/module_tools.php b/install-new/upgrade/php/moduleReinstaller.php similarity index 96% rename from install-new/upgrade/php/module_tools.php rename to install-new/upgrade/php/moduleReinstaller.php index aef5f4cf3..d54c5dbfd 100644 --- a/install-new/upgrade/php/module_tools.php +++ b/install-new/upgrade/php/moduleReinstaller.php @@ -20,7 +20,7 @@ * * @author PrestaShop SA * @copyright 2007-2011 PrestaShop SA -* @version Release: $Revision: 6844 $ +* @version Release: $Revision$ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ diff --git a/install-new/upgrade/php/regenerate_level_depth.php b/install-new/upgrade/php/regenerate_level_depth.php index bd27cbbd8..f269cd32b 100644 --- a/install-new/upgrade/php/regenerate_level_depth.php +++ b/install-new/upgrade/php/regenerate_level_depth.php @@ -41,18 +41,18 @@ function regenerate_level_depth() * @param int $level_depth */ function regenerate_children_categories($id_category, $level_depth) - { +{ $categories = Db::getInstance()->executeS('SELECT `id_category` FROM `'._DB_PREFIX_.'category` WHERE `id_parent` = '.(int)$id_category); if (!$categories) return; $new_depth = (int)$level_depth + 1; $cat_ids = ""; foreach($categories as $category) - { + { $cat_ids .= (string)$category['id_category'].','; regenerate_children_categories($category['id_category'], $new_depth); - } + } $cat_ids = substr($cat_ids, 0, -1); Db::getInstance()->execute('UPDATE `'._DB_PREFIX_.'category` SET `level_depth` = '.(int)$new_depth.' WHERE `id_category` IN ('.$cat_ids.')'); - } +} diff --git a/install-new/upgrade/php/reorderpositions.php b/install-new/upgrade/php/reorderpositions.php index 97ad86df1..e5a470264 100644 --- a/install-new/upgrade/php/reorderpositions.php +++ b/install-new/upgrade/php/reorderpositions.php @@ -20,28 +20,44 @@ * * @author PrestaShop SA * @copyright 2007-2011 PrestaShop SA -* @version Release: $Revision: 7040 $ +* @version Release: $Revision: 12447 $ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ function reorderpositions() { + $res = true; + $ps_lang_default = Db::getInstance()->getValue('SELECT value + FROM `'._DB_PREFIX_.'configuration` + WHERE name="PS_LANG_DEFAULT"'); /* Clean products positions */ - if ($cat = Category::getCategories(1, false, false)) - foreach($cat AS $i => $categ) - Product::cleanPositions((int)$categ['id_category']); + $cat = Db::getInstance()->executeS('SELECT id_category FROM `'._DB_PREFIX_.'category`'); + if ($cat) + foreach($cat AS $categ) + { + $id_category = $categ['id_category']; + $result = Db::getInstance()->executeS(' + SELECT `id_product` + FROM `'._DB_PREFIX_.'category_product` + WHERE `id_category` = '.$id_category.' + ORDER BY `position`'); + $sizeof = sizeof($result); + for ($i = 0; $i < $sizeof; $i++) + $res &= Db::getInstance()->execute(' + UPDATE `'._DB_PREFIX_.'category_product` + SET `position` = '.$i.' + WHERE `id_category` = '.$id_category.' + AND `id_product` = '.(int)($result[$i]['id_product'])); + } - //clean Category position and delete old position system - Language::loadLanguages(); - $language = Language::getLanguages(); $cat_parent = Db::getInstance()->executeS('SELECT DISTINCT c.id_parent FROM `'._DB_PREFIX_.'category` c WHERE id_category != 1'); foreach($cat_parent AS $parent) { $result = Db::getInstance()->executeS(' SELECT DISTINCT c.*, cl.* FROM `'._DB_PREFIX_.'category` c - LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON (c.`id_category` = cl.`id_category` AND `id_lang` = '.(int)(Configuration::get('PS_LANG_DEFAULT')).') + LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON (c.`id_category` = cl.`id_category` AND `id_lang` = '.$ps_lang_default.') WHERE c.id_parent = '.(int)($parent['id_parent']).' ORDER BY name ASC'); foreach($result AS $i => $categ) @@ -69,7 +85,23 @@ function reorderpositions() } /* Clean CMS positions */ - if ($cms_cat = CMSCategory::getCategories(1, false, false)) + $cms_cat = Db::getInstance()->executeS('SELECT id_cms_category FROM `'._DB_PREFIX_.'cms_category` WHERE active=1'); + if ($cms_cat) foreach($cms_cat AS $i => $categ) - CMS::cleanPositions((int)($categ['id_cms_category'])); + { + $id_category_parent = $categ['id_cms_category']; + $result &= Db::getInstance()->executeS(' + SELECT `id_cms_category` + FROM `'._DB_PREFIX_.'cms_category` + WHERE `id_parent` = '.(int)$id_category_parent.' + ORDER BY `position`'); + $sizeof = sizeof($result); + for ($i = 0; $i < $sizeof; ++$i){ + $sql = 'UPDATE `'._DB_PREFIX_.'cms_category` + SET `position` = '.(int)$i.' + WHERE `id_parent` = '.(int)$id_category_parent.' + AND `id_cms_category` = '.(int)$result[$i]['id_cms_category']; + $res &= Db::getInstance()->Execute($sql); + } + } } \ No newline at end of file diff --git a/install-new/upgrade/php/setAllGroupsOnHomeCategory.php b/install-new/upgrade/php/setAllGroupsOnHomeCategory.php new file mode 100755 index 000000000..892807ca9 --- /dev/null +++ b/install-new/upgrade/php/setAllGroupsOnHomeCategory.php @@ -0,0 +1,47 @@ + +* @copyright 2007-2011 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +function setAllGroupsOnHomeCategory() +{ + $ps_lang_default = Db::getInstance()->getValue('SELECT value + FROM `'._DB_PREFIX_.'`configuration WHERE name="PS_LANG_DEFAULT"'); + + $results = Db::getInstance()->executeS('SELECT id_group FROM `'._DB_PREFIX_.'group`'); + $groups = array(); + foreach ($results AS $result) + $groups[] = $result['id_group']; + + if (is_array($groups) && sizeof($groups)) + { + // cleanGroups + Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'category_group` + WHERE `id_category` = 1'); + // addGroups($groups); + $row = array('id_category' => 1, 'id_group' => (int)($groups)); + Db::getInstance()->autoExecute(_DB_PREFIX_.'category_group', $row, 'INSERT'); + } +} diff --git a/install-new/upgrade/php/setdiscountcategory.php b/install-new/upgrade/php/set_discount_category.php similarity index 84% rename from install-new/upgrade/php/setdiscountcategory.php rename to install-new/upgrade/php/set_discount_category.php index 613383ba7..4896de43b 100644 --- a/install-new/upgrade/php/setdiscountcategory.php +++ b/install-new/upgrade/php/set_discount_category.php @@ -20,18 +20,16 @@ * * @author PrestaShop SA * @copyright 2007-2011 PrestaShop SA -* @version Release: $Revision: 6844 $ +* @version Release: $Revision$ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ function set_discount_category() { - $discounts = Db::getInstance()->executeS('SELECT `id_discount` FROM `'._DB_PREFIX_.'discount`'); - $categories = Db::getInstance()->executeS('SELECT `id_category` FROM `'._DB_PREFIX_.'category`'); + $discounts = Db::getInstance()->ExecuteS('SELECT `id_discount` FROM `'._DB_PREFIX_.'discount`'); + $categories = Db::getInstance()->ExecuteS('SELECT `id_category` FROM `'._DB_PREFIX_.'category`'); foreach ($discounts AS $discount) foreach ($categories AS $category) - Db::getInstance()->execute('INSERT INTO `'._DB_PREFIX_.'discount_category` (`id_discount`,`id_category`) VALUES ('.(int)($discount['id_discount']).','.(int)($category['id_category']).')'); + Db::getInstance()->Execute('INSERT INTO `'._DB_PREFIX_.'discount_category` (`id_discount`,`id_category`) VALUES ('.(int)($discount['id_discount']).','.(int)($category['id_category']).')'); } - - diff --git a/install-new/upgrade/php/setpaymentmodule.php b/install-new/upgrade/php/set_payment_module.php similarity index 94% rename from install-new/upgrade/php/setpaymentmodule.php rename to install-new/upgrade/php/set_payment_module.php index 0a79befbb..84a96d5f0 100644 --- a/install-new/upgrade/php/setpaymentmodule.php +++ b/install-new/upgrade/php/set_payment_module.php @@ -20,7 +20,7 @@ * * @author PrestaShop SA * @copyright 2007-2011 PrestaShop SA -* @version Release: $Revision: 6844 $ +* @version Release: $Revision$ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ @@ -40,10 +40,10 @@ function set_payment_module() $content = fread($fd, filesize($file)); if (preg_match_all('/extends PaymentModule/U', $content, $matches)) { - Db::getInstance()->execute(' + Db::getInstance()->Execute(' INSERT INTO `'._DB_PREFIX_.'module_country` (id_module, id_country) SELECT '.(int)($module['id_module']).', id_country FROM `'._DB_PREFIX_.'country` WHERE active = 1'); - Db::getInstance()->execute(' + Db::getInstance()->Execute(' INSERT INTO `'._DB_PREFIX_.'module_currency` (id_module, id_currency) SELECT '.(int)($module['id_module']).', id_currency FROM `'._DB_PREFIX_.'currency` WHERE deleted = 0'); } diff --git a/install-new/upgrade/php/setpaymentmodulegroup.php b/install-new/upgrade/php/set_payment_module_group.php similarity index 95% rename from install-new/upgrade/php/setpaymentmodulegroup.php rename to install-new/upgrade/php/set_payment_module_group.php index c26736612..84b6bcb3d 100644 --- a/install-new/upgrade/php/setpaymentmodulegroup.php +++ b/install-new/upgrade/php/set_payment_module_group.php @@ -20,7 +20,7 @@ * * @author PrestaShop SA * @copyright 2007-2011 PrestaShop SA -* @version Release: $Revision: 6844 $ +* @version Release: $Revision$ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ @@ -40,7 +40,7 @@ function set_payment_module_group() $content = fread($fd, filesize($file)); if (preg_match_all('/extends PaymentModule/U', $content, $matches)) { - Db::getInstance()->execute(' + Db::getInstance()->Execute(' INSERT INTO `'._DB_PREFIX_.'module_group` (id_module, id_group) SELECT '.(int)($module['id_module']).', id_group FROM `'._DB_PREFIX_.'group`'); } diff --git a/install-new/upgrade/php/shop_url.php b/install-new/upgrade/php/shop_url.php index 969255f8d..31198f776 100644 --- a/install-new/upgrade/php/shop_url.php +++ b/install-new/upgrade/php/shop_url.php @@ -27,9 +27,14 @@ function shop_url() { - if (!($host = Configuration::get('CANONICAL_URL'))) - $host = Tools::getHttpHost(); - Configuration::updateValue('PS_SHOP_DOMAIN', $host); - Configuration::updateValue('PS_SHOP_DOMAIN_SSL', $host); + $host = Db::getInstance()->getValue('SELECT value FROM `'._DB_PREFIX_.'configuration` + WHERE name="CANONICAL_URL"'); + if (!$host) + $host = (isset($_SERVER['HTTP_X_FORWARDED_HOST']) ? $_SERVER['HTTP_X_FORWARDED_HOST'] : $_SERVER['HTTP_HOST']); + $res = Db::getInstance()->getValue('REPLACE INTO `'._DB_PREFIX_.'configuration` + (name, value) VALUES + ("PS_SHOP_DOMAIN", "'.$host.'"), + ("PS_SHOP_DOMAIN_SSL", "'.$host.'") + '); return true; } \ No newline at end of file diff --git a/install-new/upgrade/php/update_carrier_url.php b/install-new/upgrade/php/update_carrier_url.php index 3bdda144a..257f8ebab 100644 --- a/install-new/upgrade/php/update_carrier_url.php +++ b/install-new/upgrade/php/update_carrier_url.php @@ -20,7 +20,7 @@ * * @author PrestaShop SA * @copyright 2007-2011 PrestaShop SA -* @version Release: $Revision: 6844 $ +* @version Release: $Revision: 12447 $ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ diff --git a/install-new/upgrade/php/update_feature_detachable_cache.php~ b/install-new/upgrade/php/update_feature_detachable_cache.php~ new file mode 100644 index 000000000..9aa05e5e9 --- /dev/null +++ b/install-new/upgrade/php/update_feature_detachable_cache.php~ @@ -0,0 +1,50 @@ + +* @copyright 2007-2011 PrestaShop SA +* @version Release: $Revision: 8754 $ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +function update_feature_detachable_cache() +{ + if (!class_exists('Configuration', false)) + { + if (!class_exists('ObjectModel', false)) + { + require_once(_PS_CLASS_DIR_.'/ObjectModel.php'); + eval('class ObjectModel extends ObjectModelCore{}'); + + } + require_once(_PS_CLASS_DIR_.'/Configuration.php'); + eval('class Configuration extends ConfigurationCore{}'); + } + + Configuration::updateGlobalValue('PS_SPECIFIC_PRICE_FEATURE_ACTIVE', (int)SpecificPrice::isCurrentlyUsed('specific_price')); + Configuration::updateGlobalValue('PS_SCENE_FEATURE_ACTIVE', (int)Scene::isCurrentlyUsed('scene', true)); + Configuration::updateGlobalValue('PS_VIRTUAL_PROD_FEATURE_ACTIVE', (int)ProductDownload::isCurrentlyUsed('product_download', true)); + Configuration::updateGlobalValue('PS_CUSTOMIZATION_FEATURE_ACTIVE', (int)Customization::isCurrentlyUsed()); + Configuration::updateGlobalValue('PS_DISCOUNT_FEATURE_ACTIVE', (int)Discount::isCurrentlyUsed('discount', true)); + Configuration::updateGlobalValue('PS_GROUP_FEATURE_ACTIVE', (int)Group::isCurrentlyUsed()); + Configuration::updateGlobalValue('PS_PACK_FEATURE_ACTIVE', (int)Pack::isCurrentlyUsed()); + Configuration::updateGlobalValue('PS_ALIAS_FEATURE_ACTIVE', (int)Alias::isCurrentlyUsed('alias', true)); +} diff --git a/install-new/upgrade/php/update_for_13version.php b/install-new/upgrade/php/update_for_13version.php index 488be28e2..fbcda6400 100644 --- a/install-new/upgrade/php/update_for_13version.php +++ b/install-new/upgrade/php/update_for_13version.php @@ -8,9 +8,12 @@ function update_for_13version() return; // if the old version is a 1.4 version // Disable the Smarty 3 - Configuration::updateValue('PS_FORCE_SMARTY_2', 1); // Disable the URL rewritting - Configuration::updateValue('PS_REWRITING_SETTINGS', 0); // Disable Canonical redirection - Configuration::updateValue('PS_CANONICAL_REDIRECT', 0); + $res = Db::getInstance()->getValue('REPLACE INTO `'._DB_PREFIX_.'configuration` + (name, value) VALUES + ("PS_FORCE_SMARTY_2", "1"), + ("PS_REWRITING_SETTINGS", "0") + ("PS_CANONICAL_REDIRECT", "0") + '); } \ No newline at end of file diff --git a/install-new/upgrade/php/update_module_followup.php b/install-new/upgrade/php/update_module_followup.php index 0fbd65a3a..a07c5869d 100644 --- a/install-new/upgrade/php/update_module_followup.php +++ b/install-new/upgrade/php/update_module_followup.php @@ -27,9 +27,8 @@ function update_module_followup() { - Configuration::loadConfiguration(); - $followup = Module::getInstanceByName('followup'); - if (!$followup->id) + $id_followup = Db::getInstance()->getValue('SELECT id_module FROM `'._DB_PREFIX_.'module` WHERE name = "followup"'); + if (!$id_followup) return; Db::getInstance()->execute('ALTER TABLE `'._DB_PREFIX_.'log_email` ADD INDEX `date_add`(`date_add`), ADD INDEX `id_cart`(`id_cart`);'); diff --git a/install-new/upgrade/php/update_module_loyalty.php b/install-new/upgrade/php/update_module_loyalty.php index ec26125b4..2ffe7f6b2 100644 --- a/install-new/upgrade/php/update_module_loyalty.php +++ b/install-new/upgrade/php/update_module_loyalty.php @@ -20,7 +20,7 @@ * * @author PrestaShop SA * @copyright 2007-2011 PrestaShop SA -* @version Release: $Revision: 6844 $ +* @version Release: $Revision: 12447 $ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ @@ -28,17 +28,21 @@ // backward compatibility vouchers should be available in all categories function update_module_loyalty() { - if (Configuration::get('PS_LOYALTY_POINT_VALUE') !== false) + $ps_loyalty_point_value = Db::getInstance()->getValue('SELECT value + FROM `'._DB_PREFIX_.'configuration` + WHERE name="PS_LOYALTY_POINT_VALUE"'); + if ($ps_loyalty_point_value !== false) { $category_list = ''; - - foreach(Category::getSimpleCategories(Configuration::get('PS_LANG_DEFAULT')) as $category) + $categories = Db::getInstance('SELECT id_category FROM `'._DB_PREFIX_.'category`'); + foreach($categories as $category) $category_list .= $category['id_category'].','; if (!empty($category_list)) { $category_list = rtrim($category_list, ','); - Configuration::updateValue('PS_LOYALTY_VOUCHER_CATEGORY', $category_list); + $res &= Db::getInstance()->execute('REPLACE INTO `'._DB_PREFIX_.'configuration` + (name, value) VALUES ("PS_LOYALTY_VOUCHER_CATEGORY", "'.$category_list.'"'); } } } diff --git a/install-new/upgrade/php/updatemodulessql.php b/install-new/upgrade/php/update_modules_sql.php similarity index 70% rename from install-new/upgrade/php/updatemodulessql.php rename to install-new/upgrade/php/update_modules_sql.php index 46ed39415..a67d7cd37 100644 --- a/install-new/upgrade/php/updatemodulessql.php +++ b/install-new/upgrade/php/update_modules_sql.php @@ -20,22 +20,21 @@ * * @author PrestaShop SA * @copyright 2007-2011 PrestaShop SA -* @version Release: $Revision: 6844 $ +* @version Release: $Revision$ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ function update_modules_sql() { - Configuration::loadConfiguration(); - $blocklink = Module::getInstanceByName('blocklink'); - if ($blocklink->id) - Db::getInstance()->execute('ALTER IGNORE TABLE `'._DB_PREFIX_.'blocklink_lang` ADD PRIMARY KEY (`id_link`, `id_lang`);'); - $productComments = Module::getInstanceByName('productcomments'); - if ($productComments->id) + $id_blocklink = Db::getInstance()->getValue('SELECT id_module FROM `'._DB_PREFIX_.'module` WHERE name = "blocklink"'); + if ($id_blocklink) + Db::getInstance()->Execute('ALTER IGNORE TABLE `'._DB_PREFIX_.'blocklink_lang` ADD PRIMARY KEY (`id_link`, `id_lang`);'); + $id_productcomments = Db::getInstance()->getValue('SELECT id_module FROM `'._DB_PREFIX_.'module` WHERE name = "productcomments"'); + if ($id_productcomments) { - Db::getInstance()->execute('ALTER IGNORE TABLE `'._DB_PREFIX_.'product_comment_grade` ADD PRIMARY KEY (`id_product_comment`, `id_product_comment_criterion`);'); - Db::getInstance()->execute('ALTER IGNORE TABLE `'._DB_PREFIX_.'product_comment_criterion` DROP PRIMARY KEY, ADD PRIMARY KEY (`id_product_comment_criterion`, `id_lang`);'); - Db::getInstance()->execute('ALTER IGNORE TABLE `'._DB_PREFIX_.'product_comment_criterion_product` ADD PRIMARY KEY(`id_product`, `id_product_comment_criterion`);'); + Db::getInstance()->Execute('ALTER IGNORE TABLE `'._DB_PREFIX_.'product_comment_grade` ADD PRIMARY KEY (`id_product_comment`, `id_product_comment_criterion`);'); + Db::getInstance()->Execute('ALTER IGNORE TABLE `'._DB_PREFIX_.'product_comment_criterion` DROP PRIMARY KEY, ADD PRIMARY KEY (`id_product_comment_criterion`, `id_lang`);'); + Db::getInstance()->Execute('ALTER IGNORE TABLE `'._DB_PREFIX_.'product_comment_criterion_product` ADD PRIMARY KEY(`id_product`, `id_product_comment_criterion`);'); } } diff --git a/install-new/upgrade/php/update_order_canada.php b/install-new/upgrade/php/update_order_canada.php index 692accddb..63dce0d2e 100644 --- a/install-new/upgrade/php/update_order_canada.php +++ b/install-new/upgrade/php/update_order_canada.php @@ -27,12 +27,12 @@ function update_order_canada() { - $sql ='SHOW TABLES LIKE \''._DB_PREFIX_.'order_tax\''; - $table = Db::getInstance()->ExecuteS($sql); + $sql ='SHOW TABLES LIKE "'._DB_PREFIX_.'order_tax"'; + $table = Db::getInstance()->executeS($sql); if (!count($table)) { - Db::getInstance()->Execute(' + Db::getInstance()->execute(' CREATE TABLE IF NOT EXISTS `'._DB_PREFIX_.'order_tax` ( `id_order` int(11) NOT NULL, `tax_name` varchar(40) NOT NULL, @@ -41,46 +41,56 @@ function update_order_canada() ) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8'); - $address_field = Configuration::get('PS_TAX_ADDRESS_TYPE'); + $address_field = Db::getInstance()->getValue('SELECT value + FROM `'._DB_PREFIX_.'configuration` + WHERE name="PS_TAX_ADDRESS_TYPE"'); + $address_field = str_replace('`','\`', $address_field); + $sql = 'SELECT `id_order` FROM `'._DB_PREFIX_.'orders` o - LEFT JOIN `'._DB_PREFIX_.'address` a ON (a.`id_address` = o.`'.bqSQL($address_field).'`) + LEFT JOIN `'._DB_PREFIX_.'customer` cus ON (o.id_customer = cus.id_customer) + LEFT JOIN `'._DB_PREFIX_.'group` g ON (g.id_group = cus.id_default_group) + LEFT JOIN `'._DB_PREFIX_.'address` a ON (a.`id_address` = o.`'.$address_field.'`) LEFT JOIN `'._DB_PREFIX_.'country` c ON (c.`id_country` = a.`id_country`) WHERE c.`iso_code` = "CA"'; - $id_order_list = Db::getInstance()->ExecuteS($sql); - + $id_order_list = Db::getInstance()->executeS($sql); + $default_price_display_method = Db::getInstance()->getValue('SELECT price_display_method + FROM `'._DB_PREFIX_.'group WHERE id_group=1`'); $values = ''; - foreach ($id_order_list as $id_order) + foreach ($id_order_list as $order) { $amount = array(); - $id_order = $id_order['id_order']; - $order = new Order((int)$id_order); - if (!Validate::isLoadedObject($order)) - continue; + $id_order = $order['id_order']; + // in Order class, getTaxCalculationMethod + // returns Group::getDefaultPriceDisplayMethod + $tax_calculation_method = $order['price_display_method']; + + $products = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS(' + SELECT * FROM `'._DB_PREFIX_.'order_detail` od + WHERE od.`id_order` = '.(int)$id_order); - $products = $order->getProducts(); foreach ($products as $product) { if (!array_key_exists($product['tax_name'], $amount)) $amount[$product['tax_name']] = array('amount' => 0, 'rate' => $product['tax_rate']); - if ($order->getTaxCalculationMethod() == PS_TAX_EXC) + if ($tax_calculation_method == PS_TAX_EXC) { $total_product = $product['product_price'] * $product['product_quantity']; - $amount_tmp = Tools::ps_round($total_product * ($product['tax_rate'] / 100), 2); - $amount[$product['tax_name']]['amount'] += Tools::ps_round($total_product * ($product['tax_rate'] / 100), 2); + $amount_tmp = update_order_canada_ps_round($total_product * ($product['tax_rate'] / 100), 2); + $amount[$product['tax_name']]['amount'] += update_order_canada_ps_round($total_product * ($product['tax_rate'] / 100), 2); } else { $total_product = $product['product_price'] * $product['product_quantity']; - $amount_tmp = Tools::ps_round($total_product - ($total_product / (1 + ($product['tax_rate'] / 100))), 2); - $amount[$product['tax_name']]['amount'] += Tools::ps_round($total_product - ($total_product / (1 + ($product['tax_rate'] / 100))), 2); + $amount_tmp = update_order_canada_ps_round($total_product - ($total_product / (1 + ($product['tax_rate'] / 100))), 2); + $amount[$product['tax_name']]['amount'] += update_order_canada_ps_round($total_product - ($total_product / (1 + ($product['tax_rate'] / 100))), 2); } } foreach ($amount as $tax_name => $tax_infos) - $values .= '('.(int)$order->id.', \''.pSQL($tax_name).'\', \''.pSQL($tax_infos['rate']).'\', '.(float)$tax_infos['amount'].'),'; + $values .= '('.(int)$id_order.', "'.$tax_name.'\', "'.$tax_infos['rate'].'", '.(float)$tax_infos['amount'].'),'; unset($order); } @@ -95,3 +105,23 @@ function update_order_canada() } } +function update_order_canada_ps_round($val){ + static $ps_price_round_mode; + if (empty($ps_price_round_mode)) + { + $ps_price_round_mode = Db::getInstance()->getValue('SELECT value + FROM `'._DB_PREFIX_.'configuration` + WHERE name = "PS_PRICE_ROUND_MODE"'); + } + + switch ($ps_price_round_mode) + { + case PS_ROUND_UP: + return ceil($val * 100)/100; + case PS_ROUND_DOWN: + return floor($val * 100)/100; + default: + return round($val, 2); + } +} + diff --git a/install-new/upgrade/php/update_order_details.php b/install-new/upgrade/php/update_order_details.php index 8067c5a9f..4ffecef37 100644 --- a/install-new/upgrade/php/update_order_details.php +++ b/install-new/upgrade/php/update_order_details.php @@ -20,7 +20,7 @@ * * @author PrestaShop SA * @copyright 2007-2011 PrestaShop SA -* @version Release: $Revision: 6844 $ +* @version Release: $Revision: 6594 $ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ @@ -31,8 +31,8 @@ function update_order_details() if (sizeof($res) == 0) { - Db::getInstance()->execute('ALTER TABLE `'._DB_PREFIX_.'order_detail` ADD `reduction_percent` DECIMAL(10, 2) NOT NULL default \'0.00\' AFTER `product_price`'); - Db::getInstance()->execute('ALTER TABLE `'._DB_PREFIX_.'order_detail` ADD `reduction_amount` DECIMAL(20, 6) NOT NULL default \'0.000000\' AFTER `reduction_percent`'); + Db::getInstance()->execute('ALTER TABLE `'._DB_PREFIX_.'order_detail` ADD `reduction_percent` DECIMAL(10, 2) NOT NULL default "0.00" AFTER `product_price`'); + Db::getInstance()->execute('ALTER TABLE `'._DB_PREFIX_.'order_detail` ADD `reduction_amount` DECIMAL(20, 6) NOT NULL default "0.000000" AFTER `reduction_percent`'); } } diff --git a/install-new/upgrade/php/update_products_ecotax_v133.php b/install-new/upgrade/php/update_products_ecotax_v133.php index a307825ae..c6e83f85f 100644 --- a/install-new/upgrade/php/update_products_ecotax_v133.php +++ b/install-new/upgrade/php/update_products_ecotax_v133.php @@ -28,7 +28,7 @@ function update_products_ecotax_v133() { global $oldversion; - if($oldversion < '1.3.3.0') + if ($oldversion < '1.3.3.0') { Db::getInstance()->execute('UPDATE `'._DB_PREFIX_.'product` SET `ecotax` = \'0\' WHERE 1'); Db::getInstance()->execute('UPDATE `'._DB_PREFIX_.'order_detail` SET `ecotax` = \'0\' WHERE 1;');