From 41b8cc09bb553b0837ffa8b053a342239ab3e126 Mon Sep 17 00:00:00 2001 From: Hlavtox Date: Thu, 24 Aug 2023 12:24:52 +0200 Subject: [PATCH 01/30] Remove old upgrade code --- .github/workflows/nightly_upgrade.yml | 4 +- .github/workflows/php.yml | 2 +- .github/workflows/upgrade.yml | 2 +- classes/TaskRunner/Upgrade/UpgradeDb.php | 7 - .../CoreUpgrader/CoreUpgrader.php | 3 +- .../CoreUpgrader/CoreUpgrader16.php | 186 --- .../CoreUpgrader/CoreUpgrader17.php | 2 +- classes/UpgradeTools/FileFilter.php | 1 - classes/UpgradeTools/ModuleAdapter.php | 4 +- classes/UpgradeTools/SettingsFileWriter.php | 89 -- classes/UpgradeTools/ThemeAdapter.php | 50 +- functions.php | 46 - .../UpgradeTools/SettingsFileWriterTest.php | 81 -- upgrade/classes/ToolsInstall.php | 132 -- upgrade/classes/index.php | 34 - upgrade/php/add_accounting_tab.php | 47 - upgrade/php/add_attribute_position.php | 49 - upgrade/php/add_carrier_position.php | 41 - ...lumn_order_state_deleted_if_not_exists.php | 40 - ..._column_orders_reference_if_not_exists.php | 32 - ...dd_default_restrictions_modules_groups.php | 58 - upgrade/php/add_feature_position.php | 40 - upgrade/php/add_group_attribute_position.php | 40 - .../php/add_id_shop_to_shipper_lang_index.php | 40 - upgrade/php/add_missing_columns_customer.php | 57 - upgrade/php/add_missing_image_key.php | 42 - upgrade/php/add_missing_rewrite_value.php | 44 - .../add_missing_shop_column_pagenotfound.php | 48 - upgrade/php/add_module_to_hook.php | 63 - upgrade/php/add_new_groups.php | 59 - upgrade/php/add_new_tab.php | 26 - .../add_order_reference_in_order_payment.php | 94 -- upgrade/php/add_order_state.php | 71 -- upgrade/php/add_quick_access_tab.php | 34 - .../add_required_customization_field_flag.php | 44 - upgrade/php/add_stock_tab.php | 86 -- upgrade/php/add_unknown_gender.php | 61 - upgrade/php/alter_blocklink.php | 32 - upgrade/php/alter_cms_block.php | 36 - upgrade/php/alter_ignore_drop_key.php | 37 - .../attribute_group_clean_combinations.php | 48 - upgrade/php/block_category_1521.php | 35 - upgrade/php/blocknewsletter.php | 30 - upgrade/php/blocknewsletter1530.php | 37 - upgrade/php/category_product_index_unique.php | 42 - .../php/check_webservice_account_table.php | 42 - upgrade/php/clean_category_product.php | 45 - upgrade/php/clean_tabs_15.php | 383 ------ upgrade/php/cms_block.php | 33 - upgrade/php/cms_multishop.php | 89 -- upgrade/php/configuration_double_cleaner.php | 44 - upgrade/php/convert_product_price.php | 52 - upgrade/php/country_to_timezone.php | 276 ----- upgrade/php/create_multistore.php | 94 -- .../customization_field_multishop_lang.php | 52 - upgrade/php/delete_hook.php | 41 - upgrade/php/delivery_number_set.php | 50 - .../php/drop_image_type_non_unique_index.php | 34 - upgrade/php/drop_module_non_unique_index.php | 40 - upgrade/php/ecotax_tax_application_fix.php | 33 - upgrade/php/editorial_update.php | 71 -- upgrade/php/editorial_update_multishop.php | 35 - upgrade/php/fix_cms_shop_1520.php | 67 -- .../fix_download_product_feature_active.php | 31 - upgrade/php/fix_unique_specific_price.php | 45 - upgrade/php/generate_ntree.php | 52 - .../generate_root_category_for_multishop.php | 100 -- upgrade/php/generate_tax_rules.php | 111 -- upgrade/php/generic_add_missing_column.php | 44 - upgrade/php/gridextjs_deprecated.php | 46 - upgrade/php/group_reduction_column_fix.php | 33 - upgrade/php/hook_blocksearch_on_header.php | 46 - upgrade/php/id_currency_country_fix.php | 33 - upgrade/php/image_shop1510.php | 35 - upgrade/php/invoice_number_set.php | 50 - upgrade/php/latin1_database_to_utf8.php | 136 --- .../php/migrate_block_info_to_cms_block.php | 134 --- upgrade/php/migrate_orders.php | 343 ------ upgrade/php/migrate_tabs_15.php | 208 ---- upgrade/php/migrate_tabs_17.php | 115 -- upgrade/php/migrate_tabs_multi_shop.php | 56 - .../php/module_blockwishlist_multishop.php | 38 - .../php/module_reinstall_blockmyaccount.php | 49 - upgrade/php/module_reinstall_blocksearch.php | 49 - upgrade/php/move_crossselling.php | 33 - upgrade/php/move_translations_module_file.php | 77 -- upgrade/php/outstanding_allow_amount1530.php | 42 - ...15010_drop_column_id_address_if_exists.php | 43 - upgrade/php/p15012_add_missing_columns.php | 191 --- upgrade/php/p15013_add_missing_columns.php | 54 - upgrade/php/p15014_add_missing_columns.php | 50 - ...copy_missing_images_tab_from_installer.php | 58 - upgrade/php/p15014_upgrade_sekeywords.php | 32 - .../php/p15015_blockadvertising_extension.php | 47 - upgrade/php/p15016_add_missing_columns.php | 97 -- .../php/p15017_add_id_shop_to_primary_key.php | 50 - upgrade/php/p15018_change_image_types.php | 148 --- upgrade/php/p1531_redirect_type.php | 34 - upgrade/php/p1540_add_missing_columns.php | 77 -- upgrade/php/p16011_media_server.php | 47 - upgrade/php/p16012_pack_rework.php | 87 -- upgrade/php/p1603_add_attachment_size.php | 33 - upgrade/php/p1606module_exceptions.php | 103 -- .../php/p1607_drop_primary_key_if_exists.php | 33 - upgrade/php/ps1600_add_missing_index.php | 37 - upgrade/php/ps16012_update_alias.php | 52 - upgrade/php/ps1604_update_employee_date.php | 33 - upgrade/php/ps1605_change_index.php | 33 - upgrade/php/ps1607_language_code_update.php | 43 - upgrade/php/ps1700_stores.php | 54 - upgrade/php/ps_1700_add_locale.php | 41 - .../ps_1700_add_payment_preferences_tab.php | 39 - upgrade/php/ps_1700_reset_theme.php | 35 - upgrade/php/ps_1700_right_management.php | 91 -- .../php/ps_1700_short_description_config.php | 36 - upgrade/php/ps_1750_update_module_tabs.php | 2 +- upgrade/php/ps_1751_update_module_sf_tab.php | 2 +- upgrade/php/regenerate_level_depth.php | 57 - .../php/remove_duplicate_category_groups.php | 49 - upgrade/php/remove_module_from_hook.php | 49 - upgrade/php/remove_tab.php | 32 - ...omments_guest_index.php => rename_tab.php} | 16 +- upgrade/php/reorderpositions.php | 105 -- .../php/select_current_payment_modules.php | 70 -- upgrade/php/set_discount_category.php | 35 - upgrade/php/set_payment_module.php | 50 - upgrade/php/set_payment_module_group.php | 47 - upgrade/php/set_product_suppliers.php | 74 -- upgrade/php/set_stock_available.php | 81 -- upgrade/php/setallgroupsonhomecategory.php | 45 - upgrade/php/shop_url.php | 49 - upgrade/php/sql_indexes.php | 39 - upgrade/php/update_carrier_url.php | 43 - upgrade/php/update_customer_default_group.php | 75 -- .../php/update_feature_detachable_cache.php | 52 - upgrade/php/update_for_13version.php | 61 - upgrade/php/update_genders_images.php | 40 - upgrade/php/update_image_size_in_db.php | 41 - .../update_mailalerts_add_column_idshop.php | 40 - upgrade/php/update_module_blocklayered.php | 33 - upgrade/php/update_module_followup.php | 34 - upgrade/php/update_module_loyalty.php | 53 - upgrade/php/update_module_pagesnotfound.php | 40 - .../php/update_module_product_comments.php | 44 - upgrade/php/update_modules_multishop.php | 60 - upgrade/php/update_modules_sql.php | 38 - upgrade/php/update_order_canada.php | 120 -- upgrade/php/update_order_detail_taxes.php | 79 -- upgrade/php/update_order_details.php | 34 - upgrade/php/update_order_messages.php | 72 -- upgrade/php/update_products_ecotax_v133.php | 33 - upgrade/php/update_stock_mvt_reason.php | 129 -- upgrade/php/updateproductcomments.php | 53 - upgrade/php/updatetabicon_from_11version.php | 44 - upgrade/php/upgrade_cms_15.php | 55 - upgrade/php/upgrade_cms_15_rename.php | 48 - upgrade/sql/0.9.1.2.sql | 30 - upgrade/sql/0.9.1.sql | 9 - upgrade/sql/0.9.5.1.sql | 66 - upgrade/sql/0.9.5.2.sql | 5 - upgrade/sql/0.9.6.1.sql | 51 - upgrade/sql/0.9.6.2.sql | 7 - upgrade/sql/0.9.7.1.sql | 14 - upgrade/sql/0.9.7.2.sql | 21 - upgrade/sql/0.9.sql | 39 - upgrade/sql/1.0.0.1.sql | 122 -- upgrade/sql/1.0.0.2.sql | 13 - upgrade/sql/1.0.0.3.sql | 441 ------- upgrade/sql/1.0.0.4.sql | 88 -- upgrade/sql/1.0.0.5.sql | 35 - upgrade/sql/1.0.0.6.sql | 11 - upgrade/sql/1.0.0.7.sql | 21 - upgrade/sql/1.0.0.8.sql | 17 - upgrade/sql/1.1.0.1.sql | 629 ---------- upgrade/sql/1.1.0.2.sql | 3 - upgrade/sql/1.1.0.3.sql | 10 - upgrade/sql/1.1.0.4.sql | 28 - upgrade/sql/1.1.0.5.sql | 20 - upgrade/sql/1.2.0.1.sql | 1071 ----------------- upgrade/sql/1.2.0.2.sql | 610 ---------- upgrade/sql/1.2.0.3.sql | 33 - upgrade/sql/1.2.0.4.sql | 10 - upgrade/sql/1.2.0.5.sql | 17 - upgrade/sql/1.2.0.6.sql | 14 - upgrade/sql/1.2.0.7.sql | 12 - upgrade/sql/1.2.0.8.sql | 10 - upgrade/sql/1.2.1.0.sql | 16 - upgrade/sql/1.2.2.0.sql | 6 - upgrade/sql/1.2.3.0.sql | 3 - upgrade/sql/1.2.4.0.sql | 1 - upgrade/sql/1.2.5.0.sql | 1 - upgrade/sql/1.3.0.1.sql | 92 -- upgrade/sql/1.3.0.10.sql | 5 - upgrade/sql/1.3.0.2.sql | 147 --- upgrade/sql/1.3.0.3.sql | 15 - upgrade/sql/1.3.0.4.sql | 83 -- upgrade/sql/1.3.0.5.sql | 1 - upgrade/sql/1.3.0.6.sql | 1 - upgrade/sql/1.3.0.7.sql | 3 - upgrade/sql/1.3.0.8.sql | 5 - upgrade/sql/1.3.0.9.sql | 1 - upgrade/sql/1.3.1.1.sql | 1 - upgrade/sql/1.3.2.1.sql | 3 - upgrade/sql/1.3.2.2.sql | 27 - upgrade/sql/1.3.2.3.sql | 1 - upgrade/sql/1.3.3.0.sql | 8 - upgrade/sql/1.3.4.0.sql | 1 - upgrade/sql/1.3.5.0.sql | 1 - upgrade/sql/1.3.6.0.sql | 3 - upgrade/sql/1.3.7.0.sql | 1 - upgrade/sql/1.4.0.1.sql | 2 - upgrade/sql/1.4.0.10.sql | 20 - upgrade/sql/1.4.0.11.sql | 35 - upgrade/sql/1.4.0.12.sql | 7 - upgrade/sql/1.4.0.13.sql | 1 - upgrade/sql/1.4.0.14.sql | 24 - upgrade/sql/1.4.0.15.sql | 41 - upgrade/sql/1.4.0.16.sql | 38 - upgrade/sql/1.4.0.17.sql | 22 - upgrade/sql/1.4.0.2.sql | 694 ----------- upgrade/sql/1.4.0.3.sql | 67 -- upgrade/sql/1.4.0.4.sql | 21 - upgrade/sql/1.4.0.5.sql | 73 -- upgrade/sql/1.4.0.6.sql | 12 - upgrade/sql/1.4.0.7.sql | 10 - upgrade/sql/1.4.0.8.sql | 35 - upgrade/sql/1.4.0.9.sql | 16 - upgrade/sql/1.4.1.0.sql | 43 - upgrade/sql/1.4.2.0.sql | 20 - upgrade/sql/1.4.2.1.sql | 3 - upgrade/sql/1.4.2.2.sql | 11 - upgrade/sql/1.4.2.3.sql | 30 - upgrade/sql/1.4.2.4.sql | 10 - upgrade/sql/1.4.2.5.sql | 4 - upgrade/sql/1.4.3.0.sql | 16 - upgrade/sql/1.4.4.0.sql | 79 -- upgrade/sql/1.4.4.1.sql | 1 - upgrade/sql/1.4.5.0.sql | 55 - upgrade/sql/1.4.5.1.sql | 1 - upgrade/sql/1.4.6.0.sql | 25 - upgrade/sql/1.4.6.1.sql | 3 - upgrade/sql/1.4.6.2.sql | 5 - upgrade/sql/1.4.7.0.sql | 17 - upgrade/sql/1.4.7.1.sql | 2 - upgrade/sql/1.4.7.2.sql | 2 - upgrade/sql/1.4.8.0.sql | 3 - upgrade/sql/1.4.9.0.sql | 27 - upgrade/sql/1.5.0.0.sql | 318 ----- upgrade/sql/1.5.0.1.sql | 682 ----------- upgrade/sql/1.5.0.10.sql | 147 --- upgrade/sql/1.5.0.11.sql | 3 - upgrade/sql/1.5.0.12.sql | 67 -- upgrade/sql/1.5.0.13.sql | 50 - upgrade/sql/1.5.0.14.sql | 27 - upgrade/sql/1.5.0.15.sql | 13 - upgrade/sql/1.5.0.16.sql | 21 - upgrade/sql/1.5.0.17.sql | 14 - upgrade/sql/1.5.0.2.sql | 422 ------- upgrade/sql/1.5.0.3.sql | 10 - upgrade/sql/1.5.0.4.sql | 50 - upgrade/sql/1.5.0.5.sql | 33 - upgrade/sql/1.5.0.6.sql | 11 - upgrade/sql/1.5.0.7.sql | 43 - upgrade/sql/1.5.0.8.sql | 13 - upgrade/sql/1.5.0.9.sql | 15 - upgrade/sql/1.5.1.0.sql | 20 - upgrade/sql/1.5.2.0.sql | 5 - upgrade/sql/1.5.3.0.sql | 42 - upgrade/sql/1.5.3.1.sql | 5 - upgrade/sql/1.5.4.0.sql | 55 - upgrade/sql/1.5.4.1.sql | 11 - upgrade/sql/1.5.5.0.sql | 38 - upgrade/sql/1.5.6.0.sql | 17 - upgrade/sql/1.5.6.1.sql | 13 - upgrade/sql/1.5.6.2.sql | 1 - upgrade/sql/1.6.0.1.sql | 102 -- upgrade/sql/1.6.0.10.sql | 65 - upgrade/sql/1.6.0.11.sql | 54 - upgrade/sql/1.6.0.12.sql | 59 - upgrade/sql/1.6.0.2.sql | 35 - upgrade/sql/1.6.0.3.sql | 30 - upgrade/sql/1.6.0.4.sql | 24 - upgrade/sql/1.6.0.5.sql | 11 - upgrade/sql/1.6.0.6.sql | 30 - upgrade/sql/1.6.0.7.sql | 24 - upgrade/sql/1.6.0.8.sql | 3 - upgrade/sql/1.6.0.9.sql | 12 - upgrade/sql/1.6.1.0.sql | 226 ---- upgrade/sql/1.6.1.1.sql | 10 - upgrade/sql/1.6.1.14.sql | 3 - upgrade/sql/1.6.1.2.sql | 37 - upgrade/sql/1.6.1.5.sql | 3 - upgrade/sql/1.6.1.6.sql | 3 - upgrade/sql/1.6.1.7.sql | 3 - upgrade/sql/1.7.0.0.sql | 242 ---- upgrade/upgrade.php | 1 - 296 files changed, 28 insertions(+), 17697 deletions(-) delete mode 100644 classes/UpgradeTools/CoreUpgrader/CoreUpgrader16.php delete mode 100644 classes/UpgradeTools/SettingsFileWriter.php delete mode 100644 tests/unit/UpgradeTools/SettingsFileWriterTest.php delete mode 100644 upgrade/classes/ToolsInstall.php delete mode 100644 upgrade/classes/index.php delete mode 100644 upgrade/php/add_accounting_tab.php delete mode 100755 upgrade/php/add_attribute_position.php delete mode 100755 upgrade/php/add_carrier_position.php delete mode 100644 upgrade/php/add_column_order_state_deleted_if_not_exists.php delete mode 100644 upgrade/php/add_column_orders_reference_if_not_exists.php delete mode 100644 upgrade/php/add_default_restrictions_modules_groups.php delete mode 100644 upgrade/php/add_feature_position.php delete mode 100644 upgrade/php/add_group_attribute_position.php delete mode 100644 upgrade/php/add_id_shop_to_shipper_lang_index.php delete mode 100644 upgrade/php/add_missing_columns_customer.php delete mode 100644 upgrade/php/add_missing_image_key.php delete mode 100644 upgrade/php/add_missing_rewrite_value.php delete mode 100644 upgrade/php/add_missing_shop_column_pagenotfound.php delete mode 100644 upgrade/php/add_module_to_hook.php delete mode 100644 upgrade/php/add_new_groups.php delete mode 100644 upgrade/php/add_order_reference_in_order_payment.php delete mode 100644 upgrade/php/add_order_state.php delete mode 100644 upgrade/php/add_quick_access_tab.php delete mode 100644 upgrade/php/add_required_customization_field_flag.php delete mode 100644 upgrade/php/add_stock_tab.php delete mode 100644 upgrade/php/add_unknown_gender.php delete mode 100644 upgrade/php/alter_blocklink.php delete mode 100644 upgrade/php/alter_cms_block.php delete mode 100644 upgrade/php/alter_ignore_drop_key.php delete mode 100644 upgrade/php/attribute_group_clean_combinations.php delete mode 100644 upgrade/php/block_category_1521.php delete mode 100644 upgrade/php/blocknewsletter.php delete mode 100644 upgrade/php/blocknewsletter1530.php delete mode 100644 upgrade/php/category_product_index_unique.php delete mode 100644 upgrade/php/check_webservice_account_table.php delete mode 100644 upgrade/php/clean_category_product.php delete mode 100644 upgrade/php/clean_tabs_15.php delete mode 100644 upgrade/php/cms_block.php delete mode 100644 upgrade/php/cms_multishop.php delete mode 100644 upgrade/php/configuration_double_cleaner.php delete mode 100644 upgrade/php/convert_product_price.php delete mode 100644 upgrade/php/country_to_timezone.php delete mode 100755 upgrade/php/create_multistore.php delete mode 100644 upgrade/php/customization_field_multishop_lang.php delete mode 100644 upgrade/php/delete_hook.php delete mode 100644 upgrade/php/delivery_number_set.php delete mode 100644 upgrade/php/drop_image_type_non_unique_index.php delete mode 100644 upgrade/php/drop_module_non_unique_index.php delete mode 100644 upgrade/php/ecotax_tax_application_fix.php delete mode 100644 upgrade/php/editorial_update.php delete mode 100644 upgrade/php/editorial_update_multishop.php delete mode 100755 upgrade/php/fix_cms_shop_1520.php delete mode 100644 upgrade/php/fix_download_product_feature_active.php delete mode 100644 upgrade/php/fix_unique_specific_price.php delete mode 100644 upgrade/php/generate_ntree.php delete mode 100644 upgrade/php/generate_root_category_for_multishop.php delete mode 100644 upgrade/php/generate_tax_rules.php delete mode 100644 upgrade/php/generic_add_missing_column.php delete mode 100644 upgrade/php/gridextjs_deprecated.php delete mode 100644 upgrade/php/group_reduction_column_fix.php delete mode 100644 upgrade/php/hook_blocksearch_on_header.php delete mode 100644 upgrade/php/id_currency_country_fix.php delete mode 100644 upgrade/php/image_shop1510.php delete mode 100644 upgrade/php/invoice_number_set.php delete mode 100644 upgrade/php/latin1_database_to_utf8.php delete mode 100644 upgrade/php/migrate_block_info_to_cms_block.php delete mode 100644 upgrade/php/migrate_orders.php delete mode 100644 upgrade/php/migrate_tabs_15.php delete mode 100644 upgrade/php/migrate_tabs_17.php delete mode 100755 upgrade/php/migrate_tabs_multi_shop.php delete mode 100644 upgrade/php/module_blockwishlist_multishop.php delete mode 100644 upgrade/php/module_reinstall_blockmyaccount.php delete mode 100644 upgrade/php/module_reinstall_blocksearch.php delete mode 100644 upgrade/php/move_crossselling.php delete mode 100644 upgrade/php/move_translations_module_file.php delete mode 100644 upgrade/php/outstanding_allow_amount1530.php delete mode 100644 upgrade/php/p15010_drop_column_id_address_if_exists.php delete mode 100755 upgrade/php/p15012_add_missing_columns.php delete mode 100644 upgrade/php/p15013_add_missing_columns.php delete mode 100644 upgrade/php/p15014_add_missing_columns.php delete mode 100644 upgrade/php/p15014_copy_missing_images_tab_from_installer.php delete mode 100644 upgrade/php/p15014_upgrade_sekeywords.php delete mode 100644 upgrade/php/p15015_blockadvertising_extension.php delete mode 100644 upgrade/php/p15016_add_missing_columns.php delete mode 100644 upgrade/php/p15017_add_id_shop_to_primary_key.php delete mode 100644 upgrade/php/p15018_change_image_types.php delete mode 100644 upgrade/php/p1531_redirect_type.php delete mode 100644 upgrade/php/p1540_add_missing_columns.php delete mode 100644 upgrade/php/p16011_media_server.php delete mode 100644 upgrade/php/p16012_pack_rework.php delete mode 100644 upgrade/php/p1603_add_attachment_size.php delete mode 100644 upgrade/php/p1606module_exceptions.php delete mode 100644 upgrade/php/p1607_drop_primary_key_if_exists.php delete mode 100644 upgrade/php/ps1600_add_missing_index.php delete mode 100644 upgrade/php/ps16012_update_alias.php delete mode 100644 upgrade/php/ps1604_update_employee_date.php delete mode 100644 upgrade/php/ps1605_change_index.php delete mode 100644 upgrade/php/ps1607_language_code_update.php delete mode 100644 upgrade/php/ps1700_stores.php delete mode 100644 upgrade/php/ps_1700_add_locale.php delete mode 100644 upgrade/php/ps_1700_add_payment_preferences_tab.php delete mode 100644 upgrade/php/ps_1700_reset_theme.php delete mode 100644 upgrade/php/ps_1700_right_management.php delete mode 100644 upgrade/php/ps_1700_short_description_config.php delete mode 100644 upgrade/php/regenerate_level_depth.php delete mode 100644 upgrade/php/remove_duplicate_category_groups.php delete mode 100644 upgrade/php/remove_module_from_hook.php delete mode 100644 upgrade/php/remove_tab.php rename upgrade/php/{alter_productcomments_guest_index.php => rename_tab.php} (73%) delete mode 100644 upgrade/php/reorderpositions.php delete mode 100644 upgrade/php/select_current_payment_modules.php delete mode 100644 upgrade/php/set_discount_category.php delete mode 100644 upgrade/php/set_payment_module.php delete mode 100644 upgrade/php/set_payment_module_group.php delete mode 100644 upgrade/php/set_product_suppliers.php delete mode 100644 upgrade/php/set_stock_available.php delete mode 100644 upgrade/php/setallgroupsonhomecategory.php delete mode 100644 upgrade/php/shop_url.php delete mode 100644 upgrade/php/sql_indexes.php delete mode 100644 upgrade/php/update_carrier_url.php delete mode 100644 upgrade/php/update_customer_default_group.php delete mode 100644 upgrade/php/update_feature_detachable_cache.php delete mode 100644 upgrade/php/update_for_13version.php delete mode 100644 upgrade/php/update_genders_images.php delete mode 100644 upgrade/php/update_image_size_in_db.php delete mode 100644 upgrade/php/update_mailalerts_add_column_idshop.php delete mode 100644 upgrade/php/update_module_blocklayered.php delete mode 100644 upgrade/php/update_module_followup.php delete mode 100644 upgrade/php/update_module_loyalty.php delete mode 100644 upgrade/php/update_module_pagesnotfound.php delete mode 100644 upgrade/php/update_module_product_comments.php delete mode 100644 upgrade/php/update_modules_multishop.php delete mode 100644 upgrade/php/update_modules_sql.php delete mode 100644 upgrade/php/update_order_canada.php delete mode 100644 upgrade/php/update_order_detail_taxes.php delete mode 100644 upgrade/php/update_order_details.php delete mode 100644 upgrade/php/update_order_messages.php delete mode 100644 upgrade/php/update_products_ecotax_v133.php delete mode 100644 upgrade/php/update_stock_mvt_reason.php delete mode 100644 upgrade/php/updateproductcomments.php delete mode 100644 upgrade/php/updatetabicon_from_11version.php delete mode 100644 upgrade/php/upgrade_cms_15.php delete mode 100644 upgrade/php/upgrade_cms_15_rename.php delete mode 100644 upgrade/sql/0.9.1.2.sql delete mode 100644 upgrade/sql/0.9.1.sql delete mode 100644 upgrade/sql/0.9.5.1.sql delete mode 100644 upgrade/sql/0.9.5.2.sql delete mode 100644 upgrade/sql/0.9.6.1.sql delete mode 100644 upgrade/sql/0.9.6.2.sql delete mode 100644 upgrade/sql/0.9.7.1.sql delete mode 100644 upgrade/sql/0.9.7.2.sql delete mode 100644 upgrade/sql/0.9.sql delete mode 100644 upgrade/sql/1.0.0.1.sql delete mode 100644 upgrade/sql/1.0.0.2.sql delete mode 100644 upgrade/sql/1.0.0.3.sql delete mode 100644 upgrade/sql/1.0.0.4.sql delete mode 100644 upgrade/sql/1.0.0.5.sql delete mode 100644 upgrade/sql/1.0.0.6.sql delete mode 100644 upgrade/sql/1.0.0.7.sql delete mode 100644 upgrade/sql/1.0.0.8.sql delete mode 100644 upgrade/sql/1.1.0.1.sql delete mode 100644 upgrade/sql/1.1.0.2.sql delete mode 100644 upgrade/sql/1.1.0.3.sql delete mode 100644 upgrade/sql/1.1.0.4.sql delete mode 100644 upgrade/sql/1.1.0.5.sql delete mode 100644 upgrade/sql/1.2.0.1.sql delete mode 100644 upgrade/sql/1.2.0.2.sql delete mode 100644 upgrade/sql/1.2.0.3.sql delete mode 100644 upgrade/sql/1.2.0.4.sql delete mode 100644 upgrade/sql/1.2.0.5.sql delete mode 100644 upgrade/sql/1.2.0.6.sql delete mode 100644 upgrade/sql/1.2.0.7.sql delete mode 100644 upgrade/sql/1.2.0.8.sql delete mode 100644 upgrade/sql/1.2.1.0.sql delete mode 100644 upgrade/sql/1.2.2.0.sql delete mode 100644 upgrade/sql/1.2.3.0.sql delete mode 100644 upgrade/sql/1.2.4.0.sql delete mode 100644 upgrade/sql/1.2.5.0.sql delete mode 100644 upgrade/sql/1.3.0.1.sql delete mode 100644 upgrade/sql/1.3.0.10.sql delete mode 100644 upgrade/sql/1.3.0.2.sql delete mode 100644 upgrade/sql/1.3.0.3.sql delete mode 100644 upgrade/sql/1.3.0.4.sql delete mode 100644 upgrade/sql/1.3.0.5.sql delete mode 100644 upgrade/sql/1.3.0.6.sql delete mode 100755 upgrade/sql/1.3.0.7.sql delete mode 100644 upgrade/sql/1.3.0.8.sql delete mode 100644 upgrade/sql/1.3.0.9.sql delete mode 100644 upgrade/sql/1.3.1.1.sql delete mode 100755 upgrade/sql/1.3.2.1.sql delete mode 100755 upgrade/sql/1.3.2.2.sql delete mode 100755 upgrade/sql/1.3.2.3.sql delete mode 100644 upgrade/sql/1.3.3.0.sql delete mode 100644 upgrade/sql/1.3.4.0.sql delete mode 100644 upgrade/sql/1.3.5.0.sql delete mode 100755 upgrade/sql/1.3.6.0.sql delete mode 100644 upgrade/sql/1.3.7.0.sql delete mode 100644 upgrade/sql/1.4.0.1.sql delete mode 100644 upgrade/sql/1.4.0.10.sql delete mode 100644 upgrade/sql/1.4.0.11.sql delete mode 100644 upgrade/sql/1.4.0.12.sql delete mode 100644 upgrade/sql/1.4.0.13.sql delete mode 100644 upgrade/sql/1.4.0.14.sql delete mode 100644 upgrade/sql/1.4.0.15.sql delete mode 100644 upgrade/sql/1.4.0.16.sql delete mode 100644 upgrade/sql/1.4.0.17.sql delete mode 100644 upgrade/sql/1.4.0.2.sql delete mode 100644 upgrade/sql/1.4.0.3.sql delete mode 100644 upgrade/sql/1.4.0.4.sql delete mode 100644 upgrade/sql/1.4.0.5.sql delete mode 100644 upgrade/sql/1.4.0.6.sql delete mode 100644 upgrade/sql/1.4.0.7.sql delete mode 100644 upgrade/sql/1.4.0.8.sql delete mode 100644 upgrade/sql/1.4.0.9.sql delete mode 100755 upgrade/sql/1.4.1.0.sql delete mode 100644 upgrade/sql/1.4.2.0.sql delete mode 100644 upgrade/sql/1.4.2.1.sql delete mode 100644 upgrade/sql/1.4.2.2.sql delete mode 100644 upgrade/sql/1.4.2.3.sql delete mode 100644 upgrade/sql/1.4.2.4.sql delete mode 100644 upgrade/sql/1.4.2.5.sql delete mode 100644 upgrade/sql/1.4.3.0.sql delete mode 100644 upgrade/sql/1.4.4.0.sql delete mode 100755 upgrade/sql/1.4.4.1.sql delete mode 100644 upgrade/sql/1.4.5.0.sql delete mode 100755 upgrade/sql/1.4.5.1.sql delete mode 100644 upgrade/sql/1.4.6.0.sql delete mode 100644 upgrade/sql/1.4.6.1.sql delete mode 100755 upgrade/sql/1.4.6.2.sql delete mode 100644 upgrade/sql/1.4.7.0.sql delete mode 100644 upgrade/sql/1.4.7.1.sql delete mode 100644 upgrade/sql/1.4.7.2.sql delete mode 100644 upgrade/sql/1.4.8.0.sql delete mode 100644 upgrade/sql/1.4.9.0.sql delete mode 100755 upgrade/sql/1.5.0.0.sql delete mode 100644 upgrade/sql/1.5.0.1.sql delete mode 100644 upgrade/sql/1.5.0.10.sql delete mode 100644 upgrade/sql/1.5.0.11.sql delete mode 100644 upgrade/sql/1.5.0.12.sql delete mode 100644 upgrade/sql/1.5.0.13.sql delete mode 100644 upgrade/sql/1.5.0.14.sql delete mode 100644 upgrade/sql/1.5.0.15.sql delete mode 100644 upgrade/sql/1.5.0.16.sql delete mode 100644 upgrade/sql/1.5.0.17.sql delete mode 100755 upgrade/sql/1.5.0.2.sql delete mode 100644 upgrade/sql/1.5.0.3.sql delete mode 100644 upgrade/sql/1.5.0.4.sql delete mode 100644 upgrade/sql/1.5.0.5.sql delete mode 100644 upgrade/sql/1.5.0.6.sql delete mode 100644 upgrade/sql/1.5.0.7.sql delete mode 100644 upgrade/sql/1.5.0.8.sql delete mode 100644 upgrade/sql/1.5.0.9.sql delete mode 100644 upgrade/sql/1.5.1.0.sql delete mode 100644 upgrade/sql/1.5.2.0.sql delete mode 100644 upgrade/sql/1.5.3.0.sql delete mode 100644 upgrade/sql/1.5.3.1.sql delete mode 100644 upgrade/sql/1.5.4.0.sql delete mode 100644 upgrade/sql/1.5.4.1.sql delete mode 100644 upgrade/sql/1.5.5.0.sql delete mode 100644 upgrade/sql/1.5.6.0.sql delete mode 100644 upgrade/sql/1.5.6.1.sql delete mode 100644 upgrade/sql/1.5.6.2.sql delete mode 100644 upgrade/sql/1.6.0.1.sql delete mode 100644 upgrade/sql/1.6.0.10.sql delete mode 100644 upgrade/sql/1.6.0.11.sql delete mode 100644 upgrade/sql/1.6.0.12.sql delete mode 100644 upgrade/sql/1.6.0.2.sql delete mode 100644 upgrade/sql/1.6.0.3.sql delete mode 100644 upgrade/sql/1.6.0.4.sql delete mode 100644 upgrade/sql/1.6.0.5.sql delete mode 100644 upgrade/sql/1.6.0.6.sql delete mode 100644 upgrade/sql/1.6.0.7.sql delete mode 100644 upgrade/sql/1.6.0.8.sql delete mode 100644 upgrade/sql/1.6.0.9.sql delete mode 100644 upgrade/sql/1.6.1.0.sql delete mode 100644 upgrade/sql/1.6.1.1.sql delete mode 100644 upgrade/sql/1.6.1.14.sql delete mode 100644 upgrade/sql/1.6.1.2.sql delete mode 100644 upgrade/sql/1.6.1.5.sql delete mode 100644 upgrade/sql/1.6.1.6.sql delete mode 100644 upgrade/sql/1.6.1.7.sql delete mode 100644 upgrade/sql/1.7.0.0.sql diff --git a/.github/workflows/nightly_upgrade.yml b/.github/workflows/nightly_upgrade.yml index 637b60dee..3b4a73546 100644 --- a/.github/workflows/nightly_upgrade.yml +++ b/.github/workflows/nightly_upgrade.yml @@ -22,12 +22,10 @@ jobs: strategy: fail-fast: false matrix: - from: ['8.0.4', '1.7.6.9', '1.7.7.0', '1.6.1.24'] + from: ['8.0.4', '1.7.6.9', '1.7.7.0'] ps-versions: ${{ fromJson(needs.get_matrix.outputs.matrix) }} branch: ['dev', 'master'] exclude: - - from: '1.6.1.24' - ps-versions: {branch: 'develop'} - from: '1.7.6.9' ps-versions: {branch: 'develop'} - from: '1.7.7.0' diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index 983d1620a..b7e22996f 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -89,7 +89,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - presta-versions: ['1.6.1.18', '1.7.2.5', '1.7.3.4', '1.7.4.4', '1.7.5.1', '1.7.6', '1.7.7', '1.7.8', '8.0.0', 'latest'] + presta-versions: ['1.7.2.5', '1.7.3.4', '1.7.4.4', '1.7.5.1', '1.7.6', '1.7.7', '1.7.8', '8.0.0', 'latest'] steps: - name: Checkout uses: actions/checkout@v2.0.0 diff --git a/.github/workflows/upgrade.yml b/.github/workflows/upgrade.yml index bc5bf1adb..3e9f7be0b 100644 --- a/.github/workflows/upgrade.yml +++ b/.github/workflows/upgrade.yml @@ -4,7 +4,7 @@ jobs: upgrade: strategy: matrix: - from: ['1.6.1.11', '1.7.6.9', '1.7.6.1', '1.7.7.0'] + from: ['1.7.6.9', '1.7.6.1', '1.7.7.0'] ps-versions: - channel: minor - channel: major diff --git a/classes/TaskRunner/Upgrade/UpgradeDb.php b/classes/TaskRunner/Upgrade/UpgradeDb.php index 2a5392d33..990bc640b 100644 --- a/classes/TaskRunner/Upgrade/UpgradeDb.php +++ b/classes/TaskRunner/Upgrade/UpgradeDb.php @@ -29,11 +29,9 @@ use PrestaShop\Module\AutoUpgrade\TaskRunner\AbstractTask; use PrestaShop\Module\AutoUpgrade\UpgradeException; -use PrestaShop\Module\AutoUpgrade\UpgradeTools\CoreUpgrader\CoreUpgrader16; use PrestaShop\Module\AutoUpgrade\UpgradeTools\CoreUpgrader\CoreUpgrader17; use PrestaShop\Module\AutoUpgrade\UpgradeTools\CoreUpgrader\CoreUpgrader80; use PrestaShop\Module\AutoUpgrade\UpgradeTools\CoreUpgrader\CoreUpgrader81; -use PrestaShop\Module\AutoUpgrade\UpgradeTools\SettingsFileWriter; class UpgradeDb extends AbstractTask { @@ -61,10 +59,6 @@ public function run() public function getCoreUpgrader() { - if (version_compare($this->container->getState()->getInstallVersion(), '1.7', '<')) { - return new CoreUpgrader16($this->container, $this->logger); - } - if (version_compare($this->container->getState()->getInstallVersion(), '8', '<')) { return new CoreUpgrader17($this->container, $this->logger); } @@ -85,7 +79,6 @@ public function init() // Migrating settings file $this->container->initPrestaShopAutoloader(); - (new SettingsFileWriter($this->translator))->migrateSettingsFile($this->logger); parent::init(); } } diff --git a/classes/UpgradeTools/CoreUpgrader/CoreUpgrader.php b/classes/UpgradeTools/CoreUpgrader/CoreUpgrader.php index 5537e8d8b..2ed7ed808 100644 --- a/classes/UpgradeTools/CoreUpgrader/CoreUpgrader.php +++ b/classes/UpgradeTools/CoreUpgrader/CoreUpgrader.php @@ -191,7 +191,6 @@ protected function initConstants() define('SETTINGS_FILE_YML', $this->container->getProperty(UpgradeContainer::PS_ROOT_PATH) . '/app/config/parameters.yml'); define('DEFINES_FILE', $this->container->getProperty(UpgradeContainer::PS_ROOT_PATH) . '/config/defines.inc.php'); define('INSTALLER__PS_BASE_URI', substr($_SERVER['REQUEST_URI'], 0, -1 * (strlen($_SERVER['REQUEST_URI']) - strrpos($_SERVER['REQUEST_URI'], '/')) - strlen(substr(dirname($_SERVER['REQUEST_URI']), strrpos(dirname($_SERVER['REQUEST_URI']), '/') + 1)))); - // define('INSTALLER__PS_BASE_URI_ABSOLUTE', 'http://'.ToolsInstall::getHttpHost(false, true).INSTALLER__PS_BASE_URI); define('_PS_INSTALL_PATH_', $this->pathToInstallFolder . '/'); define('_PS_INSTALL_DATA_PATH_', _PS_INSTALL_PATH_ . 'data/'); @@ -675,7 +674,7 @@ protected function updateTheme() } $this->logger->info($this->container->getTranslator()->trans('Switching to default theme.', [], 'Modules.Autoupgrade.Admin')); - $themeAdapter = new ThemeAdapter($this->db, $this->destinationUpgradeVersion); + $themeAdapter = new ThemeAdapter($this->db); Cache::clean('*'); diff --git a/classes/UpgradeTools/CoreUpgrader/CoreUpgrader16.php b/classes/UpgradeTools/CoreUpgrader/CoreUpgrader16.php deleted file mode 100644 index 956f3bf11..000000000 --- a/classes/UpgradeTools/CoreUpgrader/CoreUpgrader16.php +++ /dev/null @@ -1,186 +0,0 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0) - */ - -namespace PrestaShop\Module\AutoUpgrade\UpgradeTools\CoreUpgrader; - -use PrestaShop\Module\AutoUpgrade\Tools14; -use PrestaShop\Module\AutoUpgrade\UpgradeContainer; -use PrestaShop\Module\AutoUpgrade\UpgradeException; -use PrestaShop\Module\AutoUpgrade\UpgradeTools\FilesystemAdapter; -use PrestaShop\Module\AutoUpgrade\UpgradeTools\SettingsFileWriter; - -class CoreUpgrader16 extends CoreUpgrader -{ - /** - * Complete path to the settings.inc.php - * - * @var string - */ - private $pathToSettingsFile; - - /** - * Generate a new settings file. - */ - public function writeNewSettings() - { - if (!defined('_PS_CACHE_ENABLED_')) { - define('_PS_CACHE_ENABLED_', '0'); - } - $caches = ['CacheMemcache', 'CacheApc', 'CacheFs', 'CacheMemcached', - 'CacheXcache', ]; - - $datas = [ - '_DB_SERVER_' => _DB_SERVER_, - '_DB_NAME_' => _DB_NAME_, - '_DB_USER_' => _DB_USER_, - '_DB_PASSWD_' => _DB_PASSWD_, - '_DB_PREFIX_' => _DB_PREFIX_, - '_MYSQL_ENGINE_' => _MYSQL_ENGINE_, - '_PS_CACHING_SYSTEM_' => ((defined('_PS_CACHING_SYSTEM_') && in_array(_PS_CACHING_SYSTEM_, $caches)) ? _PS_CACHING_SYSTEM_ : 'CacheMemcache'), - '_PS_CACHE_ENABLED_' => _PS_CACHE_ENABLED_, - '_COOKIE_KEY_' => _COOKIE_KEY_, - '_COOKIE_IV_' => _COOKIE_IV_, - '_PS_CREATION_DATE_' => defined('_PS_CREATION_DATE_') ? _PS_CREATION_DATE_ : date('Y-m-d'), - '_PS_VERSION_' => $this->destinationUpgradeVersion, - '_PS_DIRECTORY_' => __PS_BASE_URI__, - ]; - - if (defined('_RIJNDAEL_KEY_') && defined('_RIJNDAEL_IV_')) { - $datas['_RIJNDAEL_KEY_'] = _RIJNDAEL_KEY_; - $datas['_RIJNDAEL_IV_'] = _RIJNDAEL_IV_; - } elseif (function_exists('openssl_encrypt')) { - $datas['_RIJNDAEL_KEY_'] = Tools14::passwdGen(32); - $datas['_RIJNDAEL_IV_'] = base64_encode(openssl_random_pseudo_bytes(openssl_cipher_iv_length('AES-128-CBC'))); - } elseif (function_exists('mcrypt_encrypt')) { - $datas['_RIJNDAEL_KEY_'] = Tools14::passwdGen(mcrypt_get_key_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_CBC)); - $datas['_RIJNDAEL_IV_'] = base64_encode(mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_CBC), MCRYPT_RAND)); - } - - $writer = new SettingsFileWriter($this->container->getTranslator()); - $writer->writeSettingsFile($this->pathToSettingsFile, $datas); - $this->logger->debug($this->container->getTranslator()->trans('Settings file updated', [], 'Modules.Autoupgrade.Admin')); - } - - protected function initConstants() - { - parent::initConstants(); - $this->pathToSettingsFile = $this->container->getProperty(UpgradeContainer::PS_ROOT_PATH) . '/config/settings.inc.php'; - // Kept for potential BC with old PS versions - define('SETTINGS_FILE', $this->pathToSettingsFile); - } - - protected function getPreUpgradeVersion() - { - if (!file_exists($this->pathToSettingsFile)) { - throw new UpgradeException($this->container->getTranslator()->trans('The config/settings.inc.php file was not found.', [], 'Modules.Autoupgrade.Admin')); - } - include_once $this->pathToSettingsFile; - - return _PS_VERSION_; - } - - protected function upgradeLanguage($lang) - { - require_once _PS_TOOL_DIR_ . 'tar/Archive_Tar.php'; - $lang_pack = json_decode(Tools14::file_get_contents('http' . (extension_loaded('openssl') - ? 's' : '') . '://www.prestashop.com/download/lang_packs/get_language_pack.php?version=' . $this->destinationUpgradeVersion . '&iso_lang=' . $lang['iso_code'])); - - if (!$lang_pack) { - return; - } - - if ($content = Tools14::file_get_contents('http' . (extension_loaded('openssl') - ? 's' : '') . '://translations.prestashop.com/download/lang_packs/gzip/' . $lang_pack->version . '/' . $lang['iso_code'] . '.gzip')) { - $file = _PS_TRANSLATIONS_DIR_ . $lang['iso_code'] . '.gzip'; - if ((bool) file_put_contents($file, $content)) { - $gz = new \Archive_Tar($file, 'gz'); - $files_list = $gz->listContent(); - if (!$this->container->getUpgradeConfiguration()->shouldKeepMails()) { - $files_listing = []; - foreach ($files_list as $i => $file) { - if (preg_match('/^mails\/' . $lang['iso_code'] . '\/.*/', $file['filename'])) { - unset($files_list[$i]); - } - } - foreach ($files_list as $file) { - if (isset($file['filename']) && is_string($file['filename'])) { - $files_listing[] = $file['filename']; - } - } - if (is_array($files_listing)) { - $gz->extractList($files_listing, _PS_TRANSLATIONS_DIR_ . '../', ''); - } - } else { - $gz->extract(_PS_TRANSLATIONS_DIR_ . '../', false); - } - } - } - } - - protected function loadEntityInterface() - { - require_once _PS_ROOT_DIR_ . '/Core/Foundation/Database/Core_Foundation_Database_EntityInterface.php'; - } - - protected function runCoreCacheClean() - { - parent::runCoreCacheClean(); - - // delete cache filesystem if activated - if (defined('_PS_CACHE_ENABLED_') && false != _PS_CACHE_ENABLED_) { - $depth = (int) $this->db->getValue('SELECT value - FROM ' . _DB_PREFIX_ . 'configuration - WHERE name = "PS_CACHEFS_DIRECTORY_DEPTH"'); - if ($depth) { - if (!defined('_PS_CACHEFS_DIRECTORY_')) { - define('_PS_CACHEFS_DIRECTORY_', $this->container->getProperty(UpgradeContainer::PS_ROOT_PATH) . '/cache/cachefs/'); - } - FilesystemAdapter::deleteDirectory(_PS_CACHEFS_DIRECTORY_, false); - if (class_exists('CacheFs', false)) { - $this->createCacheFsDirectories((int) $depth); - } - } - } - } - - private function createCacheFsDirectories($level_depth, $directory = false) - { - if (!$directory) { - if (!defined('_PS_CACHEFS_DIRECTORY_')) { - define('_PS_CACHEFS_DIRECTORY_', $this->container->getProperty(UpgradeContainer::PS_ROOT_PATH) . '/cache/cachefs/'); - } - $directory = _PS_CACHEFS_DIRECTORY_; - } - $chars = '0123456789abcdef'; - for ($i = 0; $i < strlen($chars); ++$i) { - $new_dir = $directory . $chars[$i] . '/'; - if (mkdir($new_dir, 0775) && chmod($new_dir, 0775) && $level_depth - 1 > 0) { - $this->createCacheFsDirectories($level_depth - 1, $new_dir); - } - } - } -} diff --git a/classes/UpgradeTools/CoreUpgrader/CoreUpgrader17.php b/classes/UpgradeTools/CoreUpgrader/CoreUpgrader17.php index 766258374..473a981dd 100644 --- a/classes/UpgradeTools/CoreUpgrader/CoreUpgrader17.php +++ b/classes/UpgradeTools/CoreUpgrader/CoreUpgrader17.php @@ -117,7 +117,7 @@ protected function updateRTLFiles() return; } $this->logger->info($this->container->getTranslator()->trans('Upgrade the RTL files.', [], 'Modules.Autoupgrade.Admin')); - $themeAdapter = new ThemeAdapter($this->db, $this->destinationUpgradeVersion); + $themeAdapter = new ThemeAdapter($this->db); $themes = $themeAdapter->getListFromDisk(); $this->removeExistingRTLFiles($themes); diff --git a/classes/UpgradeTools/FileFilter.php b/classes/UpgradeTools/FileFilter.php index ef9baf7a0..31e9ff409 100644 --- a/classes/UpgradeTools/FileFilter.php +++ b/classes/UpgradeTools/FileFilter.php @@ -166,7 +166,6 @@ public function getFilesToIgnoreOnUpgrade() // If set to false, we need to preserve the default themes if (!$this->configuration->shouldUpdateDefaultTheme()) { $this->excludeAbsoluteFilesFromUpgrade[] = '/themes/classic'; - $this->excludeAbsoluteFilesFromUpgrade[] = '/themes/default-bootstrap'; } return $this->excludeAbsoluteFilesFromUpgrade; diff --git a/classes/UpgradeTools/ModuleAdapter.php b/classes/UpgradeTools/ModuleAdapter.php index d84f8b835..ca674677d 100644 --- a/classes/UpgradeTools/ModuleAdapter.php +++ b/classes/UpgradeTools/ModuleAdapter.php @@ -241,9 +241,7 @@ public function upgradeModule($id, $name) unlink($zip_fullpath); } - // Only 1.7 step - if (version_compare($this->upgradeVersion, '1.7.0.0', '>=') - && !$this->doUpgradeModule($name)) { + if (!$this->doUpgradeModule($name)) { throw (new UpgradeException('' . $this->translator->trans('[WARNING] Error when trying to upgrade module %s.', [$name], 'Modules.Autoupgrade.Admin') . ''))->setSeverity(UpgradeException::SEVERITY_WARNING)->setQuickInfos(\Module::getInstanceByName($name)->getErrors()); } } diff --git a/classes/UpgradeTools/SettingsFileWriter.php b/classes/UpgradeTools/SettingsFileWriter.php deleted file mode 100644 index 5fba18c66..000000000 --- a/classes/UpgradeTools/SettingsFileWriter.php +++ /dev/null @@ -1,89 +0,0 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0) - */ - -namespace PrestaShop\Module\AutoUpgrade\UpgradeTools; - -use PrestaShop\Module\AutoUpgrade\Log\LoggerInterface; -use PrestaShop\Module\AutoUpgrade\LoggedEvent; -use PrestaShop\Module\AutoUpgrade\UpgradeException; -use Symfony\Component\Filesystem\Filesystem; - -class SettingsFileWriter -{ - private $translator; - - public function __construct($translator) - { - $this->translator = $translator; - } - - public function migrateSettingsFile(LoggerInterface $logger) - { - if (class_exists('\PrestaShopBundle\Install\Upgrade')) { - \PrestaShopBundle\Install\Upgrade::migrateSettingsFile(new LoggedEvent($logger)); - } - } - - /** - * @param string $filePath - * @param array $data - * - * @throws UpgradeException - */ - public function writeSettingsFile($filePath, $data) - { - if (!is_writable($filePath)) { - throw new UpgradeException($this->translator->trans('Error when opening settings.inc.php file in write mode', [], 'Modules.Autoupgrade.Admin')); - } - - // Create backup file - $filesystem = new Filesystem(); - $filesystem->copy($filePath, $filePath . '.bck'); - - $fd = fopen($filePath, 'w'); - fwrite($fd, ' $value) { - if (false === fwrite($fd, "define('$name', '{$this->checkString($value)}');" . PHP_EOL)) { - throw new UpgradeException($this->translator->trans('Error when generating new settings.inc.php file.', [], 'Modules.Autoupgrade.Admin')); - } - } - fclose($fd); - } - - public function checkString($string) - { - if (get_magic_quotes_gpc()) { - $string = stripslashes($string); - } - if (!is_numeric($string)) { - $string = addslashes($string); - $string = str_replace(["\n", "\r"], '', $string); - } - - return $string; - } -} diff --git a/classes/UpgradeTools/ThemeAdapter.php b/classes/UpgradeTools/ThemeAdapter.php index a1cbc5466..abcb94fc8 100644 --- a/classes/UpgradeTools/ThemeAdapter.php +++ b/classes/UpgradeTools/ThemeAdapter.php @@ -30,26 +30,10 @@ class ThemeAdapter { private $db; - private $upgradeVersion; - public function __construct($db, $upgradeVersion) + public function __construct($db) { $this->db = $db; - $this->upgradeVersion = $upgradeVersion; - } - - /** - * Enable the given theme on the shop. - * - * @param string $themeName - * - * @return mixed - */ - public function enableTheme($themeName) - { - return version_compare($this->upgradeVersion, '1.7.0.0', '>=') ? - $this->enableTheme17($themeName) : - $this->enableTheme16($themeName); } /** @@ -59,9 +43,7 @@ public function enableTheme($themeName) */ public function getDefaultTheme() { - return version_compare($this->upgradeVersion, '1.7.0.0', '>=') ? - 'classic' : // 1.7 - 'default-bootstrap'; // 1.6 + return 'classic'; } /** @@ -86,35 +68,27 @@ public function getListFromDisk() } /** - * Backward compatibility function for theme enabling. - * - * @param string $themeName - */ - private function enableTheme16($themeName) - { - $this->db->execute('UPDATE `' . _DB_PREFIX_ . 'shop` - SET id_theme = (SELECT id_theme FROM `' . _DB_PREFIX_ . 'theme` WHERE name LIKE \'' . $themeName . '\')'); - $this->db->execute('DELETE FROM `' . _DB_PREFIX_ . 'theme` WHERE name LIKE \'default\' OR name LIKE \'prestashop\''); - - return true; - } - - /** - * Use 1.7 theme manager is order to enable the new theme. + * Use theme manager is order to enable the new theme. * * @param string $themeName * - * @return bool|array + * @return bool|string True on success, string with errors on failure */ - private function enableTheme17($themeName) + public function enableTheme($themeName) { + // Load up core theme manager $themeManager = $this->getThemeManager(); + // Enable the theme $isThemeEnabled = $themeManager->enable($themeName); if (!$isThemeEnabled) { + // Something went wrong... let's check if we have some more info $errors = $themeManager->getErrors($themeName); + if (is_array($errors) && !empty($errors)) { + return implode(',', $errors); + } - return $errors ? $errors : 'Unknown error'; + return 'Unknown error'; } return true; diff --git a/functions.php b/functions.php index e700e00bf..2ef64e629 100755 --- a/functions.php +++ b/functions.php @@ -24,52 +24,6 @@ * @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0) */ -/** - * Generate a new settings file, only transmitted parameters are updated. - * - * @param string $baseUri Base URI - * @param string $theme Theme name (eg. default) - * @param array $arrayDB Parameters in order to connect to database - */ -function rewriteSettingsFile($baseUrls = null, $theme = null, $arrayDB = null) -{ - $defines = []; - $defines['__PS_BASE_URI__'] = ($baseUrls && $baseUrls['__PS_BASE_URI__']) ? $baseUrls['__PS_BASE_URI__'] : __PS_BASE_URI__; - $defines['_MEDIA_SERVER_1_'] = ($baseUrls && isset($baseUrls['_MEDIA_SERVER_1_'])) ? $baseUrls['_MEDIA_SERVER_1_'] : _MEDIA_SERVER_1_; - $defines['_PS_CACHING_SYSTEM_'] = _PS_CACHING_SYSTEM_; - $defines['_PS_CACHE_ENABLED_'] = _PS_CACHE_ENABLED_; - $defines['_THEME_NAME_'] = $theme ? $theme : _THEME_NAME_; - $defines['_DB_NAME_'] = (($arrayDB && isset($arrayDB['_DB_NAME_'])) ? $arrayDB['_DB_NAME_'] : _DB_NAME_); - $defines['_MYSQL_ENGINE_'] = (($arrayDB && isset($arrayDB['_MYSQL_ENGINE_'])) ? $arrayDB['_MYSQL_ENGINE_'] : _MYSQL_ENGINE_); - $defines['_DB_SERVER_'] = (($arrayDB && isset($arrayDB['_DB_SERVER_'])) ? $arrayDB['_DB_SERVER_'] : _DB_SERVER_); - $defines['_DB_USER_'] = (($arrayDB && isset($arrayDB['_DB_USER_'])) ? $arrayDB['_DB_USER_'] : _DB_USER_); - $defines['_DB_PREFIX_'] = (($arrayDB && isset($arrayDB['_DB_PREFIX_'])) ? $arrayDB['_DB_PREFIX_'] : _DB_PREFIX_); - $defines['_DB_PASSWD_'] = (($arrayDB && isset($arrayDB['_DB_PASSWD_'])) ? $arrayDB['_DB_PASSWD_'] : _DB_PASSWD_); - $defines['_DB_TYPE_'] = (($arrayDB && isset($arrayDB['_DB_TYPE_'])) ? $arrayDB['_DB_TYPE_'] : _DB_TYPE_); - $defines['_COOKIE_KEY_'] = addslashes(_COOKIE_KEY_); - $defines['_COOKIE_IV_'] = addslashes(_COOKIE_IV_); - if (defined('_RIJNDAEL_KEY_')) { - $defines['_RIJNDAEL_KEY_'] = addslashes(_RIJNDAEL_KEY_); - } - if (defined('_RIJNDAEL_IV_')) { - $defines['_RIJNDAEL_IV_'] = addslashes(_RIJNDAEL_IV_); - } - $defines['_PS_VERSION_'] = addslashes(_PS_VERSION_); - $content = " $value) { - $content .= 'define(\'' . $k . '\', \'' . addslashes($value) . '\');' . "\n"; - } - $content .= "\n?>"; - if ($fd = @fopen(PS_ADMIN_DIR . '/../app/config/parameters.php', 'w')) { - fwrite($fd, $content); - fclose($fd); - - return true; - } - - return false; -} - /** * Display SQL date in friendly format. * diff --git a/tests/unit/UpgradeTools/SettingsFileWriterTest.php b/tests/unit/UpgradeTools/SettingsFileWriterTest.php deleted file mode 100644 index df1c6c069..000000000 --- a/tests/unit/UpgradeTools/SettingsFileWriterTest.php +++ /dev/null @@ -1,81 +0,0 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0) - */ -use PHPUnit\Framework\TestCase; -use PrestaShop\Module\AutoUpgrade\UpgradeContainer; -use PrestaShop\Module\AutoUpgrade\UpgradeTools\SettingsFileWriter; - -class SettingsFileWriterTest extends TestCase -{ - private $container; - private $settingsWriter; - - protected function setUp() - { - parent::setUp(); - $this->container = new UpgradeContainer('/html', '/html/admin'); - $this->settingsWriter = new SettingsFileWriter($this->container->getTranslator()); - } - - public function testSettingsIsProperlyGenerated() - { - $fileExpected = " '127.0.0.1:3307', - '_DB_NAME_' => 'prestashop16', - '_DB_USER_' => 'root', - '_DB_PREFIX_' => 'ps_', - '_MYSQL_ENGINE_' => 'InnoDB', - '_PS_CACHING_SYSTEM_' => 'CacheMemcache', - '_PS_CACHE_ENABLED_' => '0', - '_COOKIE_KEY_' => 'dedeedededede', - '_COOKIE_IV_' => 'wololo', - '_PS_CREATION_DATE_' => '2018-05-16', - '_PS_VERSION_' => '1.6.1.18', - '_RIJNDAEL_KEY_' => 'zrL1GDp2oqDoXFss', - '_RIJNDAEL_IV_' => 'QSt/I95YtA==', - ]; - - $file = tempnam(sys_get_temp_dir(), 'PSS'); - $this->settingsWriter->writeSettingsFile($file, $datas); - - $this->assertSame($fileExpected, file_get_contents($file)); - } -} diff --git a/upgrade/classes/ToolsInstall.php b/upgrade/classes/ToolsInstall.php deleted file mode 100644 index 9cabf9d1d..000000000 --- a/upgrade/classes/ToolsInstall.php +++ /dev/null @@ -1,132 +0,0 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) - */ -class ToolsInstall -{ - /** - * Converts a simpleXML element into an array. Preserves attributes and everything. - * You can choose to get your elements either flattened, or stored in a custom index that - * you define. - * For example, for a given element - * - * if you choose to flatten attributes, you would get: - * $array['field']['name'] = 'someName'; - * $array['field']['type'] = 'someType'; - * If you choose not to flatten, you get: - * $array['field']['@attributes']['name'] = 'someName'; - * _____________________________________ - * Repeating fields are stored in indexed arrays. so for a markup such as: - * - * a - * b - * c - * - * you array would be: - * $array['parent']['child'][0] = 'a'; - * $array['parent']['child'][1] = 'b'; - * ...And so on. - * _____________________________________ - * - * @param simpleXMLElement $xml the XML to convert - * @param bool $flattenValues Choose wether to flatten values - * or to set them under a particular index. - * defaults to true; - * @param bool $flattenAttributes Choose wether to flatten attributes - * or to set them under a particular index. - * Defaults to true; - * @param bool $flattenChildren Choose wether to flatten children - * or to set them under a particular index. - * Defaults to true; - * @param string $valueKey index for values, in case $flattenValues was set to - * false. Defaults to "@value" - * @param string $attributesKey index for attributes, in case $flattenAttributes was set to - * false. Defaults to "@attributes" - * @param string $childrenKey index for children, in case $flattenChildren was set to - * false. Defaults to "@children" - * - * @return array the resulting array - */ - public static function simpleXMLToArray($xml, $flattenValues = true, $flattenAttributes = true, $flattenChildren = true, $valueKey = '@value', $attributesKey = '@attributes', $childrenKey = '@children') - { - $return = []; - if (!($xml instanceof SimpleXMLElement)) { - return $return; - } - - $name = $xml->getName(); - $_value = trim((string) $xml); - if (strlen($_value) == 0) { - $_value = null; - } - - if ($_value !== null) { - if (!$flattenValues) { - $return[$valueKey] = $_value; - } else { - $return = $_value; - } - } - - $children = []; - $first = true; - foreach ($xml->children() as $elementName => $child) { - $value = static::simpleXMLToArray($child, $flattenValues, $flattenAttributes, $flattenChildren, $valueKey, $attributesKey, $childrenKey); - if (isset($children[$elementName])) { - if ($first) { - $temp = $children[$elementName]; - unset($children[$elementName]); - $children[$elementName][] = $temp; - $first = false; - } - $children[$elementName][] = $value; - } else { - $children[$elementName] = $value; - } - } - - if (count($children) > 0) { - if (!$flattenChildren) { - $return[$childrenKey] = $children; - } else { - $return = array_merge($return, $children); - } - } - - $attributes = []; - foreach ($xml->attributes() as $name => $value) { - $attributes[$name] = trim($value); - } - - if (count($attributes) > 0) { - if (!$flattenAttributes) { - $return[$attributesKey] = $attributes; - } else { - $return = array_merge($return, $attributes); - } - } - - return $return; - } -} diff --git a/upgrade/classes/index.php b/upgrade/classes/index.php deleted file mode 100644 index b2e33a490..000000000 --- a/upgrade/classes/index.php +++ /dev/null @@ -1,34 +0,0 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) - */ -header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); -header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); - -header('Cache-Control: no-store, no-cache, must-revalidate'); -header('Cache-Control: post-check=0, pre-check=0', false); -header('Pragma: no-cache'); - -header('Location: ../../../'); -exit; diff --git a/upgrade/php/add_accounting_tab.php b/upgrade/php/add_accounting_tab.php deleted file mode 100644 index bdb33a655..000000000 --- a/upgrade/php/add_accounting_tab.php +++ /dev/null @@ -1,47 +0,0 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) - */ -function add_accounting_tab() -{ - include_once __DIR__ . '/add_new_tab.php'; - $id_parent = add_new_tab( - 'AdminAccounting', - 'en:Accounting|fr:Comptabilité|es:Accounting|de:Accounting|it:Accounting', - 0, - true - ); - - add_new_tab( - 'AdminAccountingManagement', - 'en:Account Number Management|fr:Gestion des numéros de comptes|es:Account Number Management|de:Account Number Management|it:Account Number Management', - $id_parent - ); - - add_new_tab( - 'AdminAccountingExport', - 'en:Export|fr:Export|es:Export|de:Export|it:Export', - $id_parent - ); -} diff --git a/upgrade/php/add_attribute_position.php b/upgrade/php/add_attribute_position.php deleted file mode 100755 index d8e3dad0b..000000000 --- a/upgrade/php/add_attribute_position.php +++ /dev/null @@ -1,49 +0,0 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) - */ -function add_attribute_position() -{ - $groups = Db::getInstance()->executeS(' - SELECT DISTINCT `id_attribute_group` - FROM `' . _DB_PREFIX_ . 'attribute`'); - if (is_array($groups) && count($groups)) { - foreach ($groups as $group) { - $attributes = Db::getInstance()->executeS(' - SELECT * - FROM `' . _DB_PREFIX_ . 'attribute` - WHERE `id_attribute_group` = ' . (int) ($group['id_attribute_group'])); - $i = 0; - if (is_array($attributes) && count($attributes)) { - foreach ($attributes as $attribute) { - Db::getInstance()->execute(' - UPDATE `' . _DB_PREFIX_ . 'attribute` - SET `position` = ' . $i++ . ' - WHERE `id_attribute` = ' . (int) $attribute['id_attribute'] . ' - AND `id_attribute_group` = ' . (int) $attribute['id_attribute_group']); - } - } - } - } -} diff --git a/upgrade/php/add_carrier_position.php b/upgrade/php/add_carrier_position.php deleted file mode 100755 index 7b3d37c12..000000000 --- a/upgrade/php/add_carrier_position.php +++ /dev/null @@ -1,41 +0,0 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) - */ -function add_carrier_position() -{ - $carriers = Db::getInstance()->executeS(' - SELECT `id_carrier` - FROM `' . _DB_PREFIX_ . 'carrier` - WHERE `deleted` = 0'); - if (is_array($carriers) && count($carriers)) { - $i = 0; - foreach ($carriers as $carrier) { - Db::getInstance()->execute(' - UPDATE `' . _DB_PREFIX_ . 'carrier` - SET `position` = ' . $i++ . ' - WHERE `id_carrier` = ' . (int) $carrier['id_carrier']); - } - } -} diff --git a/upgrade/php/add_column_order_state_deleted_if_not_exists.php b/upgrade/php/add_column_order_state_deleted_if_not_exists.php deleted file mode 100644 index 27b2ce47d..000000000 --- a/upgrade/php/add_column_order_state_deleted_if_not_exists.php +++ /dev/null @@ -1,40 +0,0 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) - */ -function add_column_order_state_deleted_if_not_exists() -{ - $res = true; - $column = Db::getInstance()->executeS('SHOW FIELDS FROM `' . _DB_PREFIX_ . 'order_state` LIKE "deleted"'); - - if (empty($column)) { - $res = Db::getInstance()->execute('ALTER TABLE `' . _DB_PREFIX_ . 'order_state` - ADD COLUMN `deleted` tinyint(1) UNSIGNED NOT NULL default "0" AFTER `paid`'); - } - if (!$res) { - return ['error' => Db::getInstance()->getNumberError(), 'msg' => Db::getInstance()->getMsgError()]; - } - - return true; -} diff --git a/upgrade/php/add_column_orders_reference_if_not_exists.php b/upgrade/php/add_column_orders_reference_if_not_exists.php deleted file mode 100644 index 17901e4ea..000000000 --- a/upgrade/php/add_column_orders_reference_if_not_exists.php +++ /dev/null @@ -1,32 +0,0 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) - */ -function add_column_orders_reference_if_not_exists() -{ - $column = Db::getInstance()->executeS('SHOW FIELDS FROM `' . _DB_PREFIX_ . 'orders` LIKE "reference"'); - if (empty($column)) { - return Db::getInstance()->execute('ALTER TABLE `' . _DB_PREFIX_ . 'orders` ADD COLUMN `reference` varchar(10) AFTER `id_order`'); - } -} diff --git a/upgrade/php/add_default_restrictions_modules_groups.php b/upgrade/php/add_default_restrictions_modules_groups.php deleted file mode 100644 index 44cbb4446..000000000 --- a/upgrade/php/add_default_restrictions_modules_groups.php +++ /dev/null @@ -1,58 +0,0 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) - */ -function add_default_restrictions_modules_groups() -{ - $res = true; - // Table module_group had another use in previous versions, we need to clean it up. - $res &= Db::getInstance()->execute('TRUNCATE TABLE `' . _DB_PREFIX_ . 'module_group`'); - - $groups = Db::getInstance()->executeS(' - SELECT `id_group` - FROM `' . _DB_PREFIX_ . 'group`'); - $modules = Db::getInstance()->executeS(' - SELECT m.* - FROM `' . _DB_PREFIX_ . 'module` m'); - $shops = Db::getInstance()->executeS(' - SELECT `id_shop` - FROM `' . _DB_PREFIX_ . 'shop`'); - foreach ($groups as $group) { - if (!is_array($modules) || !is_array($shops)) { - return false; - } else { - $sql = 'INSERT INTO `' . _DB_PREFIX_ . 'module_group` (`id_module`, `id_shop`, `id_group`) VALUES '; - foreach ($modules as $mod) { - foreach ($shops as $s) { - $sql .= '("' . (int) $mod['id_module'] . '", "' . (int) $s . '", "' . (int) $group['id_group'] . '"),'; - } - } - // removing last comma to avoid SQL error - $sql = substr($sql, 0, strlen($sql) - 1); - $res &= Db::getInstance()->execute($sql); - } - } - - return $res; -} diff --git a/upgrade/php/add_feature_position.php b/upgrade/php/add_feature_position.php deleted file mode 100644 index 9c0bd7fa7..000000000 --- a/upgrade/php/add_feature_position.php +++ /dev/null @@ -1,40 +0,0 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) - */ -function add_feature_position() -{ - $features = Db::getInstance()->executeS(' - SELECT `id_feature` - FROM `' . _DB_PREFIX_ . 'feature`'); - $i = 0; - if (is_array($features) && count($features)) { - foreach ($features as $feature) { - Db::getInstance()->execute(' - UPDATE `' . _DB_PREFIX_ . 'feature` - SET `position` = ' . $i++ . ' - WHERE `id_feature` = ' . (int) $feature['id_feature']); - } - } -} diff --git a/upgrade/php/add_group_attribute_position.php b/upgrade/php/add_group_attribute_position.php deleted file mode 100644 index 9acedaf48..000000000 --- a/upgrade/php/add_group_attribute_position.php +++ /dev/null @@ -1,40 +0,0 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) - */ -function add_group_attribute_position() -{ - $groups = Db::getInstance()->executeS(' - SELECT * - FROM `' . _DB_PREFIX_ . 'attribute_group`'); - $i = 0; - if (is_array($groups) && count($groups)) { - foreach ($groups as $group) { - Db::getInstance()->execute(' - UPDATE `' . _DB_PREFIX_ . 'attribute_group` - SET `position` = ' . $i++ . ' - WHERE `id_attribute_group` = ' . (int) $group['id_attribute_group']); - } - } -} diff --git a/upgrade/php/add_id_shop_to_shipper_lang_index.php b/upgrade/php/add_id_shop_to_shipper_lang_index.php deleted file mode 100644 index 40d224783..000000000 --- a/upgrade/php/add_id_shop_to_shipper_lang_index.php +++ /dev/null @@ -1,40 +0,0 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) - */ -function add_id_shop_to_shipper_lang_index() -{ - $res = true; - - $key_exists = Db::getInstance()->executeS(' - SHOW INDEX - FROM `' . _DB_PREFIX_ . 'carrier_lang` - WHERE Key_name = "shipper_lang_index"'); - if ($key_exists) { - $res &= Db::getInstance()->execute('ALTER TABLE `' . _DB_PREFIX_ . 'carrier_lang` DROP KEY `shipper_lang_index`'); - } - $res &= Db::getInstance()->execute('ALTER TABLE `' . _DB_PREFIX_ . 'carrier_lang` ADD PRIMARY KEY (`id_carrier`, `id_shop`, `id_lang`)'); - - return $res; -} diff --git a/upgrade/php/add_missing_columns_customer.php b/upgrade/php/add_missing_columns_customer.php deleted file mode 100644 index 7fe53e4db..000000000 --- a/upgrade/php/add_missing_columns_customer.php +++ /dev/null @@ -1,57 +0,0 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) - */ -function add_missing_columns_customer() -{ - $db = Db::getInstance(); - $res = true; - $current_fields = $db->executeS('SHOW FIELDS FROM `' . _DB_PREFIX_ . 'customer`'); - foreach ($current_fields as $k => $field) { - $current_fields[$k] = $field['Field']; - } - - $missing_fields = [ - 'id_risk' => 'ALTER TABLE `' . _DB_PREFIX_ . 'customer` - ADD `id_risk` int(10) unsigned NOT NULL DEFAULT "1"', - 'company' => 'ALTER TABLE `' . _DB_PREFIX_ . 'customer` ADD `company` varchar(64)', - 'siret' => 'ALTER TABLE `' . _DB_PREFIX_ . 'customer` ADD `siret` varchar(14)', - 'ape' => 'ALTER TABLE `' . _DB_PREFIX_ . 'customer` ADD `ape` varchar(5)', - 'website' => 'ALTER TABLE `' . _DB_PREFIX_ . 'customer` ADD `website` varchar(128)', - 'outstanding_allow_amount' => 'ALTER TABLE `' . _DB_PREFIX_ . 'customer` - ADD `outstanding_allow_amount` DECIMAL( 10,6 ) NOT NULL default "0.00"', - 'show_public_prices' => 'ALTER TABLE `' . _DB_PREFIX_ . 'customer` - ADD `show_public_prices` tinyint(1) unsigned NOT NULL default "0"', - 'max_payment_days' => 'ALTER TABLE `' . _DB_PREFIX_ . 'customer` - ADD `max_payment_days` int(10) unsigned NOT NULL default "60"', - ]; - - foreach ($missing_fields as $field => $query) { - if (!in_array($field, $current_fields)) { - $res &= $db->execute($query); - } - } - - return $res; -} diff --git a/upgrade/php/add_missing_image_key.php b/upgrade/php/add_missing_image_key.php deleted file mode 100644 index a4ade7a4d..000000000 --- a/upgrade/php/add_missing_image_key.php +++ /dev/null @@ -1,42 +0,0 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) - */ -function add_missing_image_key() -{ - $res = true; - $key_exists = Db::getInstance()->executeS('SHOW INDEX - FROM `' . _DB_PREFIX_ . 'image` - WHERE Key_name = \'idx_product_image\''); - if ($key_exists) { - $res &= Db::getInstance()->execute('ALTER TABLE - `' . _DB_PREFIX_ . 'image` - DROP KEY `idx_product_image`'); - } - $res &= Db::getInstance()->execute('ALTER TABLE - `' . _DB_PREFIX_ . 'image` - ADD UNIQUE `idx_product_image` (`id_image`, `id_product`, `cover`)'); - - return $res; -} diff --git a/upgrade/php/add_missing_rewrite_value.php b/upgrade/php/add_missing_rewrite_value.php deleted file mode 100644 index cc0904e5e..000000000 --- a/upgrade/php/add_missing_rewrite_value.php +++ /dev/null @@ -1,44 +0,0 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) - */ -function add_missing_rewrite_value() -{ - $pages = Db::getInstance()->executeS(' - SELECT * - FROM `' . _DB_PREFIX_ . 'meta` m - LEFT JOIN `' . _DB_PREFIX_ . 'meta_lang` ml ON (m.`id_meta` = ml.`id_meta`) - WHERE ml.`url_rewrite` = \'\' - AND m.`page` != "index" - '); - if (is_array($pages) && count($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']); - } - } -} diff --git a/upgrade/php/add_missing_shop_column_pagenotfound.php b/upgrade/php/add_missing_shop_column_pagenotfound.php deleted file mode 100644 index d377e11e6..000000000 --- a/upgrade/php/add_missing_shop_column_pagenotfound.php +++ /dev/null @@ -1,48 +0,0 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) - */ -function add_missing_shop_column_pagenotfound() -{ - $res = true; - $exists = Db::getInstance()->executeS('SHOW TABLES LIKE "' . _DB_PREFIX_ . 'pagenotfound"'); - if (count($exists)) { - $fields = Db::getInstance()->executeS('SHOW FIELDS FROM `' . _DB_PREFIX_ . 'pagenotfound`'); - foreach ($fields as $k => $field) { - $fields[$k] = $field['Field']; - } - - if (!in_array('id_shop_group', $fields)) { - $res &= Db::getInstance()->execute('ALTER TABLE `' . _DB_PREFIX_ . 'pagenotfound` - ADD `id_shop_group` INT(10) AFTER `id_pagenotfound`'); - } - - if (!in_array('id_shop', $fields)) { - $res &= Db::getInstance()->execute('ALTER TABLE `' . _DB_PREFIX_ . 'pagenotfound` - ADD `id_shop` INT(10) AFTER `id_pagenotfound`'); - } - } - - return $res; -} diff --git a/upgrade/php/add_module_to_hook.php b/upgrade/php/add_module_to_hook.php deleted file mode 100644 index b35b6acf4..000000000 --- a/upgrade/php/add_module_to_hook.php +++ /dev/null @@ -1,63 +0,0 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) - */ -function add_module_to_hook($module_name, $hook_name) -{ - $res = true; - - $id_module = Db::getInstance()->getValue( - ' - SELECT `id_module` FROM `' . _DB_PREFIX_ . 'module` - WHERE `name` = "' . $module_name . '"' - ); - - if ((int) $id_module > 0) { - $id_hook = Db::getInstance()->getValue('SELECT `id_hook` FROM `' . _DB_PREFIX_ . 'hook` WHERE `name` = "' . $hook_name . '"'); - if (!$id_hook) { - if (!Db::getInstance()->execute(' - INSERT IGNORE INTO `' . _DB_PREFIX_ . 'hook` (`name`, `title`) - VALUES ("' . pSQL($hook_name) . '", "' . pSQL($hook_name) . '")')) { - $res = false; - } else { - $id_hook = Db::getInstance()->Insert_ID(); - } - } - - if ((int) $id_hook > 0) { - if (!Db::getInstance()->execute(' - INSERT IGNORE INTO `' . _DB_PREFIX_ . 'hook_module` (`id_module`, `id_hook`, `position`) - VALUES ( - ' . (int) $id_module . ', - ' . (int) $id_hook . ', - (SELECT IFNULL( - (SELECT max_position from (SELECT MAX(position)+1 as max_position FROM `' . _DB_PREFIX_ . 'hook_module` WHERE `id_hook` = ' . (int) $id_hook . ') AS max_position), 1)) - )')) { - $res = false; - } - } - } - - return $res; -} diff --git a/upgrade/php/add_new_groups.php b/upgrade/php/add_new_groups.php deleted file mode 100644 index ed8070aff..000000000 --- a/upgrade/php/add_new_groups.php +++ /dev/null @@ -1,59 +0,0 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) - */ -function add_new_groups($french, $standard) -{ - $res = 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 = Db::getInstance()->executeS('SELECT id_lang, iso_code FROM `' . _DB_PREFIX_ . 'lang`'); - - $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); - $res &= Db::getInstance()->execute('INSERT INTO `' . _DB_PREFIX_ . 'group_lang` (`id_group`, `id_lang`, `name`) VALUES ' . $sql); - // we add the different id_group in the configuration - if (strtolower($standard) == 'visitor') { - $res &= Db::getInstance()->execute('INSERT INTO `' . _DB_PREFIX_ . 'configuration` (`id_configuration`, `name`, `value`, `date_add`, `date_upd`) VALUES (NULL, "PS_UNIDENTIFIED_GROUP", "' . (int) $last_id . '", NOW(), NOW())'); - } elseif (strtolower($standard) == 'guest') { - $res &= Db::getInstance()->execute('INSERT INTO `' . _DB_PREFIX_ . 'configuration` (`id_configuration`, `name`, `value`, `date_add`, `date_upd`) VALUES (NULL, "PS_GUEST_GROUP", "' . (int) $last_id . '", NOW(), NOW())'); - } elseif (strtolower($standard) == 'test') { - $res &= Db::getInstance()->execute('INSERT INTO `' . _DB_PREFIX_ . 'configuration` (`id_configuration`, `name`, `value`, `date_add`, `date_upd`) VALUES (NULL, "PS_TEST", "' . (int) $last_id . '", NOW(), NOW())'); - } - - // Add shop association - $res &= Db::getInstance()->execute('INSERT INTO `' . _DB_PREFIX_ . 'group_shop` (`id_group`, `id_shop`) (SELECT ' . (int) $last_id . ', `value` FROM `' . _DB_PREFIX_ . 'configuration` WHERE `name` = \'PS_SHOP_DEFAULT\')'); - - // Copy categories associations from the group of id 1 (default group for both visitors and customers in version 1.4) to the new group - $res &= Db::getInstance()->execute('INSERT INTO `' . _DB_PREFIX_ . 'category_group` (`id_category`, `id_group`) (SELECT `id_category`, ' . (int) $last_id . ' FROM `' . _DB_PREFIX_ . 'category_group` WHERE `id_group` = 1)'); - - return $res; -} diff --git a/upgrade/php/add_new_tab.php b/upgrade/php/add_new_tab.php index f6e9ffba0..e5181b7f3 100644 --- a/upgrade/php/add_new_tab.php +++ b/upgrade/php/add_new_tab.php @@ -75,32 +75,6 @@ function get_new_tab_id($className, $returnId = false) } } -/** - * Entrypoint for adding new tabs prior 1.7 versions of PrestaShop - * - * @param string $className - * @param string $name Pipe-separated translated values - * @param int $id_parent - * @param bool $returnId - * @param string $parentTab - * @param string $module - * - * @return int|null Tab id if requested - */ -function add_new_tab($className, $name, $id_parent, $returnId = false, $parentTab = null, $module = '') -{ - register_tab($className, $name, $id_parent, $returnId, $parentTab, $module); - - Db::getInstance()->execute('INSERT IGNORE INTO `' . _DB_PREFIX_ . 'access` (`id_profile`, `id_tab`, `view`, `add`, `edit`, `delete`) - (SELECT `id_profile`, ( - SELECT `id_tab` - FROM `' . _DB_PREFIX_ . 'tab` - WHERE `class_name` = \'' . pSQL($className) . '\' LIMIT 0,1 - ), 1, 1, 1, 1 FROM `' . _DB_PREFIX_ . 'profile` )'); - - return get_new_tab_id($className, $returnId); -} - /** * Entrypoint for adding new tabs on +1.7 versions of PrestaShop * diff --git a/upgrade/php/add_order_reference_in_order_payment.php b/upgrade/php/add_order_reference_in_order_payment.php deleted file mode 100644 index 26bbff837..000000000 --- a/upgrade/php/add_order_reference_in_order_payment.php +++ /dev/null @@ -1,94 +0,0 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) - */ -function add_order_reference_in_order_payment() -{ - $res = true; - $payments = Db::getInstance()->query(' - SELECT op.id_order_payment, o.reference - FROM `' . _DB_PREFIX_ . 'order_payment` op - INNER JOIN `' . _DB_PREFIX_ . 'orders` o - ON o.id_order = op.id_order'); - - if (!is_resource($payments) || !$payments) { - return true; - } - - $errors = []; - // Populate "order_reference" - while ($payment = Db::getInstance()->nextRow($payments)) { - if (isset($payment['id_order_payment']) && $payment['id_order_payment']) { - $res = Db::getInstance()->execute(' - UPDATE `' . _DB_PREFIX_ . 'order_payment` - SET order_reference = \'' . pSQL($payment['reference']) . '\' - WHERE id_order_payment = ' . (int) $payment['id_order_payment']); - if (!$res) { - $errors[] = Db::getInstance()->getMsgError(); - } - } - } - - if (count($errors)) { - return ['error' => true, 'msg' => implode('
', $errors)]; - } - - // Get lines to merge (with multishipping on, durring the payment one line was added by order, only one is necessary by cart) - $duplicate_lines = Db::getInstance()->query(' - SELECT GROUP_CONCAT(id_order_payment) as id_order_payments - FROM `' . _DB_PREFIX_ . 'order_payment` - GROUP BY order_reference, date_add - HAVING COUNT(*) > 1'); - - if (!is_resource($duplicate_lines) || !$duplicate_lines) { - return true; - } - - $order_payments_to_remove = []; - while ($order_payments = Db::getInstance()->nextRow($duplicate_lines)) { - $order_payments_array = []; - if (isset($order_payments['id_order_payments'])) { - $order_payments_array = explode(',', $order_payments['id_order_payments']); - } - // Remove the first item (we want to keep one line) - $id_order_payment_keep = array_shift($order_payments_array); - - $res = Db::getInstance()->execute(' - UPDATE `' . _DB_PREFIX_ . 'order_invoice_payment` - SET id_order_payement = ' . (int) $id_order_payment_keep . ' - WHERE id_order_payment IN (' . implode(',', $order_payments_array) . ')'); - - $order_payments_to_remove = array_merge($order_payments_to_remove, $order_payments_array); - } - // Remove the duplicate lines (because of the multishipping) - if (count($order_payments_to_remove)) { - $res = Db::getInstance()->execute('DELETE FROM `' . _DB_PREFIX_ . 'order_payment` WHERE id_order_payment IN (' . implode(',', $order_payments_to_remove) . ')'); - } - - if (!$res) { - return ['errors' => true, 'msg' => Db::getInstance()->getMsgError()]; - } - - return true; -} diff --git a/upgrade/php/add_order_state.php b/upgrade/php/add_order_state.php deleted file mode 100644 index 462ace62e..000000000 --- a/upgrade/php/add_order_state.php +++ /dev/null @@ -1,71 +0,0 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) - */ -function add_order_state($conf_name, $name, $invoice, $send_email, $color, $unremovable, $logable, $delivery, $template = null) -{ - $res = true; - $name_lang = []; - $template_lang = []; - foreach (explode('|', $name) as $item) { - $temp = explode(':', $item); - $name_lang[$temp[0]] = $temp[1]; - } - - if ($template) { - foreach (explode('|', $template) as $item) { - $temp = explode(':', $item); - $template_lang[$temp[0]] = $temp[1]; - } - } - - $res &= Db::getInstance()->execute(' - INSERT INTO `' . _DB_PREFIX_ . 'order_state` (`invoice`, `send_email`, `color`, `unremovable`, `logable`, `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`'); - - $languages = Db::getInstance()->executeS('SELECT * FROM `' . _DB_PREFIX_ . 'lang`'); - foreach ($languages as $lang) { - $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 . ', "' . $name . '", "' . $template . '") - '); - } - - $exist = Db::getInstance()->getValue('SELECT `id_configuration` FROM `' . _DB_PREFIX_ . 'configuration` WHERE `name` = \'' . pSQL($conf_name) . '\''); - if ($exist) { - $res &= Db::getInstance()->execute('UPDATE `' . _DB_PREFIX_ . 'configuration` SET value = "' . (int) $id_order_state . '" WHERE `name` LIKE \'' . pSQL($conf_name) . '\''); - } else { - $res &= Db::getInstance()->execute('INSERT INTO `' . _DB_PREFIX_ . 'configuration` (name, value) VALUES ("' . pSQL($conf_name) . '", "' . (int) $id_order_state . '"'); - } -} diff --git a/upgrade/php/add_quick_access_tab.php b/upgrade/php/add_quick_access_tab.php deleted file mode 100644 index 8cede57a2..000000000 --- a/upgrade/php/add_quick_access_tab.php +++ /dev/null @@ -1,34 +0,0 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) - */ -function add_quick_access_tab() -{ - include_once __DIR__ . '/add_new_tab.php'; - add_new_tab_17( - 'AdminQuickAccesses', - 'en:Quick access|fr:Accès rapide|es:Quick access|de:Quick access|it:Quick access', - -1 - ); -} diff --git a/upgrade/php/add_required_customization_field_flag.php b/upgrade/php/add_required_customization_field_flag.php deleted file mode 100644 index 7e7da0434..000000000 --- a/upgrade/php/add_required_customization_field_flag.php +++ /dev/null @@ -1,44 +0,0 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) - */ -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) { - return false; - } - if (Db::getInstance()->numRows()) { - $productIds = []; - 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) . ')')) { - return false; - } - } - - return true; -} diff --git a/upgrade/php/add_stock_tab.php b/upgrade/php/add_stock_tab.php deleted file mode 100644 index f9bdef0b2..000000000 --- a/upgrade/php/add_stock_tab.php +++ /dev/null @@ -1,86 +0,0 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) - */ -require_once __DIR__ . '/add_new_tab.php'; - -function add_stock_tab() -{ - // Patch for the 1.0.1 sql update - Db::getInstance()->query(' - DELETE - FROM `' . _DB_PREFIX_ . 'tab` - WHERE id_parent = 1 - AND class_name = "AdminStocks"'); - - // Create new tabs - $id_parent = add_new_tab( - 'AdminStock', - 'en:Stock|fr:Stock|es:Stock|de:Stock|it:Stock', - 0, - true - ); - - add_new_tab( - 'AdminWarehouses', - 'en:Warehouses|fr:Entrepôts|es:Warehouses|de:Warehouses|it:Warehouses', - $id_parent - ); - - add_new_tab( - 'AdminStockManagement', - 'en:Stock Management|fr:Gestion du stock|es:Stock Management|de:Stock Management|it:Stock Management', - $id_parent - ); - - add_new_tab( - 'AdminStockMvt', - 'en:Stock Movement|fr:Mouvements de Stock|es:Stock Movement|de:Stock Movement|it:Stock Movement', - $id_parent - ); - - add_new_tab( - 'AdminStockInstantState', - 'en:Stock instant state|fr:Etat instantané du stock|es:Stock instant state|de:Stock instant state|it:Stock instant state', - $id_parent - ); - - add_new_tab( - 'AdminStockCover', - 'en:Stock cover|fr:Couverture du stock|es:Stock cover|de:Stock cover|it:Stock cover', - $id_parent - ); - - add_new_tab( - 'AdminSupplyOrders', - 'en:Supply orders|fr:Commandes fournisseurs|es:Supply orders|de:Supply orders|it:Supply orders', - $id_parent - ); - - add_new_tab( - 'AdminStockConfiguration', - 'en:Configuration|fr:Configuration|es:Configuration|de:Configuration|it:Configuration', - $id_parent - ); -} diff --git a/upgrade/php/add_unknown_gender.php b/upgrade/php/add_unknown_gender.php deleted file mode 100644 index e1380ac4d..000000000 --- a/upgrade/php/add_unknown_gender.php +++ /dev/null @@ -1,61 +0,0 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) - */ -function add_unknown_gender() -{ - $res = true; - - // creates the new gender - $id_type = 2; - $res &= Db::getInstance()->execute(' - INSERT INTO `' . _DB_PREFIX_ . 'gender` (`type`) - VALUES (' . (int) $id_type . ')'); - - // retrieves its id - $id_gender = Db::getInstance()->Insert_ID(); - - // inserts lang values - $languages = Db::getInstance()->executeS('SELECT * FROM `' . _DB_PREFIX_ . 'lang`'); - $lang_names = [ - 'en' => 'Unknown', - 'de' => 'Unbekannte', - 'es' => 'Desconocido', - 'fr' => 'Inconnu', - 'it' => 'Sconosciuto', - ]; - - foreach ($languages as $lang) { - $name = (isset($lang_names[$lang['iso_code']]) ? $lang_names[$lang['iso_code']] : 'Unknown'); - $res &= Db::getInstance()->execute(' - INSERT INTO `' . _DB_PREFIX_ . 'gender_lang` (`id_gender`, `id_lang`, `name`) VALUES - (' . (int) $id_gender . ', ' . (int) $lang['id_lang'] . ', \'' . pSQL($name) . '\')'); - } - - // for all clients where id gender is 0, sets the new id gender - $res &= Db::getInstance()->execute(' - UPDATE `' . _DB_PREFIX_ . 'customers` - SET `id_gender` = ' . (int) $id_gender . ' - WHERE `id_gender` = 0'); -} diff --git a/upgrade/php/alter_blocklink.php b/upgrade/php/alter_blocklink.php deleted file mode 100644 index 72d3062eb..000000000 --- a/upgrade/php/alter_blocklink.php +++ /dev/null @@ -1,32 +0,0 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) - */ -function alter_blocklink() -{ - // No one will know if the table does not exist :] Thanks Damien for your solution ;) - Db::getInstance()->execute('ALTER TABLE `' . _DB_PREFIX_ . 'blocklink_lang` CHANGE `id_link` `id_blocklink` INT( 10 ) UNSIGNED NOT NULL'); - - Db::getInstance()->execute('ALTER TABLE `' . _DB_PREFIX_ . 'blocklink` CHANGE `id_link` `id_blocklink` INT( 10 ) UNSIGNED NOT NULL'); -} diff --git a/upgrade/php/alter_cms_block.php b/upgrade/php/alter_cms_block.php deleted file mode 100644 index 403efad05..000000000 --- a/upgrade/php/alter_cms_block.php +++ /dev/null @@ -1,36 +0,0 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) - */ -function alter_cms_block() -{ - // No one will know if the table does not exist :] Thanks Damien for your solution ;) - Db::getInstance()->execute('ALTER TABLE `' . _DB_PREFIX_ . 'cms_block_lang` CHANGE `id_block_cms` `id_cms_block` INT( 10 ) UNSIGNED NOT NULL'); - - Db::getInstance()->execute('ALTER TABLE `' . _DB_PREFIX_ . 'cms_block` CHANGE `id_block_cms` `id_cms_block` INT( 10 ) UNSIGNED NOT NULL'); - - Db::getInstance()->execute('ALTER TABLE `' . _DB_PREFIX_ . 'cms_block_page` CHANGE `id_block_cms` `id_cms_block` INT( 10 ) UNSIGNED NOT NULL'); - - Db::getInstance()->execute('ALTER TABLE `' . _DB_PREFIX_ . 'cms_block_page` CHANGE `id_block_cms_page` `id_cms_block_page` INT( 10 ) UNSIGNED NOT NULL AUTO_INCREMENT'); -} diff --git a/upgrade/php/alter_ignore_drop_key.php b/upgrade/php/alter_ignore_drop_key.php deleted file mode 100644 index 3ec2f01c1..000000000 --- a/upgrade/php/alter_ignore_drop_key.php +++ /dev/null @@ -1,37 +0,0 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) - */ -function alter_ignore_drop_key($table, $key) -{ - $indexes = Db::getInstance()->executeS(' - SHOW INDEX FROM `' . _DB_PREFIX_ . pSQL($table) . '` WHERE Key_name = \'' . pSQL($key) . '\' - '); - - if (count($indexes) > 0) { - Db::getInstance()->execute(' - ALTER TABLE `' . _DB_PREFIX_ . pSQL($table) . '` DROP KEY `' . pSQL($key) . '` - '); - } -} diff --git a/upgrade/php/attribute_group_clean_combinations.php b/upgrade/php/attribute_group_clean_combinations.php deleted file mode 100644 index e111a0f23..000000000 --- a/upgrade/php/attribute_group_clean_combinations.php +++ /dev/null @@ -1,48 +0,0 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) - */ -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 = []; - 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/upgrade/php/block_category_1521.php b/upgrade/php/block_category_1521.php deleted file mode 100644 index 7bf1da008..000000000 --- a/upgrade/php/block_category_1521.php +++ /dev/null @@ -1,35 +0,0 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) - */ -function block_category_1521() -{ - if (!Db::getInstance()->getValue('SELECT value FROM `' . _DB_PREFIX_ . 'configuration` WHERE `name` = \'BLOCK_CATEG_MAX_DEPTH\' ')) { - Db::getInstance()->execute('INSERT INTO `' . _DB_PREFIX_ . 'configuration` - (`id_configuration` ,`id_shop_group` ,`id_shop` ,`name` ,`value` ,`date_add` ,`date_upd`) - VALUES (NULL, NULL, NULL, \'BLOCK_CATEG_MAX_DEPTH\', 4, NOW(), NOW())'); - } elseif ($maxdepth = (int) Db::getInstance()->getValue('SELECT value FROM `' . _DB_PREFIX_ . 'configuration` WHERE `value` IS NOT NULL AND `value` <> 0 AND `name` = \'BLOCK_CATEG_MAX_DEPTH\'')) { - Db::getInstance()->execute('UPDATE `' . _DB_PREFIX_ . 'configuration` SET `value` = ' . ($maxdepth + 1) . ' WHERE `name` = \'BLOCK_CATEG_MAX_DEPTH\''); - } -} diff --git a/upgrade/php/blocknewsletter.php b/upgrade/php/blocknewsletter.php deleted file mode 100644 index 1715bad5f..000000000 --- a/upgrade/php/blocknewsletter.php +++ /dev/null @@ -1,30 +0,0 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) - */ -function blocknewsletter() -{ - // No one will know if the table does not exist :] - Db::getInstance()->execute('ALTER TABLE ' . _DB_PREFIX_ . 'newsletter ADD `http_referer` VARCHAR(255) NULL'); -} diff --git a/upgrade/php/blocknewsletter1530.php b/upgrade/php/blocknewsletter1530.php deleted file mode 100644 index 8b7301635..000000000 --- a/upgrade/php/blocknewsletter1530.php +++ /dev/null @@ -1,37 +0,0 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) - */ -function blocknewsletter1530() -{ - include_once __DIR__ . '/generic_add_missing_column.php'; - - $column_to_add = [ - 'id_shop' => 'INTEGER UNSIGNED NOT NULL DEFAULT \'1\' after `id`', - 'id_shop_group' => 'INTEGER UNSIGNED NOT NULL DEFAULT \'1\' after `id_shop`', - 'active' => 'TINYINT(1) NOT NULL DEFAULT \'0\' after http_referer', - ]; - - return generic_add_missing_column('newsletter', $column_to_add); -} diff --git a/upgrade/php/category_product_index_unique.php b/upgrade/php/category_product_index_unique.php deleted file mode 100644 index 64f5651d9..000000000 --- a/upgrade/php/category_product_index_unique.php +++ /dev/null @@ -1,42 +0,0 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) - */ -function category_product_index_unique() -{ - $res = true; - $key_exists = Db::getInstance()->executeS('SHOW INDEX - FROM `' . _DB_PREFIX_ . 'category_product` - WHERE Key_name = "category_product_index"'); - if ($key_exists) { - $res &= Db::getInstance()->execute('ALTER TABLE - `' . _DB_PREFIX_ . 'category_product` - DROP INDEX `category_product_index`'); - } - $res &= Db::getInstance()->execute('ALTER TABLE - `' . _DB_PREFIX_ . 'category_product` - ADD UNIQUE `category_product_index` (`id_category`, `id_product`)'); - - return $res; -} diff --git a/upgrade/php/check_webservice_account_table.php b/upgrade/php/check_webservice_account_table.php deleted file mode 100644 index 6b655d387..000000000 --- a/upgrade/php/check_webservice_account_table.php +++ /dev/null @@ -1,42 +0,0 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) - */ - -/** - * Check if all needed columns in webservice_account table exists. - * These columns are used for the WebserviceRequest overriding. - * - * @return void - */ -function check_webservice_account_table() -{ - $sql = 'SHOW COLUMNS FROM ' . _DB_PREFIX_ . 'webservice_account'; - $return = Db::getInstance()->executeS($sql); - if (count($return) < 7) { - $sql = 'ALTER TABLE `' . _DB_PREFIX_ . 'webservice_account` ADD `is_module` TINYINT( 2 ) NOT NULL DEFAULT \'0\' AFTER `class_name` , - ADD `module_name` VARCHAR( 50 ) NULL DEFAULT NULL AFTER `is_module`'; - Db::getInstance()->executeS($sql); - } -} diff --git a/upgrade/php/clean_category_product.php b/upgrade/php/clean_category_product.php deleted file mode 100644 index 32c65c6b0..000000000 --- a/upgrade/php/clean_category_product.php +++ /dev/null @@ -1,45 +0,0 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) - */ - -/* Remove duplicate entries from ps_category_product */ -function clean_category_product() -{ - $list = Db::getInstance()->executeS(' - SELECT id_category, id_product, COUNT(*) n - FROM ' . _DB_PREFIX_ . 'category_product - GROUP BY CONCAT(id_category,\'|\',id_product) - HAVING n > 1'); - - $result = true; - if ($list) { - foreach ($list as $l) { - $result &= Db::getInstance()->execute('DELETE FROM ' . _DB_PREFIX_ . 'category_product - WHERE id_product = ' . (int) $l['id_product'] . ' AND id_category = ' . (int) $l['id_category'] . ' LIMIT ' . (int) ($l['n'] - 1)); - } - } - - return $result; -} diff --git a/upgrade/php/clean_tabs_15.php b/upgrade/php/clean_tabs_15.php deleted file mode 100644 index b3bd5a92e..000000000 --- a/upgrade/php/clean_tabs_15.php +++ /dev/null @@ -1,383 +0,0 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) - */ -function clean_tabs_15() -{ - include_once __DIR__ . '/migrate_tabs_15.php'; - - $clean_tabs_15 = [ - 9 => [ - 'class_name' => 'AdminCatalog', - 'position' => 0, - 'active' => 1, - 'children' => [ - 21 => ['class_name' => 'AdminProducts', 'position' => 0, 'active' => 1, - ], - 22 => ['class_name' => 'AdminCategories', 'position' => 1, 'active' => 1, - ], - 23 => ['class_name' => 'AdminTracking', 'position' => 2, 'active' => 1, - ], - 24 => ['class_name' => 'AdminAttributesGroups', 'position' => 3, 'active' => 1, - ], - 25 => ['class_name' => 'AdminFeatures', 'position' => 4, 'active' => 1, - ], - 26 => ['class_name' => 'AdminManufacturers', 'position' => 5, 'active' => 1, - ], - 27 => ['class_name' => 'AdminSuppliers', 'position' => 6, 'active' => 1, - ], - 28 => ['class_name' => 'AdminScenes', 'position' => 7, 'active' => 1, - ], - 29 => ['class_name' => 'AdminTags', 'position' => 8, 'active' => 1, - ], - 30 => ['class_name' => 'AdminAttachments', 'position' => 9, 'active' => 1, - ], - ], - ], - 10 => [ - 'class_name' => 'AdminParentOrders', - 'position' => 1, - 'active' => 1, - 'children' => [ - 31 => ['class_name' => 'AdminOrders', 'position' => 0, 'active' => 1, - ], - 32 => ['class_name' => 'AdminInvoices', 'position' => 1, 'active' => 1, - ], - 33 => ['class_name' => 'AdminReturn', 'position' => 2, 'active' => 1, - ], - 34 => ['class_name' => 'AdminDeliverySlip', 'position' => 3, 'active' => 1, - ], - 35 => ['class_name' => 'AdminSlip', 'position' => 4, 'active' => 1, - ], - 36 => ['class_name' => 'AdminStatuses', 'position' => 5, 'active' => 1, - ], - 37 => ['class_name' => 'AdminOrderMessage', 'position' => 6, 'active' => 1, - ], - ], - ], - 11 => [ - 'class_name' => 'AdminParentCustomer', - 'position' => 2, - 'active' => 1, - 'children' => [ - 38 => ['class_name' => 'AdminCustomers', 'position' => 0, 'active' => 1, - ], - 39 => ['class_name' => 'AdminAddresses', 'position' => 1, 'active' => 1, - ], - 40 => ['class_name' => 'AdminGroups', 'position' => 2, 'active' => 1, - ], - 41 => ['class_name' => 'AdminCarts', 'position' => 3, 'active' => 1, - ], - 42 => ['class_name' => 'AdminCustomerThreads', 'position' => 4, 'active' => 1, - ], - 43 => ['class_name' => 'AdminContacts', 'position' => 5, 'active' => 1, - ], - 44 => ['class_name' => 'AdminGenders', 'position' => 6, 'active' => 1, - ], - 45 => ['class_name' => 'AdminOutstanding', 'position' => 7, 'active' => 0, - ], - ], - ], - 12 => [ - 'class_name' => 'AdminPriceRule', - 'position' => 3, - 'active' => 1, - 'children' => [ - 46 => ['class_name' => 'AdminCartRules', 'position' => 0, 'active' => 1, - ], - 47 => ['class_name' => 'AdminSpecificPriceRule', 'position' => 1, 'active' => 1, - ], - ], - ], - 13 => [ - 'class_name' => 'AdminParentShipping', - 'position' => 4, - 'active' => 1, - 'children' => [ - 48 => ['class_name' => 'AdminShipping', 'position' => 0, 'active' => 1, - ], - 49 => ['class_name' => 'AdminCarriers', 'position' => 1, 'active' => 1, - ], - 50 => ['class_name' => 'AdminRangePrice', 'position' => 2, 'active' => 1, - ], - 51 => ['class_name' => 'AdminRangeWeight', 'position' => 3, 'active' => 1, - ], - ], - ], - 14 => [ - 'class_name' => 'AdminParentLocalization', - 'position' => 5, - 'active' => 1, - 'children' => [ - 52 => ['class_name' => 'AdminLocalization', 'position' => 0, 'active' => 1, - ], - 53 => ['class_name' => 'AdminLanguages', 'position' => 1, 'active' => 1, - ], - 54 => ['class_name' => 'AdminZones', 'position' => 2, 'active' => 1, - ], - 55 => ['class_name' => 'AdminCountries', 'position' => 3, 'active' => 1, - ], - 56 => ['class_name' => 'AdminStates', 'position' => 4, 'active' => 1, - ], - 57 => ['class_name' => 'AdminCurrencies', 'position' => 5, 'active' => 1, - ], - 58 => ['class_name' => 'AdminTaxes', 'position' => 6, 'active' => 1, - ], - 59 => ['class_name' => 'AdminTaxRulesGroup', 'position' => 7, 'active' => 1, - ], - 60 => ['class_name' => 'AdminTranslations', 'position' => 8, 'active' => 1, - ], - ], - ], - 15 => [ - 'class_name' => 'AdminParentModules', - 'position' => 6, - 'active' => 1, - 'children' => [ - 61 => ['class_name' => 'AdminModules', 'position' => 0, 'active' => 1, - ], - 62 => ['class_name' => 'AdminAddonsCatalog', 'position' => 1, 'active' => 1, - ], - 63 => ['class_name' => 'AdminModulesPositions', 'position' => 2, 'active' => 1, - ], - 64 => ['class_name' => 'AdminPayment', 'position' => 3, 'active' => 1, - ], - ], - ], - 16 => [ - 'class_name' => 'AdminParentPreferences', - 'position' => 7, - 'active' => 1, - 'children' => [ - 65 => ['class_name' => 'AdminPreferences', 'position' => 0, 'active' => 1, - ], - 66 => ['class_name' => 'AdminOrderPreferences', 'position' => 1, 'active' => 1, - ], - 67 => ['class_name' => 'AdminPPreferences', 'position' => 2, 'active' => 1, - ], - 68 => ['class_name' => 'AdminCustomerPreferences', 'position' => 3, 'active' => 1, - ], - 69 => ['class_name' => 'AdminThemes', 'position' => 4, 'active' => 1, - ], - 70 => ['class_name' => 'AdminMeta', 'position' => 5, 'active' => 1, - ], - 71 => ['class_name' => 'AdminCmsContent', 'position' => 6, 'active' => 1, - ], - 72 => ['class_name' => 'AdminImages', 'position' => 7, 'active' => 1, - ], - 73 => ['class_name' => 'AdminStores', 'position' => 8, 'active' => 1, - ], - 74 => ['class_name' => 'AdminSearchConf', 'position' => 9, 'active' => 1, - ], - 75 => ['class_name' => 'AdminMaintenance', 'position' => 10, 'active' => 1, - ], - 76 => ['class_name' => 'AdminGeolocation', 'position' => 11, 'active' => 1, - ], - ], - ], - 17 => [ - 'class_name' => 'AdminTools', - 'position' => 8, - 'active' => 1, - 'children' => [ - 77 => ['class_name' => 'AdminInformation', 'position' => 0, 'active' => 1, - ], - 78 => ['class_name' => 'AdminPerformance', 'position' => 1, 'active' => 1, - ], - 79 => ['class_name' => 'AdminEmails', 'position' => 2, 'active' => 1, - ], - 80 => ['class_name' => 'AdminShopGroup', 'position' => 3, 'active' => 0, - ], - 81 => ['class_name' => 'AdminImport', 'position' => 4, 'active' => 1, - ], - 82 => ['class_name' => 'AdminBackup', 'position' => 5, 'active' => 1, - ], - 83 => ['class_name' => 'AdminRequestSql', 'position' => 6, 'active' => 1, - ], - 84 => ['class_name' => 'AdminLogs', 'position' => 7, 'active' => 1, - ], - 85 => ['class_name' => 'AdminWebservice', 'position' => 8, 'active' => 1, - ], - ], - ], - 18 => [ - 'class_name' => 'AdminAdmin', - 'position' => 9, - 'active' => 1, - 'children' => [ - 86 => ['class_name' => 'AdminAdminPreferences', 'position' => 0, 'active' => 1, - ], - 87 => ['class_name' => 'AdminQuickAccesses', 'position' => 1, 'active' => 1, - ], - 88 => ['class_name' => 'AdminEmployees', 'position' => 2, 'active' => 1, - ], - 89 => ['class_name' => 'AdminProfiles', 'position' => 3, 'active' => 1, - ], - 90 => ['class_name' => 'AdminAccess', 'position' => 4, 'active' => 1, - ], - 91 => ['class_name' => 'AdminTabs', 'position' => 5, 'active' => 1, - ], - ], - ], - 19 => [ - 'class_name' => 'AdminParentStats', - 'position' => 10, - 'active' => 1, - 'children' => [ - 92 => ['class_name' => 'AdminStats', 'position' => 0, 'active' => 1, - ], - 93 => ['class_name' => 'AdminSearchEngines', 'position' => 1, 'active' => 1, - ], - 94 => ['class_name' => 'AdminReferrers', 'position' => 2, 'active' => 1, - ], - ], - ], - 20 => [ - 'class_name' => 'AdminStock', - 'position' => 11, - 'active' => 1, - 'children' => [ - 95 => ['class_name' => 'AdminWarehouses', 'position' => 0, 'active' => 1, - ], - 96 => ['class_name' => 'AdminStockManagement', 'position' => 1, 'active' => 1, - ], - 97 => ['class_name' => 'AdminStockMvt', 'position' => 2, 'active' => 1, - ], - 98 => ['class_name' => 'AdminStockInstantState', 'position' => 3, 'active' => 1, - ], - 99 => ['class_name' => 'AdminStockCover', 'position' => 4, 'active' => 1, - ], - 100 => ['class_name' => 'AdminSupplyOrders', 'position' => 5, 'active' => 1, - ], - 101 => ['class_name' => 'AdminStockConfiguration', 'position' => 6, 'active' => 1, - ], - ], - ], - ]; - - //===== step 1 disabled all useless native tabs in 1.5 =====/ - - $remove_tabs = [ - 2 => 'AdminAddonsMyAccount', 4 => 'AdminAliases', 5 => 'AdminAppearance', 12 => 'AdminCMSContent', - 13 => 'AdminContact', 16 => 'AdminCounty', 20 => 'AdminDb', 22 => 'AdminDiscounts', 26 => 'AdminGenerator', - 38 => 'AdminMessages', 45 => 'AdminPDF', 63 => 'AdminStatsConf', 67 => 'AdminSubDomains', - ]; - $ids = []; - foreach ($remove_tabs as $tab) { - if ($id = get_tab_id($tab)) { - $ids[] = $id; - } - } - - if ($ids) { - Db::getInstance()->update('tab', ['active' => 0], 'id_tab IN (' . implode(', ', $ids) . ')'); - } - - //=====================================/ - - //===== step 2 move all no native tabs in AdminTools =====/ - - $id_admin_tools = get_tab_id('AdminTools'); - - $tab_to_move = get_simple_clean_tab15($clean_tabs_15); - - $ids = []; - foreach ($tab_to_move as $tab) { - if ($id = get_tab_id($tab)) { - $ids[] = $id; - } - } - - if ($ids) { - Db::getInstance()->update('tab', ['id_parent' => $id_admin_tools], 'id_tab NOT IN (' . implode(', ', $ids) . ') AND `id_parent` <> -1'); - } - - //=====================================/ - - //===== step 3 sort all 1.5 tabs =====/ - - updatePositionAndActive15($clean_tabs_15); - - //=====================================/ - - //specific case for AdminStockMvt in AdminStock - - $id_AdminStockMvt = get_tab_id('AdminStockMvt'); - $id_AdminStock = get_tab_id('AdminStock'); - Db::getInstance()->update('tab', ['id_parent' => $id_AdminStock], 'id_tab =' . $id_AdminStockMvt); - - //rename some tabs - renameTab(get_tab_id('AdminCartRules'), ['fr' => 'Règles paniers', 'es' => 'Reglas de cesta', 'en' => 'Cart Rules', 'de' => 'Warenkorb Preisregein', 'it' => 'Regole Carrello']); - - renameTab(get_tab_id('AdminPreferences'), ['fr' => 'Générales', 'es' => 'General', 'en' => 'General', 'de' => 'Allgemein', 'it' => 'Generale']); - - renameTab(get_tab_id('AdminThemes'), ['fr' => 'Thèmes', 'es' => 'Temas', 'en' => 'Themes', 'de' => 'Themen', 'it' => 'Temi']); - - renameTab(get_tab_id('AdminStores'), ['fr' => 'Coordonnées & magasins', 'es' => 'Contacto y tiendas', 'en' => 'Store Contacts', 'de' => 'Shopadressen', 'it' => 'Contatti e Negozi']); - - renameTab(get_tab_id('AdminTools'), ['fr' => 'Paramètres avancés', 'es' => 'Parametros avanzados', 'en' => 'Advanced Parameters', 'de' => 'Erweiterte Parameter', 'it' => 'Parametri Avanzati']); - - renameTab(get_tab_id('AdminTools'), ['fr' => 'Paramètres avancés', 'es' => 'Parametros avanzados', 'en' => 'Advanced Parameters', 'de' => 'Erweiterte Parameter', 'it' => 'Parametri Avanzati']); - - renameTab(get_tab_id('AdminTabs'), ['fr' => 'Menus', 'es' => 'Pestañas', 'en' => 'Menus', 'de' => 'Tabs', 'it' => 'Tabs']); -} - -//==== functions =====/ - -function get_simple_clean_tab15($clean_tabs_15) -{ - $light_tab = []; - foreach ($clean_tabs_15 as $tab) { - $light_tab[] = $tab['class_name']; - if (isset($tab['children'])) { - $light_tab = array_merge($light_tab, get_simple_clean_tab15($tab['children'])); - } - } - - return $light_tab; -} - -function updatePositionAndActive15($clean_tabs_15) -{ - foreach ($clean_tabs_15 as $id => $tab) { - Db::getInstance()->update('tab', ['position' => $tab['position'], 'active' => $tab['active']], '`id_tab`= ' . get_tab_id($tab['class_name'])); - if (isset($tab['children'])) { - updatePositionAndActive15($tab['children']); - } - } -} - -function renameTab($id_tab, $names) -{ - if (!$id_tab) { - return; - } - $langues = Db::getInstance()->executeS('SELECT * FROM ' . _DB_PREFIX_ . 'lang'); - - foreach ($langues as $lang) { - if (array_key_exists($lang['iso_code'], $names)) { - Db::getInstance()->update('tab_lang', ['name' => $names[$lang['iso_code']]], '`id_tab`= ' . $id_tab . ' AND `id_lang` =' . $lang['id_lang']); - } - } -} diff --git a/upgrade/php/cms_block.php b/upgrade/php/cms_block.php deleted file mode 100644 index a0e466608..000000000 --- a/upgrade/php/cms_block.php +++ /dev/null @@ -1,33 +0,0 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) - */ -function cms_block() -{ - if (!Db::getInstance()->execute('SELECT `display_store` FROM `' . _DB_PREFIX_ . 'cms_block` LIMIT 1')) { - return Db::getInstance()->execute('ALTER TABLE `' . _DB_PREFIX_ . 'cms_block` ADD `display_store` TINYINT NOT NULL DEFAULT \'1\''); - } - - return true; -} diff --git a/upgrade/php/cms_multishop.php b/upgrade/php/cms_multishop.php deleted file mode 100644 index 2cc2d461f..000000000 --- a/upgrade/php/cms_multishop.php +++ /dev/null @@ -1,89 +0,0 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) - */ -function cms_multishop() -{ - $shops = Db::getInstance()->executeS(' - SELECT `id_shop` - FROM `' . _DB_PREFIX_ . 'shop` - '); - - $cms_lang = Db::getInstance()->executeS(' - SELECT * - FROM `' . _DB_PREFIX_ . 'cms_lang` - '); - foreach ($cms_lang as $value) { - $data = []; - $cms = [ - 'id_cms' => $value['id_cms'], - 'id_lang' => $value['id_lang'], - 'content' => pSQL($value['content'], true), - 'link_rewrite' => pSQL($value['link_rewrite']), - 'meta_title' => pSQL($value['meta_title']), - 'meta_keywords' => pSQL($value['meta_keywords']), - 'meta_description' => pSQL($value['meta_description']), - ]; - foreach ($shops as $shop) { - if ($shop['id_shop'] != 1) { - $cms['id_shop'] = $shop['id_shop']; - $data[] = $cms; - } - } - Db::getInstance()->insert('cms_lang', $data); - } - - $cms_category_lang = Db::getInstance()->executeS(' - SELECT * - FROM `' . _DB_PREFIX_ . 'cms_category_lang` - '); - foreach ($cms_category_lang as $value) { - $data = []; - $data_bis = []; - - $cms_category_shop = [ - 'id_cms_category' => $value['id_cms_category'], - ]; - $cms_category = [ - 'id_cms_category' => $value['id_cms_category'], - 'id_lang' => $value['id_lang'], - 'name' => pSQL($value['name']), - 'description' => pSQL($value['description']), - 'link_rewrite' => pSQL($value['link_rewrite']), - 'meta_title' => pSQL($value['meta_title']), - 'meta_keywords' => pSQL($value['meta_keywords']), - 'meta_description' => pSQL($value['meta_description']), - ]; - foreach ($shops as $shop) { - if ($shop['id_shop'] != 1) { - $cms_category['id_shop'] = $shop['id_shop']; - $data[] = $cms_category; - } - $cms_category_shop['id_shop'] = $shop['id_shop']; - $data_bis[] = $cms_category_shop; - } - Db::getInstance()->insert('cms_category_lang', $data, false, true, Db::INSERT_IGNORE); - Db::getInstance()->insert('cms_category_shop', $data_bis, false, true, Db::INSERT_IGNORE); - } -} diff --git a/upgrade/php/configuration_double_cleaner.php b/upgrade/php/configuration_double_cleaner.php deleted file mode 100644 index 44110c485..000000000 --- a/upgrade/php/configuration_double_cleaner.php +++ /dev/null @@ -1,44 +0,0 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) - */ -function configuration_double_cleaner() -{ - $result = Db::getInstance()->executeS(' - SELECT name, MIN(id_configuration) AS minid - FROM ' . _DB_PREFIX_ . 'configuration - GROUP BY name - HAVING count(name) > 1'); - foreach ($result as $row) { - Db::getInstance()->execute(' - DELETE FROM ' . _DB_PREFIX_ . 'configuration - WHERE name = \'' . addslashes($row['name']) . '\' - AND id_configuration != ' . (int) ($row['minid'])); - } - Db::getInstance()->execute(' - DELETE FROM ' . _DB_PREFIX_ . 'configuration_lang - WHERE id_configuration NOT IN ( - SELECT id_configuration - FROM ' . _DB_PREFIX_ . 'configuration)'); -} diff --git a/upgrade/php/convert_product_price.php b/upgrade/php/convert_product_price.php deleted file mode 100644 index 03e24dce4..000000000 --- a/upgrade/php/convert_product_price.php +++ /dev/null @@ -1,52 +0,0 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) - */ - -/* Convert product prices from the PS < 1.3 wrong rounding system to the new 1.3 one */ -function convert_product_price() -{ - $taxes = Db::getInstance()->executeS('SELECT * FROM ' . _DB_PREFIX_ . 'tax'); - $taxRates = []; - foreach ($taxes as $data) { - $taxRates[$data['id_tax']] = (float) ($data['rate']) / 100; - } - $resource = Db::getInstance()->executeS('SELECT `id_product`, `price`, `id_tax` - FROM `' . _DB_PREFIX_ . 'product`', false); - if (!$resource) { - return ['error' => 1, 'msg' => Db::getInstance()->getMsgError()]; - } // was previously die(mysql_error()) - - while ($row = Db::getInstance()->nextRow($resource)) { - if ($row['id_tax']) { - $price = $row['price'] * (1 + $taxRates[$row['id_tax']]); - $decimalPart = $price - (int) $price; - if ($decimalPart < 0.000001) { - $newPrice = (float) (number_format($price, 6, '.', '')); - $newPrice = Tools::floorf($newPrice / (1 + $taxRates[$row['id_tax']]), 6); - Db::getInstance()->execute('UPDATE `' . _DB_PREFIX_ . 'product` SET `price` = ' . $newPrice . ' WHERE `id_product` = ' . (int) $row['id_product']); - } - } - } -} diff --git a/upgrade/php/country_to_timezone.php b/upgrade/php/country_to_timezone.php deleted file mode 100644 index 0624fd99c..000000000 --- a/upgrade/php/country_to_timezone.php +++ /dev/null @@ -1,276 +0,0 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) - */ -$timezones = [ - 'AD' => 'Europe/Andorra', - 'AE' => 'Asia/Dubai', - 'AF' => 'Asia/Kabul', - 'AG' => 'America/Antigua', - 'AI' => 'America/Anguilla', - 'AL' => 'Europe/Tirane', - 'AM' => 'Asia/Yerevan', - 'AN' => 'America/Curacao', - 'AO' => 'Africa/Luanda', - 'AQ' => 'Antarctica/McMurdo', - 'AR' => 'America/Argentina/Buenos_Aires', - 'AS' => 'Pacific/Pago_Pago', - 'AT' => 'Europe/Vienna', - 'AU' => 'Australia/Lord_Howe', - 'AW' => 'America/Aruba', - 'AX' => 'Europe/Mariehamn', - 'AZ' => 'Asia/Baku', - 'BA' => 'Europe/Sarajevo', - 'BB' => 'America/Barbados', - 'BD' => 'Asia/Dhaka', - 'BE' => 'Europe/Brussels', - 'BF' => 'Africa/Ouagadougou', - 'BG' => 'Europe/Sofia', - 'BH' => 'Asia/Bahrain', - 'BI' => 'Africa/Bujumbura', - 'BJ' => 'Africa/Porto-Novo', - 'BL' => 'America/St_Barthelemy', - 'BM' => 'Atlantic/Bermuda', - 'BN' => 'Asia/Brunei', - 'BO' => 'America/La_Paz', - 'BR' => 'America/Noronha', - 'BS' => 'America/Nassau', - 'BT' => 'Asia/Thimphu', - 'BV' => '', - 'BW' => 'Africa/Gaborone', - 'BY' => 'Europe/Minsk', - 'BZ' => 'America/Belize', - 'CA' => 'America/Toronto', - 'CC' => 'Indian/Cocos', - 'CD' => 'Africa/Kinshasa', - 'CF' => 'Africa/Bangui', - 'CG' => 'Africa/Brazzaville', - 'CH' => 'Europe/Zurich', - 'CI' => 'Africa/Abidjan', - 'CK' => 'Pacific/Rarotonga', - 'CL' => 'America/Santiago', - 'CM' => 'Africa/Douala', - 'CN' => 'Asia/Shanghai', - 'CO' => 'America/Bogota', - 'CR' => 'America/Costa_Rica', - 'CU' => 'America/Havana', - 'CV' => 'Atlantic/Cape_Verde', - 'CX' => 'Indian/Christmas', - 'CY' => 'Asia/Nicosia', - 'CZ' => 'Europe/Prague', - 'DE' => 'Europe/Berlin', - 'DJ' => 'Africa/Djibouti', - 'DK' => 'Europe/Copenhagen', - 'DM' => 'America/Dominica', - 'DO' => 'America/Santo_Domingo', - 'DZ' => 'Africa/Algiers', - 'EC' => 'America/Guayaquil', - 'EE' => 'Europe/Tallinn', - 'EG' => 'Africa/Cairo', - 'EH' => 'Africa/El_Aaiun', - 'ER' => 'Africa/Asmara', - 'ES' => 'Europe/Madrid', - 'ET' => 'Africa/Addis_Ababa', - 'FI' => 'Europe/Helsinki', - 'FJ' => 'Pacific/Fiji', - 'FK' => 'Atlantic/Stanley', - 'FM' => 'Pacific/Chuuk', - 'FO' => 'Atlantic/Faroe', - 'FR' => 'Europe/Paris', - 'GA' => 'Africa/Libreville', - 'GB' => 'Europe/London', - 'GD' => 'America/Grenada', - 'GE' => 'Asia/Tbilisi', - 'GF' => 'America/Cayenne', - 'GG' => 'Europe/Guernsey', - 'GH' => 'Africa/Accra', - 'GI' => 'Europe/Gibraltar', - 'GL' => 'America/Godthab', - 'GM' => 'Africa/Banjul', - 'GN' => 'Africa/Conakry', - 'GP' => 'America/Guadeloupe', - 'GQ' => 'Africa/Malabo', - 'GR' => 'Europe/Athens', - 'GS' => 'Atlantic/South_Georgia', - 'GT' => 'America/Guatemala', - 'GU' => 'Pacific/Guam', - 'GW' => 'Africa/Bissau', - 'GY' => 'America/Guyana', - 'HK' => 'Asia/Hong_Kong', - 'HM' => '', - 'HN' => 'America/Tegucigalpa', - 'HR' => 'Europe/Zagreb', - 'HT' => 'America/Port-au-Prince', - 'HU' => 'Europe/Budapest', - 'ID' => 'Asia/Jakarta', - 'IE' => 'Europe/Dublin', - 'IL' => 'Asia/Jerusalem', - 'IM' => 'Europe/Isle_of_Man', - 'IN' => 'Asia/Kolkata', - 'IO' => 'Indian/Chagos', - 'IQ' => 'Asia/Baghdad', - 'IR' => 'Asia/Tehran', - 'IS' => 'Atlantic/Reykjavik', - 'IT' => 'Europe/Rome', - 'JE' => 'Europe/Jersey', - 'JM' => 'America/Jamaica', - 'JO' => 'Asia/Amman', - 'JP' => 'Asia/Tokyo', - 'KE' => 'Africa/Nairobi', - 'KG' => 'Asia/Bishkek', - 'KH' => 'Asia/Phnom_Penh', - 'KI' => 'Pacific/Tarawa', - 'KM' => 'Indian/Comoro', - 'KN' => 'America/St_Kitts', - 'KP' => 'Asia/Pyongyang', - 'KR' => 'Asia/Seoul', - 'KW' => 'Asia/Kuwait', - 'KY' => 'America/Cayman', - 'KZ' => 'Asia/Almaty', - 'LA' => 'Asia/Vientiane', - 'LB' => 'Asia/Beirut', - 'LC' => 'America/St_Lucia', - 'LI' => 'Europe/Vaduz', - 'LK' => 'Asia/Colombo', - 'LR' => 'Africa/Monrovia', - 'LS' => 'Africa/Maseru', - 'LT' => 'Europe/Vilnius', - 'LU' => 'Europe/Luxembourg', - 'LV' => 'Europe/Riga', - 'LY' => 'Africa/Tripoli', - 'MA' => 'Africa/Casablanca', - 'MC' => 'Europe/Monaco', - 'MD' => 'Europe/Chisinau', - 'ME' => 'Europe/Podgorica', - 'MF' => 'America/Marigot', - 'MG' => 'Indian/Antananarivo', - 'MH' => 'Pacific/Majuro', - 'MK' => 'Europe/Skopje', - 'ML' => 'Africa/Bamako', - 'MM' => 'Asia/Rangoon', - 'MN' => 'Asia/Ulaanbaatar', - 'MO' => 'Asia/Macau', - 'MP' => 'Pacific/Saipan', - 'MQ' => 'America/Martinique', - 'MR' => 'Africa/Nouakchott', - 'MS' => 'America/Montserrat', - 'MT' => 'Europe/Malta', - 'MU' => 'Indian/Mauritius', - 'MV' => 'Indian/Maldives', - 'MW' => 'Africa/Blantyre', - 'MX' => 'America/Mexico_City', - 'MY' => 'Asia/Kuala_Lumpur', - 'MZ' => 'Africa/Maputo', - 'NA' => 'Africa/Windhoek', - 'NC' => 'Pacific/Noumea', - 'NE' => 'Africa/Niamey', - 'NF' => 'Pacific/Norfolk', - 'NG' => 'Africa/Lagos', - 'NI' => 'America/Managua', - 'NL' => 'Europe/Amsterdam', - 'NO' => 'Europe/Oslo', - 'NP' => 'Asia/Kathmandu', - 'NR' => 'Pacific/Nauru', - 'NU' => 'Pacific/Niue', - 'NZ' => 'Pacific/Auckland', - 'OM' => 'Asia/Muscat', - 'PA' => 'America/Panama', - 'PE' => 'America/Lima', - 'PF' => 'Pacific/Tahiti', - 'PG' => 'Pacific/Port_Moresby', - 'PH' => 'Asia/Manila', - 'PK' => 'Asia/Karachi', - 'PL' => 'Europe/Warsaw', - 'PM' => 'America/Miquelon', - 'PN' => 'Pacific/Pitcairn', - 'PR' => 'America/Puerto_Rico', - 'PS' => 'Asia/Gaza', - 'PT' => 'Europe/Lisbon', - 'PW' => 'Pacific/Palau', - 'PY' => 'America/Asuncion', - 'QA' => 'Asia/Qatar', - 'RE' => 'Indian/Reunion', - 'RO' => 'Europe/Bucharest', - 'RS' => 'Europe/Belgrade', - 'RU' => 'Europe/Moscow', - 'RW' => 'Africa/Kigali', - 'SA' => 'Asia/Riyadh', - 'SB' => 'Pacific/Guadalcanal', - 'SC' => 'Indian/Mahe', - 'SD' => 'Africa/Khartoum', - 'SE' => 'Europe/Stockholm', - 'SG' => 'Asia/Singapore', - 'SI' => 'Europe/Ljubljana', - 'SJ' => 'Arctic/Longyearbyen', - 'SK' => 'Europe/Bratislava', - 'SL' => 'Africa/Freetown', - 'SM' => 'Europe/San_Marino', - 'SN' => 'Africa/Dakar', - 'SO' => 'Africa/Mogadishu', - 'SR' => 'America/Paramaribo', - 'ST' => 'Africa/Sao_Tome', - 'SV' => 'America/El_Salvador', - 'SY' => 'Asia/Damascus', - 'SZ' => 'Africa/Mbabane', - 'TC' => 'America/Grand_Turk', - 'TD' => 'Africa/Ndjamena', - 'TF' => 'Indian/Kerguelen', - 'TG' => 'Africa/Lome', - 'TH' => 'Asia/Bangkok', - 'TJ' => 'Asia/Dushanbe', - 'TK' => 'Pacific/Fakaofo', - 'TL' => 'Asia/Dili', - 'TM' => 'Asia/Ashgabat', - 'TN' => 'Africa/Tunis', - 'TO' => 'Pacific/Tongatapu', - 'TR' => 'Europe/Istanbul', - 'TT' => 'America/Port_of_Spain', - 'TV' => 'Pacific/Funafuti', - 'TW' => 'Asia/Taipei', - 'TZ' => 'Africa/Dar_es_Salaam', - 'UA' => 'Europe/Kiev', - 'UG' => 'Africa/Kampala', - 'US' => 'US/Eastern', - 'UY' => 'America/Montevideo', - 'UZ' => 'Asia/Samarkand', - 'VA' => 'Europe/Vatican', - 'VC' => 'America/St_Vincent', - 'VE' => 'America/Caracas', - 'VG' => 'America/Tortola', - 'VI' => 'America/St_Thomas', - 'VN' => 'Asia/Ho_Chi_Minh', - 'VU' => 'Pacific/Efate', - 'WF' => 'Pacific/Wallis', - 'WS' => 'Pacific/Apia', - 'YE' => 'Asia/Aden', - 'YT' => 'Indian/Mayotte', - 'ZA' => 'Africa/Johannesburg', - 'ZM' => 'Africa/Lusaka', - 'ZW' => 'Africa/Harare', -]; - -if (isset($timezones[$_GET['country']]) && $timezones[$_GET['country']]) { - exit($timezones[$_GET['country']]); -} -exit(''); diff --git a/upgrade/php/create_multistore.php b/upgrade/php/create_multistore.php deleted file mode 100755 index 93d10413d..000000000 --- a/upgrade/php/create_multistore.php +++ /dev/null @@ -1,94 +0,0 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) - */ -require_once __DIR__ . '/add_new_tab.php'; - -function create_multistore() -{ - $res = true; - if (!defined('_THEME_NAME_')) { - define('_THEME_NAME_', 'default'); - } - // @todo : use _PS_ROOT_DIR_ - if (defined('__PS_BASE_URI__')) { - $INSTALLER__PS_BASE_URI = __PS_BASE_URI__; - } else { - // note: create_multistore is called for 1.5.0.0 upgrade - // so, __PS_BASE_URI__ should be always defined in settings.inc.php - // @todo generate __PS_BASE_URI__ using $_SERVER['REQUEST_URI'], just in case - return false; - } - $all_themes_dir = _PS_ROOT_DIR_ . DIRECTORY_SEPARATOR . 'themes'; - $themes = scandir($all_themes_dir, SCANDIR_SORT_NONE); - foreach ($themes as $theme) { - if (!is_file($all_themes_dir . DIRECTORY_SEPARATOR . $theme) && is_dir($all_themes_dir . DIRECTORY_SEPARATOR . $theme . DIRECTORY_SEPARATOR) && $theme[0] != '.' && $theme != 'prestashop' && $theme != 'default-bootstrap' && $theme != _THEME_NAME_) { - $res &= Db::getInstance()->execute('INSERT INTO ' . _DB_PREFIX_ . 'theme (name) VALUES("' . Db::getInstance()->escape($theme) . '")'); - } - } - $res &= Db::getInstance()->execute(' - UPDATE ' . _DB_PREFIX_ . 'shop - SET - name = (SELECT value FROM ' . _DB_PREFIX_ . 'configuration WHERE name = "PS_SHOP_NAME"), - id_theme = (SELECT id_theme FROM ' . _DB_PREFIX_ . 'theme WHERE name = "' . Db::getInstance()->escape(_THEME_NAME_) . '") - WHERE id_shop = 1'); - $shop_domain = Db::getInstance()->getValue('SELECT `value` FROM `' . _DB_PREFIX_ . 'configuration` WHERE `name` = "PS_SHOP_DOMAIN"'); - $shop_domain_ssl = Db::getInstance()->getValue('SELECT `value` FROM `' . _DB_PREFIX_ . 'configuration` WHERE `name` = "PS_SHOP_DOMAIN_SSL"'); - if (empty($shop_domain)) { - $shop_domain = $shop_domain_ssl = create_multistore_getHttpHost(); - } - if (empty($shop_domain_ssl)) { - $shop_domain_ssl = create_multistore_getHttpHost(); - } - - $physical_uri = str_replace(' ', '%20', $INSTALLER__PS_BASE_URI); - $physical_uri = trim($physical_uri, '/\\'); - $physical_uri = ($physical_uri ? '/' . $physical_uri . '/' : '/'); - $res &= Db::getInstance()->execute(' - INSERT INTO `' . _DB_PREFIX_ . 'shop_url` (`id_shop`, `domain`, `domain_ssl`, `physical_uri`, `virtual_uri`, `main`, `active`) - VALUES(1, \'' . pSQL($shop_domain) . '\', \'' . pSQL($shop_domain_ssl) . '\', \'' . pSQL($physical_uri) . '\', \'\', 1, 1)'); - - // Stock conversion - $sql = 'INSERT INTO `' . _DB_PREFIX_ . 'stock` (`id_product`, `id_product_attribute`, `id_group_shop`, `id_shop`, `quantity`) - VALUES (SELECT p.`id_product`, 0, 1, 1, p.`quantity` FROM `' . _DB_PREFIX_ . 'product` p);'; - $res &= Db::getInstance()->execute($sql); - - $sql = 'INSERT INTO `' . _DB_PREFIX_ . 'stock` (`id_product`, `id_product_attribute`, `id_group_shop`, `id_shop`, `quantity`) - VALUES (SELECT `id_product`, `id_product_attribute`, 1, 1, `quantity` FROM `' . _DB_PREFIX_ . 'product_attribute` p);'; - $res &= Db::getInstance()->execute($sql); - - // Add admin tabs - $shop_tab_id = add_new_tab('AdminShop', 'it:Shops|es:Shops|fr:Boutiques|de:Shops|en:Shops', 0, true); - add_new_tab('AdminGroupShop', 'it:Group Shops|es:Group Shops|fr:Groupes de boutique|de:Group Shops|en:Group Shops', $shop_tab_id); - add_new_tab('AdminShopUrl', 'it:Shop Urls|es:Shop Urls|fr:URLs de boutique|de:Shop Urls|en:Shop Urls', $shop_tab_id); - - return $res; -} - -function create_multistore_getHttpHost() -{ - $host = (isset($_SERVER['HTTP_X_FORWARDED_HOST']) ? $_SERVER['HTTP_X_FORWARDED_HOST'] : $_SERVER['HTTP_HOST']); - - return $host; -} diff --git a/upgrade/php/customization_field_multishop_lang.php b/upgrade/php/customization_field_multishop_lang.php deleted file mode 100644 index 052c7a680..000000000 --- a/upgrade/php/customization_field_multishop_lang.php +++ /dev/null @@ -1,52 +0,0 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) - */ -function customization_field_multishop_lang() -{ - $shops = Db::getInstance()->executeS(' - SELECT `id_shop` - FROM `' . _DB_PREFIX_ . 'shop` - WHERE `id_shop` != 1 - '); - - $customization_field_lang = Db::getInstance()->executeS(' - SELECT * - FROM `' . _DB_PREFIX_ . 'customization_field_lang` - '); - - foreach ($customization_field_lang as $value) { - $data = []; - $customization_lang = [ - 'id_customization_field' => $value['id_customization_field'], - 'id_lang' => $value['id_lang'], - 'name' => pSQL($value['name']), - ]; - foreach ($shops as $shop) { - $customization_lang['id_shop'] = $shop['id_shop']; - $data[] = $customization_lang; - } - Db::getInstance()->insert('customization_field_lang', $data); - } -} diff --git a/upgrade/php/delete_hook.php b/upgrade/php/delete_hook.php deleted file mode 100644 index 8bdaa34fc..000000000 --- a/upgrade/php/delete_hook.php +++ /dev/null @@ -1,41 +0,0 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) - */ -function delete_hook($hook) -{ - $modules = Hook::getHookModuleExecList($hook); - if (is_array($modules)) { - foreach ($modules as $module) { - $moduleInstance = Module::getInstanceByName($module['module']); - if ($moduleInstance instanceof Module) { - Hook::unregisterHook($moduleInstance, $hook); - } - } - } - - return (bool) Db::getInstance()->execute( - 'DELETE FROM `' . _DB_PREFIX_ . 'hook` WHERE `name` = "' . pSQL($hook) . '"' - ); -} diff --git a/upgrade/php/delivery_number_set.php b/upgrade/php/delivery_number_set.php deleted file mode 100644 index e9f166ba7..000000000 --- a/upgrade/php/delivery_number_set.php +++ /dev/null @@ -1,50 +0,0 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) - */ -function delivery_number_set() -{ - Configuration::loadConfiguration(); - $number = 1; - - // Update each order with a number - $result = Db::getInstance()->executeS(' - SELECT id_order - FROM ' . _DB_PREFIX_ . 'orders - ORDER BY id_order'); - foreach ($result as $row) { - $order = new Order((int) ($row['id_order'])); - $history = $order->getHistory(false); - foreach ($history as $row2) { - $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)); - - break; - } - } - } - // Add configuration var - Configuration::updateValue('PS_DELIVERY_NUMBER', (int) ($number)); -} diff --git a/upgrade/php/drop_image_type_non_unique_index.php b/upgrade/php/drop_image_type_non_unique_index.php deleted file mode 100644 index 255b46df3..000000000 --- a/upgrade/php/drop_image_type_non_unique_index.php +++ /dev/null @@ -1,34 +0,0 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) - */ -function drop_image_type_non_unique_index() -{ - $index = Db::getInstance()->executeS('SHOW INDEX FROM `' . _DB_PREFIX_ . 'image_type` WHERE column_name="name" AND non_unique=1'); - if (is_array($index) && count($index)) { - foreach ($index as $ind) { - Db::getInstance()->execute('ALTER TABLE `' . _DB_PREFIX_ . 'image_type` DROP INDEX `' . pSQL($ind['Key_name']) . '`'); - } - } -} diff --git a/upgrade/php/drop_module_non_unique_index.php b/upgrade/php/drop_module_non_unique_index.php deleted file mode 100644 index 504362a16..000000000 --- a/upgrade/php/drop_module_non_unique_index.php +++ /dev/null @@ -1,40 +0,0 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) - */ -function drop_module_non_unique_index() -{ - $index = Db::getInstance()->executeS('SHOW INDEX FROM `' . _DB_PREFIX_ . 'module` WHERE Key_name = "name"'); - if (is_array($index) && count($index)) { - Db::getInstance()->execute('ALTER IGNORE TABLE `' . _DB_PREFIX_ . 'module` DROP INDEX `name`'); - } - $tmp = Db::getInstance()->executeS('SHOW SESSION VARIABLES WHERE Variable_Name LIKE "old_alter_table" AND Value like "OFF"'); - if (is_array($tmp) && $tmp) { - Db::getInstance()->execute('SET SESSION old_alter_table="ON"'); - } - Db::getInstance()->execute('ALTER IGNORE TABLE `' . _DB_PREFIX_ . 'module` ADD UNIQUE `name` (`name`)'); - if (is_array($tmp) && $tmp) { - Db::getInstance()->execute('SET SESSION old_alter_table="OFF"'); - } -} diff --git a/upgrade/php/ecotax_tax_application_fix.php b/upgrade/php/ecotax_tax_application_fix.php deleted file mode 100644 index f0584e5ee..000000000 --- a/upgrade/php/ecotax_tax_application_fix.php +++ /dev/null @@ -1,33 +0,0 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) - */ -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; -} diff --git a/upgrade/php/editorial_update.php b/upgrade/php/editorial_update.php deleted file mode 100644 index 44cdd96b4..000000000 --- a/upgrade/php/editorial_update.php +++ /dev/null @@ -1,71 +0,0 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) - */ -function editorial_update() -{ - /*Table creation*/ - - if (Db::getInstance()->getValue('SELECT `id_module` FROM `' . _DB_PREFIX_ . 'module` WHERE `name`="editorial"')) { - Db::getInstance()->execute(' - CREATE TABLE IF NOT EXISTS `' . _DB_PREFIX_ . 'editorial` ( - `id_editorial` int(10) unsigned NOT NULL auto_increment, - `body_home_logo_link` varchar(255) NOT NULL, - PRIMARY KEY (`id_editorial`)) - ENGINE=' . _MYSQL_ENGINE_ . ' DEFAULT CHARSET=utf8'); - - Db::getInstance()->execute(' - CREATE TABLE IF NOT EXISTS `' . _DB_PREFIX_ . 'editorial_lang` ( - `id_editorial` int(10) unsigned NOT NULL, - `id_lang` int(10) unsigned NOT NULL, - `body_title` varchar(255) NOT NULL, - `body_subheading` varchar(255) NOT NULL, - `body_paragraph` text NOT NULL, - `body_logo_subheading` varchar(255) NOT NULL, - PRIMARY KEY (`id_editorial`, `id_lang`)) - ENGINE=' . _MYSQL_ENGINE_ . ' DEFAULT CHARSET=utf8'); - - if (file_exists(dirname(__FILE__) . '/../../../modules/editorial/editorial.xml')) { - $xml = @simplexml_load_file(dirname(__FILE__) . '/../../../modules/editorial/editorial.xml'); - if (!$xml) { - return false; - } - Db::getInstance()->execute(' - INSERT INTO `' . _DB_PREFIX_ . 'editorial`(`id_editorial`, `body_home_logo_link`) VALUES(1, "' . (isset($xml->body->home_logo_link) ? pSQL($xml->body->home_logo_link) : '') . '")'); - - $languages = Db::getInstance()->executeS('SELECT * FROM `' . _DB_PREFIX_ . 'lang`'); - foreach ($languages as $language) { - Db::getInstance()->execute(' - INSERT INTO `' . _DB_PREFIX_ . 'editorial_lang` (`id_editorial`, `id_lang`, `body_title`, `body_subheading`, `body_paragraph`, `body_logo_subheading`) - VALUES (1, ' . (int) ($language['id_lang']) . ', - "' . (isset($xml->body->{'title_' . $language['id_lang']}) ? pSQL($xml->body->{'title_' . $language['id_lang']}) : '') . '", - "' . (isset($xml->body->{'subheading_' . $language['id_lang']}) ? pSQL($xml->body->{'subheading_' . $language['id_lang']}) : '') . '", - "' . (isset($xml->body->{'paragraph_' . $language['id_lang']}) ? pSQL($xml->body->{'paragraph_' . $language['id_lang']}, true) : '') . '", - "' . (isset($xml->body->{'logo_subheading_' . $language['id_lang']}) ? pSQL($xml->body->{'logo_subheading_' . $language['id_lang']}) : '') . '")'); - } - - unlink(dirname(__FILE__) . '/../../../modules/editorial/editorial.xml'); - } - } -} diff --git a/upgrade/php/editorial_update_multishop.php b/upgrade/php/editorial_update_multishop.php deleted file mode 100644 index 6779ffa31..000000000 --- a/upgrade/php/editorial_update_multishop.php +++ /dev/null @@ -1,35 +0,0 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) - */ -function editorial_update_multishop() -{ - $res = true; - if (Db::getInstance()->getValue('SELECT `id_module` FROM `' . _DB_PREFIX_ . 'module` WHERE `name`="editorial"')) { - $res = Db::getInstance()->execute('ALTER TABLE `' . _DB_PREFIX_ . 'editorial` ADD `id_shop` INT(10) UNSIGNED NOT NULL AFTER `id_editorial`'); - $res &= Db::getInstance()->execute('UPDATE `' . _DB_PREFIX_ . 'editorial` SET `id_shop` = 1'); - } - - return $res; -} diff --git a/upgrade/php/fix_cms_shop_1520.php b/upgrade/php/fix_cms_shop_1520.php deleted file mode 100755 index 93de71230..000000000 --- a/upgrade/php/fix_cms_shop_1520.php +++ /dev/null @@ -1,67 +0,0 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) - */ -function fix_cms_shop_1520() -{ - $res = true; - $db = Db::getInstance(); - //test if cms_shop with 2 underscore is present to rename it. - $result = $db->executeS('SHOW TABLES LIKE "' . _DB_PREFIX_ . '_cms_shop"'); - if (!is_array($result) || !count($result) || !$result) { - $res &= create_table_cms_shop(); - if ($res) { - insert_table_cms_to_cms_shop(); - } - } - //test if cms_shop with 1 underscore is present and create if not. - $result = $db->executeS('SHOW TABLES LIKE "' . _DB_PREFIX_ . 'cms_shop"'); - if (!is_array($result) || !count($result) || !$result) { - $res &= create_table_cms_shop(); - if ($res) { - insert_table_cms_to_cms_shop(); - } - } -} - -function insert_table_cms_to_cms_shop() -{ - // /!\ : _cms_shop and _cms are wrong tables name (fixed in 1.5.0.12.sql : upgrade_cms_15_rename() ) - $res &= Db::getInstance()->execute( - 'INSERT INTO `' . _DB_PREFIX_ . 'cms_shop` (id_shop, id_cms) - (SELECT 1, id_cms FROM ' . _DB_PREFIX_ . '_cms)' - ); -} - -function create_table_cms_shop() -{ - return Db::getInstance()->execute( - 'CREATE TABLE `' . _DB_PREFIX_ . 'cms_shop` ( - `id_cms` INT( 11 ) UNSIGNED NOT NULL, - `id_shop` INT( 11 ) UNSIGNED NOT NULL , - PRIMARY KEY (`id_cms`, `id_shop`), - KEY `id_shop` (`id_shop`) - ) ENGINE=' . _MYSQL_ENGINE_ . ' DEFAULT CHARSET=utf8;' - ); -} diff --git a/upgrade/php/fix_download_product_feature_active.php b/upgrade/php/fix_download_product_feature_active.php deleted file mode 100644 index 2b5e6f04f..000000000 --- a/upgrade/php/fix_download_product_feature_active.php +++ /dev/null @@ -1,31 +0,0 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) - */ -function fix_download_product_feature_active() -{ - if (Db::getInstance()->getValue('SELECT COUNT(id_product_download) FROM `' . _DB_PREFIX_ . 'product_download` WHERE `active` = 1') > 0) { - Db::getInstance()->execute('UPDATE `' . _DB_PREFIX_ . 'configuration` SET `value` = 1 WHERE `name` = \'PS_VIRTUAL_PROD_FEATURE_ACTIVE\''); - } -} diff --git a/upgrade/php/fix_unique_specific_price.php b/upgrade/php/fix_unique_specific_price.php deleted file mode 100644 index ecadd2edb..000000000 --- a/upgrade/php/fix_unique_specific_price.php +++ /dev/null @@ -1,45 +0,0 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) - */ -function fix_unique_specific_price() -{ - $result = Db::getInstance()->executeS(' - SELECT MIN(id_specific_price) id_specific_price - FROM ' . _DB_PREFIX_ . 'specific_price - GROUP BY `id_product`, `id_shop`, `id_currency`, `id_country`, `id_group`, `from_quantity`, `from`, `to`'); - if (!$result || !count($result)) { - return true; - } // return tru if there is not any specific price in the database - - $sql = ''; - foreach ($result as $row) { - $sql .= (int) $row['id_specific_price'] . ','; - } - $sql = rtrim($sql, ','); - - return Db::getInstance()->execute(' - DELETE FROM ' . _DB_PREFIX_ . 'specific_price - WHERE id_specific_price NOT IN (' . $sql . ')'); -} diff --git a/upgrade/php/generate_ntree.php b/upgrade/php/generate_ntree.php deleted file mode 100644 index 2319687ed..000000000 --- a/upgrade/php/generate_ntree.php +++ /dev/null @@ -1,52 +0,0 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) - */ -function generate_ntree() -{ - $categories = Db::getInstance()->executeS('SELECT id_category, id_parent FROM ' . _DB_PREFIX_ . 'category ORDER BY id_parent ASC, position ASC'); - $categoriesArray = []; - if (is_array($categories)) { - 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/upgrade/php/generate_root_category_for_multishop.php b/upgrade/php/generate_root_category_for_multishop.php deleted file mode 100644 index cf7e49e81..000000000 --- a/upgrade/php/generate_root_category_for_multishop.php +++ /dev/null @@ -1,100 +0,0 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) - */ -require_once 'generate_ntree.php'; - -function generate_root_category_for_multishop() -{ - Db::getInstance()->execute(' - UPDATE `' . _DB_PREFIX_ . 'category` SET `level_depth`=`level_depth`+1 - '); - - Db::getInstance()->execute(' - INSERT INTO `' . _DB_PREFIX_ . 'category` (`id_parent`, `level_depth`, `active`, `date_add`, `date_upd`, `is_root_category`) VALUES - (0, 0, 1, NOW(), NOW(), 0) - '); - $id = Db::getInstance()->Insert_ID(); - // set vars config - Db::getInstance()->execute('INSERT INTO `' . _DB_PREFIX_ . 'configuration` (`name`, `value`, `date_add`, `date_upd`) VALUES - (\'PS_ROOT_CATEGORY\', ' . (int) $id . ', NOW(), NOW()), - (\'PS_HOME_CATEGORY\', 1, NOW(), NOW()) - '); - - $langs = Db::getInstance()->executeS(' - SELECT `id_lang` - FROM `' . _DB_PREFIX_ . 'lang` - '); - - $shops = Db::getInstance()->executeS(' - SELECT `id_shop` - FROM `' . _DB_PREFIX_ . 'shop` - '); - - $data = []; - if (is_array($shops) && is_array($langs)) { - foreach ($langs as $lang) { - foreach ($shops as $shop) { - $data[] = [ - 'id_lang' => $lang['id_lang'], - 'id_shop' => $shop['id_shop'], - 'id_category' => $id, - 'name' => 'Root', - 'link_rewrite' => '', - ]; - } - } - Db::getInstance()->insert('category_lang', $data); - } - - $categories = Db::getInstance()->executeS(' - SELECT `id_category` - FROM `' . _DB_PREFIX_ . 'category` - '); - $data = []; - if (is_array($shops) && is_array($categories)) { - foreach ($categories as $category) { - foreach ($shops as $shop) { - $data[] = [ - 'id_category' => $category['id_category'], - 'id_shop' => $shop['id_shop'], - ]; - } - } - Db::getInstance()->insert('category_shop', $data); - } - - Db::getInstance()->execute(' - UPDATE `' . _DB_PREFIX_ . 'category` - SET `id_parent` = ' . (int) $id . ' - WHERE `id_parent` = 0 AND `id_category` <> ' . (int) $id . ' - '); - Db::getInstance()->execute(' - UPDATE `' . _DB_PREFIX_ . 'shop` - SET `id_category` = 1 - WHERE `id_shop` = 1 - '); - - generate_ntree(); -} diff --git a/upgrade/php/generate_tax_rules.php b/upgrade/php/generate_tax_rules.php deleted file mode 100644 index 4db5e34fa..000000000 --- a/upgrade/php/generate_tax_rules.php +++ /dev/null @@ -1,111 +0,0 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) - */ -function generate_tax_rules() -{ - $res = true; - $taxes = Db::getInstance()->executeS('SELECT * from `' . _DB_PREFIX_ . 'tax` WHERE active = 1'); - - // if no tax found, nothing to do, return true - if (!is_array($taxes)) { - return true; - } - - foreach ($taxes as $tax) { - $id_tax = $tax['id_tax']; - $row = [ - 'active' => 1, - 'id_tax_rules_group' => $id_tax, - 'name' => 'Rule ' . $tax['rate'] . '%', - ]; - $res &= Db::getInstance()->insert('tax_rules_group', $row); - $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('INSERT INTO `' . _DB_PREFIX_ . 'tax_rule` - (`id_tax_rules_group`, `id_country`, `id_state`, `state_behavior`, `id_tax`) - VALUES - (' . $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); - - if ($states) { - foreach ($states as $state) { - if (!in_array($state['tax_behavior'], [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 ( - ' . $id_tax_rules_group . ', - ' . (int) $state['id_country'] . ', - ' . (int) $state['id_state'] . ', - ' . (int) $tax_behavior . ', - ' . (int) $id_tax . - ')'); - } - } - - $res &= Db::getInstance()->execute( - ' - UPDATE `' . _DB_PREFIX_ . 'product` - SET `id_tax_rules_group` = ' . $id_tax_rules_group . ' - WHERE `id_tax` = ' . (int) $id_tax - ); - - $res &= Db::getInstance()->execute( - ' - UPDATE `' . _DB_PREFIX_ . 'carrier` - SET `id_tax_rules_group` = ' . $id_tax_rules_group . ' - WHERE `id_tax` = ' . (int) $id_tax - ); - - $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('UPDATE `' . _DB_PREFIX_ . 'configuration` - set value="' . $id_tax_rules_group . '" WHERE name="SOCOLISSIMO_OVERCOST_TAX"'); - } - } - - return $res; -} diff --git a/upgrade/php/generic_add_missing_column.php b/upgrade/php/generic_add_missing_column.php deleted file mode 100644 index 058bef1df..000000000 --- a/upgrade/php/generic_add_missing_column.php +++ /dev/null @@ -1,44 +0,0 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) - */ -function generic_add_missing_column($table, $column_to_add) -{ - $column_exist = Db::getInstance()->executeS('SHOW FIELDS FROM `' . _DB_PREFIX_ . $table . '`'); - $column_formated = []; - $res = true; - if ($column_exist) { - foreach ($column_exist as $c) { - $column_formated[] = $c['Field']; - } - - foreach ($column_to_add as $name => $details) { - if (!in_array($name, $column_formated)) { - $res &= Db::getInstance()->execute('ALTER TABLE `' . _DB_PREFIX_ . $table . '` ADD COLUMN `' . $name . '` ' . $details); - } - } - } - - return $res; -} diff --git a/upgrade/php/gridextjs_deprecated.php b/upgrade/php/gridextjs_deprecated.php deleted file mode 100644 index fe50b11ff..000000000 --- a/upgrade/php/gridextjs_deprecated.php +++ /dev/null @@ -1,46 +0,0 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) - */ - -/** remove the uncompatible module gridextjs (1.4.0.8 upgrade) - */ -function gridextjs_deprecated() -{ - // if exists, use _PS_MODULE_DIR_ or _PS_ROOT_DIR_ - // instead of guessing the modules dir - if (defined('_PS_MODULE_DIR_')) { - $gridextjs_path = _PS_MODULE_DIR_ . 'gridextjs'; - } elseif (defined('_PS_ROOT_DIR_')) { - $gridextjs_path = _PS_ROOT_DIR_ . '/modules/gridextjs'; - } else { - $gridextjs_path = dirname(__FILE__) . '/../../../modules/gridextjs'; - } - - if (file_exists($gridextjs_path)) { - return rename($gridextjs_path, str_replace('gridextjs', 'gridextjs.deprecated', $gridextjs_path)); - } - - return true; -} diff --git a/upgrade/php/group_reduction_column_fix.php b/upgrade/php/group_reduction_column_fix.php deleted file mode 100644 index 59d46d2f4..000000000 --- a/upgrade/php/group_reduction_column_fix.php +++ /dev/null @@ -1,33 +0,0 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) - */ -function group_reduction_column_fix() -{ - if (!Db::getInstance()->execute('SELECT `group_reduction` FROM `' . _DB_PREFIX_ . 'order_detail` LIMIT 1')) { - return Db::getInstance()->execute('ALTER TABLE `' . _DB_PREFIX_ . 'order_detail` ADD `group_reduction` DECIMAL(10, 2) NOT NULL AFTER `reduction_amount`'); - } - - return true; -} diff --git a/upgrade/php/hook_blocksearch_on_header.php b/upgrade/php/hook_blocksearch_on_header.php deleted file mode 100644 index 0ce4f7a66..000000000 --- a/upgrade/php/hook_blocksearch_on_header.php +++ /dev/null @@ -1,46 +0,0 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) - */ -function hook_blocksearch_on_header() -{ - if ($id_module = Db::getInstance()->getValue('SELECT `id_module` FROM `' . _DB_PREFIX_ . 'module` WHERE `name` = \'blocksearch\'')) { - $id_hook = Db::getInstance()->getValue(' - SELECT `id_hook` - FROM `' . _DB_PREFIX_ . 'hook` - WHERE `name` = \'header\' - '); - - $position = Db::getInstance()->getValue(' - SELECT MAX(`position`) - FROM `' . _DB_PREFIX_ . 'hook_module` - WHERE `id_hook` = ' . (int) $id_hook . ' - '); - - Db::getInstance()->execute(' - INSERT INTO `' . _DB_PREFIX_ . 'hook_module` (`id_module`, `id_hook`, `position`) - VALUES (' . (int) $id_module . ', ' . (int) $id_hook . ', ' . ($position + 1) . ') - '); - } -} diff --git a/upgrade/php/id_currency_country_fix.php b/upgrade/php/id_currency_country_fix.php deleted file mode 100644 index 724b94ac2..000000000 --- a/upgrade/php/id_currency_country_fix.php +++ /dev/null @@ -1,33 +0,0 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) - */ -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/upgrade/php/image_shop1510.php b/upgrade/php/image_shop1510.php deleted file mode 100644 index ae71f3d78..000000000 --- a/upgrade/php/image_shop1510.php +++ /dev/null @@ -1,35 +0,0 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) - */ -function image_shop1510() -{ - include_once __DIR__ . '/generic_add_missing_column.php'; - - $column_to_add = [ - 'cover' => 'TINYINT(1) UNSIGNED NOT NULL AFTER `id_shop`', - ]; - - return generic_add_missing_column('image_shop', $column_to_add); -} diff --git a/upgrade/php/invoice_number_set.php b/upgrade/php/invoice_number_set.php deleted file mode 100644 index 788c3c385..000000000 --- a/upgrade/php/invoice_number_set.php +++ /dev/null @@ -1,50 +0,0 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) - */ -function invoice_number_set() -{ - Configuration::loadConfiguration(); - $number = 1; - - // Update each order with a number - $result = Db::getInstance()->executeS(' - SELECT id_order - FROM ' . _DB_PREFIX_ . 'orders - ORDER BY id_order'); - foreach ($result as $row) { - $order = new Order((int) ($row['id_order'])); - $history = $order->getHistory(false); - foreach ($history as $row2) { - $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)); - - break; - } - } - } - // Add configuration var - Configuration::updateValue('PS_INVOICE_NUMBER', (int) ($number)); -} diff --git a/upgrade/php/latin1_database_to_utf8.php b/upgrade/php/latin1_database_to_utf8.php deleted file mode 100644 index 3633d993a..000000000 --- a/upgrade/php/latin1_database_to_utf8.php +++ /dev/null @@ -1,136 +0,0 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) - */ -if (!defined('_PS_MYSQL_REAL_ESCAPE_STRING_')) { - define('_PS_MYSQL_REAL_ESCAPE_STRING_', function_exists('mysql_real_escape_string')); -} - -function latin1_database_to_utf8() -{ - global $requests, $warningExist; - - $tables = [ - ['name' => 'address', 'id' => 'id_address', 'fields' => ['alias', 'company', 'name', 'surname', 'address1', 'address2', 'postcode', 'city', 'other', 'phone', 'phone_mobile']], - ['name' => 'alias', 'id' => 'id_alias', 'fields' => ['alias', 'search']], - ['name' => 'attribute_group_lang', 'id' => 'id_attribute_group', 'lang' => true, 'fields' => ['name', 'public_name']], - ['name' => 'attribute_lang', 'id' => 'id_attribute', 'lang' => true, 'fields' => ['name']], - ['name' => 'carrier', 'id' => 'id_carrier', 'fields' => ['name', 'url']], - ['name' => 'carrier_lang', 'id' => 'id_carrier', 'lang' => true, 'fields' => ['delay']], - ['name' => 'cart', 'id' => 'id_cart', 'fields' => ['gift_message']], - ['name' => 'category_lang', 'id' => 'id_category', 'lang' => true, 'fields' => ['name', 'description', 'link_rewrite', 'meta_title', 'meta_keywords', 'meta_description']], - ['name' => 'configuration', 'id' => 'id_configuration', 'fields' => ['name', 'value']], - ['name' => 'configuration_lang', 'id' => 'id_configuration', 'lang' => true, 'fields' => ['value']], - ['name' => 'contact', 'id' => 'id_contact', 'fields' => ['email']], - ['name' => 'contact_lang', 'id' => 'id_contact', 'lang' => true, 'fields' => ['name', 'description']], - ['name' => 'country', 'id' => 'id_country', 'fields' => ['iso_code']], - ['name' => 'country_lang', 'id' => 'id_country', 'lang' => true, 'fields' => ['name']], - ['name' => 'currency', 'id' => 'id_currency', 'fields' => ['name', 'iso_code', 'sign']], - ['name' => 'customer', 'id' => 'id_customer', 'fields' => ['email', 'passwd', 'name', 'surname']], - ['name' => 'discount', 'id' => 'id_discount', 'fields' => ['name']], - ['name' => 'discount_lang', 'id' => 'id_discount', 'lang' => true, 'fields' => ['description']], - ['name' => 'discount_type_lang', 'id' => 'id_discount_type', 'lang' => true, 'fields' => ['name']], - ['name' => 'employee', 'id' => 'id_employee', 'fields' => ['name', 'surname', 'email', 'passwd']], - ['name' => 'feature_lang', 'id' => 'id_feature', 'lang' => true, 'fields' => ['name']], - ['name' => 'feature_value_lang', 'id' => 'id_feature_value', 'lang' => true, 'fields' => ['value']], - ['name' => 'hook', 'id' => 'id_hook', 'fields' => ['name', 'title', 'description']], - ['name' => 'hook_module_exceptions', 'id' => 'id_hook_module_exceptions', 'fields' => ['file_name']], - ['name' => 'image_lang', 'id' => 'id_image', 'lang' => true, 'fields' => ['legend']], - ['name' => 'image_type', 'id' => 'id_image_type', 'fields' => ['name']], - ['name' => 'lang', 'id' => 'id_lang', 'fields' => ['name', 'iso_code']], - ['name' => 'manufacturer', 'id' => 'id_manufacturer', 'fields' => ['name']], - ['name' => 'message', 'id' => 'id_message', 'fields' => ['message']], - ['name' => 'module', 'id' => 'id_module', 'fields' => ['name']], - ['name' => 'orders', 'id' => 'id_order', 'fields' => ['payment', 'module', 'gift_message', 'shipping_number']], - ['name' => 'order_detail', 'id' => 'id_order_detail', 'fields' => ['product_name', 'product_reference', 'tax_name', 'download_hash']], - ['name' => 'order_discount', 'id' => 'id_order_discount', 'fields' => ['name']], - ['name' => 'order_state', 'id' => 'id_order_state', 'fields' => ['color']], - ['name' => 'order_state_lang', 'id' => 'id_order_state', 'lang' => true, 'fields' => ['name', 'template']], - ['name' => 'product', 'id' => 'id_product', 'fields' => ['ean13', 'reference']], - ['name' => 'product_attribute', 'id' => 'id_product_attribute', 'fields' => ['reference', 'ean13']], - ['name' => 'product_download', 'id' => 'id_product_download', 'fields' => ['display_filename', 'physically_filename']], - ['name' => 'product_lang', 'id' => 'id_product', 'lang' => true, 'fields' => ['description', 'description_short', 'link_rewrite', 'meta_description', 'meta_keywords', 'meta_title', 'name', 'availability']], - ['name' => 'profile_lang', 'id' => 'id_profile', 'lang' => true, 'fields' => ['name']], - ['name' => 'quick_access', 'id' => 'id_quick_access', 'fields' => ['link']], - ['name' => 'quick_access_lang', 'id' => 'id_quick_access', 'lang' => true, 'fields' => ['name']], - ['name' => 'supplier', 'id' => 'id_supplier', 'fields' => ['name']], - ['name' => 'tab', 'id' => 'id_tab', 'fields' => ['class_name']], - ['name' => 'tab_lang', 'id' => 'id_tab', 'lang' => true, 'fields' => ['name']], - ['name' => 'tag', 'id' => 'id_tag', 'fields' => ['name']], - ['name' => 'tax_lang', 'id' => 'id_tax', 'lang' => true, 'fields' => ['name']], - ['name' => 'zone', 'id' => 'id_zone', 'fields' => ['name']], - ]; - - foreach ($tables as $table) { - /* Latin1 datas' selection */ - if (!Db::getInstance()->execute('SET NAMES latin1')) { - echo 'Cannot change the sql encoding to latin1!'; - } - $query = 'SELECT `' . $table['id'] . '`'; - foreach ($table['fields'] as $field) { - $query .= ', `' . $field . '`'; - } - if (isset($table['lang']) && $table['lang']) { - $query .= ', `id_lang`'; - } - $query .= ' FROM `' . _DB_PREFIX_ . $table['name'] . '`'; - $latin1Datas = Db::getInstance()->executeS($query); - if ($latin1Datas === false) { - $warningExist = true; - $requests .= ' - - - getMsgError()) . ']]> - getNumberError()) . ']]> - ' . "\n"; - } - - if (Db::getInstance()->numRows()) { - /* Utf-8 datas' restitution */ - if (!Db::getInstance()->execute('SET NAMES utf8')) { - echo 'Cannot change the sql encoding to utf8!'; - } - foreach ($latin1Datas as $latin1Data) { - $query = 'UPDATE `' . _DB_PREFIX_ . $table['name'] . '` SET'; - foreach ($table['fields'] as $field) { - $query .= ' `' . $field . '` = \'' . pSQL($latin1Data[$field]) . '\','; - } - $query = rtrim($query, ','); - $query .= ' WHERE `' . $table['id'] . '` = ' . (int) ($latin1Data[$table['id']]); - if (isset($table['lang']) && $table['lang']) { - $query .= ' AND `id_lang` = ' . (int) ($latin1Data['id_lang']); - } - if (!Db::getInstance()->execute($query)) { - $warningExist = true; - $requests .= ' - - - getMsgError()) . ']]> - getNumberError()) . ']]> - ' . "\n"; - } - } - } - } -} diff --git a/upgrade/php/migrate_block_info_to_cms_block.php b/upgrade/php/migrate_block_info_to_cms_block.php deleted file mode 100644 index 997df7138..000000000 --- a/upgrade/php/migrate_block_info_to_cms_block.php +++ /dev/null @@ -1,134 +0,0 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) - */ -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 id_cms FROM `' . _DB_PREFIX_ . 'block_cms` WHERE `id_block` = ' . (int) $id_blockinfos); - //check if block info is installed and active - if (is_array($ids_cms)) { - //install module blockcms - // 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()->insert( - 'module', - ['name' => 'blockcms', 'active' => 1] - ); - $id_module = Db::getInstance()->Insert_ID(); - // 3) hooks - $hooks = ['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()->insert('hook_module', $row); - } - - // 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'); - - $exist = Db::getInstance()->getValue('SELECT `id_configuration` FROM `' . _DB_PREFIX_ . 'configuration` WHERE `name` = \'FOOTER_CMS\''); - if ($exist) { - $res &= Db::getInstance()->execute('UPDATE `' . _DB_PREFIX_ . 'configuration` SET value = "" WHERE `name` = \'FOOTER_CMS\''); - } else { - $res &= Db::getInstance()->getValue('INSERT INTO `' . _DB_PREFIX_ . 'configuration` (name, value) VALUES ("FOOTER_CMS", "")'); - } - - $exist = Db::getInstance()->getValue('SELECT `id_configuration` FROM `' . _DB_PREFIX_ . 'configuration` WHERE `name` = \'FOOTER_BLOCK_ACTIVATION\''); - if ($exist) { - $res &= Db::getInstance()->execute('UPDATE `' . _DB_PREFIX_ . 'configuration` SET value = "1" WHERE `name` = \'FOOTER_BLOCK_ACTIVATION\''); - } else { - $res &= Db::getInstance()->getValue('INSERT INTO `' . _DB_PREFIX_ . 'configuration` (name, value) VALUES ("FOOTER_BLOCK_ACTIVATION", "1")'); - } - - $exist = Db::getInstance()->getValue('SELECT `id_configuration` FROM `' . _DB_PREFIX_ . 'configuration` WHERE `name` = \'FOOTER_POWEREDBY\''); - if ($exist) { - $res &= Db::getInstance()->execute('UPDATE `' . _DB_PREFIX_ . 'configuration` SET value = "1" WHERE `name` = \'FOOTER_POWEREDBY\''); - } else { - $res &= Db::getInstance()->getValue('INSERT INTO `' . _DB_PREFIX_ . 'configuration` (name, value) VALUES ("FOOTER_POWEREDBY", "1")'); - } - - //add new block in new cms block - $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(); - - 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\')'); - } - - //save ids cms of block information in new module cms bloc - foreach ($ids_cms as $id_cms) { - Db::getInstance()->execute('INSERT INTO `' . _DB_PREFIX_ . 'cms_block_page` (`id_cms_block`, `id_cms`, `is_category`) VALUES (' . (int) $id_block . ', ' . (int) $id_cms['id_cms'] . ', 0)'); - } - } else { - return true; - } -} diff --git a/upgrade/php/migrate_orders.php b/upgrade/php/migrate_orders.php deleted file mode 100644 index ad928fcd6..000000000 --- a/upgrade/php/migrate_orders.php +++ /dev/null @@ -1,343 +0,0 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) - */ -function migrate_orders() -{ - $array_errors = []; - $res = true; - if (!defined('PS_TAX_EXC')) { - define('PS_TAX_EXC', 1); - } - - if (!defined('PS_TAX_INC')) { - define('PS_TAX_INC', 0); - } - - $col_order_detail_old = Db::getInstance()->executeS('SHOW FIELDS FROM `' . _DB_PREFIX_ . 'order_detail`'); - foreach ($col_order_detail_old as $k => $field) { - if ($field['Field'] != 'id_order_invoice') { - $col_order_detail[$k] = $field['Field']; - } - } - - if (!$col_order_detail_old) { - return ['error' => 1, 'msg' => 'unable to get fields list from order_detail table']; - } - - $insert_order_detail = 'INSERT INTO `' . _DB_PREFIX_ . 'order_detail_2` (`' . implode('`, `', $col_order_detail) . '`) VALUES '; - - $col_orders = []; - $col_orders_old = Db::getInstance()->executeS('SHOW FIELDS FROM `' . _DB_PREFIX_ . 'orders`'); - - if (!$col_orders_old) { - return ['error' => 1, 'msg' => 'unable to get fields list from orders table']; - } - - foreach ($col_orders_old as $k => $field) { - $col_orders[$k] = $field['Field']; - } - - $insert_order = 'INSERT INTO `' . _DB_PREFIX_ . 'orders_2` (`' . implode('`, `', $col_orders) . '`) VALUES '; - - // create temporary tables - $res = mo_duplicateTables(); - if (!$res) { - $array_errors[] = 'unable to duplicate tables orders and order_detail'; - } - - // this was done like that previously - $wrapping_tax_rate = 1 + ((float) Db::getInstance()->getValue('SELECT value - FROM `' . _DB_PREFIX_ . 'configuration` - WHERE name = "PS_GIFT_WRAPPING_TAX"') / 100); - - $step = 3000; - $count_orders = Db::getInstance()->getValue('SELECT count(id_order) FROM ' . _DB_PREFIX_ . 'orders'); - $nb_loop = $start = 0; - if ($count_orders > 0) { - $nb_loop = ceil($count_orders / $step); - } - for ($i = 0; $i < $nb_loop; ++$i) { - $order_res = Db::getInstance()->query('SELECT * FROM `' . _DB_PREFIX_ . 'orders` LIMIT ' . (int) $start . ', ' . (int) $step); - $start = (int) (($i + 1) * $step); - $cpt = 0; - $flush_limit = 200; - while ($order = Db::getInstance()->nextRow($order_res)) { - $sum_total_products = 0; - $sum_tax_amount = 0; - $default_group_id = mo_getCustomerDefaultGroup((int) $order['id_customer']); - $price_display_method = mo_getPriceDisplayMethod((int) $default_group_id); - $order_details_list = Db::getInstance()->query(' - SELECT od.* - FROM `' . _DB_PREFIX_ . 'order_detail` od - WHERE od.`id_order` = ' . (int) $order['id_order']); - - while ($order_details = Db::getInstance()->nextRow($order_details_list)) { - // we don't want to erase order_details data in order to create the insert query - $products = mo_setProductPrices($order_details, $price_display_method); - $tax_rate = 1 + ((float) $products['tax_rate'] / 100); - $reduction_amount_tax_incl = (float) $products['reduction_amount']; - - // cart::getTaxesAverageUsed equivalent - $sum_total_products += $products['total_price']; - - $sum_tax_amount += $products['total_wt'] - $products['total_price']; - - $order_details['reduction_amount_tax_incl'] = $reduction_amount_tax_incl; - $order_details['reduction_amount_tax_excl'] = (float) mo_ps_round($reduction_amount_tax_incl / $tax_rate); - $order_details['total_price_tax_incl'] = (float) $products['total_wt']; - $order_details['total_price_tax_excl'] = (float) $products['total_price']; - $order_details['unit_price_tax_incl'] = (float) $products['product_price_wt']; - $order_details['unit_price_tax_excl'] = (float) $products['product_price']; - - foreach (array_keys($order_details) as $k) { - if (!in_array($k, $col_order_detail)) { - unset($order_details[$k]); - } else { - if (in_array($order_details[$k], ['product_price', 'reduction_percent', 'reduction_amount', 'group_reduction', 'product_quantity_discount', 'tax_rate', 'ecotax', 'ecotax_tax_rate'])) { - $order_details[$k] = (float) $order_details[$k]; - } else { - $order_details[$k] = Db::getInstance()->escape($order_details[$k]); - } - } - } - if (count($order_details)) { - $values_order_detail[] = '(\'' . implode('\', \'', $order_details) . '\')'; - } - unset($order_details); - } - - $average_tax_used = 1; - if ($sum_total_products > 0) { - $average_tax_used += $sum_tax_amount / $sum_total_products; - } - $average_tax_used = round($average_tax_used, 4); - $carrier_tax_rate = 1; - if (isset($order['carrier_tax_rate'])) { - $carrier_tax_rate + ((float) $order['carrier_tax_rate'] / 100); - } - - $total_discount_tax_excl = $order['total_discounts'] / $average_tax_used; - $order['total_discounts_tax_incl'] = (float) $order['total_discounts']; - $order['total_discounts_tax_excl'] = (float) $total_discount_tax_excl; - - $order['total_shipping_tax_incl'] = (float) $order['total_shipping']; - $order['total_shipping_tax_excl'] = (float) ($order['total_shipping'] / $carrier_tax_rate); - $shipping_taxes = $order['total_shipping_tax_incl'] - $order['total_shipping_tax_excl']; - - $order['total_wrapping_tax_incl'] = (float) $order['total_wrapping']; - $order['total_wrapping_tax_excl'] = ((float) $order['total_wrapping'] / $wrapping_tax_rate); - $wrapping_taxes = $order['total_wrapping_tax_incl'] - $order['total_wrapping_tax_excl']; - - $product_taxes = $order['total_products_wt'] - $order['total_products']; - $order['total_paid_tax_incl'] = (float) $order['total_paid']; - $order['total_paid_tax_excl'] = (float) $order['total_paid'] - $shipping_taxes - $wrapping_taxes - $product_taxes; - // protect text and varchar fields - $order['gift_message'] = Db::getInstance()->escape($order['gift_message']); - $order['payment'] = Db::getInstance()->escape($order['payment']); - $order['module'] = Db::getInstance()->escape($order['module']); - - $values_order[] = '(\'' . implode('\', \'', $order) . '\')'; - - unset($order); - ++$cpt; - - // limit to $cpt - if ($cpt >= $flush_limit) { - $cpt = 0; - if (isset($values_order_detail) && count($values_order_detail) && !Db::getInstance()->execute($insert_order_detail . implode(',', $values_order_detail))) { - $res = false; - $array_errors[] = '[insert order detail 1] - ' . Db::getInstance()->getMsgError(); - } - if (isset($values_order) && count($values_order) && !Db::getInstance()->execute($insert_order . implode(',', $values_order))) { - $res = false; - $array_errors[] = '[insert order 2] - ' . Db::getInstance()->getMsgError(); - } - if (isset($values_order)) { - unset($values_order); - } - if (isset($values_order_detail)) { - unset($values_order_detail); - } - } - } - } - - if (isset($values_order_detail) && count($values_order_detail) && !Db::getInstance()->execute($insert_order_detail . implode(',', $values_order_detail))) { - $res = false; - $array_errors[] = '[insert order detail 3] - ' . Db::getInstance()->getMsgError(); - } - if (isset($values_order) && count($values_order) && !Db::getInstance()->execute($insert_order . implode(',', $values_order))) { - $res = false; - $array_errors[] = '[insert order 4] - ' . Db::getInstance()->getMsgError(); - } - if (isset($values_order)) { - unset($values_order); - } - if (isset($values_order_detail)) { - unset($values_order_detail); - } - if (!mo_renameTables()) { - $res = false; - $array_errors[] = 'unable to rename tables orders_2 and order_detail_2 to orders and order_detail'; - } - - if (!$res) { - return ['error' => 1, 'msg' => count($array_errors) . ' error(s) :
' . implode('
', $array_errors)]; - } -} - -/** - * mo_ps_round is a simplification of Tools::ps_round: - * - round is always 2 - * - no call to Configuration class - * - * @param mixed $val - * - * @return void - */ -function mo_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 0: - return ceil($val * 100) / 100; - case 1: - return floor($val * 100) / 100; - default: - return round($val, 2); - } -} - -function mo_duplicateTables() -{ - $res = true; - $res &= Db::getInstance()->execute('CREATE TABLE - `' . _DB_PREFIX_ . 'orders_2` LIKE `' . _DB_PREFIX_ . 'orders`'); - $res &= Db::getInstance()->execute('CREATE TABLE - `' . _DB_PREFIX_ . 'order_detail_2` LIKE `' . _DB_PREFIX_ . 'order_detail`'); - - return $res; -} - -function mo_renameTables() -{ - $res = true; - $res &= Db::getInstance()->execute('DROP TABLE `' . _DB_PREFIX_ . 'orders`'); - $res &= Db::getInstance()->execute('DROP TABLE `' . _DB_PREFIX_ . 'order_detail`'); - - $res &= Db::getInstance()->execute('RENAME TABLE `' . _DB_PREFIX_ . 'orders_2` TO `' . _DB_PREFIX_ . 'orders`'); - $res &= Db::getInstance()->execute('RENAME TABLE `' . _DB_PREFIX_ . 'order_detail_2` TO `' . _DB_PREFIX_ . 'order_detail`'); - - return $res; -} - -function mo_getCustomerDefaultGroup($id_customer) -{ - static $cache; - if (!isset($cache[$id_customer])) { - $cache[$id_customer] = Db::getInstance()->getValue('SELECT `id_default_group` FROM `' . _DB_PREFIX_ . 'customer` WHERE `id_customer` = ' . (int) $id_customer); - } - - return $cache[$id_customer]; -} - -function mo_getPriceDisplayMethod($id_group) -{ - static $cache; - - if (!isset($cache[$id_group])) { - $cache[$id_group] = Db::getInstance()->getValue(' - SELECT `price_display_method` - FROM `' . _DB_PREFIX_ . 'group` - WHERE `id_group` = ' . (int) $id_group); - } - - return $cache[$id_group]; -} - -function mo_setProductPrices($row, $tax_calculation_method) -{ - if ($tax_calculation_method == PS_TAX_EXC) { - $row['product_price'] = mo_ps_round($row['product_price']); - } else { - $row['product_price_wt'] = mo_ps_round($row['product_price'] * (1 + $row['tax_rate'] / 100)); - } - - $group_reduction = 1; - if ($row['group_reduction'] > 0) { - $group_reduction = 1 - $row['group_reduction'] / 100; - } - - if ($row['reduction_percent'] != 0) { - if ($tax_calculation_method == PS_TAX_EXC) { - $row['product_price'] = ($row['product_price'] - $row['product_price'] * ($row['reduction_percent'] * 0.01)); - } else { - $reduction = mo_ps_round($row['product_price_wt'] * ($row['reduction_percent'] * 0.01)); - $row['product_price_wt'] = mo_ps_round(($row['product_price_wt'] - $reduction)); - } - } - - if ($row['reduction_amount'] != 0) { - if ($tax_calculation_method == PS_TAX_EXC) { - $row['product_price'] = ($row['product_price'] - ($row['reduction_amount'] / (1 + $row['tax_rate'] / 100))); - } else { - $row['product_price_wt'] = mo_ps_round(($row['product_price_wt'] - $row['reduction_amount'])); - } - } - - if ($row['group_reduction'] > 0) { - if ($tax_calculation_method == PS_TAX_EXC) { - $row['product_price'] = $row['product_price'] * $group_reduction; - } else { - $row['product_price_wt'] = mo_ps_round($row['product_price_wt'] * $group_reduction); - } - } - - if (($row['reduction_percent'] || $row['reduction_amount'] || $row['group_reduction']) && $tax_calculation_method == PS_TAX_EXC) { - $row['product_price'] = mo_ps_round($row['product_price']); - } - - if ($tax_calculation_method == PS_TAX_EXC) { - $row['product_price_wt'] = mo_ps_round($row['product_price'] * (1 + ($row['tax_rate'] * 0.01))) + mo_ps_round($row['ecotax'] * (1 + $row['ecotax_tax_rate'] / 100)); - } else { - $row['product_price_wt_but_ecotax'] = $row['product_price_wt']; - $row['product_price_wt'] = mo_ps_round($row['product_price_wt'] + $row['ecotax'] * (1 + $row['ecotax_tax_rate'] / 100)); - } - - if ($tax_calculation_method != PS_TAX_EXC) { - $row['product_price'] = $row['product_price_wt'] / (1 + $row['tax_rate'] / 100); - } - - $row['total_wt'] = $row['product_quantity'] * $row['product_price_wt']; - $row['total_price'] = $row['product_quantity'] * $row['product_price']; - - return $row; -} diff --git a/upgrade/php/migrate_tabs_15.php b/upgrade/php/migrate_tabs_15.php deleted file mode 100644 index 602578897..000000000 --- a/upgrade/php/migrate_tabs_15.php +++ /dev/null @@ -1,208 +0,0 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) - */ - -/** - * Migrate BO tabs for 1.5 (new reorganization of BO) - */ -function migrate_tabs_15() -{ - include_once __DIR__ . '/add_new_tab.php'; - - // ===== Remove deleted tabs ===== - $remove_tabs = [ - 'AdminAliases', - 'AdminContact', - 'AdminDb', - 'AdminGenerator', - 'AdminPdf', - 'AdminSubDomains', - 'AdminStatsConf', - ]; - - $ids = []; - foreach ($remove_tabs as $tab) { - if ($id = get_tab_id($tab)) { - $ids[] = $id; - } - } - - if ($ids) { - Db::getInstance()->delete('tab', 'id_tab IN (' . implode(', ', $ids) . ')'); - Db::getInstance()->delete('tab_lang', 'id_tab IN (' . implode(', ', $ids) . ')'); - } - - // ===== Create new parent tabs ===== - $parent = [ - 'AdminCatalog' => get_tab_id('AdminCatalog'), - 'AdminParentOrders' => add_new_tab('AdminParentOrders', 'en:Orders|fr:Commandes|es:Pedidos|de:Bestellungen|it:Ordini', 0, true), - 'AdminParentCustomer' => add_new_tab('AdminParentCustomer', 'en:Customers|fr:Clients|es:Clientes|de:Kunden|it:Clienti', 0, true), - 'AdminPriceRule' => add_new_tab('AdminPriceRule', 'en:Price rules|fr:Promotions|es:Price rules|de:Price rules|it:Price rules', 0, true), - 'AdminParentShipping' => add_new_tab('AdminParentShipping', 'en:Shipping|fr:Transport|es:Transporte|de:Versandkosten|it:Spedizione', 0, true), - 'AdminParentLocalization' => add_new_tab('AdminParentLocalization', 'en:Localization|fr:Localisation|es:Ubicación|de:Lokalisierung|it:Localizzazione', 0, true), - 'AdminParentModules' => add_new_tab('AdminParentModules', 'en:Modules|fr:Modules|es:Módulos|de:Module|it:Moduli', 0, true), - 'AdminParentPreferences' => add_new_tab('AdminParentPreferences', 'en:Preferences|fr:Préférences|es:Preferencias|de:Voreinstellungen|it:Preferenze', 0, true), - 'AdminTools' => get_tab_id('AdminTools'), - 'AdminAdmin' => add_new_tab('AdminAdmin', 'en:Administration|fr:Administration|es:Administration|de:Administration|it:Administration', 0, true), - 'AdminParentStats' => add_new_tab('AdminParentStats', 'en:Stats|fr:Stats|es:Estadísticas|de:Statistik|it:Stat', 0, true), - 'AdminParentShop' => add_new_tab('AdminParentShop', 'en:Shops|fr:Boutiques|es:Shops|de:Shops|it:Shops', 0, true), - 'AdminStock' => get_tab_id('AdminStock'), - ]; - - // ===== Move tabs from old parents to new parents ===== - $move_association = [ - 'AdminParentOrders' => 'AdminOrders', - 'AdminParentCustomer' => 'AdminCustomers', - 'AdminParentShipping' => 'AdminShipping', - 'AdminParentLocalization' => 'AdminLocalization', - 'AdminParentModules' => 'AdminModules', - 'AdminParentPreferences' => 'AdminPreferences', - 'AdminAdmin' => 'AdminEmployees', - 'AdminParentStats' => 'AdminStats', - 'AdminParentShop' => 'AdminShop', - ]; - - foreach ($move_association as $to => $from) { - if (empty($parent[$to])) { - continue; - } - - $id_parent = get_tab_id($from); - if ($id_parent) { - Db::getInstance()->execute(' - UPDATE ' . _DB_PREFIX_ . 'tab - SET id_parent = ' . $parent[$to] . ' - WHERE id_parent = ' . $id_parent . ' - OR id_tab = ' . $id_parent . ' - '); - } - } - - // ===== Move tabs to their new parents ===== - $move_to = [ - 'AdminContacts' => 'AdminParentCustomer', - 'AdminCustomerThreads' => 'AdminParentCustomer', - 'AdminCurrencies' => 'AdminParentLocalization', - 'AdminTaxes' => 'AdminParentLocalization', - 'AdminTaxRulesGroup' => 'AdminParentLocalization', - 'AdminLanguages' => 'AdminParentLocalization', - 'AdminTranslations' => 'AdminParentLocalization', - 'AdminZones' => 'AdminParentLocalization', - 'AdminCountries' => 'AdminParentLocalization', - 'AdminStates' => 'AdminParentLocalization', - 'AdminCartRules' => 'AdminPriceRule', - 'AdminSpecificPriceRule' => 'AdminPriceRule', - 'AdminQuickAccesses' => 'AdminAdmin', - 'AdminPayment' => 'AdminParentModules', - 'AdminCmsContent' => 'AdminParentPreferences', - 'AdminStores' => 'AdminParentPreferences', - 'AdminEmails' => 'AdminTools', - 'AdminPerformance' => 'AdminTools', - 'AdminAccountingConfiguration' => 'AdminTools', - 'AdminAccountingRegisteredNumber' => 'AdminTools', - 'AdminAccountingExport' => 'AdminStats', - ]; - - foreach ($move_to as $from => $to) { - if (empty($parent[$to])) { - continue; - } - - $id_tab = get_tab_id($from); - if ($id_tab) { - Db::getInstance()->execute(' - UPDATE ' . _DB_PREFIX_ . 'tab - SET id_parent = ' . $parent[$to] . ' - WHERE id_tab = ' . $id_tab . ' - '); - } - } - - // ===== Remove AdminThemes from Modules parent ===== - $id_tab_theme = Db::getInstance()->getValue( - 'SELECT id_tab FROM ' . _DB_PREFIX_ . 'tab - WHERE class_name = \'AdminThemes\' - AND id_parent = ' . $parent['AdminParentModules'] . ' - ' - ); - - if ($id_tab_theme) { - Db::getInstance()->delete('tab', 'id_tab = ' . $id_tab_theme); - } - - // ===== Create new tabs (but not parents this time) ===== - add_new_tab('AdminOrderPreferences', 'en:Orders|fr:Commandes|es:Pedidos|de:Bestellungen|it:Ordini', $parent['AdminParentPreferences']); - add_new_tab('AdminCustomerPreferences', 'en:Customers|fr:Clients|es:Clientes|de:Kunden|it:Clienti', $parent['AdminParentPreferences']); - add_new_tab('AdminMaintenance', 'en:Maintenance|fr:Maintenance|es:Maintenance|de:Maintenance|it:Maintenance', $parent['AdminParentPreferences']); - add_new_tab('AdminAdminPreferences', 'en:Preferences|fr:Préférences|es:Preferencias|de:Voreinstellungen|it:Preferenze', $parent['AdminAdmin']); - - // ===== Sort parent tabs ===== - $position = 0; - foreach ($parent as $id) { - Db::getInstance()->update('tab', ['position' => $position++], 'id_tab = ' . (int) $id); - } - - $sql = 'SELECT id_tab FROM ' . _DB_PREFIX_ . 'tab - WHERE id_tab NOT IN (' . implode(', ', $parent) . ') - AND id_parent = 0'; - - $id_tabs = Db::getInstance()->executeS($sql); - if (is_array($id_tabs) && count($id_tabs)) { - foreach (Db::getInstance()->executeS($sql) as $row) { - Db::getInstance()->update('tab', ['position' => $position++], 'id_tab = ' . $row['id_tab']); - } - } -} - -function get_tab_id($class_name) -{ - static $cache = []; - - if (!isset($cache[$class_name])) { - $cache[$class_name] = Db::getInstance()->getValue('SELECT id_tab FROM ' . _DB_PREFIX_ . 'tab WHERE class_name = \'' . pSQL($class_name) . '\''); - } - - return $cache[$class_name]; -} - -/* DO NOT REMOVE THIS FUNCTION ! -function get_tab_langs($classname) -{ - $parent_xml = simplexml_load_file(_PS_INSTALL_DATA_PATH_.'xml/tab.xml'); - $result = $parent_xml->xpath('entities/tab[class_name=\''.$classname.'\']'); - $id = (string)$result[0]['id']; - foreach (array('en', 'fr', 'es', 'de', 'it') as $iso) - { - $xml = simplexml_load_file(_PS_INSTALL_LANGS_PATH_.$iso.'/data/tab.xml'); - $result = $xml->xpath('tab[@id=\''.$id.'\']'); - $values[$iso] = (string)$result[0]['name']; - } - - $return = ''; - foreach ($values as $iso => $lang) - $return .= $iso.':'.$lang.'|'; - return utf8_decode(rtrim($return, '|')); -} -*/ diff --git a/upgrade/php/migrate_tabs_17.php b/upgrade/php/migrate_tabs_17.php deleted file mode 100644 index 141b71b9e..000000000 --- a/upgrade/php/migrate_tabs_17.php +++ /dev/null @@ -1,115 +0,0 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) - */ - -use PrestaShop\PrestaShop\Adapter\Entity\Language; -use PrestaShopBundle\Install\LanguageList; -use PrestaShopBundle\Install\XmlLoader; - -/** - * Migrate BO tabs for 1.7 (new reorganization of BO) - */ -function migrate_tabs_17() -{ - include_once __DIR__ . '/add_new_tab.php'; - - /* first make some room for new tabs */ - $moduleTabs = Db::getInstance()->executeS( - 'SELECT id_parent FROM ' . _DB_PREFIX_ . 'tab WHERE module IS NOT NULL AND module != "" ORDER BY id_tab ASC' - ); - - $moduleParents = []; - - foreach ($moduleTabs as $tab) { - $idParent = $tab['id_parent']; - $moduleParents[$idParent] = Db::getInstance()->getValue('SELECT class_name FROM ' . _DB_PREFIX_ . 'tab WHERE id_tab=' . $idParent); - } - - /* delete the old structure */ - Db::getInstance()->execute( - 'DELETE t, tl FROM ' . _DB_PREFIX_ . 'tab t JOIN ' . _DB_PREFIX_ . 'tab_lang tl ON (t.id_tab=tl.id_tab) WHERE module IS NULL OR module = ""' - ); - - $defaultLanguage = new Language((int) Configuration::get('PS_LANG_DEFAULT')); - - $languageList = LanguageList::getInstance(); - $languageList->setLanguage($defaultLanguage->iso_code); - - /* insert the new structure */ - ProfileCore::resetCacheAccesses(); - LanguageCore::resetCache(); - if (!populateTab()) { - return false; - } - - /* update remaining idParent */ - foreach ($moduleParents as $idParent => $className) { - if (!empty($className)) { - $idTab = Db::getInstance()->getValue('SELECT id_tab FROM ' . _DB_PREFIX_ . 'tab WHERE class_name="' . pSQL($className) . '"'); - Db::getInstance()->execute('UPDATE ' . _DB_PREFIX_ . 'tab SET id_parent=' . (int) $idTab . ' WHERE id_parent=' . (int) $idParent); - } - } - - return true; -} - -function populateTab() -{ - $languages = []; - foreach (Language::getLanguages() as $lang) { - $languages[$lang['id_lang']] = $lang['iso_code']; - } - - // Because we use 1.7.7+ files but with a not-yet migrated Tab entity, we need to use - // a custom XmlLoader to remove the `enabled` key before inserting to the DB - $xml_loader = new \XmlLoader1700(); - $xml_loader->setTranslator(Context::getContext()->getTranslator()); - $xml_loader->setLanguages($languages); - - try { - $xml_loader->populateEntity('tab'); - } catch (PrestashopInstallerException $e) { - return false; - } - - return true; -} - -class XmlLoader1700 extends XmlLoader -{ - public function createEntityTab($identifier, array $data, array $data_lang) - { - if (isset($data['enabled'])) { - unset($data['enabled']); - } - if (isset($data['wording'])) { - unset($data['wording']); - } - if (isset($data['wording_domain'])) { - unset($data['wording_domain']); - } - parent::createEntityTab($identifier, $data, $data_lang); - } -} diff --git a/upgrade/php/migrate_tabs_multi_shop.php b/upgrade/php/migrate_tabs_multi_shop.php deleted file mode 100755 index 2e9b38f05..000000000 --- a/upgrade/php/migrate_tabs_multi_shop.php +++ /dev/null @@ -1,56 +0,0 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) - */ - -/** - * Migrate BO tabs for multi-shop new reorganization - */ -function migrate_tabs_multi_shop() -{ - include_once __DIR__ . '/add_new_tab.php'; - include_once __DIR__ . '/migrate_tabs_15.php'; - - $nbr_shop = Db::getInstance()->getValue('SELECT count(id_shop) FROM ' . _DB_PREFIX_ . 'shop'); - $tab_shop_group_active = false; - - //check if current configuration has more than one shop - if ($nbr_shop > 1) { - Db::getInstance()->update('configuration', ['value' => true], 'name = \'PS_MULTISHOP_FEATURE_ACTIVE\''); - $tab_shop_group_active = true; - } - - // ===== remove AdminParentShop from BO menu ===== - $admin_parent_shop_id = get_tab_id('AdminParentShop'); - $admin_shop_group_id = get_tab_id('AdminShopGroup'); - Db::getInstance()->delete('tab', 'id_tab IN (' . (int) $admin_shop_group_id . ', ' . (int) $admin_parent_shop_id . ')'); - Db::getInstance()->delete('tab_lang', 'id_tab IN (' . (int) $admin_shop_group_id . ', ' . (int) $admin_parent_shop_id . ')'); - - // ===== add AdminShopGroup to parent AdminTools ===== - $admin_shop_group_id = add_new_tab('AdminShopGroup', 'en:Multi-shop|fr:Multiboutique|es:Multi-tienda|de:Multi-shop|it:Multi-shop', get_tab_id('AdminTools'), true); - Db::getInstance()->update('tab', ['active' => $tab_shop_group_active], 'id_tab = ' . (int) $admin_shop_group_id); - - // ===== hide AdminShopUrl and AdminShop ===== - Db::getInstance()->update('tab', ['id_parent' => '-1'], 'id_tab IN (' . get_tab_id('AdminShop') . ', ' . get_tab_id('AdminShopUrl') . ')'); -} diff --git a/upgrade/php/module_blockwishlist_multishop.php b/upgrade/php/module_blockwishlist_multishop.php deleted file mode 100644 index bca673be0..000000000 --- a/upgrade/php/module_blockwishlist_multishop.php +++ /dev/null @@ -1,38 +0,0 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) - */ -function module_blockwishlist_multishop() -{ - $id_module = Db::getInstance()->getValue('SELECT id_module FROM ' . _DB_PREFIX_ . 'module where name="blockwishlist"'); - if ($id_module) { - $res = Db::getInstance()->execute('ALTER TABLE `' . _DB_PREFIX_ . 'wishlist` - ADD `id_shop` INTEGER NOT NULL default \'1\' AFTER `counter`, - ADD `id_group_shop` INTEGER NOT NULL default \'1\' AFTER `id_shop`'); - - return $res; - } - - return true; -} diff --git a/upgrade/php/module_reinstall_blockmyaccount.php b/upgrade/php/module_reinstall_blockmyaccount.php deleted file mode 100644 index 90b9f385f..000000000 --- a/upgrade/php/module_reinstall_blockmyaccount.php +++ /dev/null @@ -1,49 +0,0 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) - */ -function module_reinstall_blockmyaccount() -{ - $res = true; - $id_module = Db::getInstance()->getValue('SELECT id_module FROM ' . _DB_PREFIX_ . 'module where name="blockmyaccount"'); - if ($id_module) { - $res &= Db::getInstance()->execute('INSERT INTO `' . _DB_PREFIX_ . 'hook` - (`name`, `title`, `description`, `position`) VALUES - ("displayMyAccountBlock", "My account block", "Display extra informations inside the \"my account\" block", 1)'); - // register left column, and header, and addmyaccountblockhook - $hooks = ['leftColumn', '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()->insert('hook_module', $row); - } - - return $res; - } - - return true; -} diff --git a/upgrade/php/module_reinstall_blocksearch.php b/upgrade/php/module_reinstall_blocksearch.php deleted file mode 100644 index cade51814..000000000 --- a/upgrade/php/module_reinstall_blocksearch.php +++ /dev/null @@ -1,49 +0,0 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) - */ -function module_reinstall_blocksearch() -{ - $res = true; - $id_module = Db::getInstance()->getValue('SELECT id_module FROM ' . _DB_PREFIX_ . 'module where name="blocksearch"'); - if ($id_module) { - $res &= Db::getInstance()->execute('INSERT INTO `' . _DB_PREFIX_ . 'hook` - (`name`, `title`, `description`, `position`) VALUES - ("displayMyAccountBlock", "My account block", "Display extra informations inside the \"my account\" block", 1)'); - // register left column, and header, and addmyaccountblockhook - $hooks = ['top', '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()->insert('hook_module', $row); - } - - return $res; - } - - return true; -} diff --git a/upgrade/php/move_crossselling.php b/upgrade/php/move_crossselling.php deleted file mode 100644 index 5a48c6e34..000000000 --- a/upgrade/php/move_crossselling.php +++ /dev/null @@ -1,33 +0,0 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) - */ -function move_crossselling() -{ - if (Db::getInstance()->executeS('SELECT FROM `' . _DB_PREFIX_ . 'module` WHERE `name` = \'crossselling\'')) { - Db::getInstance()->execute(' -INSERT INTO `' . _DB_PREFIX_ . 'hook_module` (`id_module`, `id_hook`, `position`) -VALUES ((SELECT `id_module` FROM `' . _DB_PREFIX_ . 'module` WHERE `name` = \'crossselling\'), 9, (SELECT max_position FROM (SELECT MAX(position)+1 as max_position FROM `' . _DB_PREFIX_ . 'hook_module` WHERE `id_hook` = 9) tmp))'); - } -} diff --git a/upgrade/php/move_translations_module_file.php b/upgrade/php/move_translations_module_file.php deleted file mode 100644 index cb70f7ea9..000000000 --- a/upgrade/php/move_translations_module_file.php +++ /dev/null @@ -1,77 +0,0 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) - */ - -/** - * Move all translation modules files 1.4 for a good architecture in 1.5 - */ -function move_translations_module_file() -{ - $res = true; - // Get all languages - $languages = Db::getInstance()->executeS(' - SELECT * - FROM `' . _DB_PREFIX_ . 'lang` - '); - - // Get the list of modules - $modules = scandir(_PS_MODULE_DIR_, SCANDIR_SORT_NONE); - - $error_list = []; - // Scan all modules and check if translation file exists - foreach ($modules as $module_name) { - // Check if is a good module - if (in_array($module_name, ['.', '..', '.svn', '.htaccess', 'index.php', 'autoupgrade']) || !is_dir(_PS_MODULE_DIR_ . '/' . $module_name)) { - continue; - } - - foreach ($languages as $lang) { - // Name for the old file and the new file - $old_file = _PS_MODULE_DIR_ . $module_name . '/' . $lang['iso_code'] . '.php'; - if (!@file_exists($old_file)) { - continue; - } - - $dir_translations = _PS_MODULE_DIR_ . $module_name . '/translations/'; - $new_file = $dir_translations . $lang['iso_code'] . '.php'; - - // Create folder if no exist - if (!is_dir($dir_translations)) { - $res &= mkdir($dir_translations, 0777); - } - - if (!@rename($old_file, $new_file)) { - $error_list[] = $module_name . ' - ' . $lang['iso_code'] . "
\r\n"; - $res &= false; - } - } - } - - if (!$res || (count($error_list) > 0)) { - return ['error' => 1, 'msg' => implode("\r\n
", $error_list)]; - } else { - return true; - } -} diff --git a/upgrade/php/outstanding_allow_amount1530.php b/upgrade/php/outstanding_allow_amount1530.php deleted file mode 100644 index 472c40db3..000000000 --- a/upgrade/php/outstanding_allow_amount1530.php +++ /dev/null @@ -1,42 +0,0 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) - */ -function outstanding_allow_amount1530() -{ - $column_exist = Db::getInstance()->executeS('SHOW FIELDS FROM `' . _DB_PREFIX_ . 'address`'); - $column_formated = []; - $res = true; - if ($column_exist) { - foreach ($column_exist as $c) { - $column_formated[] = $c['Field']; - } - - if (in_array('outstanding_allow_amount', $column_formated)) { - Db::getInstance()->execute('ALTER TABLE `' . _DB_PREFIX_ . 'address` CHANGE `outstanding_allow_amount` `outstanding_allow_amount` DECIMAL(20, 6) NOT NULL DEFAULT 0.000000'); - } - } - - return $res; -} diff --git a/upgrade/php/p15010_drop_column_id_address_if_exists.php b/upgrade/php/p15010_drop_column_id_address_if_exists.php deleted file mode 100644 index ada3e2a4c..000000000 --- a/upgrade/php/p15010_drop_column_id_address_if_exists.php +++ /dev/null @@ -1,43 +0,0 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) - */ -function p15010_drop_column_id_address_if_exists() -{ - $res = true; - $exists = Db::getInstance()->executeS('SHOW TABLES LIKE "' . _DB_PREFIX_ . 'supplier"'); - if (count($exists)) { - $fields = Db::getInstance()->executeS('SHOW FIELDS FROM `' . _DB_PREFIX_ . 'supplier`'); - foreach ($fields as $k => $field) { - $fields[$k] = $field['Field']; - } - - if (in_array('id_address', $fields)) { - $res &= Db::getInstance()->execute('ALTER TABLE `' . _DB_PREFIX_ . 'supplier` - DROP `id_address`'); - } - } - - return $res; -} diff --git a/upgrade/php/p15012_add_missing_columns.php b/upgrade/php/p15012_add_missing_columns.php deleted file mode 100755 index 39fabc7f5..000000000 --- a/upgrade/php/p15012_add_missing_columns.php +++ /dev/null @@ -1,191 +0,0 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) - */ -function p15012_add_missing_columns() -{ - $errors = []; - $db = Db::getInstance(); - $q_list = []; - // columns must exists - $q_list['carrier']['id_reference']['mod'] = 'ALTER TABLE `' . _DB_PREFIX_ . 'carrier` - CHANGE `id_reference` `id_reference` int(10) unsigned NOT NULL'; - $q_list['carrier']['id_reference']['add'] = 'ALTER TABLE `' . _DB_PREFIX_ . 'carrier` - ADD `id_reference` int(10) unsigned NOT NULL'; - $q_list['carrier']['id_tax_rules_group']['add'] = 'ALTER TABLE `' . _DB_PREFIX_ . 'carrier` - ADD `id_tax_rules_group` INT(10) unsigned DEFAULT "0" AFTER `id_reference`'; - - $q_list['cart']['order_reference']['mod'] = 'ALTER TABLE `' . _DB_PREFIX_ . 'cart` - DROP COLUMN `order_reference`'; - - $q_list['cart']['id_shop_group']['mod'] = 'ALTER TABLE `' . _DB_PREFIX_ . 'cart` - CHANGE `id_shop_group` `id_shop_group` int(11) unsigned NOT NULL DEFAULT "1"'; - $q_list['cart']['id_shop_group']['add'] = 'ALTER TABLE `' . _DB_PREFIX_ . 'cart` - ADD `id_shop_group` int(11) unsigned NOT NULL DEFAULT "1"'; - - $q_list['cart_product']['id_shop']['mod'] = 'ALTER TABLE `' . _DB_PREFIX_ . 'cart_product` - CHANGE `id_shop` `id_shop` int(10) unsigned NOT NULL DEFAULT "1" AFTER `id_address_delivery`'; - $q_list['cart_product']['id_shop']['add'] = 'ALTER TABLE `' . _DB_PREFIX_ . 'cart_product` - ADD `id_shop` int(10) unsigned NOT NULL DEFAULT "1" AFTER `id_address_delivery`'; - $q_list['cart_product']['id_product_attribute']['mod'] = 'ALTER TABLE `' . _DB_PREFIX_ . 'cart_product` - CHANGE `id_product_attribute` `id_product_attribute` int(10) unsigned DEFAULT NULL AFTER `id_shop`'; - $q_list['cart_product']['id_product_attribute']['add'] = 'ALTER TABLE `' . _DB_PREFIX_ . 'cart_product` - ADD `id_product_attribute` int(10) unsigned DEFAULT NULL AFTER `id_shop`'; - - $q_list['cart_rule_product_rule']['quantity']['mod'] = 'ALTER TABLE `' . _DB_PREFIX_ . 'cart_rule_product_rule` - DROP COLUMN `quantity`'; - - $q_list['connections']['id_shop_group']['mod'] = 'ALTER TABLE `' . _DB_PREFIX_ . 'connections` - CHANGE id_shop_group `id_shop_group` int(11) unsigned NOT NULL DEFAULT "1" AFTER id_connections'; - - $q_list['country']['display_tax_label']['mod'] = 'ALTER TABLE `' . _DB_PREFIX_ . 'country` - CHANGE display_tax_label `display_tax_label` tinyint(1) NOT NULL AFTER zip_code_format'; - - $q_list['currency']['active']['mod'] = 'ALTER TABLE `' . _DB_PREFIX_ . 'currency` - CHANGE active active tinyint(1) unsigned NOT NULL DEFAULT "1"'; - - $q_list['customer']['id_shop_group']['mod'] = 'ALTER TABLE `' . _DB_PREFIX_ . 'customer` - CHANGE id_shop_group id_shop_group int(11) unsigned NOT NULL DEFAULT "1"'; - - $q_list['employee']['bo_uimode']['mod'] = 'ALTER TABLE `' . _DB_PREFIX_ . 'employee` - DROP `bo_uimode`'; - - $q_list['meta_lang']['url_rewrite']['mod'] = 'ALTER TABLE `' . _DB_PREFIX_ . 'meta_lang` - CHANGE url_rewrite url_rewrite varchar(254) NOT NULL'; - - $q_list['order_detail']['id_warehouse']['mod'] = 'ALTER TABLE `' . _DB_PREFIX_ . 'order_detail` - CHANGE `id_warehouse` id_warehouse int(10) unsigned DEFAULT "0"'; - $q_list['order_detail']['reduction_amount_tax_incl']['mod'] = 'ALTER TABLE `' . _DB_PREFIX_ . 'order_detail` - CHANGE `reduction_amount_tax_incl` reduction_amount_tax_incl DEC(20,6) NOT NULL DEFAULT "0.000000"'; - $q_list['order_detail']['reduction_amount_tax_excl']['mod'] = 'ALTER TABLE `' . _DB_PREFIX_ . 'order_detail` - CHANGE `reduction_amount_tax_excl` reduction_amount_tax_excl DEC(20,6) NOT NULL DEFAULT "0.000000"'; - - $q_list['order_detail']['ecotax_tax_rate']['mod'] = 'ALTER TABLE `' . _DB_PREFIX_ . 'order_detail` - CHANGE `ecotax_tax_rate` ecotax_tax_rate DEC(5,3) NOT NULL DEFAULT "0.000"'; - - $q_list['order_detail']['total_price_tax_incl']['mod'] = 'ALTER TABLE `' . _DB_PREFIX_ . 'order_detail` - CHANGE `total_price_tax_incl` total_price_tax_incl DEC(20,6) NOT NULL DEFAULT "0.000000"'; - $q_list['order_detail']['total_price_tax_excl']['mod'] = 'ALTER TABLE `' . _DB_PREFIX_ . 'order_detail` - CHANGE `total_price_tax_excl` total_price_tax_excl DEC(20,6) NOT NULL DEFAULT "0.000000"'; - $q_list['order_detail']['unit_price_tax_incl']['mod'] = 'ALTER TABLE `' . _DB_PREFIX_ . 'order_detail` - CHANGE `unit_price_tax_incl` unit_price_tax_incl DEC(20,6) NOT NULL DEFAULT "0.000000"'; - $q_list['order_detail']['unit_price_tax_excl']['mod'] = 'ALTER TABLE `' . _DB_PREFIX_ . 'order_detail` - CHANGE `unit_price_tax_excl` unit_price_tax_excl DEC(20,6) NOT NULL DEFAULT "0.000000"'; - $q_list['order_detail']['total_shipping_price_tax_incl']['mod'] = 'ALTER TABLE `' . _DB_PREFIX_ . 'order_detail` - CHANGE `total_shipping_price_tax_incl` total_shipping_price_tax_incl DEC(20,6) NOT NULL DEFAULT "0.000000"'; - $q_list['order_detail']['total_shipping_price_tax_excl']['mod'] = 'ALTER TABLE `' . _DB_PREFIX_ . 'order_detail` - CHANGE `total_shipping_price_tax_excl` total_shipping_price_tax_excl DEC(20,6) NOT NULL DEFAULT "0.000000"'; - $q_list['order_detail']['purchase_supplier_price']['mod'] = 'ALTER TABLE `' . _DB_PREFIX_ . 'order_detail` - CHANGE `purchase_supplier_price` purchase_supplier_price DEC(20,6) NOT NULL DEFAULT "0.000000"'; - $q_list['order_detail']['original_product_price']['mod'] = 'ALTER TABLE `' . _DB_PREFIX_ . 'order_detail` - CHANGE `original_product_price` original_product_price DEC(20,6) NOT NULL DEFAULT "0.000000"'; - - $q_list['order_detail_tax']['unit_amount']['mod'] = 'ALTER TABLE `' . _DB_PREFIX_ . 'order_detail_tax` - CHANGE `unit_amount` unit_amount DEC(10,6) NOT NULL DEFAULT "0.000000"'; - $q_list['order_detail_tax']['total_amount']['mod'] = 'ALTER TABLE `' . _DB_PREFIX_ . 'order_detail_tax` - CHANGE `total_amount` total_amount DEC(10,6) NOT NULL DEFAULT "0.000000"'; - - $q_list['order_invoice']['note']['mod'] = 'ALTER TABLE `' . _DB_PREFIX_ . 'order_invoice` - CHANGE `note` note text'; - - $q_list['order_payment']['id_order_invoice']['mod'] = 'ALTER TABLE `' . _DB_PREFIX_ . 'order_payment` - CHANGE `id_order_invoice` id_order_invoice int(10) unsigned NOT NULL DEFAULT 0'; - - $q_list['orders']['reference']['mod'] = 'ALTER TABLE `' . _DB_PREFIX_ . 'orders` - CHANGE `reference` reference varchar(9) DEFAULT NULL'; - $q_list['orders']['id_shop_group']['mod'] = 'ALTER TABLE `' . _DB_PREFIX_ . 'orders` - CHANGE `id_shop_group` id_shop_group int(11) unsigned NOT NULL DEFAULT "1"'; - - $q_list['product']['unity']['mod'] = 'ALTER TABLE `' . _DB_PREFIX_ . 'product` - CHANGE `unity` unity varchar(255) DEFAULT NULL'; - - $q_list['product']['width']['mod'] = 'ALTER TABLE `' . _DB_PREFIX_ . 'product` - CHANGE `width` `width` float NOT NULL DEFAULT "0"'; - - $q_list['product']['height']['mod'] = 'ALTER TABLE `' . _DB_PREFIX_ . 'product` - CHANGE `height` `height` float NOT NULL DEFAULT "0"'; - - $q_list['product']['depth']['mod'] = 'ALTER TABLE `' . _DB_PREFIX_ . 'product` - CHANGE `depth` `depth` float NOT NULL DEFAULT "0"'; - - $q_list['product']['minimal_quantity']['mod'] = 'ALTER TABLE `' . _DB_PREFIX_ . 'product` - CHANGE `minimal_quantity` `minimal_quantity` int(10) unsigned NOT NULL DEFAULT "1"'; - - $q_list['product_attribute']['ecotax']['mod'] = 'ALTER TABLE `' . _DB_PREFIX_ . 'product_attribute` - CHANGE `ecotax` ecotax decimal(17,6) NOT NULL DEFAULT "0.000000"'; - - $q_list['stock_mvt_reason']['id_stock_mvt_reason']['mod'] = 'ALTER TABLE `' . _DB_PREFIX_ . 'stock_mvt_reason` - CHANGE `id_stock_mvt_reason` id_stock_mvt_reason int(11) unsigned NOT NULL'; - - $q_list['stock_mvt_reason_lang']['id_stock_mvt_reason']['mod'] = 'ALTER TABLE `' . _DB_PREFIX_ . 'stock_mvt_reason_lang` - CHANGE `id_stock_mvt_reason` id_stock_mvt_reason int(11) unsigned NOT NULL'; - - $q_list['stock_mvt_reason_lang']['id_lang']['mod'] = 'ALTER TABLE `' . _DB_PREFIX_ . 'stock_mvt_reason_lang` - CHANGE `id_lang` id_lang int(11) unsigned NOT NULL'; - - $q_list['supply_order']['reference']['mod'] = 'ALTER TABLE `' . _DB_PREFIX_ . 'supply_order` - CHANGE `reference` reference varchar(64) NOT NULL'; - - $q_list['tax']['deleted']['mod'] = 'ALTER TABLE `' . _DB_PREFIX_ . 'tax` - CHANGE `deleted` deleted tinyint(1) unsigned NOT NULL DEFAULT "0"'; - - $q_list['carrier']['need_range']['mod'] = 'ALTER TABLE `' . _DB_PREFIX_ . 'carrier` - CHANGE `need_range` need_range tinyint(1) unsigned NOT NULL DEFAULT "0" AFTER shipping_external'; - - foreach ($q_list as $table => $cols) { - if (empty($table)) { - continue; - } - $list_fields = $db->executeS('SHOW FIELDS FROM `' . _DB_PREFIX_ . $table . '`'); - if (is_array($list_fields)) { - foreach ($list_fields as $k => $field) { - $list_fields[$k] = $field['Field']; - } - } - if (is_array($cols)) { - foreach ($cols as $col => $q) { - // do only if column exists - if (is_array($list_fields) && in_array($col, $list_fields)) { - $do = 'mod'; - } else { - $do = 'add'; - } - - if (!empty($q[$do])) { - if (!$db->execute($q[$do])) { - $errors[] = '' . $q[$do] . '' . $db->getMsgError() . ''; - } - } - } - } - } - - if (count($errors) > 0) { - $msg = implode("\r", $errors); - - return ['error' => 1, 'msg' => $msg]; - } else { - return true; - } -} diff --git a/upgrade/php/p15013_add_missing_columns.php b/upgrade/php/p15013_add_missing_columns.php deleted file mode 100644 index 84dea0d7d..000000000 --- a/upgrade/php/p15013_add_missing_columns.php +++ /dev/null @@ -1,54 +0,0 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) - */ -function p15013_add_missing_columns() -{ - $errors = []; - $db = Db::getInstance(); - $id_module = $db->getValue('SELECT id_module FROM `' . _DB_PREFIX_ . 'module` WHERE name="statssearch"'); - - if ($id_module) { - $list_fields = Db::getInstance()->executeS('SHOW FIELDS FROM `' . _DB_PREFIX_ . 'statssearch`'); - foreach ($list_fields as $k => $field) { - $list_fields[$k] = $field['Field']; - } - - if (!in_array('id_group_shop', $list_fields)) { - if (!Db::getInstance()->execute('ALTER TABLE `' . _DB_PREFIX_ . 'statssearch` - ADD `id_group_shop` INT(10) NOT NULL default "1" AFTER id_statssearch')) { - $errors[] = $db->getMsgError(); - } - } - if (!in_array('id_shop', $list_fields)) { - if (!Db::getInstance()->execute('ALTER TABLE `' . _DB_PREFIX_ . 'statssearch` - ADD `id_shop` INT(10) NOT NULL default "1" AFTER id_statssearch')) { - $errors[] = $db->getMsgError(); - } - } - } - if (count($errors)) { - return ['error' => 1, 'msg' => implode(',', $errors)]; - } -} diff --git a/upgrade/php/p15014_add_missing_columns.php b/upgrade/php/p15014_add_missing_columns.php deleted file mode 100644 index 2bd79824e..000000000 --- a/upgrade/php/p15014_add_missing_columns.php +++ /dev/null @@ -1,50 +0,0 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) - */ -function p15014_add_missing_columns() -{ - $errors = []; - $db = Db::getInstance(); - - // for module statssearch - $id_module = $db->getValue('SELECT id_module FROM `' . _DB_PREFIX_ . 'module` WHERE name="statssearch"'); - if ($id_module) { - $list_fields = $db->executeS('SHOW FIELDS FROM `' . _DB_PREFIX_ . 'statssearch`'); - foreach ($list_fields as $k => $field) { - $list_fields[$k] = $field['Field']; - } - - if (in_array('id_group_shop', $list_fields)) { - if (!Db::getInstance()->execute('ALTER TABLE `' . _DB_PREFIX_ . 'statssearch` - CHANGE `id_group_shop` `id_shop_group` INT(10) NOT NULL default "1"')) { - $errors[] = $db->getMsgError(); - } - } - } - - if (count($errors)) { - return ['error' => 1, 'msg' => implode(',', $errors)]; - } -} diff --git a/upgrade/php/p15014_copy_missing_images_tab_from_installer.php b/upgrade/php/p15014_copy_missing_images_tab_from_installer.php deleted file mode 100644 index 0f7126fd3..000000000 --- a/upgrade/php/p15014_copy_missing_images_tab_from_installer.php +++ /dev/null @@ -1,58 +0,0 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) - */ - -/** - * This function copy all images located in /install/data/img/* that are missing in previous upgrade - * in the matching img dir. This does not modify images that are already present. - */ -function p15014_copy_missing_images_tab_from_installer() -{ - $res = true; - $DIR_SEP = DIRECTORY_SEPARATOR; - if (!defined('_PS_ROOT_DIR_')) { - define('_PS_ROOT_DIR_', realpath(INSTALL_PATH . '/../')); - } - - $install_dir_path = INSTALL_PATH . $DIR_SEP . 'data' . $DIR_SEP . 'img'; - $img_dir = scandir($install_dir_path, SCANDIR_SORT_NONE); - foreach ($img_dir as $dir) { - if ($dir[0] == '.' || !is_dir($install_dir_path . $DIR_SEP . $dir)) { - continue; - } - - $img_subdir = scandir($install_dir_path . $DIR_SEP . $dir, SCANDIR_SORT_NONE); - foreach ($img_subdir as $img) { - if ($img[0] == '.') { - continue; - } - if (!file_exists(_PS_ROOT_DIR_ . $DIR_SEP . 'img' . $DIR_SEP . $dir . $DIR_SEP . $img) && file_exists($install_dir_path . $DIR_SEP . $dir . $DIR_SEP . $img)) { - $res &= copy($install_dir_path . $DIR_SEP . $dir . $DIR_SEP . $img, _PS_ROOT_DIR_ . $DIR_SEP . 'img' . $DIR_SEP . $dir . $DIR_SEP . $img); - } - } - } - - return $res; -} diff --git a/upgrade/php/p15014_upgrade_sekeywords.php b/upgrade/php/p15014_upgrade_sekeywords.php deleted file mode 100644 index 9b3a20348..000000000 --- a/upgrade/php/p15014_upgrade_sekeywords.php +++ /dev/null @@ -1,32 +0,0 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) - */ -function p15014_upgrade_sekeywords() -{ - Db::getInstance()->execute('ALTER TABLE `' . _DB_PREFIX_ . 'sekeyword` ADD id_shop INTEGER UNSIGNED NOT NULL DEFAULT 1 AFTER id_sekeyword'); - Db::getInstance()->execute('ALTER TABLE `' . _DB_PREFIX_ . 'sekeyword` ADD id_shop_group INTEGER UNSIGNED NOT NULL DEFAULT 1 AFTER id_shop'); - - return true; -} diff --git a/upgrade/php/p15015_blockadvertising_extension.php b/upgrade/php/p15015_blockadvertising_extension.php deleted file mode 100644 index d8eee1181..000000000 --- a/upgrade/php/p15015_blockadvertising_extension.php +++ /dev/null @@ -1,47 +0,0 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) - */ -function p15015_blockadvertising_extension() -{ - if (!defined('_PS_ROOT_DIR_')) { - define('_PS_ROOT_DIR_', realpath(INSTALL_PATH . '/../')); - } - - // Try to update with the extension of the image that exists in the module directory - if (@file_exists(_PS_ROOT_DIR_ . '/modules/blockadvertising')) { - foreach (@scandir(_PS_ROOT_DIR_ . '/modules/blockadvertising', SCANDIR_SORT_NONE) as $file) { - if (in_array($file, ['advertising.jpg', 'advertising.gif', 'advertising.png'])) { - $exist = Db::getInstance()->getValue('SELECT `id_configuration` FROM `' . _DB_PREFIX_ . 'configuration` WHERE `name` = \'BLOCKADVERT_IMG_EXT\''); - if ($exist) { - Db::getInstance()->execute('UPDATE `' . _DB_PREFIX_ . 'configuration` SET value = "' . pSQL(substr($file, strrpos($file, '.') + 1)) . '" WHERE `name` = \'BLOCKADVERT_IMG_EXT\''); - } else { - Db::getInstance()->execute('INSERT INTO `' . _DB_PREFIX_ . 'configuration` (name, value) VALUES ("BLOCKADVERT_IMG_EXT", "' . pSQL(substr($file, strrpos($file, '.') + 1)) . '"'); - } - } - } - } - - return true; -} diff --git a/upgrade/php/p15016_add_missing_columns.php b/upgrade/php/p15016_add_missing_columns.php deleted file mode 100644 index b0439639b..000000000 --- a/upgrade/php/p15016_add_missing_columns.php +++ /dev/null @@ -1,97 +0,0 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) - */ -function p15016_add_missing_columns() -{ - $errors = []; - - $id_module = Db::getInstance()->getValue('SELECT id_module FROM `' . _DB_PREFIX_ . 'module` WHERE name="blockreinsurance"'); - if ($id_module) { - $list_fields = Db::getInstance()->executeS('SHOW FIELDS FROM `' . _DB_PREFIX_ . 'reinsurance`'); - foreach ($list_fields as $k => $field) { - $list_fields[$k] = $field['Field']; - } - - if (in_array('id_contactinfos', $list_fields)) { - if (!Db::getInstance()->execute('ALTER TABLE `' . _DB_PREFIX_ . 'reinsurance` CHANGE `id_contactinfos` `id_reinsurance` INT( 10 ) UNSIGNED NOT NULL AUTO_INCREMENT')) { - $errors[] = Db::getInstance()->getMsgError(); - } - } - if (!in_array('id_shop', $list_fields)) { - if (!Db::getInstance()->execute('ALTER TABLE `' . _DB_PREFIX_ . 'reinsurance` ADD `id_shop` INT(10) NOT NULL default "1" AFTER id_reinsurance')) { - $errors[] = Db::getInstance()->getMsgError(); - } - } - if (in_array('filename', $list_fields)) { - if (!Db::getInstance()->execute('ALTER TABLE `' . _DB_PREFIX_ . 'reinsurance` CHANGE `filename` `file_name` VARCHAR(100) NOT NULL')) { - $errors[] = Db::getInstance()->getMsgError(); - } - } - - $list_fields = Db::getInstance()->executeS('SHOW FIELDS FROM `' . _DB_PREFIX_ . 'reinsurance_lang`'); - - if (!is_array($list_fields) || $list_fields == false) { - $return = Db::getInstance()->execute(' - CREATE TABLE IF NOT EXISTS `' . _DB_PREFIX_ . 'reinsurance_lang` ( - `id_reinsurance` INT UNSIGNED NOT NULL AUTO_INCREMENT, - `id_lang` int(10) unsigned NOT NULL , - `text` VARCHAR(300) NOT NULL, - PRIMARY KEY (`id_reinsurance`, `id_lang`) - ) ENGINE=' . _MYSQL_ENGINE_ . ' DEFAULT CHARSET=utf8 ;'); - if (!$return) { - $errors[] = Db::getInstance()->getMsgError(); - } - } - } - - $id_module = Db::getInstance()->getValue('SELECT id_module FROM `' . _DB_PREFIX_ . 'module` WHERE name="blocktopmenu"'); - if ($id_module) { - $list_fields = Db::getInstance()->executeS('SHOW FIELDS FROM `' . _DB_PREFIX_ . 'linksmenutop`'); - foreach ($list_fields as $k => $field) { - $list_fields[$k] = $field['Field']; - } - - if (in_array('id_link', $list_fields) && !in_array('id_linksmenutop', $list_fields)) { - if (!Db::getInstance()->execute('ALTER TABLE `' . _DB_PREFIX_ . 'linksmenutop` CHANGE `id_link` `id_linksmenutop` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT')) { - $errors[] = Db::getInstance()->getMsgError(); - } - } - - $list_fields = Db::getInstance()->executeS('SHOW FIELDS FROM `' . _DB_PREFIX_ . 'linksmenutop_lang`'); - foreach ($list_fields as $k => $field) { - $list_fields[$k] = $field['Field']; - } - - if (in_array('id_link', $list_fields) && !in_array('id_linksmenutop', $list_fields)) { - if (!Db::getInstance()->execute('ALTER TABLE `' . _DB_PREFIX_ . 'linksmenutop_lang` CHANGE `id_link` `id_linksmenutop` INT(10) UNSIGNED NOT NULL')) { - $errors[] = Db::getInstance()->getMsgError(); - } - } - } - - if (count($errors)) { - return ['error' => 1, 'msg' => implode(',', $errors)]; - } -} diff --git a/upgrade/php/p15017_add_id_shop_to_primary_key.php b/upgrade/php/p15017_add_id_shop_to_primary_key.php deleted file mode 100644 index 9aea319d8..000000000 --- a/upgrade/php/p15017_add_id_shop_to_primary_key.php +++ /dev/null @@ -1,50 +0,0 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) - */ -function p15017_add_id_shop_to_primary_key() -{ - // Drop old indexes - $old_indexes = [ - 'category_lang_index' => 'category_lang', - 'shipper_lang_index' => 'carrier_lang', - 'product_lang_index' => 'product_lang', - 'id_category_shop' => 'category_shop', - ]; - foreach ($old_indexes as $index => $table) { - if (Db::getInstance()->executeS('SHOW INDEX FROM `' . _DB_PREFIX_ . $table . '` WHERE Key_name = "' . $index . '"')) { - Db::getInstance()->execute('ALTER TABLE `' . _DB_PREFIX_ . $table . '` DROP KEY `' . $index . '`'); - } - } - - // The former primary keys where set on id_object and id_lang. They must now be set on id_shop too. - foreach (['product', 'category', 'meta', 'carrier'] as $table) { - if (Db::getInstance()->executeS('SHOW INDEX FROM `' . _DB_PREFIX_ . $table . '` WHERE Key_name = "PRIMARY"')) { - Db::getInstance()->execute('ALTER TABLE `' . _DB_PREFIX_ . $table . '_lang` DROP PRIMARY KEY'); - } - Db::getInstance()->execute('ALTER TABLE `' . _DB_PREFIX_ . $table . '_lang` ADD PRIMARY KEY (`id_' . $table . '`, `id_shop`, `id_lang`)'); - } - - return true; -} diff --git a/upgrade/php/p15018_change_image_types.php b/upgrade/php/p15018_change_image_types.php deleted file mode 100644 index bc56edb00..000000000 --- a/upgrade/php/p15018_change_image_types.php +++ /dev/null @@ -1,148 +0,0 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) - */ -function p15018_change_image_types() -{ - $replace_types = [ - 'products' => [ - 'small' => ['small_default', '98', '98'], - 'medium' => ['medium_default', '125', '125'], - 'large' => ['large_default', '458', '458'], - 'thickbox' => ['thickbox_default', '800', '800'], - 'home' => ['home_default', '270', '270'], - ], - 'others' => [ - 'category' => ['category_default', '870', '217'], - 'large_scene' => ['scene_default', '520', '189'], - 'thumb_scene' => ['m_scene_default', '161', '58'], - ], - ]; - - $new_types = [ - 'products' => [ - 'small' => ['cart_default', '80', '80'], - ], - ]; - - foreach ($new_types as $type => $type_array) { - foreach ($type_array as $old_type => $new_type) { - if (is_array($new_type) && count($new_type)) { - Db::getInstance()->execute('INSERT INTO `' . _DB_PREFIX_ . 'image_type` ( - SELECT NULL, "' . $new_type[0] . '", "' . $new_type[1] . '", "' . $new_type[2] . '", products, categories, manufacturers, suppliers, scenes, stores - FROM `' . _DB_PREFIX_ . 'image_type` WHERE name = "' . $old_type . '" LIMIT 1)'); - } - } - } - - $option = (bool) Db::getInstance()->getValue('SELECT id_theme FROM `' . _DB_PREFIX_ . 'theme` WHERE directory != "default" AND directory != "prestashop"'); - - // If there is another theme than the default one, duplicate - if ($option) { - foreach ($replace_types as $type => $type_array) { - foreach ($type_array as $old_type => $new_type) { - if (is_array($new_type) && count($new_type)) { - Db::getInstance()->execute('INSERT INTO `' . _DB_PREFIX_ . 'image_type` ( - SELECT NULL, "' . $new_type[0] . '", "' . $new_type[1] . '", "' . $new_type[2] . '", products, categories, manufacturers, suppliers, scenes, stores - FROM `' . _DB_PREFIX_ . 'image_type` WHERE name = "' . $old_type . '" LIMIT 1)'); - } - // But if there is only the default one, we can update de names - else { - foreach ($replace_types as $type => $type_array) { - foreach ($type_array as $old_type => $new_type) { - if (is_array($new_type) && count($new_type)) { - Db::getInstance()->execute('UPDATE `' . _DB_PREFIX_ . 'image_type` SET name = "' . $new_type[0] . '" WHERE name = "' . $old_type . '"'); - } - } - } - } - } - } - } - - // If there is less than 500 images, copy to the new format (if there is more, the merchant will have to click "regenerate thumbnails") - $result = Db::getInstance()->executeS('SELECT id_image, id_product FROM `' . _DB_PREFIX_ . 'image`'); - if (Db::getInstance()->numRows() < 500) { - if (!defined('_PS_ROOT_DIR_')) { - define('_PS_ROOT_DIR_', realpath(INSTALL_PATH . '/../')); - } - foreach ($result as $row) { - if (file_exists(_PS_ROOT_DIR_ . DIRECTORY_SEPARATOR . 'img' . DIRECTORY_SEPARATOR . 'p' . DIRECTORY_SEPARATOR . $row['id_product'] . '-' . $row['id_image'] . '.jpg')) { - foreach ($replace_types['products'] as $old_type => $new_type) { - if (is_array($new_type) && count($new_type)) { - p15018_copy_or_rename( - _PS_ROOT_DIR_ . DIRECTORY_SEPARATOR . 'img' . DIRECTORY_SEPARATOR . 'p' . DIRECTORY_SEPARATOR . $row['id_product'] . '-' . $row['id_image'] . '-' . $old_type . '.jpg', - _PS_ROOT_DIR_ . DIRECTORY_SEPARATOR . 'img' . DIRECTORY_SEPARATOR . 'p' . DIRECTORY_SEPARATOR . $row['id_product'] . '-' . $row['id_image'] . '-' . $new_type[0] . '.jpg', - $option - ); - } - } - } - $folder = implode(DIRECTORY_SEPARATOR, str_split((string) $row['id_image'])) . DIRECTORY_SEPARATOR; - if (file_exists(_PS_ROOT_DIR_ . DIRECTORY_SEPARATOR . 'img' . DIRECTORY_SEPARATOR . 'p' . DIRECTORY_SEPARATOR . $folder . $row['id_image'] . '.jpg')) { - foreach ($replace_types['products'] as $old_type => $new_type) { - if (is_array($new_type) && count($new_type)) { - p15018_copy_or_rename( - _PS_ROOT_DIR_ . DIRECTORY_SEPARATOR . 'img' . DIRECTORY_SEPARATOR . 'p' . DIRECTORY_SEPARATOR . $folder . $row['id_image'] . '-' . $old_type . '.jpg', - _PS_ROOT_DIR_ . DIRECTORY_SEPARATOR . 'img' . DIRECTORY_SEPARATOR . 'p' . DIRECTORY_SEPARATOR . $folder . $row['id_image'] . '-' . $new_type[0] . '.jpg', - $option - ); - } - } - } - } - - // Then the other entities (if there is less than 500 products, that should not be a problem) - $directories = ['p', 'c', 'm', 's', 'su', 'scenes', 'scenes' . DIRECTORY_SEPARATOR . 'thumbs', 'st']; - foreach ($directories as $directory) { - foreach (scandir(_PS_ROOT_DIR_ . DIRECTORY_SEPARATOR . 'img' . DIRECTORY_SEPARATOR . $directory, SCANDIR_SORT_NONE) as $file) { - if (!preg_match('/^([0-9]+|[a-z]{2}-default)\-[a-z_-]+\.jpg$/i', $file)) { - continue; - } - foreach ($replace_types as $type => $type_array) { - foreach ($type_array as $old_type => $new_type) { - if (preg_match('/^([0-9]+|[a-z]{2}-default)\-' . $old_type . '\.jpg$/i', $file, $matches) && is_array($new_type) && count($new_type)) { - p15018_copy_or_rename( - _PS_ROOT_DIR_ . DIRECTORY_SEPARATOR . 'img' . DIRECTORY_SEPARATOR . $directory . DIRECTORY_SEPARATOR . $matches[1] . '-' . $old_type . '.jpg', - _PS_ROOT_DIR_ . DIRECTORY_SEPARATOR . 'img' . DIRECTORY_SEPARATOR . $directory . DIRECTORY_SEPARATOR . $matches[1] . '-' . $new_type[0] . '.jpg', - $option - ); - } - } - } - } - } - } - - return true; -} - -function p15018_copy_or_rename($from, $to, $option) -{ - if ($option) { - @copy($from, $to); - } else { - @rename($from, $to); - } -} diff --git a/upgrade/php/p1531_redirect_type.php b/upgrade/php/p1531_redirect_type.php deleted file mode 100644 index e948e0e3f..000000000 --- a/upgrade/php/p1531_redirect_type.php +++ /dev/null @@ -1,34 +0,0 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) - */ -function p1531_redirect_type() -{ - include_once __DIR__ . '/generic_add_missing_column.php'; - - $result = generic_add_missing_column('product', ['redirect_type' => 'ENUM(\'\', \'404\', \'301\', \'302\') NOT NULL DEFAULT \'404\' AFTER `active`']); - $result &= generic_add_missing_column('product_shop', ['redirect_type' => 'ENUM(\'\', \'404\', \'301\', \'302\') NOT NULL DEFAULT \'404\' AFTER `active`']); - - return $result; -} diff --git a/upgrade/php/p1540_add_missing_columns.php b/upgrade/php/p1540_add_missing_columns.php deleted file mode 100644 index a1cc45c5e..000000000 --- a/upgrade/php/p1540_add_missing_columns.php +++ /dev/null @@ -1,77 +0,0 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) - */ -function p1540_add_missing_columns() -{ - $errors = []; - $id_module = Db::getInstance()->getValue('SELECT id_module FROM `' . _DB_PREFIX_ . 'module` WHERE name = "loyalty"'); - if ($id_module) { - $list_fields = Db::getInstance()->executeS('SHOW FIELDS FROM `' . _DB_PREFIX_ . 'loyalty`'); - foreach ($list_fields as $k => $field) { - $list_fields[$k] = $field['Field']; - } - - if (in_array('id_discount', $list_fields)) { - if (!Db::getInstance()->execute('ALTER TABLE `' . _DB_PREFIX_ . 'loyalty` CHANGE `id_discount` `id_cart_rule` INT( 10 ) UNSIGNED NULL DEFAULT NULL')) { - $errors[] = Db::getInstance()->getMsgError(); - } - } - } - - $id_module = Db::getInstance()->getValue('SELECT id_module FROM `' . _DB_PREFIX_ . 'module` WHERE name = "blocklayered"'); - if ($id_module) { - $list_fields = Db::getInstance()->executeS('SHOW FIELDS FROM `' . _DB_PREFIX_ . 'layered_product_attribute`'); - if (is_array($list_fields)) { - foreach ($list_fields as $k => $field) { - $list_fields[$k] = $field['Field']; - } - if (!in_array('id_shop', $list_fields)) { - if (!Db::getInstance()->execute('ALTER TABLE `' . _DB_PREFIX_ . 'layered_product_attribute` ADD `id_shop` INT( 10 ) UNSIGNED NOT NULL DEFAULT "1" AFTER `id_attribute_group`')) { - $errors[] = Db::getInstance()->getMsgError(); - } - } - } - } - - $key_exists = Db::getInstance()->executeS('SHOW INDEX FROM `' . _DB_PREFIX_ . 'stock_available` WHERE KEY_NAME = "product_sqlstock"'); - - if (is_array($key_exists) && count($key_exists)) { - if (!Db::getInstance()->execute('ALTER TABLE `' . _DB_PREFIX_ . 'stock_available` DROP INDEX `product_sqlstock`')) { - $errors[] = Db::getInstance()->getMsgError(); - } - } - - $key_exists = Db::getInstance()->executeS('SHOW INDEX FROM `' . _DB_PREFIX_ . 'stock_available` WHERE KEY_NAME = "id_product_2"'); - - if (is_array($key_exists) && count($key_exists)) { - if (!Db::getInstance()->execute('ALTER TABLE `' . _DB_PREFIX_ . 'stock_available` DROP INDEX `id_product_2`')) { - $errors[] = Db::getInstance()->getMsgError(); - } - } - - if (count($errors)) { - return ['error' => 1, 'msg' => implode(',', $errors)]; - } -} diff --git a/upgrade/php/p16011_media_server.php b/upgrade/php/p16011_media_server.php deleted file mode 100644 index 05f1659c2..000000000 --- a/upgrade/php/p16011_media_server.php +++ /dev/null @@ -1,47 +0,0 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) - */ -function p16011_media_server() -{ - $new_settings = $prev_settings = file_get_contents(_PS_ROOT_DIR_ . '/config/settings.inc.php'); - - if (preg_match_all('/define\(\'_MEDIA_SERVER_([1-3])_\',\s*?\'(.*?)\'\s*?\)/ism', $new_settings, $matches)) { - $total = (count($matches[1])); - for ($i = 0; $i < $total; ++$i) { - Db::getInstance()->execute('INSERT INTO ' . _DB_PREFIX_ . 'configuration (`name`, `value`, `date_add`, `date_upd`) VALUES (\'PS_MEDIA_SERVER_' . $matches[1][$i] . '\', \'' . $matches[2][$i] . '\', NOW(), NOW())'); - } - } - - $new_settings = preg_replace('/define\(\'_MEDIA_SERVER_[1-3]_\',\s*?\'.*?\'\s*?\);/ism', '', $new_settings); - - if ($new_settings == $prev_settings || ( - copy(_PS_ROOT_DIR_ . '/config/settings.inc.php', _PS_ROOT_DIR_ . '/config/settings.old.php') - && (bool) file_put_contents(_PS_ROOT_DIR_ . '/config/settings.inc.php', $new_settings) - )) { - return true; - } - - return false; -} diff --git a/upgrade/php/p16012_pack_rework.php b/upgrade/php/p16012_pack_rework.php deleted file mode 100644 index 1ac2d1d98..000000000 --- a/upgrade/php/p16012_pack_rework.php +++ /dev/null @@ -1,87 +0,0 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) - */ -function p16012_pack_rework() -{ - Db::getInstance()->execute('INSERT INTO `' . _DB_PREFIX_ . 'configuration` (`id_configuration`, `name`, `value`, `date_add`, `date_upd`) VALUES (NULL, "PS_PACK_STOCK_TYPE", "0", NOW(), NOW())'); - $all_product_in_pack = Db::getInstance()->executeS('SELECT `id_product_item` FROM ' . _DB_PREFIX_ . 'pack GROUP BY `id_product_item`'); - foreach ($all_product_in_pack as $value) { - Db::getInstance()->execute('UPDATE ' . _DB_PREFIX_ . 'pack - SET `id_product_attribute_item` = ' . (getDefaultAttribute($value['id_product_item']) ? getDefaultAttribute($value['id_product_item']) . ' ' : '0 ') . ' - WHERE `id_product_item` = ' . $value['id_product_item']); - } - - $all_product_pack = Db::getInstance()->executeS('SELECT `id_product_pack` FROM ' . _DB_PREFIX_ . 'pack GROUP BY `id_product_pack`'); - foreach ($all_product_pack as $value) { - $work_with_stock = 1; - $lang = Db::getInstance()->executeS('SELECT value FROM ' . _DB_PREFIX_ . 'configuration WHERE `id_shop` = NULL AND `id_shop_group` = NULL AND `name` = "PS_LANG_DEFAULT"'); - $products = getItems($value['id_product_pack']); - foreach ($products as $product) { - if ($product != 1) { - $work_with_stock = 0; - - break; - } - } - if ($work_with_stock) { - Db::getInstance()->execute('UPDATE ' . _DB_PREFIX_ . 'product SET `pack_stock_type` = 1 WHERE `id_product` = ' . (int) $value['id_product_pack']); - } - } -} - -function getDefaultAttribute($id_product) -{ - static $combinations = []; - - if (!isset($combinations[$id_product])) { - $combinations[$id_product] = []; - } - if (isset($combinations[$id_product]['default'])) { - return $combinations[$id_product]['default']; - } - - $sql = 'SELECT id_product_attribute - FROM ' . _DB_PREFIX_ . 'product_attribute - WHERE default_on = 1 AND id_product = ' . (int) $id_product; - $result = Db::getInstance()->getValue($sql); - - $combinations[$id_product]['default'] = $result ? $result : ($result = Db::getInstance()->getValue('SELECT id_product_attribute - FROM ' . _DB_PREFIX_ . 'product_attribute - WHERE id_product = ' . (int) $id_product)); - - return $result; -} - -function getItems($id_product) -{ - $result = Db::getInstance()->executeS('SELECT id_product_item, quantity FROM ' . _DB_PREFIX_ . 'pack where id_product_pack = ' . (int) $id_product); - $array_result = []; - foreach ($result as $row) { - $p = Db::getInstance()->executeS('SELECT `advanced_stock_management` FROM ' . _DB_PREFIX_ . 'product WHERE `id_product` = ' . (int) $row['id_product_item']); - $array_result[] = $p[0]['advanced_stock_management']; - } - - return $array_result; -} diff --git a/upgrade/php/p1603_add_attachment_size.php b/upgrade/php/p1603_add_attachment_size.php deleted file mode 100644 index e7cfc8a6c..000000000 --- a/upgrade/php/p1603_add_attachment_size.php +++ /dev/null @@ -1,33 +0,0 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) - */ -function p1603_add_attachment_size() -{ - $attachments = Db::getInstance()->executeS('SELECT id_attachment, file FROM ' . _DB_PREFIX_ . 'attachment'); - foreach ($attachments as $attachment) { - $file_size = @filesize(_PS_DOWNLOAD_DIR_ . $attachment['file']); - Db::getInstance()->execute('UPDATE ' . _DB_PREFIX_ . 'attachment SET file_size = ' . (int) $file_size . ' WHERE id_attachement = ' . (int) $attachment['id_attachment']); - } -} diff --git a/upgrade/php/p1606module_exceptions.php b/upgrade/php/p1606module_exceptions.php deleted file mode 100644 index 004c8d9ac..000000000 --- a/upgrade/php/p1606module_exceptions.php +++ /dev/null @@ -1,103 +0,0 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) - */ -function p1606module_exceptions() -{ - $modules_dir = scandir(_PS_MODULE_DIR_, SCANDIR_SORT_NONE); - $modules_controllers = $core_controllers = []; - $core_controllers = []; - - foreach ($modules_dir as $module_dir) { - $module_path = _PS_MODULE_DIR_ . $module_dir; - - if ($module_dir[0] == '.' || $module_dir == 'index.php') { - continue; - } - - if (file_exists($module_path . '/controllers/') && is_dir($module_path . '/controllers/')) { - $module_path_admin = $module_path . '/controllers/admin/'; - if (file_exists($module_path_admin) && is_dir($module_path_admin)) { - $admin = scandir($module_path_admin, SCANDIR_SORT_NONE); - foreach ($admin as $a_controller) { - if ($a_controller[0] == '.' || $a_controller == 'index.php') { - continue; - } - if (isset($modules_controllers[$module_dir])) { - $modules_controllers[$module_dir][] = str_replace('.php', '', $a_controller); - } else { - $modules_controllers[$module_dir] = [str_replace('.php', '', $a_controller)]; - } - } - } - - $module_path_front = $module_path . '/controllers/front/'; - if (file_exists($module_path_front) && is_dir($module_path_front)) { - $front = scandir($module_path_front, SCANDIR_SORT_NONE); - foreach ($front as $f_controller) { - if ($f_controller[0] == '.' || $f_controller == 'index.php') { - continue; - } - if (isset($modules_controllers[$module_dir])) { - $modules_controllers[$module_dir][] = str_replace('.php', '', $f_controller); - } else { - $modules_controllers[$module_dir] = [str_replace('.php', '', $f_controller)]; - } - } - } - } - } - - $controller_dir = _PS_ROOT_DIR_ . '/controllers/front/'; - - if (file_exists($controller_dir) && is_dir($controller_dir)) { - $front_controllers = scandir($controller_dir, SCANDIR_SORT_NONE); - - foreach ($front_controllers as $controller) { - if ($controller[0] == '.' || $controller == 'index.php') { - continue; - } - $core_controllers[] = strtolower(str_replace('Controller.php', '', $controller)); - } - } - - $hook_module_exceptions = Db::getInstance()->executeS('SELECT * FROM `' . _DB_PREFIX_ . 'hook_module_exceptions`'); - $sql_insert = 'INSERT INTO `' . _DB_PREFIX_ . 'hook_module_exceptions` (`id_hook_module_exceptions`, `id_shop`, `id_module`, `id_hook`, `file_name`) VALUES '; - $sql_delete = 'DELETE FROM `' . _DB_PREFIX_ . 'hook_module_exceptions` WHERE '; - - foreach ($hook_module_exceptions as $exception) { - foreach ($modules_controllers as $module => $controllers) { - if (in_array($exception['file_name'], $controllers) && !in_array($exception['file_name'], $core_controllers)) { - $sql_delete .= ' `id_hook_module_exceptions` = ' . (int) $exception['id_hook_module_exceptions'] . ' AND'; - foreach ($controllers as $cont) { - if ($exception['file_name'] == $cont) { - $sql_insert .= '(null, ' . (int) $exception['id_shop'] . ', ' . (int) $exception['id_module'] . ', ' . (int) $exception['id_hook'] . ', \'module-' . pSQL($module) . '-' . pSQL($exception['file_name']) . '\'),'; - } - } - } - } - } - Db::getInstance()->execute($sql_insert); - Db::getInstance()->execute($sql_delete); -} diff --git a/upgrade/php/p1607_drop_primary_key_if_exists.php b/upgrade/php/p1607_drop_primary_key_if_exists.php deleted file mode 100644 index 21bebb34f..000000000 --- a/upgrade/php/p1607_drop_primary_key_if_exists.php +++ /dev/null @@ -1,33 +0,0 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) - */ -function p1607_drop_primary_key_if_exists() -{ - if (Db::getInstance()->executeS('SHOW INDEX FROM `' . _DB_PREFIX_ . 'order_detail_tax` WHERE Key_name = "PRIMARY"')) { - Db::getInstance()->execute('ALTER TABLE `' . _DB_PREFIX_ . 'order_detail_tax` DROP PRIMARY KEY'); - } - - return true; -} diff --git a/upgrade/php/ps1600_add_missing_index.php b/upgrade/php/ps1600_add_missing_index.php deleted file mode 100644 index 004465158..000000000 --- a/upgrade/php/ps1600_add_missing_index.php +++ /dev/null @@ -1,37 +0,0 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) - */ -function ps1600_add_missing_index() -{ - $key_exists = Db::getInstance()->executeS(' - SHOW INDEX - FROM `' . _DB_PREFIX_ . 'connections` - WHERE Key_name = "id_guest"'); - if (!$key_exists) { - Db::getInstance()->execute('ALTER TABLE `' . _DB_PREFIX_ . 'connections` ADD INDEX (`id_guest`)'); - } - - return true; -} diff --git a/upgrade/php/ps16012_update_alias.php b/upgrade/php/ps16012_update_alias.php deleted file mode 100644 index e7c8443e1..000000000 --- a/upgrade/php/ps16012_update_alias.php +++ /dev/null @@ -1,52 +0,0 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) - */ -function ps16012_update_alias() -{ - $step = 3000; - $count_alias = Db::getInstance()->getValue('SELECT count(id_alias) FROM ' . _DB_PREFIX_ . 'alias'); - $nb_loop = $start = 0; - - if ($count_alias > 0) { - $nb_loop = ceil($count_alias / $step); - } - for ($i = 0; $i < $nb_loop; ++$i) { - $sql = 'SELECT id_alias, alias, search FROM `' . _DB_PREFIX_ . 'alias`'; - $start = (int) (($i + 1) * $step); - if ($aliass = Db::getInstance()->query($sql)) { - while ($alias = Db::getInstance()->nextRow($aliass)) { - if (is_array($alias)) { - Db::getInstance()->execute(' - UPDATE `' . _DB_PREFIX_ . 'alias` - SET alias = \'' . pSQL(Tools::replaceAccentedChars($alias['alias'])) . '\', - search = \'' . pSQL(Tools::replaceAccentedChars($alias['search'])) . '\' - WHERE id_alias = ' . (int) $alias['id_alias']); - } - } - } - } - - return true; -} diff --git a/upgrade/php/ps1604_update_employee_date.php b/upgrade/php/ps1604_update_employee_date.php deleted file mode 100644 index fd93f4c3d..000000000 --- a/upgrade/php/ps1604_update_employee_date.php +++ /dev/null @@ -1,33 +0,0 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) - */ -function ps1604_update_employee_date() -{ - if (defined('_PS_CREATION_DATE_')) { - return Db::getInstance()->execute('UPDATE `' . _DB_PREFIX_ . 'employee` SET stats_date_from = \'' . addslashes(_PS_CREATION_DATE_) . '\' WHERE `stats_date_from` < \'' . addslashes(_PS_CREATION_DATE_) . '\''); - } - - return true; -} diff --git a/upgrade/php/ps1605_change_index.php b/upgrade/php/ps1605_change_index.php deleted file mode 100644 index 5b37fe4fe..000000000 --- a/upgrade/php/ps1605_change_index.php +++ /dev/null @@ -1,33 +0,0 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) - */ -function ps1605_change_index() -{ - $index = Db::getInstance()->executeS('SHOW INDEX FROM `' . _DB_PREFIX_ . 'order_detail_tax` WHERE Key_name = "id_tax"'); - if (is_array($index) && count($index)) { - Db::getInstance()->execute('ALTER IGNORE TABLE `' . _DB_PREFIX_ . 'order_detail_tax` DROP INDEX `id_tax`'); - } - Db::getInstance()->execute('ALTER IGNORE TABLE `' . _DB_PREFIX_ . 'order_detail_tax` ADD INDEX (`id_tax`)'); -} diff --git a/upgrade/php/ps1607_language_code_update.php b/upgrade/php/ps1607_language_code_update.php deleted file mode 100644 index d042759d2..000000000 --- a/upgrade/php/ps1607_language_code_update.php +++ /dev/null @@ -1,43 +0,0 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) - */ -function ps1607_language_code_update() -{ - if (defined('_PS_VERSION_')) { - $langs = Db::getInstance()->executeS('SELECT `id_lang`, `iso_code`, `language_code` FROM `' . _DB_PREFIX_ . 'lang`'); - if (is_array($langs) && $langs) { - foreach ($langs as $lang) { - if (Tools::strlen($lang['language_code']) == 2) { - $result = json_decode(Tools::file_get_contents('https://www.prestashop.com/download/lang_packs/get_language_pack.php?version=' . _PS_VERSION_ . '&iso_lang=' . Tools::strtolower($lang['iso_code']))); - if ($result && !isset($result->error) && Tools::strlen($result->language_code) > 2) { - Db::getInstance()->execute('UPDATE `' . _DB_PREFIX_ . 'lang` SET `language_code` = \'' . pSQL($result->language_code) . '\' WHERE `id_lang` = ' . (int) $lang['id_lang']) . ' LIMIT 1'; - } - } - } - } - } - - return true; -} diff --git a/upgrade/php/ps1700_stores.php b/upgrade/php/ps1700_stores.php deleted file mode 100644 index 86a2145c0..000000000 --- a/upgrade/php/ps1700_stores.php +++ /dev/null @@ -1,54 +0,0 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) - */ -function ps1700_stores() -{ - $stores = Db::getInstance()->executeS(' - SELECT `id_store`, `hours` - FROM `' . _DB_PREFIX_ . 'store` - '); - - $result = true; - foreach ($stores as $store) { - $hours = Tools::unSerialize($store['hours']); - if (is_array($hours)) { - foreach ($hours as $key => $h) { - $hours[$key] = [$h]; - } - } else { - $hours = []; - } - $hours = json_encode($hours); - - $result &= Db::getInstance()->execute( - ' - UPDATE `' . _DB_PREFIX_ . 'store` - SET `hours` = \'' . $hours . '\' - WHERE `id_store` = ' . $store['id_store'] - ); - } - - return $result; -} diff --git a/upgrade/php/ps_1700_add_locale.php b/upgrade/php/ps_1700_add_locale.php deleted file mode 100644 index f05c0f2f7..000000000 --- a/upgrade/php/ps_1700_add_locale.php +++ /dev/null @@ -1,41 +0,0 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) - */ -function ps_1700_add_locale() -{ - $locale = file_get_contents(__DIR__ . '/../legacy-to-standard-locales.json'); - $locale_mapping = json_decode($locale, true); - $results = Db::getInstance()->executeS('SELECT id_lang, iso_code FROM ' . _DB_PREFIX_ . 'lang'); - foreach ($results as $result) { - $id_lang = $result['id_lang']; - $iso_code = $result['iso_code']; - if (array_key_exists($iso_code, $locale_mapping)) { - $locale = $locale_mapping[$iso_code]; - Db::getInstance()->execute('UPDATE ' . _DB_PREFIX_ . 'lang SET locale="' . $locale . '" WHERE id_lang="' . $id_lang . '"'); - } - } - - return true; -} diff --git a/upgrade/php/ps_1700_add_payment_preferences_tab.php b/upgrade/php/ps_1700_add_payment_preferences_tab.php deleted file mode 100644 index 743e721a9..000000000 --- a/upgrade/php/ps_1700_add_payment_preferences_tab.php +++ /dev/null @@ -1,39 +0,0 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) - */ -function ps_1700_add_payment_preferences_tab() -{ - include_once 'add_new_tab.php'; - // TODO: ajouter les trads ? translations/[fr]/tabs.php et autre ? - add_new_tab( - 'AdminPaymentPreferences', - 'en:Payment preferences|fr:Préférences de paiement|es:Hola|de:Artung|it:Mama mia', - 0, - false, - 'AdminParentModules' - ); - - return true; -} diff --git a/upgrade/php/ps_1700_reset_theme.php b/upgrade/php/ps_1700_reset_theme.php deleted file mode 100644 index 5574784d6..000000000 --- a/upgrade/php/ps_1700_reset_theme.php +++ /dev/null @@ -1,35 +0,0 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) - */ - -use PrestaShop\PrestaShop\Core\Addon\Theme\ThemeManagerBuilder; - -function ps_1700_reset_theme() -{ - $theme = (new ThemeManagerBuilder(Context::getContext(), Db::getInstance()))->build(); - $theme->reset('classic'); - - return true; -} diff --git a/upgrade/php/ps_1700_right_management.php b/upgrade/php/ps_1700_right_management.php deleted file mode 100644 index 5e41e425e..000000000 --- a/upgrade/php/ps_1700_right_management.php +++ /dev/null @@ -1,91 +0,0 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) - */ -function ps_1700_right_management() -{ - $actions = ['CREATE', 'READ', 'UPDATE', 'DELETE']; - - /* - * Add roles - */ - foreach (['TAB' => 'class_name', 'MODULE' => 'name'] as $element => $nameColumn) { - foreach ($actions as $action) { - Db::getInstance()->execute(' - INSERT IGNORE INTO `' . _DB_PREFIX_ . 'authorization_role` - (`slug`) - SELECT CONCAT("ROLE_MOD_' . $element . '_", UCASE(`' . $nameColumn . '`), "_' . $action . '") - FROM `' . _DB_PREFIX_ . strtolower($element) . '` - '); - } - } - - /** - * Add access - */ - $accessObject = new Access(); - - // Tabs - $oldAccess = Db::getInstance()->executeS('SELECT t.id_tab, a.id_profile, a.view, a.add, a.edit, a.delete FROM `' . _DB_PREFIX_ . 'tab` t LEFT JOIN `' . _DB_PREFIX_ . 'access_old` a USING (id_tab)'); - if (empty($oldAccess)) { - $oldAccess = []; - } - foreach ($oldAccess as $currOldAccess) { - foreach (['view', 'add', 'edit', 'delete'] as $action) { - if (array_key_exists($action, $currOldAccess) && ($currOldAccess[$action] == '1' - || $currOldAccess['id_profile'] == _PS_ADMIN_PROFILE_ - || empty($currOldAccess['id_profile']))) { - $accessObject->updateLgcAccess( - !empty($currOldAccess['id_profile']) ? $currOldAccess['id_profile'] : _PS_ADMIN_PROFILE_, - $currOldAccess['id_tab'], - $action, - true - ); - } - } - } - - // Modules - $oldAccess = Db::getInstance()->executeS('SELECT mo.id_module, m.id_profile, m.configure, m.view, m.uninstall FROM `' . _DB_PREFIX_ . 'module` mo LEFT JOIN `' . _DB_PREFIX_ . 'module_access_old` m USING (id_module)'); - if (empty($oldAccess)) { - $oldAccess = []; - } - - foreach ($oldAccess as $currOldAccess) { - foreach (['configure', 'view', 'uninstall'] as $action) { - if (array_key_exists($action, $currOldAccess) && ($currOldAccess[$action] == '1' - || $currOldAccess['id_profile'] == _PS_ADMIN_PROFILE_ - || empty($currOldAccess['id_profile']))) { - $accessObject->updateLgcModuleAccess( - !empty($currOldAccess['id_profile']) ? $currOldAccess['id_profile'] : _PS_ADMIN_PROFILE_, - $currOldAccess['id_module'], - $action, - true - ); - } - } - } - - return true; -} diff --git a/upgrade/php/ps_1700_short_description_config.php b/upgrade/php/ps_1700_short_description_config.php deleted file mode 100644 index b6e995a56..000000000 --- a/upgrade/php/ps_1700_short_description_config.php +++ /dev/null @@ -1,36 +0,0 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) - */ - -/** - * Preset enabled new column in tabs to true for all (except for disabled modules). - */ -function ps_1700_short_description_config() -{ - Configuration::loadConfiguration(); - - return empty(Configuration::get('PS_PRODUCT_SHORT_DESC_LIMIT')) - ? Configuration::updateValue('PS_PRODUCT_SHORT_DESC_LIMIT', 800) : true; -} diff --git a/upgrade/php/ps_1750_update_module_tabs.php b/upgrade/php/ps_1750_update_module_tabs.php index 755e07a14..d794da508 100644 --- a/upgrade/php/ps_1750_update_module_tabs.php +++ b/upgrade/php/ps_1750_update_module_tabs.php @@ -50,7 +50,7 @@ function ps_1750_update_module_tabs() } // STEP 2: Rename module tabs (Notifications as Alerts, Module selection as Module Catalog, Module Catalog as Module Selections) - include_once 'clean_tabs_15.php'; + include_once 'rename_tab.php'; $adminModulesNotificationsTabId = Db::getInstance()->getValue( 'SELECT id_tab FROM ' . _DB_PREFIX_ . 'tab WHERE class_name = "AdminModulesNotifications"' ); diff --git a/upgrade/php/ps_1751_update_module_sf_tab.php b/upgrade/php/ps_1751_update_module_sf_tab.php index 53df45b10..52d396598 100644 --- a/upgrade/php/ps_1751_update_module_sf_tab.php +++ b/upgrade/php/ps_1751_update_module_sf_tab.php @@ -30,7 +30,7 @@ function ps_1751_update_module_sf_tab() { // Rename parent module tab (= Module manager) - include_once 'clean_tabs_15.php'; + include_once 'rename_tab.php'; $adminModulesParentTabId = Db::getInstance()->getValue( 'SELECT id_tab FROM ' . _DB_PREFIX_ . 'tab WHERE class_name = "AdminModulesSf"' ); diff --git a/upgrade/php/regenerate_level_depth.php b/upgrade/php/regenerate_level_depth.php deleted file mode 100644 index b5985cc20..000000000 --- a/upgrade/php/regenerate_level_depth.php +++ /dev/null @@ -1,57 +0,0 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) - */ - -/** - * Regenerate the entire category tree level_depth - */ -function regenerate_level_depth() -{ - Db::getInstance()->execute('UPDATE `' . _DB_PREFIX_ . 'category` SET `level_depth` = 0 WHERE `id_category` = 1'); - regenerate_children_categories(1, 0); -} - -/** - * Recursively regenerate the level_depth of this category's children - * - * @param int $id_category - * @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/upgrade/php/remove_duplicate_category_groups.php b/upgrade/php/remove_duplicate_category_groups.php deleted file mode 100644 index fbcc16c31..000000000 --- a/upgrade/php/remove_duplicate_category_groups.php +++ /dev/null @@ -1,49 +0,0 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) - */ - -/** - * Removes duplicates from table category_group caused by a bug in category importing in PS < 1.4.2 - */ -function remove_duplicate_category_groups() -{ - $result = Db::getInstance()->executeS(' - SELECT `id_category`, `id_group`, COUNT(*) as `count` - FROM `' . _DB_PREFIX_ . 'category_group` - GROUP BY `id_category`, `id_group` - ORDER BY `count` DESC'); - - foreach ($result as $row) { - if ((int) $row['count'] > 1) { - $limit = (int) $row['count'] - 1; - $result = Db::getInstance()->execute(' - DELETE FROM `' . _DB_PREFIX_ . 'category_group` - WHERE `id_category` = ' . $row['id_category'] . ' AND `id_group` = ' . $row['id_group'] . ' - LIMIT ' . $limit); - } else { - return; - } - } -} diff --git a/upgrade/php/remove_module_from_hook.php b/upgrade/php/remove_module_from_hook.php deleted file mode 100644 index dcf2e7c98..000000000 --- a/upgrade/php/remove_module_from_hook.php +++ /dev/null @@ -1,49 +0,0 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) - */ -function remove_module_from_hook($module_name, $hook_name) -{ - $result = true; - - $id_module = Db::getInstance()->getValue( - ' - SELECT `id_module` FROM `' . _DB_PREFIX_ . 'module` - WHERE `name` = \'' . pSQL($module_name) . '\'' - ); - - if ((int) $id_module > 0) { - $id_hook = Db::getInstance()->getValue(' - SELECT `id_hook` FROM `' . _DB_PREFIX_ . 'hook` WHERE `name` = \'' . pSQL($hook_name) . '\' - '); - - if ((int) $id_hook > 0) { - $result &= Db::getInstance()->execute(' - DELETE FROM `' . _DB_PREFIX_ . 'hook_module` - WHERE `id_module` = ' . (int) $id_module . ' AND `id_hook` = ' . (int) $id_hook); - } - } - - return $result; -} diff --git a/upgrade/php/remove_tab.php b/upgrade/php/remove_tab.php deleted file mode 100644 index c7efe0de2..000000000 --- a/upgrade/php/remove_tab.php +++ /dev/null @@ -1,32 +0,0 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) - */ -function remove_tab($tabname) -{ - Db::getInstance()->execute(' - DELETE t, l - FROM `' . _DB_PREFIX_ . 'tab` t LEFT JOIN `' . _DB_PREFIX_ . 'tab_lang` l ON (t.id_tab = l.id_tab) - WHERE t.`class_name` = "' . pSQL($tabname) . '"'); -} diff --git a/upgrade/php/alter_productcomments_guest_index.php b/upgrade/php/rename_tab.php similarity index 73% rename from upgrade/php/alter_productcomments_guest_index.php rename to upgrade/php/rename_tab.php index 59fd1ab25..525e37270 100644 --- a/upgrade/php/alter_productcomments_guest_index.php +++ b/upgrade/php/rename_tab.php @@ -23,16 +23,16 @@ * @copyright Since 2007 PrestaShop SA and Contributors * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) */ -function alter_productcomments_guest_index() +function renameTab($id_tab, $names) { - $id_productcomments = Db::getInstance()->getValue('SELECT id_module - FROM `' . _DB_PREFIX_ . 'module` WHERE name = "productcomments"'); - - if (!$id_productcomments) { + if (!$id_tab) { return; } + $langues = Db::getInstance()->executeS('SELECT * FROM ' . _DB_PREFIX_ . 'lang'); - Db::getInstance()->execute(' - ALTER TABLE `' . _DB_PREFIX_ . 'product_comment` - DROP INDEX `id_guest`, ADD INDEX `id_guest` (`id_guest`);'); + foreach ($langues as $lang) { + if (array_key_exists($lang['iso_code'], $names)) { + Db::getInstance()->update('tab_lang', ['name' => $names[$lang['iso_code']]], '`id_tab`= ' . $id_tab . ' AND `id_lang` =' . $lang['id_lang']); + } + } } diff --git a/upgrade/php/reorderpositions.php b/upgrade/php/reorderpositions.php deleted file mode 100644 index e7a33aae8..000000000 --- a/upgrade/php/reorderpositions.php +++ /dev/null @@ -1,105 +0,0 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) - */ -function reorderpositions() -{ - $res = true; - $ps_lang_default = Db::getInstance()->getValue('SELECT value - FROM `' . _DB_PREFIX_ . 'configuration` - WHERE name="PS_LANG_DEFAULT"'); - /* Clean products positions */ - $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 = count($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'])); - } - } - } - - $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` = ' . $ps_lang_default . ') - WHERE c.id_parent = ' . (int) ($parent['id_parent']) . ' - ORDER BY name ASC'); - foreach ($result as $i => $categ) { - Db::getInstance()->execute(' - UPDATE `' . _DB_PREFIX_ . 'category` - SET `position` = ' . (int) ($i) . ' - WHERE `id_parent` = ' . (int) ($categ['id_parent']) . ' - AND `id_category` = ' . (int) ($categ['id_category'])); - } - - $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`) - WHERE c.id_parent = ' . (int) ($parent['id_parent']) . ' - ORDER BY name ASC'); - - // Remove number from category name - foreach ($result as $i => $categ) { - Db::getInstance()->execute('UPDATE `' . _DB_PREFIX_ . 'category` c - LEFT JOIN `' . _DB_PREFIX_ . 'category_lang` cl ON (c.`id_category` = cl.`id_category`) - SET `name` = \'' . preg_replace('/^[0-9]+\./', '', $categ['name']) . '\' - WHERE c.id_category = ' . (int) ($categ['id_category']) . ' AND id_lang = \'' . (int) ($categ['id_lang']) . '\''); - } - } - - /* Clean CMS positions */ - $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) { - $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 = count($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); - } - } - } -} diff --git a/upgrade/php/select_current_payment_modules.php b/upgrade/php/select_current_payment_modules.php deleted file mode 100644 index f826f881d..000000000 --- a/upgrade/php/select_current_payment_modules.php +++ /dev/null @@ -1,70 +0,0 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) - */ - -/** - * Select all current payment modules for the carrier restriction - */ -function select_current_payment_modules() -{ - $shops = Db::getInstance()->executeS( - ' - SELECT `id_shop` - FROM `' . _DB_PREFIX_ . 'shop`' - ); - $carriers = Db::getInstance()->executeS( - ' - SELECT DISTINCT `id_reference` - FROM `' . _DB_PREFIX_ . 'carrier` - WHERE `active` = 1 - AND `deleted` = 0' - ); - $modules = Db::getInstance()->executeS( - ' - SELECT m.`id_module` - FROM `' . _DB_PREFIX_ . 'module` m - LEFT JOIN `' . _DB_PREFIX_ . 'hook_module` hm ON hm.`id_module` = m.`id_module` - LEFT JOIN `' . _DB_PREFIX_ . 'hook` h ON hm.`id_hook` = h.`id_hook` - WHERE h.`name` = \'displayPayment\' OR h.`name` = \'displayPaymentEU\' OR h.`name` = \'paymentOptions\'' - ); - - foreach ($shops as $shop) { - foreach ($carriers as $carrier) { - foreach ($modules as $module) { - Db::getInstance()->insert( - 'module_carrier', - [ - 'id_reference' => (int) $carrier['id_reference'], - 'id_module' => (int) $module['id_module'], - 'id_shop' => (int) $shop['id_shop'], - ], - false, - false, - Db::INSERT_IGNORE - ); - } - } - } -} diff --git a/upgrade/php/set_discount_category.php b/upgrade/php/set_discount_category.php deleted file mode 100644 index 54dd7e8ce..000000000 --- a/upgrade/php/set_discount_category.php +++ /dev/null @@ -1,35 +0,0 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) - */ -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`'); - 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']) . ')'); - } - } -} diff --git a/upgrade/php/set_payment_module.php b/upgrade/php/set_payment_module.php deleted file mode 100644 index ef3cfee49..000000000 --- a/upgrade/php/set_payment_module.php +++ /dev/null @@ -1,50 +0,0 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) - */ -function set_payment_module() -{ - // Get all modules then select only payment ones - $modules = Module::getModulesInstalled(); - foreach ($modules as $module) { - $file = _PS_MODULE_DIR_ . $module['name'] . '/' . $module['name'] . '.php'; - if (!file_exists($file)) { - continue; - } - $fd = fopen($file, 'rb'); - if (!$fd) { - continue; - } - $content = fread($fd, filesize($file)); - if (preg_match_all('/extends PaymentModule/U', $content, $matches)) { - 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(' - INSERT INTO `' . _DB_PREFIX_ . 'module_currency` (id_module, id_currency) - SELECT ' . (int) ($module['id_module']) . ', id_currency FROM `' . _DB_PREFIX_ . 'currency` WHERE deleted = 0'); - } - fclose($fd); - } -} diff --git a/upgrade/php/set_payment_module_group.php b/upgrade/php/set_payment_module_group.php deleted file mode 100644 index c16792ed2..000000000 --- a/upgrade/php/set_payment_module_group.php +++ /dev/null @@ -1,47 +0,0 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) - */ -function set_payment_module_group() -{ - // Get all modules then select only payment ones - $modules = Db::getInstance()->executeS('SELECT * FROM `' . _DB_PREFIX_ . 'module`'); - foreach ($modules as $module) { - $file = _PS_MODULE_DIR_ . $module['name'] . '/' . $module['name'] . '.php'; - if (!file_exists($file)) { - continue; - } - $fd = @fopen($file, 'rb'); - if (!$fd) { - continue; - } - $content = fread($fd, filesize($file)); - if (preg_match_all('/extends PaymentModule/U', $content, $matches)) { - Db::getInstance()->execute(' - INSERT INTO `' . _DB_PREFIX_ . 'module_group` (id_module, id_group) - SELECT ' . (int) ($module['id_module']) . ', id_group FROM `' . _DB_PREFIX_ . 'group`'); - } - fclose($fd); - } -} diff --git a/upgrade/php/set_product_suppliers.php b/upgrade/php/set_product_suppliers.php deleted file mode 100644 index e2b4a3712..000000000 --- a/upgrade/php/set_product_suppliers.php +++ /dev/null @@ -1,74 +0,0 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) - */ -function set_product_suppliers() -{ - $ps_currency_default = Db::getInstance()->getValue('SELECT value - FROM `' . _DB_PREFIX_ . 'configuration` WHERE name="PS_CURRENCY_DEFAULT"'); - - //Get all products with positive quantity - $resource = Db::getInstance()->query(' - SELECT id_supplier, id_product, supplier_reference, wholesale_price - FROM `' . _DB_PREFIX_ . 'product` - WHERE `id_supplier` > 0 - '); - - while ($row = Db::getInstance()->nextRow($resource)) { - //Set default supplier for product - Db::getInstance()->execute(' - INSERT INTO `' . _DB_PREFIX_ . 'product_supplier` - (`id_product`, `id_product_attribute`, `id_supplier`, - `product_supplier_reference`, `product_supplier_price_te`, - `id_currency`) - VALUES - ("' . (int) $row['id_product'] . '", "0", "' . (int) $row['id_supplier'] . '", - "' . pSQL($row['supplier_reference']) . '", "' . (int) $row['wholesale_price'] . '", - "' . (int) $ps_currency_default . '") - '); - - //Try to get product attribues - $attributes = Db::getInstance()->executeS( - ' - SELECT id_product_attribute, supplier_reference, wholesale_price - FROM `' . _DB_PREFIX_ . 'product_attribute` - WHERE `id_product` = ' . (int) $row['id_product'] - ); - - //Add each attribute to stock_available - foreach ($attributes as $attribute) { - // set supplier for attribute - Db::getInstance()->execute(' - INSERT INTO `' . _DB_PREFIX_ . 'product_supplier` - (`id_product`, `id_product_attribute`, - `id_supplier`, `product_supplier_reference`, - `product_supplier_price_te`, `id_currency`) - VALUES - ("' . (int) $row['id_product'] . '", "' . (int) $attribute['id_product_attribute'] . '", - "' . (int) $row['id_supplier'] . '", "' . pSQL($attribute['supplier_reference']) . '", - "' . (int) $attribute['wholesale_price'] . '", "' . (int) $ps_currency_default . '") - '); - } - } -} diff --git a/upgrade/php/set_stock_available.php b/upgrade/php/set_stock_available.php deleted file mode 100644 index fb76124b0..000000000 --- a/upgrade/php/set_stock_available.php +++ /dev/null @@ -1,81 +0,0 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) - */ -function set_stock_available() -{ - $res = true; - //Get all products with positive quantity - $resource = Db::getInstance()->query(' - SELECT quantity, id_product, out_of_stock - FROM `' . _DB_PREFIX_ . 'product` - WHERE `active` = 1 - '); - - while ($row = Db::getInstance()->nextRow($resource)) { - $quantity = 0; - - //Try to get product attribues - $attributes = Db::getInstance()->executeS( - ' - SELECT quantity, id_product_attribute - FROM `' . _DB_PREFIX_ . 'product_attribute` - WHERE `id_product` = ' . (int) $row['id_product'] - ); - - //Add each attribute to stock_available - foreach ($attributes as $attribute) { - // add to global quantity - $quantity += $attribute['quantity']; - - //add stock available for attributes - $res &= Db::getInstance()->execute(' - INSERT INTO `' . _DB_PREFIX_ . 'stock_available` - (`id_product`, `id_product_attribute`, `id_shop`, `id_group_shop`, `quantity`, `depends_on_stock`, `out_of_stock`) - VALUES - ("' . (int) $row['id_product'] . '", "' . (int) $attribute['id_product_attribute'] . '", "1", "0", "' . (int) $attribute['quantity'] . '", "0", "' . (int) $row['out_of_stock'] . '") - '); - if (!$res) { - return ['error' => Db::getInstance()->getNumberError(), 'msg' => '(attributes)' . Db::getInstance()->getMsgError()]; - } - } - - if (count($attributes) == 0) { - $quantity = (int) $row['quantity']; - } - - //Add stock available for product; - $res &= Db::getInstance()->execute(' - INSERT INTO `' . _DB_PREFIX_ . 'stock_available` - (`id_product`, `id_product_attribute`, `id_shop`, `id_group_shop`, `quantity`, `depends_on_stock`, `out_of_stock`) - VALUES - ("' . (int) $row['id_product'] . '", "0", "1", "0", "' . (int) $quantity . '", "0", "' . (int) $row['out_of_stock'] . '") - '); - if (!$res) { - return ['error' => Db::getInstance()->getNumberError(), 'msg' => '(products)' . Db::getInstance()->getMsgError()]; - } - } - - return $res; -} diff --git a/upgrade/php/setallgroupsonhomecategory.php b/upgrade/php/setallgroupsonhomecategory.php deleted file mode 100644 index dc85e0c62..000000000 --- a/upgrade/php/setallgroupsonhomecategory.php +++ /dev/null @@ -1,45 +0,0 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) - */ -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 = []; - foreach ($results as $result) { - $groups[] = $result['id_group']; - } - - if (is_array($groups) && count($groups)) { - // cleanGroups - Db::getInstance()->execute('DELETE FROM `' . _DB_PREFIX_ . 'category_group` - WHERE `id_category` = 1'); - // addGroups($groups); - $row = ['id_category' => 1, 'id_group' => (int) $groups]; - Db::getInstance()->insert('category_group', $row); - } -} diff --git a/upgrade/php/shop_url.php b/upgrade/php/shop_url.php deleted file mode 100644 index 7739bc170..000000000 --- a/upgrade/php/shop_url.php +++ /dev/null @@ -1,49 +0,0 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) - */ -function shop_url() -{ - $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 = true; - $exist = Db::getInstance()->getValue('SELECT `id_configuration` FROM `' . _DB_PREFIX_ . 'configuration` WHERE `name` = \'PS_SHOP_DOMAIN\''); - if ($exist) { - $res &= Db::getInstance()->execute('UPDATE `' . _DB_PREFIX_ . 'configuration` SET value = "' . pSQL($host) . '" WHERE `name` = \'PS_SHOP_DOMAIN\''); - } else { - $res &= Db::getInstance()->getValue('INSERT INTO `' . _DB_PREFIX_ . 'configuration` (name, value) VALUES ("PS_SHOP_DOMAIN", "' . pSQL($host) . '")'); - } - - $exist = Db::getInstance()->getValue('SELECT `id_configuration` FROM `' . _DB_PREFIX_ . 'configuration` WHERE `name` = \'PS_SHOP_DOMAIN_SSL\''); - if ($exist) { - $res &= Db::getInstance()->execute('UPDATE `' . _DB_PREFIX_ . 'configuration` SET value = "' . pSQL($host) . '" WHERE `name` = \'PS_SHOP_DOMAIN_SSL\''); - } else { - $res &= Db::getInstance()->getValue('INSERT INTO `' . _DB_PREFIX_ . 'configuration` (name, value) VALUES ("PS_SHOP_DOMAIN_SSL", "' . pSQL($host) . '")'); - } - - return $res; -} diff --git a/upgrade/php/sql_indexes.php b/upgrade/php/sql_indexes.php deleted file mode 100644 index d9675f361..000000000 --- a/upgrade/php/sql_indexes.php +++ /dev/null @@ -1,39 +0,0 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) - */ - function drop_index_if_exists($indexName, $table) - { - $keyExists = Db::getInstance()->executeS('SHOW INDEX - FROM `' . $table . '` - WHERE Key_name = \'' . $indexName . '\''); - - if ($keyExists) { - return Db::getInstance()->execute('ALTER TABLE - `' . $table . '` - DROP KEY `' . $indexName . '`'); - } - - return true; - } diff --git a/upgrade/php/update_carrier_url.php b/upgrade/php/update_carrier_url.php deleted file mode 100644 index 4b8d66cd0..000000000 --- a/upgrade/php/update_carrier_url.php +++ /dev/null @@ -1,43 +0,0 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) - */ -function update_carrier_url() -{ - // Get all carriers - $sql = ' - SELECT c.`id_carrier`, c.`url` - FROM `' . _DB_PREFIX_ . 'carrier` c'; - $carriers = Db::getInstance()->executeS($sql); - - // Check each one and erase carrier URL if not correct URL - foreach ($carriers as $carrier) { - if (empty($carrier['url']) || !preg_match('/^https?:\/\/[:#%&_=\(\)\.\? \+\-@\/a-zA-Z0-9]+$/', $carrier['url'])) { - Db::getInstance()->execute(' - UPDATE `' . _DB_PREFIX_ . 'carrier` - SET `url` = \'\' - WHERE `id_carrier`= ' . (int) ($carrier['id_carrier'])); - } - } -} diff --git a/upgrade/php/update_customer_default_group.php b/upgrade/php/update_customer_default_group.php deleted file mode 100644 index 1a6c3eac4..000000000 --- a/upgrade/php/update_customer_default_group.php +++ /dev/null @@ -1,75 +0,0 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) - */ -function update_customer_default_group() -{ - $filename = _PS_ROOT_DIR_ . '/config/defines.inc.php'; - $filename_old = str_replace('.inc.', '.old.', $filename); - copy($filename, $filename_old); - chmod($filename_old, 0664); - $content = file_get_contents($filename); - $pattern = "/define\('_PS_DEFAULT_CUSTOMER_GROUP_', (\d)\);/"; - preg_match($pattern, $content, $matches); - if (!defined('_PS_DEFAULT_CUSTOMER_GROUP_')) { - define('_PS_DEFAULT_CUSTOMER_GROUP_', ((isset($matches[1]) && is_numeric($matches[1])) ? $matches[1] : 3)); - } - $ps_customer_group = Db::getInstance()->getValue('SELECT value FROM `' . _DB_PREFIX_ . 'configuration` WHERE name = "PS_CUSTOMER_GROUP"', false); - if ($ps_customer_group) { - $str_old = 'define(\'_PS_DEFAULT_CUSTOMER_GROUP_\', ' . (int) _PS_DEFAULT_CUSTOMER_GROUP_ . ');'; - $str_new = 'define(\'_PS_DEFAULT_CUSTOMER_GROUP_\', ' . (int) $ps_customer_group . ');'; - $content = str_replace($str_old, $str_new, $content); - } - - $carriers = Db::getInstance()->executeS(' - SELECT `id_carrier` - FROM `' . _DB_PREFIX_ . 'carrier` - WHERE `deleted` = 0'); - - $groups = Db::getInstance()->executeS(' - SELECT `value` as id_group - FROM `' . _DB_PREFIX_ . 'configuration` - WHERE `name` IN (\'PS_UNIDENTIFIED_GROUP\', \'PS_GUEST_GROUP\')'); - - if (is_array($carriers) && count($carriers) && is_array($groups) && count($groups)) { - foreach ($carriers as $carrier) { - foreach ($groups as $group) { - Db::getInstance()->execute(' - INSERT IGNORE INTO `' . _DB_PREFIX_ . 'carrier_group` - VALUES (' . (int) $carrier['id_carrier'] . ', ' . (int) $group['id_group'] . ')'); - } - } - } - - $result = false; - if (file_exists($filename) && is_writable($filename)) { - $result = (bool) file_put_contents($filename, $content); - if ($result && file_exists($filename_old)) { - unlink($filename_old); - @chmod($filename, 0664); - } - } - - return $result; -} diff --git a/upgrade/php/update_feature_detachable_cache.php b/upgrade/php/update_feature_detachable_cache.php deleted file mode 100644 index 4744fb053..000000000 --- a/upgrade/php/update_feature_detachable_cache.php +++ /dev/null @@ -1,52 +0,0 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) - */ -function update_feature_detachable_cache() -{ - $array_features = [ - 'PS_SPECIFIC_PRICE_FEATURE_ACTIVE' => 'specific_price', - 'PS_SCENE_FEATURE_ACTIVE' => 'scene', - 'PS_PRODUCT_DOWNLOAD_FEATURE_ACTIVE' => 'product_download', - 'PS_CUSTOMIZATION_FEATURE_ACTIVE' => 'customization_field', - 'PS_CART_RULE_FEATURE_ACTIVE' => 'discount', - 'PS_GROUP_FEATURE_ACTIVE' => 'group', - 'PS_PACK_FEATURE_ACTIVE' => 'pack', - 'PS_ALIAS_FEATURE_ACTIVE' => 'alias', - ]; - $res = true; - foreach ($array_features as $config_key => $feature) { - // array_features is an array defined above, so please don't add bqSql ! - $count = (int) Db::getInstance()->getValue('SELECT count(*) FROM `' . _DB_PREFIX_ . $feature . '`'); - - $exist = Db::getInstance()->getValue('SELECT `id_configuration` FROM `' . _DB_PREFIX_ . 'configuration` WHERE `name` = \'' . pSQL($config_key) . '\''); - if ($exist) { - $res &= Db::getInstance()->execute('UPDATE `' . _DB_PREFIX_ . 'configuration` SET value = "' . (int) $count . '" WHERE `name` = \'' . pSQL($config_key) . '\''); - } else { - $res &= Db::getInstance()->execute('INSERT INTO `' . _DB_PREFIX_ . 'configuration` (name, value) values ("' . pSQL($config_key) . '", "' . (int) $count . '")'); - } - } - - return $res; -} diff --git a/upgrade/php/update_for_13version.php b/upgrade/php/update_for_13version.php deleted file mode 100644 index 8ecf16ff7..000000000 --- a/upgrade/php/update_for_13version.php +++ /dev/null @@ -1,61 +0,0 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) - */ -function update_for_13version() -{ - global $oldversion; - - if (version_compare($oldversion, '1.4.0.1') >= 0) { - return; - } // if the old version is a 1.4 version - - // Disable the Smarty 3 - // Disable the URL rewritting - // Disable Canonical redirection - - $res = true; - $exist = Db::getInstance()->getValue('SELECT `id_configuration` FROM `' . _DB_PREFIX_ . 'configuration` WHERE `name` = \'PS_FORCE_SMARTY_2\''); - if ($exist) { - $res &= Db::getInstance()->execute('UPDATE `' . _DB_PREFIX_ . 'configuration` SET value = "1" WHERE `name` = \'PS_FORCE_SMARTY_2\''); - } else { - $res &= Db::getInstance()->getValue('INSERT INTO `' . _DB_PREFIX_ . 'configuration` (name, value) VALUES ("PS_FORCE_SMARTY_2", "1")'); - } - - $exist = Db::getInstance()->getValue('SELECT `id_configuration` FROM `' . _DB_PREFIX_ . 'configuration` WHERE `name` = \'PS_REWRITING_SETTINGS\''); - if ($exist) { - $res &= Db::getInstance()->execute('UPDATE `' . _DB_PREFIX_ . 'configuration` SET value = "0" WHERE `name` = \'PS_REWRITING_SETTINGS\''); - } else { - $res &= Db::getInstance()->getValue('INSERT INTO `' . _DB_PREFIX_ . 'configuration` (name, value) VALUES ("PS_REWRITING_SETTINGS", "0")'); - } - - $exist = Db::getInstance()->getValue('SELECT `id_configuration` FROM `' . _DB_PREFIX_ . 'configuration` WHERE `name` = \'PS_CANONICAL_REDIRECT\''); - if ($exist) { - $res &= Db::getInstance()->execute('UPDATE `' . _DB_PREFIX_ . 'configuration` SET value = "0" WHERE `name` = \'PS_CANONICAL_REDIRECT\''); - } else { - $res &= Db::getInstance()->getValue('INSERT INTO `' . _DB_PREFIX_ . 'configuration` (name, value) VALUES ("PS_CANONICAL_REDIRECT", "0")'); - } - - return $res; -} diff --git a/upgrade/php/update_genders_images.php b/upgrade/php/update_genders_images.php deleted file mode 100644 index 3fdbcea40..000000000 --- a/upgrade/php/update_genders_images.php +++ /dev/null @@ -1,40 +0,0 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) - */ -function update_genders_images() -{ - if (@file_exists(_PS_ROOT_DIR_ . '/img/genders/Mr.jpg')) { - @rename(_PS_ROOT_DIR_ . '/img/genders/Mr.jpg', _PS_ROOT_DIR_ . '/img/genders/1.jpg'); - } - if (@file_exists(_PS_ROOT_DIR_ . '/img/genders/Ms.jpg')) { - @rename(_PS_ROOT_DIR_ . '/img/genders/Ms.jpg', _PS_ROOT_DIR_ . '/img/genders/2.jpg'); - } - if (@file_exists(_PS_ROOT_DIR_ . '/img/genders/Miss.jpg')) { - @rename(_PS_ROOT_DIR_ . '/img/genders/Miss.jpg', _PS_ROOT_DIR_ . '/img/genders/3.jpg'); - } - if (@file_exists(_PS_ROOT_DIR_ . '/img/genders/unknown.jpg')) { - @rename(_PS_ROOT_DIR_ . '/img/genders/unknown.jpg', _PS_ROOT_DIR_ . '/img/genders/Unknown.jpg'); - } -} diff --git a/upgrade/php/update_image_size_in_db.php b/upgrade/php/update_image_size_in_db.php deleted file mode 100644 index 7c157c221..000000000 --- a/upgrade/php/update_image_size_in_db.php +++ /dev/null @@ -1,41 +0,0 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) - */ -function update_image_size_in_db() -{ - $logo_name = Db::getInstance()->getValue('SELECT `value` FROM `' . _DB_PREFIX_ . 'configuration` WHERE `name` = \'PS_LOGO\''); - $logo_name = (!empty($logo_name)) ? $logo_name : 'logo.jpg'; - - if (file_exists(realpath(INSTALL_PATH . '/../img') . '/' . $logo_name)) { - list($width, $height, $type, $attr) = getimagesize(realpath(INSTALL_PATH . '/../img') . '/' . $logo_name); - Db::getInstance()->execute('UPDATE `' . _DB_PREFIX_ . 'configuration` SET value = "' . (int) round($width) . '" WHERE `name` = \'SHOP_LOGO_WIDTH\''); - Db::getInstance()->execute('UPDATE `' . _DB_PREFIX_ . 'configuration` SET value = "' . (int) round($height) . '" WHERE `name` = \'SHOP_LOGO_HEIGHT\''); - } - if (file_exists(realpath(INSTALL_PATH . '/../modules/editorial') . '/homepage_logo.jpg')) { - list($width, $height, $type, $attr) = getimagesize(realpath(INSTALL_PATH . '/../modules/editorial') . '/homepage_logo.jpg'); - Db::getInstance()->execute('UPDATE `' . _DB_PREFIX_ . 'configuration` SET value = "' . (int) round($width) . '" WHERE `name` = \'EDITORIAL_IMAGE_WIDTH\''); - Db::getInstance()->execute('UPDATE `' . _DB_PREFIX_ . 'configuration` SET value = "' . (int) round($height) . '" WHERE `name` = \'EDITORIAL_IMAGE_HEIGHT\''); - } -} diff --git a/upgrade/php/update_mailalerts_add_column_idshop.php b/upgrade/php/update_mailalerts_add_column_idshop.php deleted file mode 100644 index 308c5f63f..000000000 --- a/upgrade/php/update_mailalerts_add_column_idshop.php +++ /dev/null @@ -1,40 +0,0 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) - */ - -/* - * To change this template, choose Tools | Templates - * and open the template in the editor. - */ -function update_mailalerts_add_column_idshop() -{ - $installed = Db::getInstance()->getValue('SELECT id_module FROM `' . _DB_PREFIX_ . 'module` WHERE name = "mailalerts"'); - $installed &= Db::getInstance()->getValue('SHOW TABLES LIKE "' . _DB_PREFIX_ . 'mailalert_customer_oos"'); - if ($installed && !Db::getInstance()->execute('ALTER TABLE `' . _DB_PREFIX_ . 'mailalert_customer_oos` ADD COLUMN `id_shop` int(11) NOT NULL default "0" AFTER `id_customer`')) { - return ['error' => 1, 'msg' => sprintf('unable to create column id_shop (%s)', Db::getInstance()->getMsgError())]; - } - - return true; -} diff --git a/upgrade/php/update_module_blocklayered.php b/upgrade/php/update_module_blocklayered.php deleted file mode 100644 index e26a5323f..000000000 --- a/upgrade/php/update_module_blocklayered.php +++ /dev/null @@ -1,33 +0,0 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) - */ -function update_module_blocklayered() -{ - if (Db::getInstance()->getValue('SELECT id_module FROM `' . _DB_PREFIX_ . 'module` WHERE name = \'blocklayered\'')) { - @Db::getInstance()->execute('ALTER TABLE `' . _DB_PREFIX_ . 'layered_price_index` ADD INDEX id_product (`id_product`)'); - } - - return true; -} diff --git a/upgrade/php/update_module_followup.php b/upgrade/php/update_module_followup.php deleted file mode 100644 index f8c74957e..000000000 --- a/upgrade/php/update_module_followup.php +++ /dev/null @@ -1,34 +0,0 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) - */ -function update_module_followup() -{ - $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/upgrade/php/update_module_loyalty.php b/upgrade/php/update_module_loyalty.php deleted file mode 100644 index 35eeb354c..000000000 --- a/upgrade/php/update_module_loyalty.php +++ /dev/null @@ -1,53 +0,0 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) - */ - -/** - * backward compatibility vouchers should be available in all categories - */ -function update_module_loyalty() -{ - $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 = ''; - $categories = Db::getInstance()->executeS('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, ','); - - $exist = Db::getInstance()->getValue('SELECT `id_configuration` FROM `' . _DB_PREFIX_ . 'configuration` WHERE `name` = \'PS_LOYALTY_VOUCHER_CATEGORY\''); - if ($exist) { - $res = Db::getInstance()->execute('UPDATE `' . _DB_PREFIX_ . 'configuration` SET value = "' . pSQL($category_list) . '" WHERE `name` = \'PS_LOYALTY_VOUCHER_CATEGORY\''); - } else { - $res = Db::getInstance()->execute('INSERT INTO `' . _DB_PREFIX_ . 'configuration` (name, value) VALUES ("PS_LOYALTY_VOUCHER_CATEGORY", "' . pSQL($category_list) . '"'); - } - } - } -} diff --git a/upgrade/php/update_module_pagesnotfound.php b/upgrade/php/update_module_pagesnotfound.php deleted file mode 100644 index 0790913a3..000000000 --- a/upgrade/php/update_module_pagesnotfound.php +++ /dev/null @@ -1,40 +0,0 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) - */ -function update_module_pagesnotfound() -{ - $id_pagesnotfound = (int) Db::getInstance()->getValue('SELECT id_module FROM `' . _DB_PREFIX_ . 'module` WHERE name = \'pagesnotfound\''); - if ($id_pagesnotfound) { - $id_hook = (int) Db::getInstance()->getValue('SELECT `id_hook` FROM `' . _DB_PREFIX_ . 'hook` WHERE `name` = \'frontCanonicalRedirect\''); - if ($id_hook) { - $position = (int) Db::getInstance()->getValue('SELECT IFNULL(MAX(`position`), 0) + 1 FROM `' . _DB_PREFIX_ . 'hook_module` WHERE `id_hook` = ' . (int) $id_hook); - if ($position) { - return Db::getInstance()->execute('INSERT IGNORE INTO `' . _DB_PREFIX_ . 'hook_module` (`id_hook`, `id_module`, `position`) VALUES (' . (int) $id_hook . ', ' . (int) $id_pagesnotfound . ', ' . (int) $position . ')'); - } - } - } - - return true; -} diff --git a/upgrade/php/update_module_product_comments.php b/upgrade/php/update_module_product_comments.php deleted file mode 100644 index 2854d5a4a..000000000 --- a/upgrade/php/update_module_product_comments.php +++ /dev/null @@ -1,44 +0,0 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) - */ -function update_module_product_comments() -{ - if (Db::getInstance()->getValue('SELECT `id_module` FROM `' . _DB_PREFIX_ . 'module` WHERE `name`="productcomments"')) { - Db::getInstance()->execute(' - CREATE TABLE IF NOT EXISTS `' . _DB_PREFIX_ . 'product_comment_usefulness` ( - `id_product_comment` int(10) unsigned NOT NULL, - `id_customer` int(10) unsigned NOT NULL, - `usefulness` tinyint(1) unsigned NOT NULL, - PRIMARY KEY (`id_product_comment`, `id_customer`) - ) ENGINE=' . _MYSQL_ENGINE_ . ' DEFAULT CHARSET=utf8'); - - Db::getInstance()->execute(' - CREATE TABLE IF NOT EXISTS `' . _DB_PREFIX_ . 'product_comment_report` ( - `id_product_comment` int(10) unsigned NOT NULL, - `id_customer` int(10) unsigned NOT NULL, - PRIMARY KEY (`id_product_comment`, `id_customer`) - ) ENGINE=' . _MYSQL_ENGINE_ . ' DEFAULT CHARSET=utf8'); - } -} diff --git a/upgrade/php/update_modules_multishop.php b/upgrade/php/update_modules_multishop.php deleted file mode 100644 index e04647b82..000000000 --- a/upgrade/php/update_modules_multishop.php +++ /dev/null @@ -1,60 +0,0 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) - */ -function update_modules_multishop() -{ - $block_cms_installed = (bool) Db::getInstance()->getValue('SELECT count(*) FROM `' . _DB_PREFIX_ . 'module` WHERE name = "blockcms"'); - if ($block_cms_installed) { - Db::getInstance()->execute('CREATE TABLE IF NOT EXISTS `' . _DB_PREFIX_ . 'blocklink_shop` ( - `id_blocklink` int(2) NOT NULL AUTO_INCREMENT, - `id_shop` varchar(255) NOT NULL, - PRIMARY KEY(`id_blocklink`, `id_shop`)) - ENGINE=' . _MYSQL_ENGINE_ . ' default CHARSET=utf8'); - - Db::getInstance()->execute(' - CREATE TABLE IF NOT EXISTS `' . _DB_PREFIX_ . 'cms_block_shop` ( - `id_cms_block` int(10) unsigned NOT NULL auto_increment, - `id_shop` int(10) unsigned NOT NULL, - PRIMARY KEY (`id_cms_block`, `id_shop`) - ) ENGINE=' . _MYSQL_ENGINE_ . ' DEFAULT CHARSET=utf8'); - - Db::getInstance()->execute('INSERT INTO ' . _DB_PREFIX_ . 'cms_block_shop (cms_block, id_shop) - (SELECT id_cms_block, 1 FROM ' . _DB_PREFIX_ . 'cms_block)'); - } - - $block_link_installed = (bool) Db::getInstance()->getValue('SELECT count(*) FROM `' . _DB_PREFIX_ . 'module` WHERE name = "blocklink"'); - if ($block_link_installed) { - Db::getInstance()->execute(' - CREATE TABLE IF NOT EXISTS `' . _DB_PREFIX_ . 'blocklink_shop` ( - `id_blocklink` int(2) NOT NULL AUTO_INCREMENT, - `id_shop` varchar(255) NOT NULL, - PRIMARY KEY(`id_blocklink`, `id_shop`)) - ENGINE=' . _MYSQL_ENGINE_ . ' default CHARSET=utf8'); - Db::getInstance()->execute('INSERT INTO `' . _DB_PREFIX_ . 'blocklink_shop` (id_blocklink, id_shop) - (SELECT id_blocklink, 1 FROM `' . _DB_PREFIX_ . 'blocklink`)'); - } - - return true; -} diff --git a/upgrade/php/update_modules_sql.php b/upgrade/php/update_modules_sql.php deleted file mode 100644 index 90e7761e6..000000000 --- a/upgrade/php/update_modules_sql.php +++ /dev/null @@ -1,38 +0,0 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) - */ -function update_modules_sql() -{ - $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`);'); - } -} diff --git a/upgrade/php/update_order_canada.php b/upgrade/php/update_order_canada.php deleted file mode 100644 index 5a84e69fa..000000000 --- a/upgrade/php/update_order_canada.php +++ /dev/null @@ -1,120 +0,0 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) - */ -function update_order_canada() -{ - $sql = 'SHOW TABLES LIKE "' . str_replace('_', '\_', _DB_PREFIX_) . 'order\_tax"'; - $table = Db::getInstance()->executeS($sql); - - if (!count($table)) { - Db::getInstance()->execute(' - CREATE TABLE IF NOT EXISTS `' . _DB_PREFIX_ . 'order_tax` ( - `id_order` int(11) NOT NULL, - `tax_name` varchar(40) NOT NULL, - `tax_rate` decimal(6,3) NOT NULL, - `amount` decimal(20,6) NOT NULL - ) ENGINE=' . _MYSQL_ENGINE_ . ' DEFAULT CHARSET=utf8'); - - $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`, `price_display_method` - FROM `' . _DB_PREFIX_ . 'orders` o - 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); - $default_price_display_method = Db::getInstance()->getValue('SELECT price_display_method - FROM `' . _DB_PREFIX_ . 'group` WHERE id_group=1'); - $values = ''; - if (is_array($id_order_list)) { - foreach ($id_order_list as $order) { - $amount = []; - $id_order = $order['id_order']; - // in Order class, getTaxCalculationMethod - // returns Group::getDefaultPriceDisplayMethod - $tax_calculation_method = $order['price_display_method']; - - $products = Db::getInstance()->executeS(' - SELECT * FROM `' . _DB_PREFIX_ . 'order_detail` od - WHERE od.`id_order` = ' . (int) $id_order); - - foreach ($products as $product) { - if (!array_key_exists($product['tax_name'], $amount)) { - $amount[$product['tax_name']] = ['amount' => 0, 'rate' => $product['tax_rate']]; - } - - // PS_TAX_EXC = 1, PS_TAX_INC = 0 - if ($tax_calculation_method == 1) { - $total_product = $product['product_price'] * $product['product_quantity']; - $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 = 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) $id_order . ', "' . $tax_name . '\', "' . $tax_infos['rate'] . '", ' . (float) $tax_infos['amount'] . '),'; - } - unset($order); - } - } - - if (!empty($values)) { - $values = rtrim($values, ','); - - Db::getInstance()->execute(' - INSERT INTO `' . _DB_PREFIX_ . 'order_tax` (id_order, tax_name, tax_rate, amount) - VALUES ' . $values); - } - } -} - -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 0: - return ceil($val * 100) / 100; - case 1: - return floor($val * 100) / 100; - default: - return round($val, 2); - } -} diff --git a/upgrade/php/update_order_detail_taxes.php b/upgrade/php/update_order_detail_taxes.php deleted file mode 100644 index 19a5466bb..000000000 --- a/upgrade/php/update_order_detail_taxes.php +++ /dev/null @@ -1,79 +0,0 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) - */ -function update_order_detail_taxes() -{ - $order_detail_taxes = Db::getInstance()->executeS(' - SELECT `id_order_detail`, `tax_name`, `tax_rate` FROM `' . _DB_PREFIX_ . 'order_detail` - '); - $id_lang_list = Db::getInstance()->executeS('SELECT id_lang FROM `' . _DB_PREFIX_ . 'lang`'); - - foreach ($order_detail_taxes as $order_detail_tax) { - if ($order_detail_tax['tax_rate'] == '0.000') { - continue; - } - - $alternative_tax_name = 'Tax ' . $order_detail_tax['tax_rate']; - $create_tax = true; - $id_tax = (int) Db::getInstance()->getValue('SELECT t.`id_tax` - FROM `' . _DB_PREFIX_ . 'tax` t - LEFT JOIN `' . _DB_PREFIX_ . 'tax_lang` tl ON (tl.id_tax = t.id_tax) - WHERE tl.`name` = \'' . pSQL($order_detail_tax['tax_name']) . '\' '); - $id_tax_alt = (int) Db::getInstance()->getValue('SELECT t.`id_tax` - FROM `' . _DB_PREFIX_ . 'tax` t - LEFT JOIN `' . _DB_PREFIX_ . 'tax_lang` tl ON (tl.id_tax = t.id_tax) - WHERE tl.`name` = \'' . pSQL($alternative_tax_name) . '\' '); - - if ($id_tax || $id_tax_alt) { - $create_tax = !(bool) Db::getInstance()->getValue('SELECT count(*) - FROM `' . _DB_PREFIX_ . 'tax` - WHERE id_tax = ' . (int) $id_tax . ' - AND rate = "' . pSQL($order_detail_tax['tax_rate']) . '" - '); - } - - if ($create_tax) { - $tax_name = (isset($order_detail_tax['tax_name']) ? $order_detail_tax['tax_name'] : $alternative_tax_name); - - Db::getInstance()->execute( - 'INSERT INTO `' . _DB_PREFIX_ . 'tax` (`rate`, `active`, `deleted`) - VALUES (\'' . (float) $order_detail_tax['tax_rate'] . '\', 0, 1)' - ); - - $id_tax = Db::getInstance()->Insert_ID(); - foreach ($id_lang_list as $id_lang) { - Db::getInstance()->execute(' - INSERT INTO `' . _DB_PREFIX_ . 'tax_lang` (`id_tax`, `id_lang`, `name`) - VALUES (' . (int) $id_tax . ',' . (int) $id_lang['id_lang'] . ',\'' . pSQL($tax_name) . '\') - '); - } - } - - Db::getInstance()->execute(' - INSERT INTO `' . _DB_PREFIX_ . 'order_detail_tax` (`id_order_detail`, `id_tax`) - VALUES (' . (int) $order_detail_tax['id_order_detail'] . ',' . $id_tax . ') - '); - } -} diff --git a/upgrade/php/update_order_details.php b/upgrade/php/update_order_details.php deleted file mode 100644 index e961e52cc..000000000 --- a/upgrade/php/update_order_details.php +++ /dev/null @@ -1,34 +0,0 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) - */ -function update_order_details() -{ - $res = Db::getInstance()->executeS('SHOW COLUMNS FROM `' . _DB_PREFIX_ . 'order_detail` = \'reduction_percent\''); - - if (count($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`'); - } -} diff --git a/upgrade/php/update_order_messages.php b/upgrade/php/update_order_messages.php deleted file mode 100644 index bb1706d56..000000000 --- a/upgrade/php/update_order_messages.php +++ /dev/null @@ -1,72 +0,0 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) - */ -function update_order_messages() -{ - $step = 3000; - $count_messages = Db::getInstance()->getValue('SELECT count(id_message) FROM ' . _DB_PREFIX_ . 'message'); - $nb_loop = $start = 0; - $pattern = ' 0) { - $nb_loop = ceil($count_messages / $step); - } - for ($i = 0; $i < $nb_loop; ++$i) { - $sql = 'SELECT id_message, message FROM `' . _DB_PREFIX_ . 'message` WHERE message REGEXP \'' . pSQL($pattern, true) . '\' LIMIT ' . (int) $start . ', ' . (int) $step; - $start = (int) (($i + 1) * $step); - if ($messages = Db::getInstance()->query($sql)) { - while ($message = Db::getInstance()->nextRow($messages)) { - if (is_array($message)) { - Db::getInstance()->execute(' - UPDATE `' . _DB_PREFIX_ . 'message` - SET message = \'' . pSQL(preg_replace('/' . $pattern . '/', '', Tools::htmlentitiesDecodeUTF8(br2nl($message['message'])))) . '\' - WHERE id_message = ' . (int) $message['id_message']); - } - } - } - } - $nb_loop = $start = 0; - if ($count_messages > 0) { - $nb_loop = ceil($count_messages / $step); - } - for ($i = 0; $i < $nb_loop; ++$i) { - $sql = 'SELECT id_customer_message, message FROM `' . _DB_PREFIX_ . 'customer_message` WHERE message REGEXP \'' . pSQL($pattern, true) . '\' LIMIT ' . (int) $start . ', ' . (int) $step; - $start = (int) (($i + 1) * $step); - if ($messages = Db::getInstance()->query($sql)) { - while ($message = Db::getInstance()->nextRow($messages)) { - if (is_array($message)) { - Db::getInstance()->execute(' - UPDATE `' . _DB_PREFIX_ . 'customer_message` - SET message = \'' . pSQL(preg_replace('/' . $pattern . '/', '', Tools::htmlentitiesDecodeUTF8(str_replace('&', '&', $message['message'])))) . '\' - WHERE id_customer_message = ' . (int) $message['id_customer_message']); - } - } - } - } -} - -function br2nl($str) -{ - return str_replace(['
', '
', '
'], "\n", $str); -} diff --git a/upgrade/php/update_products_ecotax_v133.php b/upgrade/php/update_products_ecotax_v133.php deleted file mode 100644 index 8da538d2e..000000000 --- a/upgrade/php/update_products_ecotax_v133.php +++ /dev/null @@ -1,33 +0,0 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) - */ -function update_products_ecotax_v133() -{ - global $oldversion; - 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;'); - } -} diff --git a/upgrade/php/update_stock_mvt_reason.php b/upgrade/php/update_stock_mvt_reason.php deleted file mode 100644 index 4ac906b4b..000000000 --- a/upgrade/php/update_stock_mvt_reason.php +++ /dev/null @@ -1,129 +0,0 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) - */ -function update_stock_mvt_reason() -{ - //Get all stock mvts reasons already presents in the solution (from 1.4.x) - //Remove standard movements to keep only custom movement - $mvts = Db::getInstance()->executeS(' - SELECT smr.* - FROM `' . _DB_PREFIX_ . 'stock_mvt_reason` - WHERE `id` > 5 - '); - - //Get all stock mvts reasons language traduction already presents in the solution (from 1.4.x) - //Remove standard movements to keep only custom movement - $mvts_lang = Db::getInstance()->executeS(' - SELECT smrl.* - FROM `' . _DB_PREFIX_ . 'stock_movement_reason_lang` - WHERE `id_stock_mvt_reason` > 5 - '); - - //Clean table - Db::getInstance()->query('TRUNCATE TABLE `' . _DB_PREFIX_ . 'stock_movement_reason`'); - Db::getInstance()->query('TRUNCATE TABLE `' . _DB_PREFIX_ . 'stock_movement_reason_lang`'); - - //Recreate new standards movements - Db::getInstance()->execute(' - INSERT INTO `' . _DB_PREFIX_ . 'stock_mvt_reason` (`id_stock_mvt_reason`, `sign`, `date_add`, `date_upd`) - VALUES - (1, 1, NOW(), NOW()), - (2, -1, NOW(), NOW()), - (3, -1, NOW(), NOW()), - (4, -1, NOW(), NOW()), - (5, 1, NOW(), NOW()), - (6, -1, NOW(), NOW()), - (7, 1, NOW(), NOW()), - (8, 1, NOW(), NOW()) - '); - - Db::getInstance()->execute(' - INSERT INTO `' . _DB_PREFIX_ . "stock_mvt_reason_lang` (`id_stock_mvt_reason`, `id_lang`, `name`) - VALUES - (1, 1, 'Increase'), - (1, 2, 'Augmenter'), - (1, 3, 'Aumentar'), - (1, 4, 'Erhöhen'), - (1, 5, 'Increase'), - (2, 1, 'Decrease'), - (2, 2, 'Diminuer'), - (2, 3, 'Disminuir'), - (2, 4, 'Reduzieren'), - (2, 5, 'Decrease'), - (3, 1, 'Customer Order'), - (3, 2, 'Commande client'), - (3, 3, 'Pedido'), - (3, 4, 'Bestellung'), - (3, 5, 'Ordine'), - (4, 1, 'Regulation following an inventory of stock'), - (4, 2, 'Régularisation du stock suite à un inventaire'), - (4, 3, 'Regulation following an inventory of stock'), - (4, 4, 'Bestandsberichtigung nach Inventur'), - (4, 5, 'Regulation following an inventory of stock'), - (5, 1, 'Regulation following an inventory of stock'), - (5, 2, 'Régularisation du stock suite à un inventaire'), - (5, 3, 'Regulation following an inventory of stock'), - (5, 4, 'Regulation following an inventory of stock'), - (5, 5, 'Regulation following an inventory of stock'), - (6, 1, 'Transfer to another warehouse'), - (6, 2, 'Transfert vers un autre entrepôt'), - (6, 3, 'Transfer to another warehouse'), - (6, 4, 'Übertragung in anderes Lager'), - (6, 5, 'Transfer to another warehouse'), - (7, 1, 'Transfer from another warehouse'), - (7, 2, 'Transfert depuis un autre entrepôt'), - (7, 3, 'Transfer from another warehouse'), - (7, 4, 'Übertragung von anderem Lager'), - (7, 5, 'Transfer from another warehouse'), - (8, 1, 'Supply Order'), - (8, 2, 'Commande fournisseur'), - (8, 3, 'Supply Order'), - (8, 4, 'Lieferbestellung'), - (8, 5, 'Supply Order') - "); - - //Add custom movements - if (is_array($mvts)) { - foreach ($mvts as $mvt) { - Db::getInstance()->execute(' - INSERT INTO `' . _DB_PREFIX_ . 'stock_mvt_reason` (`sign`, `date_add`, `date_upd`) - VALUES ("' . (int) $mvt['sign'] . '", "' . pSQL($mvt['date_add']) . '", "' . pSQL($mvt['date_upd']) . '") - '); - - $row_id = Db::getInstance()->Insert_ID(); - - foreach ($mvts_lang as $mvt_lang) { - if ($mvt_lang['id_stock_mvt_reason'] != $mvt['id']) { - continue; - } - - Db::getInstance()->execute(' - INSERT INTO `' . _DB_PREFIX_ . 'stock_mvt_reason_lang` (`id_stock_mvt_reason`, `id_lang`, `name`) - VALUES ("' . (int) $row_id . '", "' . (int) $mvt_lang['id_lang'] . '", "' . pSQL($mvt_lang['name']) . '") - '); - } - } - } -} diff --git a/upgrade/php/updateproductcomments.php b/upgrade/php/updateproductcomments.php deleted file mode 100644 index fd8185f12..000000000 --- a/upgrade/php/updateproductcomments.php +++ /dev/null @@ -1,53 +0,0 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) - */ -function updateproductcomments() -{ - if (Db::getInstance()->executeS('SELECT * FROM ' . _DB_PREFIX_ . 'product_comment') !== false) { - Db::getInstance()->execute('CREATE TABLE IF NOT EXISTS ' . _DB_PREFIX_ . 'product_comment_criterion_lang ( - `id_product_comment_criterion` INT( 11 ) UNSIGNED NOT NULL , - `id_lang` INT(11) UNSIGNED NOT NULL , - `name` VARCHAR(64) NOT NULL , - PRIMARY KEY ( `id_product_comment_criterion` , `id_lang` ) - ) ENGINE=' . _MYSQL_ENGINE_ . ' DEFAULT CHARSET=utf8'); - Db::getInstance()->execute('CREATE TABLE IF NOT EXISTS ' . _DB_PREFIX_ . 'product_comment_criterion_category ( - `id_product_comment_criterion` int(10) unsigned NOT NULL, - `id_category` int(10) unsigned NOT NULL, - PRIMARY KEY(`id_product_comment_criterion`, `id_category`), - KEY `id_category` (`id_category`) - ) ENGINE=' . _MYSQL_ENGINE_ . ' DEFAULT CHARSET=utf8'); - Db::getInstance()->execute('ALTER TABLE ' . _DB_PREFIX_ . 'product_comment ADD `id_guest` INT(11) NULL AFTER `id_customer`'); - Db::getInstance()->execute('ALTER TABLE ' . _DB_PREFIX_ . 'product_comment ADD `customer_name` varchar(64) NULL AFTER `content`'); - Db::getInstance()->execute('ALTER TABLE ' . _DB_PREFIX_ . 'product_comment ADD `deleted` tinyint(1) NOT NULL AFTER `validate`'); - Db::getInstance()->execute('ALTER TABLE ' . _DB_PREFIX_ . 'product_comment ADD INDEX (id_customer)'); - Db::getInstance()->execute('ALTER TABLE ' . _DB_PREFIX_ . 'product_comment ADD INDEX (id_guest)'); - Db::getInstance()->execute('ALTER TABLE ' . _DB_PREFIX_ . 'product_comment ADD INDEX (id_product)'); - Db::getInstance()->execute('ALTER TABLE ' . _DB_PREFIX_ . 'product_comment_criterion DROP `id_lang`'); - Db::getInstance()->execute('ALTER TABLE ' . _DB_PREFIX_ . 'product_comment_criterion DROP `name`'); - Db::getInstance()->execute('ALTER TABLE ' . _DB_PREFIX_ . 'product_comment_criterion ADD `id_product_comment_criterion_type` tinyint(1) NOT NULL AFTER `id_product_comment_criterion`'); - Db::getInstance()->execute('ALTER TABLE ' . _DB_PREFIX_ . 'product_comment_criterion ADD `active` tinyint(1) NOT NULL AFTER `id_product_comment_criterion_type`'); - Db::getInstance()->execute('ALTER IGNORE TABLE `' . _DB_PREFIX_ . 'product_comment` ADD `title` VARCHAR(64) NULL AFTER `id_guest`;'); - } -} diff --git a/upgrade/php/updatetabicon_from_11version.php b/upgrade/php/updatetabicon_from_11version.php deleted file mode 100644 index a2ed8cca7..000000000 --- a/upgrade/php/updatetabicon_from_11version.php +++ /dev/null @@ -1,44 +0,0 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) - */ -function updatetabicon_from_11version() -{ - global $oldversion; - if (version_compare($oldversion, '1.5.0.0', '<')) { - $rows = Db::getInstance()->executeS('SELECT `id_tab`,`class_name` FROM ' . _DB_PREFIX_ . 'tab'); - if (count($rows)) { - $img_dir = scandir(_PS_ROOT_DIR_ . '/img/t/', SCANDIR_SORT_NONE); - $result = true; - foreach ($rows as $tab) { - if (file_exists(_PS_ROOT_DIR_ . '/img/t/' . $tab['id_tab'] . '.gif') - && !file_exists(_PS_ROOT_DIR_ . '/img/t/' . $tab['class_name'] . '.gif')) { - $result &= rename(_PS_ROOT_DIR_ . '/img/t/' . $tab['id_tab'] . '.gif', _PS_ROOT_DIR_ . '/img/t/' . $tab['class_name'] . '.gif'); - } - } - } - } - - return true; -} diff --git a/upgrade/php/upgrade_cms_15.php b/upgrade/php/upgrade_cms_15.php deleted file mode 100644 index 70ca8dc9b..000000000 --- a/upgrade/php/upgrade_cms_15.php +++ /dev/null @@ -1,55 +0,0 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) - */ -function upgrade_cms_15() -{ - $res = true; - - // note : cms_shop table is required and independant of blockcms module - // /!\ : _cms_shop is the wrong table name (fixed in 1.5.0.12.sql : upgrade_cms_15_rename() ) - $res &= Db::getInstance()->execute('CREATE TABLE `' . _DB_PREFIX_ . '_cms_shop` ( -`id_cms` INT( 11 ) UNSIGNED NOT NULL, -`id_shop` INT( 11 ) UNSIGNED NOT NULL , - PRIMARY KEY (`id_cms`, `id_shop`), - KEY `id_shop` (`id_shop`) -) ENGINE=' . _MYSQL_ENGINE_ . ' DEFAULT CHARSET=utf8;'); - - // /!\ : _cms_shop and _cms are wrong tables name (fixed in 1.5.0.12.sql : upgrade_cms_15_rename() ) - $res &= Db::getInstance()->execute('INSERT INTO `' . _DB_PREFIX_ . '_cms_shop` (id_shop, id_cms) - (SELECT 1, id_cms FROM ' . _DB_PREFIX_ . '_cms)'); - - // cms_block table is blockcms module dependant. Don't update table that does not exists - // /!\ : _module is the wrong table name (fixed in 1.5.0.12.sql : upgrade_cms_15_rename() ) - $id_module_cms = Db::getInstance()->getValue('SELECT id_module from `' . _DB_PREFIX_ . '_module - WHERE name="blockcms"`'); - if (!$id_module_cms) { - return $res; - } - // /!\ : _cms_block is the wrong table name (fixed in 1.5.0.12.sql : upgrade_cms_15_rename() ) - $res &= Db::getInstance()->execute('ALTER TABLE `' . _DB_PREFIX_ . '._cms_block` - ADD `id_shop` INT(11) UNSIGNED NOT NULL DEFAULT "1" AFTER `id_cms_block`'); - - return $res; -} diff --git a/upgrade/php/upgrade_cms_15_rename.php b/upgrade/php/upgrade_cms_15_rename.php deleted file mode 100644 index 2db8cc0c5..000000000 --- a/upgrade/php/upgrade_cms_15_rename.php +++ /dev/null @@ -1,48 +0,0 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) - */ -function upgrade_cms_15_rename() -{ - $res = true; - $db = Db::getInstance(); - - $res &= $db->executeS('SHOW TABLES LIKE "' . _DB_PREFIX_ . '_cms_shop"'); - if ($res) { - $res &= $db->execute('RENAME TABLE `' . _DB_PREFIX_ . '_cms_shop` to `' . _DB_PREFIX_ . 'cms_shop`'); - // in case the script upgrade_cms_15.php have set a wrong table name, it's empty - $res &= Db::getInstance()->execute('INSERT INTO `' . _DB_PREFIX_ . 'cms_shop` (id_shop, id_cms) - (SELECT 1, id_cms FROM ' . _DB_PREFIX_ . 'cms)'); - - // cms_block table is blockcms module dependant. Don't update table that does not exists - $table_cms_block_exists = $db->executeS('SHOW TABLES LIKE "' . _DB_PREFIX_ . 'cms"'); - if (!$table_cms_block_exists) { - return $res; - } - $res &= Db::getInstance()->execute('ALTER TABLE `' . _DB_PREFIX_ . 'cms` - ADD `id_shop` INT(11) UNSIGNED NOT NULL DEFAULT "1" AFTER `id_cms`'); - } - - return $res; -} diff --git a/upgrade/sql/0.9.1.2.sql b/upgrade/sql/0.9.1.2.sql deleted file mode 100644 index 4ff1333c6..000000000 --- a/upgrade/sql/0.9.1.2.sql +++ /dev/null @@ -1,30 +0,0 @@ -/* STRUCTURE */ -CREATE TABLE `PREFIX_product_sale` ( -`id_product` INT( 10 ) UNSIGNED NOT NULL , -`quantity` INT( 10 ) UNSIGNED NOT NULL DEFAULT '0', -`nb_vente` INT( 10 ) UNSIGNED NOT NULL DEFAULT '0', -`date_upd` DATE NOT NULL , -PRIMARY KEY ( `id_product` ) -) ENGINE = MYISAM DEFAULT CHARSET=utf8; - -ALTER TABLE `PREFIX_image_type` - ADD `manufacturers` BOOL NOT NULL DEFAULT '1' AFTER `categories`; - -ALTER TABLE `PREFIX_address` - ADD `id_manufacturer` INT( 10 ) UNSIGNED NOT NULL AFTER `id_customer` ; - -ALTER TABLE `PREFIX_address` - ADD `id_supplier` INT( 10 ) UNSIGNED NOT NULL AFTER `id_manufacturer` ; - -ALTER TABLE `PREFIX_order_discount` - ADD `id_discount` INT( 10 ) UNSIGNED NOT NULL AFTER `id_order` ; - -ALTER TABLE `PREFIX_discount` - ADD `quantity_per_user` INT( 10 ) UNSIGNED NOT NULL DEFAULT '1' AFTER `quantity` ; - -ALTER TABLE `PREFIX_contact` CHANGE `position` `position` TINYINT( 2 ) UNSIGNED NOT NULL DEFAULT '0'; - -/* CONTENTS */ - -/* CONFIGURATION VARIABLE */ - diff --git a/upgrade/sql/0.9.1.sql b/upgrade/sql/0.9.1.sql deleted file mode 100644 index 5b0fabb09..000000000 --- a/upgrade/sql/0.9.1.sql +++ /dev/null @@ -1,9 +0,0 @@ -/* STRUCTURE */ -ALTER TABLE `PREFIX_product` CHANGE `price` `price` DECIMAL(13,6) NOT NULL DEFAULT '0.000000'; - -/* CONTENTS */ -DELETE FROM `PREFIX_carrier_lang` WHERE `id_carrier` = (SELECT c.`id_carrier` FROM `PREFIX_carrier` c WHERE c.`name` = 'My download manager' LIMIT 1); -DELETE FROM `PREFIX_carrier` WHERE `name` = 'My download manager'; - -/* Conf vars */ -INSERT INTO `PREFIX_configuration` (`name`, `value`, `date_add`, `date_upd`) VALUES ('PS_TAX_NO', '0', NOW(), NOW()); \ No newline at end of file diff --git a/upgrade/sql/0.9.5.1.sql b/upgrade/sql/0.9.5.1.sql deleted file mode 100644 index 31bc41c99..000000000 --- a/upgrade/sql/0.9.5.1.sql +++ /dev/null @@ -1,66 +0,0 @@ -/* STRUCTURE */ -ALTER TABLE `PREFIX_order_state` - ADD `logable` TINYINT(1) NOT NULL DEFAULT 0; -ALTER TABLE `PREFIX_product_sale` - CHANGE `nb_vente` `sale_nbr` INT(10) UNSIGNED NOT NULL DEFAULT 0; -ALTER TABLE `PREFIX_carrier` - CHANGE `tax` `id_tax` INT(10) UNSIGNED NULL DEFAULT 0 AFTER `id_carrier`; -ALTER TABLE `PREFIX_carrier` - ADD `shipping_handling` TINYINT(1) UNSIGNED NOT NULL DEFAULT 1 AFTER `deleted`; -ALTER TABLE `PREFIX_address` - CHANGE `id_country` `id_country` INT(10) UNSIGNED NOT NULL DEFAULT 0, - CHANGE `id_customer` `id_customer` INT(10) UNSIGNED NOT NULL DEFAULT 0, - CHANGE `id_manufacturer` `id_manufacturer` INT(10) UNSIGNED NOT NULL DEFAULT 0; -RENAME TABLE `PREFIX_product_attribute_combinaison` TO `PREFIX_product_attribute_combination`; -ALTER TABLE `PREFIX_product_attribute_combination` - DROP INDEX `product_attribute_combinaison_index`, - ADD PRIMARY KEY (`id_attribute`, `id_product_attribute`); - -CREATE TABLE `PREFIX_carrier_zone` ( - id_carrier int(10) unsigned NOT NULL, - id_zone int(10) unsigned NOT NULL, - INDEX carrier_zone_index(id_carrier, id_zone) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; - -CREATE TABLE `PREFIX_tax_zone` ( - id_tax int(10) unsigned NOT NULL, - id_zone int(10) unsigned NOT NULL, - INDEX tax_zone_index(id_tax, id_zone) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; - - -/* CONTENTS */ - -/* Rename old tab */ -UPDATE `PREFIX_tab_lang` SET `name` = 'Produits' - WHERE `id_tab` = (SELECT `id_tab` FROM `PREFIX_tab` t WHERE t.class_name = 'AdminPPreferences') - AND `id_lang` = (SELECT `id_lang` FROM `PREFIX_lang` l WHERE l.iso_code = 'fr'); -UPDATE `PREFIX_tab_lang` SET `name` = 'Emails' - WHERE `id_tab` = (SELECT `id_tab` FROM `PREFIX_tab` t WHERE t.class_name = 'AdminEmails') - AND `id_lang` = (SELECT `id_lang` FROM `PREFIX_lang` l WHERE l.iso_code = 'fr'); -UPDATE `PREFIX_tab_lang` SET `name` = 'Images' - WHERE `id_tab` = (SELECT `id_tab` FROM `PREFIX_tab` t WHERE t.class_name = 'AdminImages') - AND `id_lang` = (SELECT `id_lang` FROM `PREFIX_lang` l WHERE l.iso_code = 'fr'); - -/* New BankWire state */ -UPDATE `PREFIX_order_state` SET `logable` = 1 WHERE `id_order_state` < 6 AND `id_order_state` > 1; -INSERT INTO `PREFIX_order_state` (`id_order_state`, `invoice`, `send_email`, `color`, `unremovable`, `logable`) VALUES (10, 0, 1, 'lightblue', 1, 0); -INSERT INTO `PREFIX_order_state_lang` (`id_order_state`, `id_lang`, `name`, `template`) VALUES -(10, 1, 'Awaiting bank wire payment', 'bankwire'), -(10, 2, 'En attente du paiement par virement bancaire', 'bankwire'); - -/* New hook */ -INSERT INTO `PREFIX_hook` (`name`, `title`, `description`, `position`) VALUES ('updateOrderStatus', 'Order''s status update event', 'Launch modules when the order''s status of an order change.', 0); - -/* Adding zones for tax/carrier */ -INSERT INTO `PREFIX_tax_zone` (id_tax, id_zone) (SELECT id_tax, id_zone FROM `PREFIX_tax` CROSS JOIN `PREFIX_zone`); -INSERT INTO `PREFIX_carrier_zone` (id_carrier, id_zone) (SELECT id_carrier, id_zone FROM `PREFIX_carrier` CROSS JOIN `PREFIX_zone`); - -/* CONFIGURATION VARIABLE */ - -INSERT INTO `PREFIX_configuration` (`name`, `value`, `date_add`, `date_upd`) VALUES -('PREFIX_PURCHASE_MINIMUM', '0', NOW(), NOW()), -('PREFIX_SHOP_ENABLE', '1', NOW(), NOW()); - -/* Adding tab Contact */ -/* PHP:add_new_tab(AdminContact, fr:Coordonnées|es:Datos|en:Contact Information|de:Kontaktinformation|it:Informazioni di contatto, 8); */; \ No newline at end of file diff --git a/upgrade/sql/0.9.5.2.sql b/upgrade/sql/0.9.5.2.sql deleted file mode 100644 index 57f9b765c..000000000 --- a/upgrade/sql/0.9.5.2.sql +++ /dev/null @@ -1,5 +0,0 @@ -/* STRUCTURE */ - -/* CONTENTS */ - -/* CONFIGURATION VARIABLE */ \ No newline at end of file diff --git a/upgrade/sql/0.9.6.1.sql b/upgrade/sql/0.9.6.1.sql deleted file mode 100644 index fa371d9b9..000000000 --- a/upgrade/sql/0.9.6.1.sql +++ /dev/null @@ -1,51 +0,0 @@ -/* STRUCTURE */ - -CREATE TABLE `PREFIX_alias` ( - alias varchar(255) NOT NULL, - search varchar(255) NOT NULL, - active tinyint(1) NOT NULL default 1, - id_alias int(10) NOT NULL auto_increment, - PRIMARY KEY (id_alias), - UNIQUE KEY alias (alias) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; - -ALTER TABLE `PREFIX_configuration` - ADD UNIQUE `name` (`name`); -ALTER TABLE `PREFIX_product` - ADD `wholesale_price` DECIMAL( 13, 6 ) NOT NULL AFTER `price`; -ALTER TABLE `PREFIX_range_weight` - CHANGE `delimiter1` `delimiter1` DECIMAL( 13, 6 ) NOT NULL DEFAULT '0.000000'; -ALTER TABLE `PREFIX_range_weight` - CHANGE `delimiter2` `delimiter2` DECIMAL( 13, 6 ) NOT NULL DEFAULT '0.000000'; - ALTER TABLE `PREFIX_discount_type_lang` - CHANGE `name` `name` VARCHAR(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL; - ALTER TABLE `PREFIX_product` - CHANGE `bargain` `on_sale` TINYINT(1) UNSIGNED NOT NULL DEFAULT 0; -ALTER TABLE `PREFIX_image_type` - ADD `suppliers` BOOL NOT NULL DEFAULT 1; - -/* CONTENTS */ - -/* Adding tab alias */ -INSERT INTO `PREFIX_tab` (`id_parent`, `class_name`, `position`) VALUES ((SELECT tmp.id_tab FROM (SELECT `id_tab` FROM `PREFIX_tab` t WHERE t.class_name = 'AdminTools' LIMIT 1) AS tmp), 'AdminAliases', 9); -INSERT INTO `PREFIX_tab_lang` (id_lang, id_tab, name) ( - SELECT id_lang, - (SELECT `id_tab` FROM `PREFIX_tab` t WHERE t.class_name = 'AdminAliases' LIMIT 1), - 'Alias' FROM `PREFIX_lang`); -INSERT INTO `PREFIX_access` (`id_profile`, `id_tab`, `view`, `add`, `edit`, `delete`) - VALUES ('1', (SELECT `id_tab` FROM `PREFIX_tab` t WHERE t.class_name = 'AdminAliases' LIMIT 1), '1', '1', '1', '1'); - -/* Adding tab import */ -INSERT INTO `PREFIX_tab` (`id_parent`, `class_name`, `position`) VALUES ((SELECT tmp.id_tab FROM (SELECT `id_tab` FROM `PREFIX_tab` t WHERE t.class_name = 'AdminTools' LIMIT 1) AS tmp), 'AdminImport', 10); -INSERT INTO `PREFIX_tab_lang` (id_lang, id_tab, name) ( - SELECT id_lang, - (SELECT `id_tab` FROM `PREFIX_tab` t WHERE t.class_name = 'AdminImport' LIMIT 1), - 'Import' FROM `PREFIX_lang`); -INSERT INTO `PREFIX_access` (`id_profile`, `id_tab`, `view`, `add`, `edit`, `delete`) - VALUES ('1', (SELECT `id_tab` FROM `PREFIX_tab` t WHERE t.class_name = 'AdminImport' LIMIT 1), '1', '1', '1', '1'); - -INSERT INTO `PREFIX_hook` (`name`, `title`, `description`) -VALUES ('adminOrder', 'Display in Back-Office, tab AdminOrder', 'Launch modules when the tab AdminOrder is displayed on back-office.'); - - -/* CONFIGURATION VARIABLE */ \ No newline at end of file diff --git a/upgrade/sql/0.9.6.2.sql b/upgrade/sql/0.9.6.2.sql deleted file mode 100644 index c55fefbb8..000000000 --- a/upgrade/sql/0.9.6.2.sql +++ /dev/null @@ -1,7 +0,0 @@ -/* STRUCTURE */ - -ALTER TABLE `PREFIX_product` CHANGE `wholesale_price` `wholesale_price` DECIMAL(13, 6) NULL; - -/* CONTENTS */ - -/* CONFIGURATION VARIABLE */ \ No newline at end of file diff --git a/upgrade/sql/0.9.7.1.sql b/upgrade/sql/0.9.7.1.sql deleted file mode 100644 index 5a8ded7f5..000000000 --- a/upgrade/sql/0.9.7.1.sql +++ /dev/null @@ -1,14 +0,0 @@ -/* STRUCTURE */ - -ALTER TABLE `PREFIX_module` ADD INDEX (`name`); - -/* CONTENTS */ - -INSERT INTO `PREFIX_hook` (`name` , `title`, `description`, `position`) VALUES -('footer', 'Footer', 'Add block in footer', 1), -('PDFInvoice', 'PDF Invoice', 'Allow the display of extra informations into the PDF invoice', 0); -UPDATE `PREFIX_hook` SET `description` = 'Add blocks in the header', `position` = '1' WHERE `name` = 'header' LIMIT 1 ; -UPDATE `PREFIX_currency` SET `iso_code` = 'XXX' WHERE `iso_code` IS NULL; - - -/* CONFIGURATION VARIABLE */ \ No newline at end of file diff --git a/upgrade/sql/0.9.7.2.sql b/upgrade/sql/0.9.7.2.sql deleted file mode 100644 index c0ebf4949..000000000 --- a/upgrade/sql/0.9.7.2.sql +++ /dev/null @@ -1,21 +0,0 @@ -/* STRUCTURE */ - -CREATE TABLE `PREFIX_discount_quantity` ( - id_discount_quantity INT UNSIGNED NOT NULL auto_increment, - id_discount_type INT UNSIGNED NOT NULL, - id_product INT UNSIGNED NOT NULL, - id_product_attribute INT UNSIGNED NULL, - quantity INT UNSIGNED NOT NULL, - value DECIMAL(10,2) UNSIGNED NOT NULL, - PRIMARY KEY (id_discount_quantity) -) ENGINE=MYISAM DEFAULT CHARSET=utf8; - -ALTER TABLE `PREFIX_product` ADD quantity_discount BOOL NULL DEFAULT 0 AFTER out_of_stock; - -/* CONTENTS */ - - -/* CONFIGURATION VARIABLE */ - -UPDATE `PREFIX_configuration` SET name = 'PS_TAX', value = 1 WHERE name = 'PS_TAX_NO' AND value = 0; -UPDATE `PREFIX_configuration` SET name = 'PS_TAX', value = 0 WHERE name = 'PS_TAX_NO' AND value = 1; \ No newline at end of file diff --git a/upgrade/sql/0.9.sql b/upgrade/sql/0.9.sql deleted file mode 100644 index abef1ee07..000000000 --- a/upgrade/sql/0.9.sql +++ /dev/null @@ -1,39 +0,0 @@ -/* STRUCTURE */ - -ALTER TABLE `PREFIX_currency` ADD `iso_code` VARCHAR( 3 ) NOT NULL DEFAULT '0' AFTER `name`; -ALTER TABLE `PREFIX_product_attribute` ADD `default_on` TINYINT( 1 ) UNSIGNED NOT NULL DEFAULT '0' AFTER `weight`; -ALTER TABLE `PREFIX_carrier` ADD `tax` INT( 10 ) UNSIGNED NOT NULL DEFAULT '0' AFTER `deleted`; - -ALTER TABLE `PREFIX_order_detail` - ADD `download_hash` VARCHAR(255) default NULL AFTER `tax_rate`, - ADD `download_nb` INT(10) unsigned default 0 AFTER `tax_rate`, - ADD `download_deadline` DATETIME DEFAULT NULL AFTER `tax_rate`; - -CREATE TABLE `PREFIX_product_download` ( - `id_product_download` INT(10) unsigned NOT NULL auto_increment, - `id_product` INT(10) unsigned NOT NULL, - `display_filename` VARCHAR(255) default NULL, - `physically_filename` VARCHAR(255) default NULL, - `date_deposit` DATETIME NOT NULL, - `date_expiration` DATETIME default NULL, - `nb_days_accessible` int(10) unsigned default NULL, - `nb_downloadable` int(10) unsigned default 1, - PRIMARY KEY (`id_product_download`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; - - -/* CONTENTS */ - -/* Adding tab Appearance */ -UPDATE `PREFIX_tab` SET `class_name` = 'AdminAppearance' WHERE class_name = 'AdminHomepage'; -UPDATE `PREFIX_tab_lang` SET `name` = 'Appearance' - WHERE `id_tab` = (SELECT `id_tab` FROM `PREFIX_tab` t WHERE t.class_name = 'AdminAppearance'); -UPDATE `PREFIX_tab_lang` SET `name` = 'Apparence' - WHERE `id_tab` = (SELECT `id_tab` FROM `PREFIX_tab` t WHERE t.class_name = 'AdminAppearance') - AND `id_lang` = (SELECT `id_lang` FROM `PREFIX_lang` l WHERE l.iso_code = 'fr'); - -/* Adding iso_code to currency */ -UPDATE `PREFIX_currency` SET `iso_code` = 'XXX'; - -/* Conf vars */ -INSERT INTO `PREFIX_configuration` (`name`, `value`, `date_add`, `date_upd`) VALUES ('PS_DISPLAY_QTIES', '1', NOW(), NOW()); \ No newline at end of file diff --git a/upgrade/sql/1.0.0.1.sql b/upgrade/sql/1.0.0.1.sql deleted file mode 100644 index 1aafc5d8f..000000000 --- a/upgrade/sql/1.0.0.1.sql +++ /dev/null @@ -1,122 +0,0 @@ -/* PHP */ -/* PHP:latin1_database_to_utf8(); */; - -/* STRUCTURE */ -SET NAMES 'utf8'; - -CREATE TABLE PREFIX_attribute_impact ( - id_attribute_impact int(11) NOT NULL AUTO_INCREMENT, - id_product int(11) NOT NULL, - id_attribute int(11) NOT NULL, - weight float NOT NULL, - price decimal(10,2) NOT NULL, - PRIMARY KEY (id_attribute_impact), - UNIQUE KEY id_product (id_product,id_attribute) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; - -CREATE TABLE PREFIX_supplier_lang ( - id_supplier INTEGER UNSIGNED NOT NULL, - id_lang INTEGER UNSIGNED NOT NULL, - description TEXT NULL, - INDEX supplier_lang_index(id_supplier, id_lang) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; - -CREATE TABLE PREFIX_manufacturer_lang ( - id_manufacturer INTEGER UNSIGNED NOT NULL, - id_lang INTEGER UNSIGNED NOT NULL, - description TEXT NULL, - INDEX manufacturer_lang_index(id_manufacturer, id_lang) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; - -CREATE TABLE PREFIX_state ( - id_state int(10) unsigned NOT NULL AUTO_INCREMENT, - id_country int(11) NOT NULL, - name varchar(64) NOT NULL, - iso_code varchar(3) NOT NULL, - active tinyint(1) NOT NULL default 0, - PRIMARY KEY (id_state) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; - -ALTER TABLE PREFIX_customer ADD secure_key VARCHAR(32) NOT NULL DEFAULT '-1' AFTER id_gender; -ALTER TABLE PREFIX_orders ADD secure_key VARCHAR(32) NOT NULL DEFAULT '-1' AFTER id_address_invoice; -ALTER TABLE PREFIX_product ADD id_category_default INT NULL AFTER id_tax; -ALTER TABLE PREFIX_category_product ADD position INTEGER UNSIGNED NOT NULL DEFAULT 0 AFTER id_product; -ALTER TABLE PREFIX_product ADD INDEX (id_category_default); -ALTER TABLE PREFIX_order_detail ADD ecotax DECIMAL(10, 2) NOT NULL DEFAULT 0 AFTER tax_rate; -ALTER TABLE PREFIX_employee - CHANGE name lastname VARCHAR(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, - CHANGE surname firstname VARCHAR(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL; -ALTER TABLE PREFIX_address - CHANGE name lastname VARCHAR(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, - CHANGE surname firstname VARCHAR(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL; -ALTER TABLE PREFIX_customer - CHANGE name lastname VARCHAR(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL , - CHANGE surname firstname VARCHAR(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL; -ALTER TABLE PREFIX_quick_access ADD new_window TINYINT( 1 ) NOT NULL DEFAULT 0 AFTER id_quick_access; - -/* CONTENTS */ -UPDATE PREFIX_hook_module SET id_hook = 14 WHERE id_hook = 9; -UPDATE PREFIX_quick_access SET new_window = 1 WHERE id_quick_access = 2 LIMIT 1; -INSERT INTO PREFIX_hook (name, title, description, position) VALUES ('orderConfirmation', 'Order confirmation page', 'Called on order confirmation page', 0); -UPDATE PREFIX_order_detail odt - SET product_price = ( - odt.product_price * ( - SELECT conversion_rate FROM PREFIX_currency c, PREFIX_orders o WHERE o.id_order = odt.id_order AND c.id_currency = o.id_currency - ) -); -UPDATE PREFIX_product p SET p.id_category_default = (SELECT id_category FROM PREFIX_category_product cp WHERE cp.id_product = p.id_product GROUP BY id_product ORDER BY cp.id_category ASC); -UPDATE PREFIX_category_product cp SET cp.position= cp.id_product; - -/* NEW TABS */ - -INSERT INTO PREFIX_tab (id_parent, class_name, position) VALUES ((SELECT tmp.`id_tab` FROM (SELECT `id_tab` FROM PREFIX_tab t WHERE t.class_name = 'AdminOrders' LIMIT 1) AS tmp), 'AdminPrintPDF', (SELECT tmp.max FROM (SELECT MAX(position) max FROM `PREFIX_tab` WHERE id_parent = (SELECT tmp.`id_tab` FROM (SELECT `id_tab` FROM PREFIX_tab t WHERE t.class_name = 'AdminOrders' LIMIT 1) AS tmp )) AS tmp)); -INSERT INTO PREFIX_tab_lang (id_lang, id_tab, name) ( - SELECT id_lang, - (SELECT id_tab FROM PREFIX_tab t WHERE t.class_name = 'AdminPrintPDF' LIMIT 1), - 'Print invoices' FROM PREFIX_lang); -UPDATE `PREFIX_tab_lang` SET `name` = 'Impression factures' - WHERE `id_tab` = (SELECT `id_tab` FROM `PREFIX_tab` t WHERE t.class_name = 'AdminPrintPDF') - AND `id_lang` = (SELECT `id_lang` FROM `PREFIX_lang` l WHERE l.iso_code = 'fr'); -INSERT INTO PREFIX_access (id_profile, id_tab, `view`, `add`, edit, `delete`) VALUES ('1', (SELECT id_tab FROM PREFIX_tab t WHERE t.class_name = 'AdminPrintPDF' LIMIT 1), 1, 1, 1, 1); - -INSERT INTO PREFIX_tab (id_parent, class_name, position) VALUES (-1, 'AdminSearch', 2); -INSERT INTO PREFIX_tab_lang (id_lang, id_tab, name) ( - SELECT id_lang, - (SELECT id_tab FROM PREFIX_tab t WHERE t.class_name = 'AdminSearch' LIMIT 1), - 'Search' FROM PREFIX_lang); -UPDATE `PREFIX_tab_lang` SET `name` = 'Recherche' - WHERE `id_tab` = (SELECT `id_tab` FROM `PREFIX_tab` t WHERE t.class_name = 'AdminSearch') - AND `id_lang` = (SELECT `id_lang` FROM `PREFIX_lang` l WHERE l.iso_code = 'fr'); -INSERT INTO PREFIX_access (id_profile, id_tab, `view`, `add`, edit, `delete`) VALUES ('1', (SELECT id_tab FROM PREFIX_tab t WHERE t.class_name = 'AdminSearch' LIMIT 1), 1, 1, 1, 1); - -INSERT INTO PREFIX_tab (id_parent, class_name, position) VALUES ((SELECT tmp.`id_tab` FROM (SELECT `id_tab` FROM PREFIX_tab t WHERE t.class_name = 'AdminPreferences' LIMIT 1) AS tmp), 'AdminLocalization', (SELECT tmp.max FROM (SELECT MAX(position) max FROM `PREFIX_tab` WHERE id_parent = (SELECT tmp.`id_tab` FROM (SELECT `id_tab` FROM PREFIX_tab t WHERE t.class_name = 'AdminPreferences' LIMIT 1) AS tmp )) AS tmp)); -INSERT INTO PREFIX_tab_lang (id_lang, id_tab, name) ( - SELECT id_lang, - (SELECT id_tab FROM PREFIX_tab t WHERE t.class_name = 'AdminLocalization' LIMIT 1), - 'Localization' FROM PREFIX_lang); -UPDATE `PREFIX_tab_lang` SET `name` = 'Localisation' - WHERE `id_tab` = (SELECT `id_tab` FROM `PREFIX_tab` t WHERE t.class_name = 'AdminLocalization') - AND `id_lang` = (SELECT `id_lang` FROM `PREFIX_lang` l WHERE l.iso_code = 'fr'); -INSERT INTO PREFIX_access (id_profile, id_tab, `view`, `add`, edit, `delete`) VALUES ('1', (SELECT id_tab FROM PREFIX_tab t WHERE t.class_name = 'AdminLocalization' LIMIT 1), 1, 1, 1, 1); - -INSERT INTO PREFIX_tab (id_parent, class_name, position) VALUES ((SELECT tmp.`id_tab` FROM (SELECT `id_tab` FROM PREFIX_tab t WHERE t.class_name = 'AdminShipping' LIMIT 1) AS tmp), 'AdminStates', (SELECT tmp.max FROM (SELECT MAX(position) max FROM `PREFIX_tab` WHERE id_parent = (SELECT tmp.`id_tab` FROM (SELECT `id_tab` FROM PREFIX_tab t WHERE t.class_name = 'AdminShipping' LIMIT 1) AS tmp )) AS tmp)); -INSERT INTO PREFIX_tab_lang (id_lang, id_tab, name) ( - SELECT id_lang, - (SELECT id_tab FROM PREFIX_tab t WHERE t.class_name = 'AdminStates' LIMIT 1), - 'States' FROM PREFIX_lang); -UPDATE `PREFIX_tab_lang` SET `name` = 'Etats' - WHERE `id_tab` = (SELECT `id_tab` FROM `PREFIX_tab` t WHERE t.class_name = 'AdminStates') - AND `id_lang` = (SELECT `id_lang` FROM `PREFIX_lang` l WHERE l.iso_code = 'fr'); -INSERT INTO PREFIX_access (`id_profile`, `id_tab`, `view`, `add`, edit, `delete`) VALUES ('1', (SELECT id_tab FROM PREFIX_tab t WHERE t.class_name = 'AdminStates' LIMIT 1), 1, 1, 1, 1); - -INSERT INTO PREFIX_image_type (`name`, `width`, `height`, `products`, `categories`, `manufacturers`, `suppliers`) VALUES ('home', 129, 129, 1, 0, 0, 0); - -/* CONFIGURATION VARIABLE */ -INSERT INTO PREFIX_configuration (name, value, date_add, date_upd) VALUES ('PS_NB_DAYS_NEW_PRODUCT', 20, NOW(), NOW()); -INSERT INTO PREFIX_configuration (name, value, date_add, date_upd) VALUES ('PS_WEIGHT_UNIT', 'kg', NOW(), NOW()); -INSERT INTO PREFIX_configuration (name, value, date_add, date_upd) VALUES ('PS_BLOCK_CART_AJAX', '1', NOW(), NOW()); -INSERT INTO PREFIX_configuration (name, value, date_add, date_upd) VALUES ('PS_FO_PROTOCOL', 'http://', NOW(), NOW()); -UPDATE PREFIX_configuration SET name = 'PS_MAIL_SMTP_PORT', value = 25 WHERE name = 'PS_MAIL_SMTP_PORT' AND value = 'default'; -UPDATE PREFIX_configuration SET name = 'PS_MAIL_SMTP_PORT', value = 465 WHERE name = 'PS_MAIL_SMTP_PORT' AND value = 'secure'; - -/* PHP:add_new_tab(AdminPDF, fr:PDF|es:PDF|en:PDF|de:PDF|it:PDF, 3); */; \ No newline at end of file diff --git a/upgrade/sql/1.0.0.2.sql b/upgrade/sql/1.0.0.2.sql deleted file mode 100644 index fb0c72687..000000000 --- a/upgrade/sql/1.0.0.2.sql +++ /dev/null @@ -1,13 +0,0 @@ - -/* STRUCTURE */ -SET NAMES 'utf8'; - -ALTER TABLE PREFIX_currency CHANGE COLUMN conversion_rate conversion_rate DECIMAL(10,6) NOT NULL; - -/* CONTENTS */ - -INSERT INTO PREFIX_image_type (`name`, `width`, `height`, `products`, `categories`, `manufacturers`, `suppliers`) VALUES ('thickbox', 600, 600, 1, 0, 0, 0); -INSERT INTO PREFIX_image_type (`name`, `width`, `height`, `products`, `categories`, `manufacturers`, `suppliers`) VALUES ('category', 600, 150, 0, 1, 0, 0); -INSERT INTO PREFIX_image_type (`name`, `width`, `height`, `products`, `categories`, `manufacturers`, `suppliers`) VALUES ('thickbox', 129, 129, 1, 0, 0, 0); - -/* CONFIGURATION VARIABLE */ diff --git a/upgrade/sql/1.0.0.3.sql b/upgrade/sql/1.0.0.3.sql deleted file mode 100644 index e82995b59..000000000 --- a/upgrade/sql/1.0.0.3.sql +++ /dev/null @@ -1,441 +0,0 @@ -/* STRUCTURE */ -SET NAMES 'utf8'; - -ALTER TABLE PREFIX_attribute_group_lang DROP INDEX attribute_group_lang_index, ADD PRIMARY KEY (id_attribute_group, id_lang); -ALTER TABLE PREFIX_discount_lang DROP INDEX discount_lang_index, ADD PRIMARY KEY (id_discount, id_lang); -ALTER TABLE PREFIX_discount_type_lang DROP INDEX discount_type_lang_index, ADD PRIMARY KEY (id_discount_type, id_lang); -ALTER TABLE PREFIX_manufacturer_lang DROP INDEX manufacturer_lang_index, ADD PRIMARY KEY (id_manufacturer, id_lang); -ALTER TABLE PREFIX_supplier_lang DROP INDEX supplier_lang_index, ADD PRIMARY KEY (id_supplier, id_lang); -ALTER TABLE PREFIX_profile_lang DROP INDEX profile_lang_index, ADD PRIMARY KEY (id_profile, id_lang); -ALTER TABLE PREFIX_configuration_lang DROP INDEX configuration_lang_index, ADD PRIMARY KEY (id_configuration, id_lang); -ALTER TABLE PREFIX_tab_lang DROP INDEX tab_lang, ADD PRIMARY KEY (id_tab, id_lang); - -ALTER TABLE PREFIX_product ADD id_color_default INT UNSIGNED NULL AFTER id_category_default; -ALTER TABLE PREFIX_attribute_group ADD is_color_group TINYINT(1) NOT NULL DEFAULT 0; -ALTER TABLE PREFIX_attribute ADD color VARCHAR(32) NULL DEFAULT NULL; -ALTER TABLE PREFIX_currency CHANGE conversion_rate conversion_rate DECIMAL(13, 6) NOT NULL ; -ALTER TABLE PREFIX_address ADD id_state INT NULL AFTER id_country; -ALTER TABLE PREFIX_state ADD id_zone INT NULL AFTER id_country; -ALTER TABLE PREFIX_country ADD contains_states tinyint(1) NOT NULL DEFAULT 0; - -UPDATE PREFIX_customer SET secure_key = MD5(RAND()) WHERE secure_key = '-1'; -UPDATE PREFIX_orders o SET secure_key = (SELECT secure_key FROM PREFIX_customer c WHERE c.id_customer = o.id_customer); - -CREATE TABLE PREFIX_order_return ( - id_order_return INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, - id_customer INTEGER UNSIGNED NOT NULL, - id_order INTEGER UNSIGNED NOT NULL, - state tinyint(1) unsigned NOT NULL DEFAULT 0, - question TEXT NOT NULL, - date_add DATETIME NOT NULL, - date_upd DATETIME NOT NULL, - PRIMARY KEY(id_order_return), - INDEX order_return_customer(id_customer) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; - -CREATE TABLE PREFIX_order_return_detail ( - id_order_return INTEGER UNSIGNED NOT NULL, - id_order_detail INTEGER UNSIGNED NOT NULL, - product_quantity int(10) unsigned NOT NULL DEFAULT 1, - PRIMARY KEY (id_order_return,id_order_detail) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; - -CREATE TABLE PREFIX_order_return_state ( - id_order_return_state int(10) unsigned NOT NULL auto_increment, - color varchar(32) default NULL, - PRIMARY KEY (`id_order_return_state`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; - -CREATE TABLE PREFIX_order_return_state_lang ( - id_order_return_state int(10) unsigned NOT NULL, - id_lang int(10) unsigned NOT NULL, - name varchar(64) NOT NULL, - UNIQUE KEY `order_state_lang_index` (`id_order_return_state`,`id_lang`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; - -CREATE TABLE PREFIX_order_slip ( - id_order_slip INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, - id_customer INTEGER UNSIGNED NOT NULL, - id_order INTEGER UNSIGNED NOT NULL, - date_add DATETIME NOT NULL, - date_upd DATETIME NOT NULL, - PRIMARY KEY(id_order_slip), - INDEX order_slip_customer(id_customer) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; - -CREATE TABLE PREFIX_order_slip_detail ( - id_order_slip INTEGER UNSIGNED NOT NULL, - id_order_detail INTEGER UNSIGNED NOT NULL, - product_quantity int(10) unsigned NOT NULL DEFAULT 0, - PRIMARY KEY (`id_order_slip`,`id_order_detail`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; - -CREATE TABLE PREFIX_tax_state ( - id_tax int(10) unsigned NOT NULL, - id_state int(10) unsigned NOT NULL, - INDEX tax_state_index(id_tax, id_state) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; - -/* CONTENTS */ - -INSERT INTO PREFIX_order_return_state (`id_order_return_state`, `color`) VALUES -(1, '#ADD8E6'), -(2, '#EEDDFF'), -(3, '#DDFFAA'), -(4, '#FFD3D3'), -(5, '#FFFFBB'); - -INSERT INTO PREFIX_order_return_state_lang (`id_order_return_state`, `id_lang`, `name`) VALUES -(1, 1, 'Waiting for confirmation'), -(2, 1, 'Waiting for package'), -(3, 1, 'Package received'), -(4, 1, 'Return denied'), -(5, 1, 'Return completed'), -(1, 2, 'En attente de confirmation'), -(2, 2, 'En attente du colis'), -(3, 2, 'Colis reçu'), -(4, 2, 'Retour refusé'), -(5, 2, 'Retour terminé'); - -UPDATE PREFIX_country SET contains_states = 1 WHERE id_country = 21; - -INSERT INTO `PREFIX_state` (`id_state`, `id_country`, `id_zone`, `name`, `iso_code`, `active`) VALUES -(1, 21, 2, 'Alabama', 'AL', 1), -(2, 21, 2, 'Alaska', 'AK', 1), -(3, 21, 2, 'Arizona', 'AZ', 1), -(4, 21, 2, 'Arkansas', 'AR', 1), -(5, 21, 2, 'California', 'CA', 1), -(6, 21, 2, 'Colorado', 'CO', 1), -(7, 21, 2, 'Connecticut', 'CT', 1), -(8, 21, 2, 'Delaware', 'DE', 1), -(9, 21, 2, 'Florida', 'FL', 1), -(10, 21, 2, 'Georgia', 'GA', 1), -(11, 21, 2, 'Hawaii', 'HI', 1), -(12, 21, 2, 'Idaho', 'ID', 1), -(13, 21, 2, 'Illinois', 'IL', 1), -(14, 21, 2, 'Indiana', 'IN', 1), -(15, 21, 2, 'Iowa', 'IA', 1), -(16, 21, 2, 'Kansas', 'KS', 1), -(17, 21, 2, 'Kentucky', 'KY', 1), -(18, 21, 2, 'Louisiana', 'LA', 1), -(19, 21, 2, 'Maine', 'ME', 1), -(20, 21, 2, 'Maryland', 'MD', 1), -(21, 21, 2, 'Massachusetts', 'MA', 1), -(22, 21, 2, 'Michigan', 'MI', 1), -(23, 21, 2, 'Minnesota', 'MN', 1), -(24, 21, 2, 'Mississippi', 'MS', 1), -(25, 21, 2, 'Missouri', 'MO', 1), -(26, 21, 2, 'Montana', 'MT', 1), -(27, 21, 2, 'Nebraska', 'NE', 1), -(28, 21, 2, 'Nevada', 'NV', 1), -(29, 21, 2, 'New Hampshire', 'NH', 1), -(30, 21, 2, 'New Jersey', 'NJ', 1), -(31, 21, 2, 'New Mexico', 'NM', 1), -(32, 21, 2, 'New York', 'NY', 1), -(33, 21, 2, 'North Carolina', 'NC', 1), -(34, 21, 2, 'North Dakota', 'ND', 1), -(35, 21, 2, 'Ohio', 'OH', 1), -(36, 21, 2, 'Oklahoma', 'OK', 1), -(37, 21, 2, 'Oregon', 'OR', 1), -(38, 21, 2, 'Pennsylvania', 'PA', 1), -(39, 21, 2, 'Rhode Island', 'RI', 1), -(40, 21, 2, 'South Carolina', 'SC', 1), -(41, 21, 2, 'South Dakota', 'SD', 1), -(42, 21, 2, 'Tennessee', 'TN', 1), -(43, 21, 2, 'Texas', 'TX', 1), -(44, 21, 2, 'Utah', 'UT', 1), -(45, 21, 2, 'Vermont', 'VT', 1), -(46, 21, 2, 'Virginia', 'VA', 1), -(47, 21, 2, 'Washington', 'WA', 1), -(48, 21, 2, 'West Virginia', 'WV', 1), -(49, 21, 2, 'Wisconsin', 'WI', 1), -(50, 21, 2, 'Wyoming', 'WY', 1), -(51, 21, 2, 'Puerto Rico', 'PR', 1), -(52, 21, 2, 'US Virgin Islands', 'VI', 1); - -INSERT INTO `PREFIX_lang` (`name`, `active`, `iso_code`) VALUES -('Deutsch (German)', 1, 'de'), -('Español (Spanish)', 1, 'es'), -('Nederlands (Dutch)', 1, 'nl'), -('Bahasa Indonesia (Indonesian)', 1, 'id'), -('Italiano (Italian)', 1, 'it'), -('Język polski (Polish)', 1, 'pl'), -('Português (Portuguese)', 1, 'pt'), -('Čeština (Czech)', 1, 'cs'), -('Pусский язык (Russian)', 0, 'ru'), -('Türkçe (Turkish)', 0, 'tr'), -('Tiếng Việt (Vietnamese)', 0, 'vn'); - -/* NEW LANGS */ - -INSERT IGNORE INTO `PREFIX_tab_lang` (`id_tab`, `id_lang`, `name`) - (SELECT `id_tab`, id_lang, (SELECT tl.`name` - FROM `PREFIX_tab_lang` tl - WHERE tl.`id_lang` = (SELECT c.`value` - FROM `PREFIX_configuration` c - WHERE c.`name` = 'PS_LANG_DEFAULT' LIMIT 1) AND tl.`id_tab`=`PREFIX_tab`.`id_tab`) - FROM `PREFIX_lang` CROSS JOIN `PREFIX_tab`); - -INSERT IGNORE INTO `PREFIX_country_lang` (`id_country`, `id_lang`, `name`) - (SELECT `id_country`, id_lang, (SELECT tl.`name` - FROM `PREFIX_country_lang` tl - WHERE tl.`id_lang` = (SELECT c.`value` - FROM `PREFIX_configuration` c - WHERE c.`name` = 'PS_LANG_DEFAULT' LIMIT 1) AND tl.`id_country`=`PREFIX_country`.`id_country`) - FROM `PREFIX_lang` CROSS JOIN `PREFIX_country`); - -INSERT IGNORE INTO `PREFIX_quick_access_lang` (`id_quick_access`, `id_lang`, `name`) - (SELECT `id_quick_access`, id_lang, (SELECT tl.`name` - FROM `PREFIX_quick_access_lang` tl - WHERE tl.`id_lang` = (SELECT c.`value` - FROM `PREFIX_configuration` c - WHERE c.`name` = 'PS_LANG_DEFAULT' LIMIT 1) AND tl.`id_quick_access`=`PREFIX_quick_access`.`id_quick_access`) - FROM `PREFIX_lang` CROSS JOIN `PREFIX_quick_access`); - -INSERT IGNORE INTO `PREFIX_attribute_group_lang` (`id_attribute_group`, `id_lang`, `name`, `public_name`) - (SELECT `id_attribute_group`, id_lang, (SELECT tl.`name` - FROM `PREFIX_attribute_group_lang` tl - WHERE tl.`id_lang` = (SELECT c.`value` - FROM `PREFIX_configuration` c - WHERE c.`name` = 'PS_LANG_DEFAULT' LIMIT 1) AND tl.`id_attribute_group`=`PREFIX_attribute_group`.`id_attribute_group`), - (SELECT tl.`public_name` - FROM `PREFIX_attribute_group_lang` tl - WHERE tl.`id_lang` = (SELECT c.`value` - FROM `PREFIX_configuration` c - WHERE c.`name` = 'PS_LANG_DEFAULT' LIMIT 1) AND tl.`id_attribute_group`=`PREFIX_attribute_group`.`id_attribute_group`) - FROM `PREFIX_lang` CROSS JOIN `PREFIX_attribute_group`); - -INSERT IGNORE INTO `PREFIX_attribute_lang` (`id_attribute`, `id_lang`, `name`) - (SELECT `id_attribute`, id_lang, (SELECT tl.`name` - FROM `PREFIX_attribute_lang` tl - WHERE tl.`id_lang` = (SELECT c.`value` - FROM `PREFIX_configuration` c - WHERE c.`name` = 'PS_LANG_DEFAULT' LIMIT 1) AND tl.`id_attribute`=`PREFIX_attribute`.`id_attribute`) - FROM `PREFIX_lang` CROSS JOIN `PREFIX_attribute`); - -INSERT IGNORE INTO `PREFIX_carrier_lang` (`id_carrier`, `id_lang`, `delay`) - (SELECT `id_carrier`, id_lang, (SELECT tl.`delay` - FROM `PREFIX_carrier_lang` tl - WHERE tl.`id_lang` = (SELECT c.`value` - FROM `PREFIX_configuration` c - WHERE c.`name` = 'PS_LANG_DEFAULT' LIMIT 1) AND tl.`id_carrier`=`PREFIX_carrier`.`id_carrier`) - FROM `PREFIX_lang` CROSS JOIN `PREFIX_carrier`); - -INSERT IGNORE INTO `PREFIX_contact_lang` (`id_contact`, `id_lang`, `name`, `description`) - (SELECT `id_contact`, id_lang, (SELECT tl.`name` - FROM `PREFIX_contact_lang` tl - WHERE tl.`id_lang` = (SELECT c.`value` - FROM `PREFIX_configuration` c - WHERE c.`name` = 'PS_LANG_DEFAULT' LIMIT 1) AND tl.`id_contact`=`PREFIX_contact`.`id_contact`), - (SELECT tl.`description` - FROM `PREFIX_contact_lang` tl - WHERE tl.`id_lang` = (SELECT c.`value` - FROM `PREFIX_configuration` c - WHERE c.`name` = 'PS_LANG_DEFAULT' LIMIT 1) AND tl.`id_contact`=`PREFIX_contact`.`id_contact`) - FROM `PREFIX_lang` CROSS JOIN `PREFIX_contact`); - -INSERT IGNORE INTO `PREFIX_discount_lang` (`id_discount`, `id_lang`, `description`) - (SELECT `id_discount`, id_lang, (SELECT tl.`description` - FROM `PREFIX_discount_lang` tl - WHERE tl.`id_lang` = (SELECT c.`value` - FROM `PREFIX_configuration` c - WHERE c.`name` = 'PS_LANG_DEFAULT' LIMIT 1) AND tl.`id_discount`=`PREFIX_discount`.`id_discount`) - FROM `PREFIX_lang` CROSS JOIN `PREFIX_discount`); - -INSERT IGNORE INTO `PREFIX_discount_type_lang` (`id_discount_type`, `id_lang`, `name`) - (SELECT `id_discount_type`, id_lang, (SELECT tl.`name` - FROM `PREFIX_discount_type_lang` tl - WHERE tl.`id_lang` = (SELECT c.`value` - FROM `PREFIX_configuration` c - WHERE c.`name` = 'PS_LANG_DEFAULT' LIMIT 1) AND tl.`id_discount_type`=`PREFIX_discount_type`.`id_discount_type`) - FROM `PREFIX_lang` CROSS JOIN `PREFIX_discount_type`); - -INSERT IGNORE INTO `PREFIX_feature_lang` (`id_feature`, `id_lang`, `name`) - (SELECT `id_feature`, id_lang, (SELECT tl.`name` - FROM `PREFIX_feature_lang` tl - WHERE tl.`id_lang` = (SELECT c.`value` - FROM `PREFIX_configuration` c - WHERE c.`name` = 'PS_LANG_DEFAULT' LIMIT 1) AND tl.`id_feature`=`PREFIX_feature`.`id_feature`) - FROM `PREFIX_lang` CROSS JOIN `PREFIX_feature`); - -INSERT IGNORE INTO `PREFIX_feature_value_lang` (`id_feature_value`, `id_lang`, `value`) - (SELECT `id_feature_value`, id_lang, (SELECT tl.`value` - FROM `PREFIX_feature_value_lang` tl - WHERE tl.`id_lang` = (SELECT c.`value` - FROM `PREFIX_configuration` c - WHERE c.`name` = 'PS_LANG_DEFAULT' LIMIT 1) AND tl.`id_feature_value`=`PREFIX_feature_value`.`id_feature_value`) - FROM `PREFIX_lang` CROSS JOIN `PREFIX_feature_value`); - -INSERT IGNORE INTO `PREFIX_image_lang` (`id_image`, `id_lang`, `legend`) - (SELECT `id_image`, id_lang, (SELECT tl.`legend` - FROM `PREFIX_image_lang` tl - WHERE tl.`id_lang` = (SELECT c.`value` - FROM `PREFIX_configuration` c - WHERE c.`name` = 'PS_LANG_DEFAULT' LIMIT 1) AND tl.`id_image`=`PREFIX_image`.`id_image`) - FROM `PREFIX_lang` CROSS JOIN `PREFIX_image`); - -INSERT IGNORE INTO `PREFIX_manufacturer_lang` (`id_manufacturer`, `id_lang`, `description`) - (SELECT `id_manufacturer`, id_lang, (SELECT tl.`description` - FROM `PREFIX_manufacturer_lang` tl - WHERE tl.`id_lang` = (SELECT c.`value` - FROM `PREFIX_configuration` c - WHERE c.`name` = 'PS_LANG_DEFAULT' LIMIT 1) AND tl.`id_manufacturer`=`PREFIX_manufacturer`.`id_manufacturer`) - FROM `PREFIX_lang` CROSS JOIN `PREFIX_manufacturer`); - -INSERT IGNORE INTO `PREFIX_order_return_state_lang` (`id_order_return_state`, `id_lang`, `name`) - (SELECT `id_order_return_state`, id_lang, (SELECT tl.`name` - FROM `PREFIX_order_return_state_lang` tl - WHERE tl.`id_lang` = (SELECT c.`value` - FROM `PREFIX_configuration` c - WHERE c.`name` = 'PS_LANG_DEFAULT' LIMIT 1) AND tl.`id_order_return_state`=`PREFIX_order_return_state`.`id_order_return_state`) - FROM `PREFIX_lang` CROSS JOIN `PREFIX_order_return_state`); - -INSERT IGNORE INTO `PREFIX_order_state_lang` (`id_order_state`, `id_lang`, `name`, `template`) - (SELECT `id_order_state`, id_lang, (SELECT tl.`name` - FROM `PREFIX_order_state_lang` tl - WHERE tl.`id_lang` = (SELECT c.`value` - FROM `PREFIX_configuration` c - WHERE c.`name` = 'PS_LANG_DEFAULT' LIMIT 1) AND tl.`id_order_state`=`PREFIX_order_state`.`id_order_state`), - (SELECT tl.`template` - FROM `PREFIX_order_state_lang` tl - WHERE tl.`id_lang` = (SELECT c.`value` - FROM `PREFIX_configuration` c - WHERE c.`name` = 'PS_LANG_DEFAULT' LIMIT 1) AND tl.`id_order_state`=`PREFIX_order_state`.`id_order_state`) - FROM `PREFIX_lang` CROSS JOIN `PREFIX_order_state`); - -INSERT IGNORE INTO `PREFIX_profile_lang` (`id_profile`, `id_lang`, `name`) - (SELECT `id_profile`, id_lang, (SELECT tl.`name` - FROM `PREFIX_profile_lang` tl - WHERE tl.`id_lang` = (SELECT c.`value` - FROM `PREFIX_configuration` c - WHERE c.`name` = 'PS_LANG_DEFAULT' LIMIT 1) AND tl.`id_profile`=`PREFIX_profile`.`id_profile`) - FROM `PREFIX_lang` CROSS JOIN `PREFIX_profile`); - -INSERT IGNORE INTO `PREFIX_supplier_lang` (`id_supplier`, `id_lang`, `description`) - (SELECT `id_supplier`, id_lang, (SELECT tl.`description` - FROM `PREFIX_supplier_lang` tl - WHERE tl.`id_lang` = (SELECT c.`value` - FROM `PREFIX_configuration` c - WHERE c.`name` = 'PS_LANG_DEFAULT' LIMIT 1) AND tl.`id_supplier`=`PREFIX_supplier`.`id_supplier`) - FROM `PREFIX_lang` CROSS JOIN `PREFIX_supplier`); - -INSERT IGNORE INTO `PREFIX_tax_lang` (`id_tax`, `id_lang`, `name`) - (SELECT `id_tax`, id_lang, (SELECT tl.`name` - FROM `PREFIX_tax_lang` tl - WHERE tl.`id_lang` = (SELECT c.`value` - FROM `PREFIX_configuration` c - WHERE c.`name` = 'PS_LANG_DEFAULT' LIMIT 1) AND tl.`id_tax`=`PREFIX_tax`.`id_tax`) - FROM `PREFIX_lang` CROSS JOIN `PREFIX_tax`); - -/* products */ -INSERT IGNORE INTO `PREFIX_product_lang` (`id_product`, `id_lang`, `description`, `description_short`, `link_rewrite`, `meta_description`, `meta_keywords`, `meta_title`, `name`, `availability`) - (SELECT `id_product`, id_lang, - (SELECT tl.`description` - FROM `PREFIX_product_lang` tl - WHERE tl.`id_lang` = (SELECT c.`value` - FROM `PREFIX_configuration` c - WHERE c.`name` = 'PS_LANG_DEFAULT' LIMIT 1) AND tl.`id_product`=`PREFIX_product`.`id_product`), - (SELECT tl.`description_short` - FROM `PREFIX_product_lang` tl - WHERE tl.`id_lang` = (SELECT c.`value` - FROM `PREFIX_configuration` c - WHERE c.`name` = 'PS_LANG_DEFAULT' LIMIT 1) AND tl.`id_product`=`PREFIX_product`.`id_product`), - (SELECT tl.`link_rewrite` - FROM `PREFIX_product_lang` tl - WHERE tl.`id_lang` = (SELECT c.`value` - FROM `PREFIX_configuration` c - WHERE c.`name` = 'PS_LANG_DEFAULT' LIMIT 1) AND tl.`id_product`=`PREFIX_product`.`id_product`), - (SELECT tl.`meta_description` - FROM `PREFIX_product_lang` tl - WHERE tl.`id_lang` = (SELECT c.`value` - FROM `PREFIX_configuration` c - WHERE c.`name` = 'PS_LANG_DEFAULT' LIMIT 1) AND tl.`id_product`=`PREFIX_product`.`id_product`), - (SELECT tl.`meta_keywords` - FROM `PREFIX_product_lang` tl - WHERE tl.`id_lang` = (SELECT c.`value` - FROM `PREFIX_configuration` c - WHERE c.`name` = 'PS_LANG_DEFAULT' LIMIT 1) AND tl.`id_product`=`PREFIX_product`.`id_product`), - (SELECT tl.`meta_title` - FROM `PREFIX_product_lang` tl - WHERE tl.`id_lang` = (SELECT c.`value` - FROM `PREFIX_configuration` c - WHERE c.`name` = 'PS_LANG_DEFAULT' LIMIT 1) AND tl.`id_product`=`PREFIX_product`.`id_product`), - (SELECT tl.`name` - FROM `PREFIX_product_lang` tl - WHERE tl.`id_lang` = (SELECT c.`value` - FROM `PREFIX_configuration` c - WHERE c.`name` = 'PS_LANG_DEFAULT' LIMIT 1) AND tl.`id_product`=`PREFIX_product`.`id_product`), - (SELECT tl.`availability` - FROM `PREFIX_product_lang` tl - WHERE tl.`id_lang` = (SELECT c.`value` - FROM `PREFIX_configuration` c - WHERE c.`name` = 'PS_LANG_DEFAULT' LIMIT 1) AND tl.`id_product`=`PREFIX_product`.`id_product`) - FROM `PREFIX_lang` CROSS JOIN `PREFIX_product`); - -/* categories */ -INSERT IGNORE INTO `PREFIX_category_lang` (`id_category`, `id_lang`, `description`, `link_rewrite`, `meta_description`, `meta_keywords`, `meta_title`, `name`) - (SELECT `id_category`, id_lang, - (SELECT tl.`description` - FROM `PREFIX_category_lang` tl - WHERE tl.`id_lang` = (SELECT c.`value` - FROM `PREFIX_configuration` c - WHERE c.`name` = 'PS_LANG_DEFAULT' LIMIT 1) AND tl.`id_category`=`PREFIX_category`.`id_category`), - (SELECT tl.`link_rewrite` - FROM `PREFIX_category_lang` tl - WHERE tl.`id_lang` = (SELECT c.`value` - FROM `PREFIX_configuration` c - WHERE c.`name` = 'PS_LANG_DEFAULT' LIMIT 1) AND tl.`id_category`=`PREFIX_category`.`id_category`), - (SELECT tl.`meta_description` - FROM `PREFIX_category_lang` tl - WHERE tl.`id_lang` = (SELECT c.`value` - FROM `PREFIX_configuration` c - WHERE c.`name` = 'PS_LANG_DEFAULT' LIMIT 1) AND tl.`id_category`=`PREFIX_category`.`id_category`), - (SELECT tl.`meta_keywords` - FROM `PREFIX_category_lang` tl - WHERE tl.`id_lang` = (SELECT c.`value` - FROM `PREFIX_configuration` c - WHERE c.`name` = 'PS_LANG_DEFAULT' LIMIT 1) AND tl.`id_category`=`PREFIX_category`.`id_category`), - (SELECT tl.`meta_title` - FROM `PREFIX_category_lang` tl - WHERE tl.`id_lang` = (SELECT c.`value` - FROM `PREFIX_configuration` c - WHERE c.`name` = 'PS_LANG_DEFAULT' LIMIT 1) AND tl.`id_category`=`PREFIX_category`.`id_category`), - (SELECT tl.`name` - FROM `PREFIX_category_lang` tl - WHERE tl.`id_lang` = (SELECT c.`value` - FROM `PREFIX_configuration` c - WHERE c.`name` = 'PS_LANG_DEFAULT' LIMIT 1) AND tl.`id_category`=`PREFIX_category`.`id_category`) - FROM `PREFIX_lang` CROSS JOIN `PREFIX_category`); - - - -/* NEW TABS */ - -INSERT INTO PREFIX_tab (id_parent, class_name, position) VALUES ((SELECT tmp.`id_tab` FROM (SELECT `id_tab` FROM PREFIX_tab t WHERE t.class_name = 'AdminOrders' LIMIT 1) AS tmp), 'AdminReturn', (SELECT tmp.max FROM (SELECT MAX(position) max FROM `PREFIX_tab` WHERE id_parent = (SELECT tmp.`id_tab` FROM (SELECT `id_tab` FROM PREFIX_tab t WHERE t.class_name = 'AdminOrders' LIMIT 1) AS tmp )) AS tmp)); -INSERT INTO PREFIX_tab_lang (id_lang, id_tab, name) ( - SELECT id_lang, - (SELECT id_tab FROM PREFIX_tab t WHERE t.class_name = 'AdminReturn' LIMIT 1), - 'Merchandise returns (RMAs)' FROM PREFIX_lang); -UPDATE `PREFIX_tab_lang` SET `name` = 'Retours produit' - WHERE `id_tab` = (SELECT `id_tab` FROM `PREFIX_tab` t WHERE t.class_name = 'AdminReturn') - AND `id_lang` = (SELECT `id_lang` FROM `PREFIX_lang` l WHERE l.iso_code = 'fr'); -INSERT INTO PREFIX_access (id_profile, id_tab, `view`, `add`, edit, `delete`) VALUES ('1', (SELECT id_tab FROM PREFIX_tab t WHERE t.class_name = 'AdminReturn' LIMIT 1), 1, 1, 1, 1); - -INSERT INTO PREFIX_tab (id_parent, class_name, position) VALUES ((SELECT tmp.`id_tab` FROM (SELECT `id_tab` FROM PREFIX_tab t WHERE t.class_name = 'AdminOrders' LIMIT 1) AS tmp), 'AdminSlip', (SELECT tmp.max FROM (SELECT MAX(position) max FROM `PREFIX_tab` WHERE id_parent = (SELECT tmp.`id_tab` FROM (SELECT `id_tab` FROM PREFIX_tab t WHERE t.class_name = 'AdminOrders' LIMIT 1) AS tmp )) AS tmp)); -INSERT INTO PREFIX_tab_lang (id_lang, id_tab, name) ( - SELECT id_lang, - (SELECT id_tab FROM PREFIX_tab t WHERE t.class_name = 'AdminSlip' LIMIT 1), - 'Credit slips' FROM PREFIX_lang); -UPDATE `PREFIX_tab_lang` SET `name` = 'Avoirs' - WHERE `id_tab` = (SELECT `id_tab` FROM `PREFIX_tab` t WHERE t.class_name = 'AdminSlip') - AND `id_lang` = (SELECT `id_lang` FROM `PREFIX_lang` l WHERE l.iso_code = 'fr'); -INSERT INTO PREFIX_access (id_profile, id_tab, `view`, `add`, edit, `delete`) VALUES ('1', (SELECT id_tab FROM PREFIX_tab t WHERE t.class_name = 'AdminSlip' LIMIT 1), 1, 1, 1, 1); - - -/* CONFIGURATION VARIABLE */ -INSERT INTO `PREFIX_configuration` (`name`, `value`, `date_add`, `date_upd`) VALUES ('PS_ORDER_RETURN', '0', NOW(), NOW()); -INSERT INTO `PREFIX_configuration` (`name`, `value`, `date_add`, `date_upd`) VALUES ('PS_ORDER_RETURN_NB_DAYS', '7', NOW(), NOW()); -UPDATE PREFIX_configuration SET name = 'PS_SSL_ENABLED' WHERE name = 'PS_FO_PROTOCOL'; -UPDATE PREFIX_configuration SET name = 'PS_SSL_ENABLED', value = 0 WHERE name = 'PS_SSL_ENABLED' AND value = 'http://'; -UPDATE PREFIX_configuration SET name = 'PS_SSL_ENABLED', value = 1 WHERE name = 'PS_SSL_ENABLED' AND value = 'https://'; - diff --git a/upgrade/sql/1.0.0.4.sql b/upgrade/sql/1.0.0.4.sql deleted file mode 100644 index 1d5697ce5..000000000 --- a/upgrade/sql/1.0.0.4.sql +++ /dev/null @@ -1,88 +0,0 @@ -/* STRUCTURE */ -SET NAMES 'utf8'; - -ALTER TABLE PREFIX_order_detail - ADD product_ean13 VARCHAR(13) CHARACTER SET utf8 COLLATE utf8_general_ci NULL AFTER product_price; -ALTER TABLE PREFIX_order_detail - ADD product_quantity_return INT(10) UNSIGNED NOT NULL DEFAULT 0 AFTER product_quantity; - -ALTER TABLE PREFIX_state - ADD tax_behavior SMALLINT(1) NOT NULL DEFAULT 0 AFTER iso_code; - -ALTER TABLE PREFIX_product - ADD reduction_from DATE NOT NULL AFTER reduction_percent; -ALTER TABLE PREFIX_product - ADD reduction_to DATE NOT NULL AFTER reduction_from; - -ALTER TABLE PREFIX_range_weight - ADD id_carrier INTEGER UNSIGNED DEFAULT NULL AFTER id_range_weight; -ALTER TABLE PREFIX_range_weight - DROP INDEX range_weight_index, - ADD UNIQUE range_weight_unique (delimiter1, delimiter2, id_carrier); -ALTER TABLE PREFIX_range_price - ADD id_carrier INTEGER UNSIGNED DEFAULT NULL AFTER id_range_price; -ALTER TABLE PREFIX_range_price - DROP INDEX range_price_index, - ADD UNIQUE range_price_unique (delimiter1, delimiter2, id_carrier); - -/* CONTENTS */ -/* One request per insert, if one die, other can be inserted */ -INSERT INTO PREFIX_hook (`name`, `title`, `description`, `position`) VALUES ('adminCustomers', 'Display in Back-Office, tab AdminCustomers', 'Launch modules when the tab AdminCustomers is displayed on back-office.', 0); -INSERT INTO PREFIX_hook (`name`, `title`, `description`, `position`) VALUES ('createAccount', 'Successful customer create account', 'Called when new customer create account successfuled', 0); -INSERT INTO PREFIX_hook (`name`, `title`, `description`, `position`) VALUES ('customerAccount', 'Customer account page display in front office', 'Called when a customer access to his account.', 1); -INSERT INTO PREFIX_hook (`name`, `title`, `description`, `position`) VALUES ('orderSlip', 'Called when a order slip is created', 'Called when a quantity of one product change in an order.', 0); -INSERT INTO PREFIX_hook (`name`, `title`, `description`, `position`) VALUES ('productTab', 'Tabs on product page', 'Called on order product page tabs', 0); -INSERT INTO PREFIX_hook (`name`, `title`, `description`, `position`) VALUES ('productTabContent', 'Content of tabs on product page', 'Called on order product page tabs', 0); -INSERT INTO PREFIX_hook (`name`, `title`, `description`, `position`) VALUES ('shoppingCart', 'Shopping cart footer', 'Display some specific informations on the shopping cart page', 0); - -INSERT INTO `PREFIX_configuration` (`name`, `value`, `date_add`, `date_upd`) VALUES ('PS_MAIL_TYPE', '3', NOW(), NOW()); - -INSERT INTO `PREFIX_configuration` (`name`, `value`, `date_add`, `date_upd`) VALUES ('PS_TOKEN_ENABLE', '0', NOW(), NOW()); - -INSERT INTO `PREFIX_configuration` (`name`, `value`, `date_add`, `date_upd`) VALUES ('PS_GIFT_WRAPPING_PRICE', '0', NOW(), NOW()); - -/* NEW RANGES */ - -INSERT IGNORE INTO PREFIX_range_price ( id_carrier, delimiter1, delimiter2 ) - (SELECT c.id_carrier, rp.delimiter1, rp.delimiter2 - FROM PREFIX_range_price rp - CROSS JOIN PREFIX_carrier c - WHERE c.deleted = 0 - AND c.active = 1 - ); - -UPDATE `PREFIX_delivery` d SET d.`id_range_price` = ( - SELECT rw.`id_range_price` FROM `PREFIX_range_price` rw WHERE - rw.`id_carrier` = d.`id_carrier` AND - rw.`delimiter1` = ( - SELECT `delimiter1` FROM `PREFIX_range_price` rw2 WHERE rw2.`id_range_price` = d.`id_range_price` LIMIT 1 - ) AND - rw.`delimiter2` = ( - SELECT `delimiter2` FROM `PREFIX_range_price` rw3 WHERE rw3.`id_range_price` = d.`id_range_price` LIMIT 1 - ) -); - -INSERT IGNORE INTO PREFIX_range_weight ( id_carrier, delimiter1, delimiter2 ) - (SELECT c.id_carrier, rp.delimiter1, rp.delimiter2 - FROM PREFIX_range_weight rp - CROSS JOIN PREFIX_carrier c - WHERE c.deleted = 0 - AND c.active = 1 - ); - -UPDATE `PREFIX_delivery` d SET d.`id_range_weight` = ( - SELECT rw.`id_range_weight` FROM `PREFIX_range_weight` rw WHERE - rw.`id_carrier` = d.`id_carrier` AND - rw.`delimiter1` = ( - SELECT `delimiter1` FROM `PREFIX_range_weight` rw2 WHERE rw2.`id_range_weight` = d.`id_range_weight` LIMIT 1 - ) AND - rw.`delimiter2` = ( - SELECT `delimiter2` FROM `PREFIX_range_weight` rw3 WHERE rw3.`id_range_weight` = d.`id_range_weight` LIMIT 1 - ) -); - -DELETE FROM PREFIX_range_price WHERE id_carrier IS NULL; -DELETE FROM PREFIX_range_weight WHERE id_carrier IS NULL; - -/* CONFIGURATION VARIABLE */ - diff --git a/upgrade/sql/1.0.0.5.sql b/upgrade/sql/1.0.0.5.sql deleted file mode 100644 index de1edb4bd..000000000 --- a/upgrade/sql/1.0.0.5.sql +++ /dev/null @@ -1,35 +0,0 @@ -/* STRUCTURE */ -SET NAMES 'utf8'; - -ALTER TABLE PREFIX_orders - ADD total_wrapping DECIMAL(10,2) NOT NULL DEFAULT 0 AFTER total_shipping; - -ALTER TABLE PREFIX_carrier - ADD range_behavior TINYINT(1) UNSIGNED NOT NULL DEFAULT 0 AFTER shipping_handling; - -ALTER TABLE PREFIX_order_detail - ADD product_supplier_reference VARCHAR(32) NULL AFTER product_reference; - -ALTER TABLE PREFIX_product - ADD supplier_reference VARCHAR(32) NULL AFTER reference; - -ALTER TABLE PREFIX_product_attribute - ADD supplier_reference VARCHAR(32) NULL AFTER reference; - -ALTER TABLE PREFIX_customer - ADD UNIQUE customer_email(email(128)); - -ALTER TABLE PREFIX_product_download - ADD active TINYINT(1) UNSIGNED NOT NULL DEFAULT 1 AFTER nb_downloadable; - - -/* CONTENTS */ -INSERT INTO PREFIX_hook (`name`, `title`, `description`, `position`) VALUES ('createAccountForm', 'Customer account creation form', 'Display some information on the form to create a customer account', 1); - -INSERT INTO PREFIX_lang (`name`, `active`, `iso_code`) VALUES -('Română (Romanian)', 0, 'ro'), -('Νεοελληνική (Greek)', 0, 'gr'), -('Slovenčina (Slovak)', 0, 'sk'); - -/* CONFIGURATION VARIABLE */ - diff --git a/upgrade/sql/1.0.0.6.sql b/upgrade/sql/1.0.0.6.sql deleted file mode 100644 index b2eb0806c..000000000 --- a/upgrade/sql/1.0.0.6.sql +++ /dev/null @@ -1,11 +0,0 @@ -/* STRUCTURE */ -SET NAMES 'utf8'; - -ALTER TABLE PREFIX_order_detail - CHANGE product_price product_price DECIMAL(13, 6) NOT NULL DEFAULT '0.000000'; - - -/* CONTENTS */ - -/* CONFIGURATION VARIABLE */ - diff --git a/upgrade/sql/1.0.0.7.sql b/upgrade/sql/1.0.0.7.sql deleted file mode 100644 index c42b6734e..000000000 --- a/upgrade/sql/1.0.0.7.sql +++ /dev/null @@ -1,21 +0,0 @@ -/* PHP */ -/* PHP:attribute_group_clean_combinations() */; - -/* STRUCTURE */ -SET NAMES 'utf8'; - -ALTER TABLE PREFIX_order_detail - ADD product_quantity_discount DECIMAL(13,6) NOT NULL DEFAULT 0 AFTER product_price; -ALTER TABLE PREFIX_country - ADD deleted TINYINT(1) NOT NULL DEFAULT 0; - - -/* CONTENTS */ - -INSERT INTO PREFIX_lang (`name`, `active`, `iso_code`) VALUES -('Norsk (Norwegian)', 0, 'no'), -('ภาษาไทย (Thai)', 0, 'th'), -('Dansk (Danish)', 0, 'dk'); - -/* CONFIGURATION VARIABLE */ - diff --git a/upgrade/sql/1.0.0.8.sql b/upgrade/sql/1.0.0.8.sql deleted file mode 100644 index 3194fcfae..000000000 --- a/upgrade/sql/1.0.0.8.sql +++ /dev/null @@ -1,17 +0,0 @@ -/* PHP */ -/* PHP:attribute_group_clean_combinations(); */; - -/* STRUCTURE */ -SET NAMES 'utf8'; - -/* CONTENTS */ - -INSERT INTO `PREFIX_configuration` (`name`, `value`, `date_add`, `date_upd`) VALUES -('PS_DISP_UNAVAILABLE_ATTR', '1', NOW(), NOW()); - -INSERT INTO PREFIX_lang (`name`, `active`, `iso_code`) VALUES -('Svenska (Swedish)', 0, 'se'), -('עברית (Hebrew)', 0, 'he'); - -/* CONFIGURATION VARIABLE */ - diff --git a/upgrade/sql/1.1.0.1.sql b/upgrade/sql/1.1.0.1.sql deleted file mode 100644 index 344b69f18..000000000 --- a/upgrade/sql/1.1.0.1.sql +++ /dev/null @@ -1,629 +0,0 @@ -/* PHP */ -/* PHP:attribute_group_clean_combinations(); */; -/* PHP:configuration_double_cleaner(); */; - -SET NAMES 'utf8'; - -/* ##################################### */ -/* STRUCTURE */ -/* ##################################### */ -DROP TABLE IF EXISTS PREFIX_gender; -DROP TABLE IF EXISTS PREFIX_search; -ALTER TABLE PREFIX_category_lang - ADD INDEX category_name (name); -ALTER TABLE PREFIX_order_detail - MODIFY COLUMN product_name VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL; -ALTER TABLE PREFIX_order_detail - ADD deleted TINYINT(3) UNSIGNED NOT NULL DEFAULT 0; -ALTER TABLE PREFIX_configuration - MODIFY COLUMN name VARCHAR(32) NOT NULL UNIQUE; -ALTER TABLE PREFIX_orders - ADD invoice_number INTEGER(10) UNSIGNED NOT NULL DEFAULT 0 AFTER total_wrapping; -ALTER TABLE PREFIX_orders - ADD delivery_number INTEGER(10) UNSIGNED NOT NULL DEFAULT 0 AFTER invoice_number; -ALTER TABLE PREFIX_orders - ADD invoice_date DATETIME NOT NULL AFTER delivery_number; -ALTER TABLE PREFIX_orders - ADD delivery_date DATETIME NOT NULL AFTER invoice_date; -ALTER TABLE PREFIX_order_detail - CHANGE product_price product_price DECIMAL(13, 6) NOT NULL DEFAULT 0.000000; -ALTER TABLE PREFIX_order_slip - ADD shipping_cost TINYINT UNSIGNED NOT NULL DEFAULT 0 AFTER id_order; -ALTER TABLE PREFIX_order_state - ADD delivery TINYINT(1) UNSIGNED NOT NULL DEFAULT 0 AFTER logable; -ALTER TABLE PREFIX_country - DROP deleted; -ALTER TABLE PREFIX_product - ADD customizable BOOL NOT NULL DEFAULT 0 AFTER quantity_discount; -ALTER TABLE PREFIX_product - ADD uploadable_files TINYINT NOT NULL DEFAULT 0 AFTER customizable; -ALTER TABLE PREFIX_product - ADD text_fields TINYINT NOT NULL DEFAULT 0 AFTER uploadable_files; -ALTER TABLE PREFIX_product_lang - CHANGE availability available_now VARCHAR(255) NULL; -ALTER TABLE PREFIX_product_lang - ADD available_later VARCHAR(255) NULL AFTER available_now; -ALTER TABLE PREFIX_access - DROP id_access; -ALTER TABLE PREFIX_access - DROP INDEX access_profile; -ALTER TABLE PREFIX_access - DROP INDEX access_tab; -ALTER TABLE PREFIX_access - ADD PRIMARY KEY(id_profile, id_tab); -ALTER TABLE PREFIX_currency - ADD blank TINYINT(1) UNSIGNED NOT NULL DEFAULT 0 AFTER sign; -ALTER TABLE PREFIX_currency - ADD decimals TINYINT(1) UNSIGNED NOT NULL DEFAULT 1 AFTER format; -ALTER TABLE PREFIX_product_attribute - ADD wholesale_price decimal(13,6) NOT NULL DEFAULT 0.000000 AFTER ean13; -ALTER TABLE PREFIX_employee - ADD last_passwd_gen TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP AFTER passwd; -ALTER TABLE PREFIX_customer - ADD last_passwd_gen TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP AFTER passwd; -ALTER TABLE PREFIX_customer - ADD ip_registration_newsletter VARCHAR(15) NULL DEFAULT NULL AFTER newsletter; -ALTER TABLE PREFIX_image_type - ADD scenes TINYINT(1) NOT NULL DEFAULT 1; -ALTER TABLE PREFIX_image_lang - CHANGE legend legend VARCHAR(128) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL; - -/* CMS */ -CREATE TABLE PREFIX_cms ( - id_cms INTEGER UNSIGNED NOT NULL auto_increment, - PRIMARY KEY (id_cms) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; - -CREATE TABLE PREFIX_cms_lang ( - id_cms INTEGER UNSIGNED NOT NULL auto_increment, - id_lang INTEGER UNSIGNED NOT NULL, - meta_title VARCHAR(128) NOT NULL, - meta_description VARCHAR(255) DEFAULT NULL, - meta_keywords VARCHAR(255) DEFAULT NULL, - content longtext NULL, - link_rewrite VARCHAR(128) NOT NULL, - PRIMARY KEY (id_cms, id_lang) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; - -CREATE TABLE PREFIX_block_cms ( - id_block INTEGER(10) NOT NULL, - id_cms INTEGER(10) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=utf8; - -/* PAYMENT MODULE RESTRICTIONS */ -CREATE TABLE `PREFIX_module_country` ( - `id_module` INTEGER UNSIGNED NOT NULL, - `id_country` INTEGER UNSIGNED NOT NULL, - PRIMARY KEY (`id_module`, `id_country`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; - -CREATE TABLE `PREFIX_module_currency` ( - `id_module` INTEGER UNSIGNED NOT NULL, - `id_currency` INTEGER NOT NULL, - PRIMARY KEY (`id_module`, `id_currency`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; - -/* ORDER-MESSAGE */ -CREATE TABLE PREFIX_order_message -( - id_order_message int(10) unsigned NOT NULL auto_increment, - date_add datetime NOT NULL, - PRIMARY KEY (id_order_message) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; - -CREATE TABLE PREFIX_order_message_lang -( - id_order_message int(10) unsigned NOT NULL, - id_lang int(10) unsigned NOT NULL, - name varchar(128) NOT NULL, - message text NOT NULL, - PRIMARY KEY (id_order_message,id_lang) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; - -/* SUB-DOMAINS */ -CREATE TABLE PREFIX_subdomain ( - id_subdomain INTEGER(10) NOT NULL AUTO_INCREMENT, - name VARCHAR(16) NOT NULL, - PRIMARY KEY(id_subdomain) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; - -/* META-CLASS */ -CREATE TABLE PREFIX_meta ( - id_meta INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, - page VARCHAR(64) NOT NULL, - PRIMARY KEY(id_meta), - KEY `meta_name` (`page`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; - -CREATE TABLE PREFIX_meta_lang ( - id_meta INTEGER UNSIGNED NOT NULL, - id_lang INTEGER UNSIGNED NOT NULL, - title VARCHAR(255) NULL, - description VARCHAR(255) NULL, - keywords VARCHAR(255) NULL, - PRIMARY KEY (id_meta, id_lang) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; - -CREATE TABLE PREFIX_discount_category ( - id_discount INTEGER(11) NOT NULL, - id_category INTEGER(11) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=utf8; - -/* Customized products */ -CREATE TABLE PREFIX_customization ( - id_customization int(10) NOT NULL AUTO_INCREMENT, - id_product_attribute int(10) NOT NULL DEFAULT 0, - id_cart int(10) NOT NULL, - id_product int(10) NOT NULL, - PRIMARY KEY(id_customization, id_cart, id_product) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; - -CREATE TABLE PREFIX_customized_data ( - id_customization int(10) NOT NULL, - `type` tinyint(1) NOT NULL, - `index` int(3) NOT NULL, - `value` varchar(255) NOT NULL, - PRIMARY KEY(id_customization, `type`, `index`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; - -CREATE TABLE PREFIX_customization_field ( - id_customization_field int(10) NOT NULL AUTO_INCREMENT, - id_product int(10) NOT NULL, - type tinyint(1) NOT NULL, - required tinyint(1) NOT NULL, - PRIMARY KEY(id_customization_field) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; - -CREATE TABLE PREFIX_customization_field_lang ( - id_customization_field int(10) NOT NULL, - id_lang int(10) NOT NULL, - name varchar(255) NOT NULL, - PRIMARY KEY(id_customization_field, id_lang) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; - -/* Product location */ -ALTER TABLE `PREFIX_product_attribute` ADD `location` VARCHAR(64) NULL AFTER `supplier_reference`; -ALTER TABLE `PREFIX_product` ADD `location` VARCHAR(64) NULL AFTER `supplier_reference`; - -/* Paypal default e-mail fix */ -UPDATE `PREFIX_configuration` SET value = 'paypal@prestashop.com' WHERE name = 'PAYPAL_BUSINESS' AND value = 'your-address@paypal.com'; - -/* ##################################### */ -/* CONTENTS */ -/* ##################################### */ -INSERT INTO PREFIX_subdomain (id_subdomain, name) VALUES (NULL, 'www'); -UPDATE PREFIX_currency SET blank = 1 WHERE iso_code = 'EUR'; -UPDATE PREFIX_order_state SET delivery = 1 WHERE id_order_state = 3; -UPDATE PREFIX_order_state SET delivery = 1 WHERE id_order_state = 4; -UPDATE PREFIX_order_state SET delivery = 1 WHERE id_order_state = 5; - -/* IMAGE MAPPING */ -UPDATE PREFIX_image_type SET scenes = 0; -INSERT INTO `PREFIX_image_type` (`name` ,`width` ,`height` ,`products` ,`categories` ,`manufacturers` ,`suppliers` ,`scenes`) VALUES ('large_scene', '556', '200', '0', '0', '0', '0', '1'); -INSERT INTO `PREFIX_image_type` (`name` ,`width` ,`height` ,`products` ,`categories` ,`manufacturers` ,`suppliers` ,`scenes`) VALUES ('thumb_scene', '161', '58', '0', '0', '0', '0', '1'); - -/* CONFIGURATION VARIABLE */ -INSERT INTO PREFIX_configuration (name, value, date_add, date_upd) VALUES ('PS_INVOICE', '1', NOW(), NOW()); -INSERT INTO PREFIX_configuration (name, value, date_add, date_upd) VALUES ('PS_INVOICE_PREFIX', 'IN', NOW(), NOW()); -INSERT INTO PREFIX_configuration (name, value, date_add, date_upd) VALUES ('PS_DELIVERY_PREFIX', 'DE', NOW(), NOW()); -INSERT INTO PREFIX_configuration (name, value, date_add, date_upd) VALUES ('PS_PRODUCT_PICTURE_MAX_SIZE', '131072', NOW(), NOW()); -INSERT INTO PREFIX_configuration (name, value, date_add, date_upd) VALUES ('PS_PRODUCT_PICTURE_WIDTH', '64', NOW(), NOW()); -INSERT INTO PREFIX_configuration (name, value, date_add, date_upd) VALUES ('PS_PRODUCT_PICTURE_HEIGHT', '64', NOW(), NOW()); -INSERT INTO PREFIX_configuration (name, value, date_add, date_upd) VALUES ('PS_PASSWD_TIME_BACK', '360', NOW(), NOW()); -INSERT INTO PREFIX_configuration (name, value, date_add, date_upd) VALUES ('PS_PASSWD_TIME_FRONT', '360', NOW(), NOW()); - -INSERT INTO `PREFIX_configuration_lang` (`id_configuration`, `id_lang`, `value`, `date_upd`) VALUES ((SELECT id_configuration FROM PREFIX_configuration c WHERE c.name = 'PS_INVOICE_PREFIX' LIMIT 1), 1, 'IN', NOW()); -INSERT INTO `PREFIX_configuration_lang` (`id_configuration`, `id_lang`, `value`, `date_upd`) VALUES ((SELECT id_configuration FROM PREFIX_configuration c WHERE c.name = 'PS_INVOICE_PREFIX' LIMIT 1), 2, 'FA', NOW()); -INSERT INTO `PREFIX_configuration_lang` (`id_configuration`, `id_lang`, `value`, `date_upd`) VALUES ((SELECT id_configuration FROM PREFIX_configuration c WHERE c.name = 'PS_DELIVERY_PREFIX' LIMIT 1), 1, 'DE', NOW()); -INSERT INTO `PREFIX_configuration_lang` (`id_configuration`, `id_lang`, `value`, `date_upd`) VALUES ((SELECT id_configuration FROM PREFIX_configuration c WHERE c.name = 'PS_DELIVERY_PREFIX' LIMIT 1), 2, 'LI', NOW()); - -/* HOOKS/MODULES */ -UPDATE PREFIX_hook SET description = 'This hook is called when a product is deleted' WHERE name = 'deleteProduct' LIMIT 1; -UPDATE PREFIX_hook SET name = 'extraLeft', title = 'Extra actions on the product page (left column).' WHERE name = 'extra' LIMIT 1; -INSERT INTO PREFIX_hook (name, title, position, description) VALUES ('orderReturn', 'Product returned', 0, 'When an order return is made'); -INSERT INTO PREFIX_hook (name, title, position, description) VALUES ('postUpdateOrderStatus', 'Post Order\'s status update event', 0, 'Launch modules when the order\'s status was changed (enables automated workflow).'); -INSERT INTO PREFIX_hook (name, title, position, description) VALUES ('productActions', 'Product actions', 1, 'Put new action buttons on product page'); -INSERT INTO PREFIX_hook (name, title, position, description) VALUES ('cancelProduct', 'Product cancelled', 0, 'This hook is called when you cancel a product in an order'); -INSERT INTO PREFIX_hook (name, title, position) VALUES ('backOfficeHome', 'Administration panel homepage', 1); -INSERT INTO PREFIX_hook (name, title, position, description) VALUES ('extraRight', 'Extra actions on the product page (right column).', 0, NULL); -UPDATE PREFIX_hook SET position = 1 WHERE name = 'top'; -UPDATE PREFIX_hook SET position = 0 WHERE name = 'header'; - -/* ORDER MESSAGES */ -INSERT INTO `PREFIX_order_message` (`id_order_message`, `date_add`) VALUES (1, NOW()); -INSERT INTO `PREFIX_order_message_lang` (`id_order_message`, `id_lang`, `name`, `message`) VALUES -(1, 1, 'Delay', 'Hi, - -Unfortunately, an item on your order is currently out of stock. This may cause a slight delay in delivery. -Please accept our apologies and rest assured that we are working hard to rectify this. - -Best regards, -'); -INSERT INTO `PREFIX_order_message_lang` (`id_order_message`, `id_lang`, `name`, `message`) VALUES -(1, 2, 'Délai', 'Bonjour, - -Un des éléments de votre commande est actuellement en réapprovisionnement, ce qui peut légèrement retarder son envoi. - -Merci de votre compréhension. - -Cordialement, -'); - -/* META */ -INSERT INTO `PREFIX_meta` (`id_meta`, `page`) VALUES -(1, '404'), -(2, 'best-sales'), -(3, 'contact-form'), -(4, 'index'), -(5, 'manufacturer'), -(6, 'new-products'), -(7, 'password'), -(8, 'prices-drop'), -(9, 'sitemap'), -(10, 'supplier'); - -INSERT INTO `PREFIX_meta_lang` (`id_meta`, `id_lang`, `title`, `description`, `keywords`) VALUES -(1, 1, '404 error', 'This page cannot be found', 'error, 404, not found'), -(1, 2, 'Erreur 404', 'Cette page est introuvable', 'erreur, 404, introuvable'), -(2, 1, 'Best sales', 'Our best sales', 'best sales'), -(2, 2, 'Meilleurs ventes', 'Liste de nos produits les mieux vendus', 'meilleurs ventes'), -(3, 1, 'Contact us', 'Use our form to contact us', 'contact, form, e-mail'), -(3, 2, 'Contactez-nous', 'Utilisez notre formulaire pour nous contacter', 'contact, formulaire, e-mail'), -(4, 1, '', 'Shop powered by PrestaShop', 'shop, prestashop'), -(4, 2, '', 'Boutique propulsé par PrestaShop', 'boutique, prestashop'), -(5, 1, 'Manufacturers', 'Manufacturers list', 'manufacturer'), -(5, 2, 'Fabricants', 'Liste de nos fabricants', 'fabricants'), -(6, 1, 'New products', 'Our new products', 'new, products'), -(6, 2, 'Nouveaux produits', 'Liste de nos nouveaux produits', 'nouveau, produit'), -(7, 1, 'Forgot your password', 'Enter your e-mail address used to register in goal to get e-mail with your new password', 'forgot, password, e-mail, new, reset'), -(7, 2, 'Mot de passe oublié', 'Renseignez votre adresse e-mail afin de recevoir votre nouveau mot de passe.', 'mot de passe, oublié, e-mail, nouveau, regénération'), -(8, 1, 'Specials', 'Our special products', 'special, prices drop'), -(8, 2, 'Promotions', 'Nos produits en promotion', 'promotion, réduction'), -(9, 1, 'Sitemap', 'Lost ? Find what your are looking for', 'sitemap'), -(9, 2, 'Plan du site', 'Perdu ? Trouvez ce que vous cherchez', 'plan, site'), -(10, 1, 'Suppliers', 'Suppliers list', 'supplier'), -(10, 2, 'Fournisseurs', 'Liste de nos fournisseurs', 'fournisseurs'); - -/* CMS */ -INSERT INTO `PREFIX_cms` VALUES (1),(2),(3),(4),(5); -INSERT INTO `PREFIX_cms_lang` (`id_cms`, `id_lang`, `meta_title`, `meta_description`, `meta_keywords`, `content`, `link_rewrite`) VALUES -(1, 1, 'Delivery', 'Our terms and conditions of delivery', 'conditions, delivery, delay, shipment, pack', '

Shipments and returns

Your pack shipment

Packages are generally dispatched within 2 days after receipt of payment and are shipped via Colissimo with tracking and drop-off without signature. If you prefer delivery by Colissimo Extra with required signature, an additional cost will be applied, so please contact us before choosing this method. Whichever shipment choice you make, we will provide you with a link to track your package online.

Shipping fees include handling and packing fees as well as postage costs. Handling fees are fixed, whereas transport fees vary according to total weight of the shipment. We advise you to group your items in one order. We cannot group two distinct orders placed separately, and shipping fees will apply to each of them. Your package will be dispatched at your own risk, but special care is taken to protect fragile objects.

Boxes are amply sized and your items are well-protected.

', 'delivery'); -INSERT INTO `PREFIX_cms_lang` (`id_cms`, `id_lang`, `meta_title`, `meta_description`, `meta_keywords`, `content`, `link_rewrite`) VALUES -(1, 2, 'Livraison', 'Nos conditions générales de livraison', 'conditions, livraison, délais, transport, colis', '

Livraisons et retours

Le transport de votre colis

Les colis sont généralement expédiés en 48h après réception de votre paiement. Le mode d''expédidition standard est le Colissimo suivi, remis sans signature. Si vous souhaitez une remise avec signature, un coût supplémentaire s''applique, merci de nous contacter. Quel que soit le mode d''expédition choisi, nous vous fournirons dès que possible un lien qui vous permettra de suivre en ligne la livraison de votre colis.

Les frais d''expédition comprennent l''emballage, la manutention et les frais postaux. Ils peuvent contenir une partie fixe et une partie variable en fonction du prix ou du poids de votre commande. Nous vous conseillons de regrouper vos achats en une unique commande. Nous ne pouvons pas grouper deux commandes distinctes et vous devrez vous acquitter des frais de port pour chacune d''entre elles. Votre colis est expédié à vos propres risques, un soin particulier est apporté au colis contenant des produits fragiles..

Les colis sont surdimensionnés et protégés.

', 'livraison'); -INSERT INTO `PREFIX_cms_lang` (`id_cms`, `id_lang`, `meta_title`, `meta_description`, `meta_keywords`, `content`, `link_rewrite`) VALUES -(2, 1, 'Legal Notice', 'Legal notice', 'notice, legal, credits', '

Legal

Credits

Concept and production:

This Web site was created using PrestaShop™ open-source software.

', 'legal-notice'); -INSERT INTO `PREFIX_cms_lang` (`id_cms`, `id_lang`, `meta_title`, `meta_description`, `meta_keywords`, `content`, `link_rewrite`) VALUES -(2, 2, 'Mentions légales', 'Mentions légales', 'mentions, légales, crédits', '

Mentions légales

Crédits

Concept et production :

Ce site internet a été réalisé en utilisant la solution open-source PrestaShop™ .

', 'mentions-legales'); -INSERT INTO `PREFIX_cms_lang` (`id_cms`, `id_lang`, `meta_title`, `meta_description`, `meta_keywords`, `content`, `link_rewrite`) VALUES -(3, 1, 'Terms and conditions of use', 'Our terms and conditions of use', 'conditions, terms, use, sell', '

Your terms and conditions of use

Rule 1

Here is the rule 1 content

\r\n

Rule 2

Here is the rule 2 content

\r\n

Rule 3

Here is the rule 3 content

', 'terms-and-conditions-of-use'); -INSERT INTO `PREFIX_cms_lang` (`id_cms`, `id_lang`, `meta_title`, `meta_description`, `meta_keywords`, `content`, `link_rewrite`) VALUES -(3, 2, 'Conditions d''utilisation', 'Nos conditions générales de ventes', 'conditions, utilisation, générales, ventes', '

Vos conditions de ventes

Règle n°1

Contenu de la règle numéro 1

\r\n

Règle n°2

Contenu de la règle numéro 2

\r\n

Règle n°3

Contenu de la règle numéro 3

', 'conditions-generales-de-ventes'); -INSERT INTO `PREFIX_cms_lang` (`id_cms`, `id_lang`, `meta_title`, `meta_description`, `meta_keywords`, `content`, `link_rewrite`) VALUES -(4, 1, 'About us', 'Learn more about us', 'about us, informations', '

About us

\r\n

Our company

Our company

\r\n

Our team

Our team

\r\n

Informations

Informations

', 'about-us'); -INSERT INTO `PREFIX_cms_lang` (`id_cms`, `id_lang`, `meta_title`, `meta_description`, `meta_keywords`, `content`, `link_rewrite`) VALUES -(4, 2, 'A propos', 'Apprenez-en d''avantage sur nous', 'à propos, informations', '

A propos

\r\n

Notre entreprise

Notre entreprise

\r\n

Notre équipe

Notre équipe

\r\n

Informations

Informations

', 'a-propos'); -INSERT INTO `PREFIX_cms_lang` (`id_cms`, `id_lang`, `meta_title`, `meta_description`, `meta_keywords`, `content`, `link_rewrite`) VALUES -(5, 1, 'Secure payment', 'Our secure payment mean', 'secure payment, ssl, visa, mastercard, paypal', '

Secure payment

\r\n

Our secure payment

With SSL

\r\n

Using Visa/Mastercard/Paypal

About this services

', 'secure-payment'); -INSERT INTO `PREFIX_cms_lang` (`id_cms`, `id_lang`, `meta_title`, `meta_description`, `meta_keywords`, `content`, `link_rewrite`) VALUES -(5, 2, 'Paiement sécurisé', 'Notre offre de paiement sécurisé', 'paiement sécurisé, ssl, visa, mastercard, paypal', '

Paiement sécurisé

\r\n

Notre offre de paiement sécurisé

Avec SSL

\r\n

Utilisation de Visa/Mastercard/Paypal

A propos de ces services

', 'paiement-securise'); - -INSERT INTO PREFIX_block_cms (`id_block`, `id_cms`) VALUES (IFNULL((SELECT id_module FROM PREFIX_module m WHERE m.name = 'blockvariouslinks' LIMIT 1), 0), 3); -INSERT INTO PREFIX_block_cms (`id_block`, `id_cms`) VALUES (IFNULL((SELECT id_module FROM PREFIX_module m WHERE m.name = 'blockvariouslinks' LIMIT 1), 0), 4); -INSERT INTO PREFIX_block_cms (`id_block`, `id_cms`) VALUES (IFNULL((SELECT id_module FROM PREFIX_module m WHERE m.name = 'blockinfos' LIMIT 1), 0), 1); -INSERT INTO PREFIX_block_cms (`id_block`, `id_cms`) VALUES (IFNULL((SELECT id_module FROM PREFIX_module m WHERE m.name = 'blockinfos' LIMIT 1), 0), 2); -INSERT INTO PREFIX_block_cms (`id_block`, `id_cms`) VALUES (IFNULL((SELECT id_module FROM PREFIX_module m WHERE m.name = 'blockinfos' LIMIT 1), 0), 3); -INSERT INTO PREFIX_block_cms (`id_block`, `id_cms`) VALUES (IFNULL((SELECT id_module FROM PREFIX_module m WHERE m.name = 'blockinfos' LIMIT 1), 0), 4); -DELETE FROM PREFIX_block_cms WHERE id_block = 0; - -/* NEW TABS */ -UPDATE PREFIX_tab_lang - SET name = 'Vouchers' - WHERE id_lang = (SELECT `id_lang` FROM `PREFIX_lang` l WHERE l.iso_code = 'en' LIMIT 1) - AND id_tab = (SELECT `id_tab` FROM PREFIX_tab t WHERE t.class_name = 'AdminDiscounts' LIMIT 1); - -INSERT INTO PREFIX_tab (id_parent, class_name, position) VALUES ((SELECT tmp.`id_tab` FROM (SELECT `id_tab` FROM PREFIX_tab t WHERE t.class_name = 'AdminTools' LIMIT 1) AS tmp), 'AdminCMS', (SELECT tmp.max FROM (SELECT MAX(position) max FROM `PREFIX_tab` WHERE id_parent = (SELECT tmp.`id_tab` FROM (SELECT `id_tab` FROM PREFIX_tab t WHERE t.class_name = 'AdminTools' LIMIT 1) AS tmp )) AS tmp)); -INSERT INTO PREFIX_tab_lang (id_lang, id_tab, name) ( - SELECT id_lang, - (SELECT id_tab FROM PREFIX_tab t WHERE t.class_name = 'AdminCMS' LIMIT 1), - 'CMS' FROM PREFIX_lang); -INSERT INTO PREFIX_access (id_profile, id_tab, `view`, `add`, edit, `delete`) VALUES ('1', (SELECT id_tab FROM PREFIX_tab t WHERE t.class_name = 'AdminCMS' LIMIT 1), 1, 1, 1, 1); - -INSERT INTO PREFIX_tab (id_parent, class_name, position) VALUES ((SELECT tmp.`id_tab` FROM (SELECT `id_tab` FROM PREFIX_tab t WHERE t.class_name = 'AdminTools' LIMIT 1) AS tmp), 'AdminSubDomains', (SELECT tmp.max FROM (SELECT MAX(position) max FROM `PREFIX_tab` WHERE id_parent = (SELECT tmp.`id_tab` FROM (SELECT `id_tab` FROM PREFIX_tab t WHERE t.class_name = 'AdminTools' LIMIT 1) AS tmp )) AS tmp)); -INSERT INTO PREFIX_tab_lang (id_lang, id_tab, name) ( - SELECT id_lang, - (SELECT id_tab FROM PREFIX_tab t WHERE t.class_name = 'AdminSubDomains' LIMIT 1), - 'Subdomains' FROM PREFIX_lang); -UPDATE `PREFIX_tab_lang` SET `name` = 'Sous domaines' - WHERE `id_tab` = (SELECT `id_tab` FROM `PREFIX_tab` t WHERE t.class_name = 'AdminSubDomains') - AND `id_lang` = (SELECT `id_lang` FROM `PREFIX_lang` l WHERE l.iso_code = 'fr'); -INSERT INTO PREFIX_access (id_profile, id_tab, `view`, `add`, edit, `delete`) VALUES ('1', (SELECT id_tab FROM PREFIX_tab t WHERE t.class_name = 'AdminSubDomains' LIMIT 1), 1, 1, 1, 1); - -INSERT INTO PREFIX_tab (id_parent, class_name, position) VALUES ((SELECT tmp.`id_tab` FROM (SELECT `id_tab` FROM PREFIX_tab t WHERE t.class_name = 'AdminOrders' LIMIT 1) AS tmp), 'AdminOrderMessage', (SELECT tmp.max FROM (SELECT MAX(position) max FROM `PREFIX_tab` WHERE id_parent = (SELECT tmp.`id_tab` FROM (SELECT `id_tab` FROM PREFIX_tab t WHERE t.class_name = 'AdminOrders' LIMIT 1) AS tmp )) AS tmp)); -INSERT INTO PREFIX_tab_lang (id_lang, id_tab, name) ( - SELECT id_lang, - (SELECT id_tab FROM PREFIX_tab t WHERE t.class_name = 'AdminOrderMessage' LIMIT 1), - 'Order messages' FROM PREFIX_lang); -UPDATE `PREFIX_tab_lang` SET `name` = 'Messages prédéfinis' - WHERE `id_tab` = (SELECT `id_tab` FROM `PREFIX_tab` t WHERE t.class_name = 'AdminOrderMessage') - AND `id_lang` = (SELECT `id_lang` FROM `PREFIX_lang` l WHERE l.iso_code = 'fr'); -INSERT INTO PREFIX_access (id_profile, id_tab, `view`, `add`, edit, `delete`) VALUES ('1', (SELECT id_tab FROM PREFIX_tab t WHERE t.class_name = 'AdminOrderMessage' LIMIT 1), 1, 1, 1, 1); - -INSERT INTO PREFIX_tab (id_parent, class_name, position) VALUES ((SELECT tmp.`id_tab` FROM (SELECT `id_tab` FROM PREFIX_tab t WHERE t.class_name = 'AdminOrders' LIMIT 1) AS tmp), 'AdminDeliverySlip', (SELECT tmp.max FROM (SELECT MAX(position) max FROM `PREFIX_tab` WHERE id_parent = (SELECT tmp.`id_tab` FROM (SELECT `id_tab` FROM PREFIX_tab t WHERE t.class_name = 'AdminOrders' LIMIT 1) AS tmp )) AS tmp)); -INSERT INTO PREFIX_tab_lang (id_lang, id_tab, name) ( - SELECT id_lang, - (SELECT id_tab FROM PREFIX_tab t WHERE t.class_name = 'AdminDeliverySlip' LIMIT 1), - 'Delivery slips' FROM PREFIX_lang); -UPDATE `PREFIX_tab_lang` SET `name` = 'Bons de livraison' - WHERE `id_tab` = (SELECT `id_tab` FROM `PREFIX_tab` t WHERE t.class_name = 'AdminDeliverySlip') - AND `id_lang` = (SELECT `id_lang` FROM `PREFIX_lang` l WHERE l.iso_code = 'fr'); -INSERT INTO PREFIX_access (id_profile, id_tab, `view`, `add`, edit, `delete`) VALUES ('1', (SELECT id_tab FROM PREFIX_tab t WHERE t.class_name = 'AdminDeliverySlip' LIMIT 1), 1, 1, 1, 1); - -INSERT INTO PREFIX_tab (id_parent, class_name, position) VALUES ((SELECT tmp.`id_tab` FROM (SELECT `id_tab` FROM PREFIX_tab t WHERE t.class_name = 'AdminTools' LIMIT 1) AS tmp), 'AdminBackup', (SELECT tmp.max FROM (SELECT MAX(position) max FROM `PREFIX_tab` WHERE id_parent = (SELECT tmp.`id_tab` FROM (SELECT `id_tab` FROM PREFIX_tab t WHERE t.class_name = 'AdminTools' LIMIT 1) AS tmp )) AS tmp)); -INSERT INTO PREFIX_tab_lang (id_lang, id_tab, name) ( - SELECT id_lang, - (SELECT id_tab FROM PREFIX_tab t WHERE t.class_name = 'AdminBackup' LIMIT 1), - 'Database backup' FROM PREFIX_lang); -UPDATE `PREFIX_tab_lang` SET `name` = 'Sauvegarde BDD' - WHERE `id_tab` = (SELECT `id_tab` FROM `PREFIX_tab` t WHERE t.class_name = 'AdminBackup') - AND `id_lang` = (SELECT `id_lang` FROM `PREFIX_lang` l WHERE l.iso_code = 'fr'); -INSERT INTO PREFIX_access (id_profile, id_tab, `view`, `add`, edit, `delete`) VALUES ('1', (SELECT id_tab FROM PREFIX_tab t WHERE t.class_name = 'AdminBackup' LIMIT 1), 1, 1, 1, 1); - -INSERT INTO PREFIX_tab (id_parent, class_name, position) VALUES ((SELECT tmp.`id_tab` FROM (SELECT `id_tab` FROM PREFIX_tab t WHERE t.class_name = 'AdminPreferences' LIMIT 1) AS tmp), 'AdminMeta', (SELECT tmp.max FROM (SELECT MAX(position) max FROM `PREFIX_tab` WHERE id_parent = (SELECT tmp.`id_tab` FROM (SELECT `id_tab` FROM PREFIX_tab t WHERE t.class_name = 'AdminPreferences' LIMIT 1) AS tmp )) AS tmp)); -INSERT INTO PREFIX_tab_lang (id_lang, id_tab, name) ( - SELECT id_lang, - (SELECT id_tab FROM PREFIX_tab t WHERE t.class_name = 'AdminMeta' LIMIT 1), - 'Meta-tags' FROM PREFIX_lang); -UPDATE `PREFIX_tab_lang` SET `name` = 'Méta-Tags' - WHERE `id_tab` = (SELECT `id_tab` FROM `PREFIX_tab` t WHERE t.class_name = 'AdminMeta') - AND `id_lang` = (SELECT `id_lang` FROM `PREFIX_lang` l WHERE l.iso_code = 'fr'); -INSERT INTO PREFIX_access (id_profile, id_tab, `view`, `add`, edit, `delete`) VALUES ('1', (SELECT id_tab FROM PREFIX_tab t WHERE t.class_name = 'AdminMeta' LIMIT 1), 1, 1, 1, 1); - -INSERT INTO PREFIX_tab (id_parent, class_name, position) VALUES ((SELECT tmp.`id_tab` FROM (SELECT `id_tab` FROM PREFIX_tab t WHERE t.class_name = 'AdminCatalog' LIMIT 1) AS tmp), 'AdminScenes', (SELECT tmp.max FROM (SELECT MAX(position) max FROM `PREFIX_tab` WHERE id_parent = (SELECT tmp.`id_tab` FROM (SELECT `id_tab` FROM PREFIX_tab t WHERE t.class_name = 'AdminCatalog' LIMIT 1) AS tmp )) AS tmp)); -INSERT INTO PREFIX_tab_lang (id_lang, id_tab, name) ( - SELECT id_lang, - (SELECT id_tab FROM PREFIX_tab t WHERE t.class_name = 'AdminScenes' LIMIT 1), - 'Image mapping' FROM PREFIX_lang); -UPDATE `PREFIX_tab_lang` SET `name` = 'Scènes' - WHERE `id_tab` = (SELECT `id_tab` FROM `PREFIX_tab` t WHERE t.class_name = 'AdminScenes') - AND `id_lang` = (SELECT `id_lang` FROM `PREFIX_lang` l WHERE l.iso_code = 'fr'); -INSERT INTO PREFIX_access (id_profile, id_tab, `view`, `add`, edit, `delete`) VALUES ('1', (SELECT id_tab FROM PREFIX_tab t WHERE t.class_name = 'AdminScenes' LIMIT 1), 1, 1, 1, 1); - -/* NEW TEAM TAB */ -UPDATE PREFIX_tab SET position = 10 WHERE class_name = 'AdminTools'; -UPDATE PREFIX_tab SET position = 9 WHERE class_name = 'AdminPreferences'; -UPDATE PREFIX_tab SET position = 8, id_parent = 0 WHERE class_name = 'AdminEmployees'; -UPDATE PREFIX_tab SET position = 1, id_parent = 29 WHERE class_name = 'AdminProfiles'; -UPDATE PREFIX_tab SET position = 2, id_parent = 29 WHERE class_name = 'AdminAccess'; -UPDATE PREFIX_tab SET position = 3, id_parent = 29 WHERE class_name = 'AdminContacts'; -UPDATE PREFIX_tab SET position = 1 WHERE class_name = 'AdminLanguages'; -UPDATE PREFIX_tab SET position = 2 WHERE class_name = 'AdminTranslations'; -UPDATE PREFIX_tab SET position = 3 WHERE class_name = 'AdminTabs'; -UPDATE PREFIX_tab SET position = 4 WHERE class_name = 'AdminQuickAccesses'; -UPDATE PREFIX_tab SET position = 5 WHERE class_name = 'AdminAliases'; -UPDATE PREFIX_tab SET position = 6 WHERE class_name = 'AdminImport'; -UPDATE PREFIX_tab SET position = 7 WHERE class_name = 'AdminSubDomains'; - -/* UPDATE ORDER TABS */ -UPDATE PREFIX_tab SET class_name = 'AdminInvoices' WHERE class_name = 'AdminPrintPDF'; -UPDATE PREFIX_tab SET position = 1 WHERE class_name = 'AdminInvoices'; -UPDATE PREFIX_tab SET position = 2 WHERE class_name = 'AdminReturn'; -UPDATE PREFIX_tab SET position = 3 WHERE class_name = 'AdminSlip'; -UPDATE PREFIX_tab SET position = 4 WHERE class_name = 'AdminOrdersStates'; -UPDATE PREFIX_tab_lang SET name = 'Invoices' WHERE name = 'PDF Invoice'; -UPDATE PREFIX_tab_lang SET name = 'Factures' WHERE name = 'Facture PDF'; - -/* ##################################### */ -/* STATS */ -/* ##################################### */ -CREATE TABLE PREFIX_web_browser ( - id_web_browser INTEGER(10) UNSIGNED NOT NULL AUTO_INCREMENT, - name VARCHAR(64) NULL, - PRIMARY KEY(id_web_browser) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; - -CREATE TABLE PREFIX_operating_system ( - id_operating_system INTEGER(10) UNSIGNED NOT NULL AUTO_INCREMENT, - name VARCHAR(64) NULL, - PRIMARY KEY(id_operating_system) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; - -CREATE TABLE PREFIX_page_type ( - id_page_type INTEGER(10) UNSIGNED NOT NULL AUTO_INCREMENT, - name VARCHAR(256) NOT NULL, - PRIMARY KEY(id_page_type) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; - -CREATE TABLE PREFIX_date_range ( - id_date_range INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, - time_start DATETIME NOT NULL, - time_end DATETIME NOT NULL, - PRIMARY KEY(id_date_range) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; - -CREATE TABLE PREFIX_page ( - id_page INTEGER(10) UNSIGNED NOT NULL AUTO_INCREMENT, - id_page_type INTEGER(10) UNSIGNED NOT NULL, - id_object VARCHAR(256) NULL, - PRIMARY KEY(id_page) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; - -CREATE TABLE PREFIX_page_viewed ( - id_page INTEGER(10) UNSIGNED NOT NULL, - id_date_range INTEGER UNSIGNED NOT NULL, - counter INTEGER UNSIGNED NOT NULL, - PRIMARY KEY(id_page, id_date_range) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; - -CREATE TABLE PREFIX_guest ( - id_guest INTEGER(10) UNSIGNED NOT NULL AUTO_INCREMENT, - id_operating_system INTEGER(10) UNSIGNED NULL DEFAULT NULL, - id_web_browser INTEGER(10) UNSIGNED NULL DEFAULT NULL, - id_customer INTEGER(10) UNSIGNED NULL DEFAULT NULL, - javascript BOOL NULL DEFAULT 0, - screen_resolution_x SMALLINT UNSIGNED NULL DEFAULT NULL, - screen_resolution_y SMALLINT UNSIGNED NULL DEFAULT NULL, - screen_color TINYINT UNSIGNED NULL DEFAULT NULL, - sun_java BOOL NULL DEFAULT NULL, - adobe_flash BOOL NULL DEFAULT NULL, - adobe_director BOOL NULL DEFAULT NULL, - apple_quicktime BOOL NULL DEFAULT NULL, - real_player BOOL NULL DEFAULT NULL, - windows_media BOOL NULL DEFAULT NULL, - accept_language VARCHAR(8) NULL DEFAULT NULL, - PRIMARY KEY(id_guest) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; - -CREATE TABLE IF NOT EXISTS `PREFIX_scene` ( - `id_scene` int(10) NOT NULL auto_increment, - `active` tinyint(1) NOT NULL default '1', - PRIMARY KEY (`id_scene`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; - -CREATE TABLE IF NOT EXISTS `PREFIX_scene_category` ( - `id_scene` int(10) NOT NULL, - `id_category` int(10) NOT NULL, - PRIMARY KEY (`id_scene`,`id_category`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; - -CREATE TABLE IF NOT EXISTS `PREFIX_scene_lang` ( - `id_scene` int(10) NOT NULL, - `id_lang` int(10) NOT NULL, - `name` varchar(100) NOT NULL, - PRIMARY KEY (`id_scene`,`id_lang`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; - -CREATE TABLE IF NOT EXISTS `PREFIX_scene_products` ( - `id_scene` int(10) NOT NULL, - `id_product` int(10) NOT NULL, - `x_axis` int(4) NOT NULL, - `y_axis` int(4) NOT NULL, - `zone_width` int(3) NOT NULL, - `zone_height` int(3) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=utf8; - -INSERT INTO PREFIX_guest (id_customer) SELECT id_customer FROM PREFIX_customer; - -ALTER TABLE PREFIX_connections ADD id_guest INTEGER(10) UNSIGNED NULL AFTER id_connections; -ALTER TABLE PREFIX_connections ADD id_page INTEGER(10) UNSIGNED NOT NULL AFTER id_guest; -ALTER TABLE PREFIX_connections ADD http_referer VARCHAR(256) NULL; -ALTER TABLE PREFIX_connections CHANGE date date_add DATETIME NOT NULL; - -UPDATE PREFIX_connections, PREFIX_guest SET PREFIX_connections.id_guest=PREFIX_guest.id_guest WHERE PREFIX_connections.id_customer=PREFIX_guest.id_customer; -ALTER TABLE PREFIX_connections CHANGE id_guest id_guest INTEGER(10) UNSIGNED NOT NULL; -ALTER TABLE PREFIX_connections DROP id_customer; - -CREATE TABLE PREFIX_connections_page ( - id_connections INTEGER(10) UNSIGNED NOT NULL, - id_page INTEGER(10) UNSIGNED NOT NULL, - time_start DATETIME NOT NULL, - time_end DATETIME NULL, - PRIMARY KEY(id_connections, id_page, time_start) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; - -INSERT INTO `PREFIX_operating_system` (`name`) VALUES ('Windows XP'),('Windows Vista'),('MacOsX'),('Linux'); -INSERT INTO `PREFIX_web_browser` (`name`) VALUES ('Safari'),('Firefox 2.x'),('Firefox 3.x'),('Opera'),('IE 6.x'),('IE 7.x'),('IE 8.x'),('Google Chrome'); -INSERT INTO `PREFIX_page_type` (`name`) VALUES ('product.php'),('category.php'),('order.php'),('manufacturer.php'); - -INSERT INTO `PREFIX_hook` (`name`, `title`, `position`) VALUES -('AdminStatsModules', 'Stats - Modules', 1), -('GraphEngine', 'Graph Engines', 0), -('GridEngine', 'Grid Engines', 0); - -/* Temporary configuration variable used in the following query */ -INSERT INTO `PREFIX_configuration` (`name`, `value`, `date_add`, `date_upd`) VALUES ('TMP_ID_TAB_STATS', (SELECT `id_tab` FROM `PREFIX_tab` WHERE `class_name` = 'AdminStats'), NOW(), NOW()); -INSERT INTO `PREFIX_tab` (`id_parent`, `class_name`, `position`) VALUES - ((SELECT `value` FROM `PREFIX_configuration` WHERE `name` = 'TMP_ID_TAB_STATS'), 'AdminStatsModules', 1); -INSERT INTO `PREFIX_tab` (`id_parent`, `class_name`, `position`) VALUES - ((SELECT `value` FROM `PREFIX_configuration` WHERE `name` = 'TMP_ID_TAB_STATS'), 'AdminStatsConf', 2); -INSERT INTO `PREFIX_tab_lang` (`id_lang`, `id_tab`, `name`) VALUES - (1, (SELECT `id_tab` FROM `PREFIX_tab` WHERE `class_name` = 'AdminStatsModules'), 'Modules'); -INSERT INTO `PREFIX_tab_lang` (`id_lang`, `id_tab`, `name`) VALUES - (2, (SELECT `id_tab` FROM `PREFIX_tab` WHERE `class_name` = 'AdminStatsModules'), 'Modules'); -INSERT INTO `PREFIX_tab_lang` (`id_lang`, `id_tab`, `name`) VALUES - (1, (SELECT `id_tab` FROM `PREFIX_tab` WHERE `class_name` = 'AdminStatsConf'), 'Settings'); -INSERT INTO `PREFIX_tab_lang` (`id_lang`, `id_tab`, `name`) VALUES - (2, (SELECT `id_tab` FROM `PREFIX_tab` WHERE `class_name` = 'AdminStatsConf'), 'Configuration'); -INSERT INTO `PREFIX_access` (`id_profile`, `id_tab`, `view`, `add`, `edit`, `delete`) VALUES - (1, (SELECT `id_tab` FROM `PREFIX_tab` WHERE `class_name` = 'AdminStatsModules'), 1, 1, 1, 1); -INSERT INTO `PREFIX_access` (`id_profile`, `id_tab`, `view`, `add`, `edit`, `delete`) VALUES - (1, (SELECT `id_tab` FROM `PREFIX_tab` WHERE `class_name` = 'AdminStatsConf'), 1, 1, 1, 1); -DELETE FROM `PREFIX_configuration` WHERE `name` = 'TMP_ID_TAB_STATS'; - -/* ##################################### */ -/* DOUBLE LANGUAGE */ -/* ##################################### */ -INSERT IGNORE INTO `PREFIX_discount_type_lang` (`id_discount_type`, `id_lang`, `name`) - (SELECT `id_discount_type`, id_lang, (SELECT tl.`name` - FROM `PREFIX_discount_type_lang` tl - WHERE tl.`id_lang` = (SELECT c.`value` - FROM `PREFIX_configuration` c - WHERE c.`name` = 'PS_LANG_DEFAULT' LIMIT 1) AND tl.`id_discount_type`=`PREFIX_discount_type`.`id_discount_type`) - FROM `PREFIX_lang` CROSS JOIN `PREFIX_discount_type`); - -INSERT IGNORE INTO `PREFIX_cms_lang` (`id_cms`, `id_lang`, `link_rewrite`, `meta_description`, `meta_keywords`, `meta_title`, `content`) - (SELECT `id_cms`, id_lang, - (SELECT tl.`link_rewrite` - FROM `PREFIX_cms_lang` tl - WHERE tl.`id_lang` = (SELECT c.`value` - FROM `PREFIX_configuration` c - WHERE c.`name` = 'PS_LANG_DEFAULT' LIMIT 1) AND tl.`id_cms`=`PREFIX_cms`.`id_cms`), - (SELECT tl.`meta_description` - FROM `PREFIX_cms_lang` tl - WHERE tl.`id_lang` = (SELECT c.`value` - FROM `PREFIX_configuration` c - WHERE c.`name` = 'PS_LANG_DEFAULT' LIMIT 1) AND tl.`id_cms`=`PREFIX_cms`.`id_cms`), - (SELECT tl.`meta_keywords` - FROM `PREFIX_cms_lang` tl - WHERE tl.`id_lang` = (SELECT c.`value` - FROM `PREFIX_configuration` c - WHERE c.`name` = 'PS_LANG_DEFAULT' LIMIT 1) AND tl.`id_cms`=`PREFIX_cms`.`id_cms`), - (SELECT tl.`meta_title` - FROM `PREFIX_cms_lang` tl - WHERE tl.`id_lang` = (SELECT c.`value` - FROM `PREFIX_configuration` c - WHERE c.`name` = 'PS_LANG_DEFAULT' LIMIT 1) AND tl.`id_cms`=`PREFIX_cms`.`id_cms`), - (SELECT tl.`content` - FROM `PREFIX_cms_lang` tl - WHERE tl.`id_lang` = (SELECT c.`value` - FROM `PREFIX_configuration` c - WHERE c.`name` = 'PS_LANG_DEFAULT' LIMIT 1) AND tl.`id_cms`=`PREFIX_cms`.`id_cms`) - FROM `PREFIX_lang` CROSS JOIN `PREFIX_cms`); - -INSERT IGNORE INTO `PREFIX_meta_lang` (`id_meta`, `id_lang`, `description`, `keywords`, `title`) - (SELECT `id_meta`, id_lang, - (SELECT tl.`description` - FROM `PREFIX_meta_lang` tl - WHERE tl.`id_lang` = (SELECT c.`value` - FROM `PREFIX_configuration` c - WHERE c.`name` = 'PS_LANG_DEFAULT' LIMIT 1) AND tl.`id_meta`=`PREFIX_meta`.`id_meta`), - (SELECT tl.`keywords` - FROM `PREFIX_meta_lang` tl - WHERE tl.`id_lang` = (SELECT c.`value` - FROM `PREFIX_configuration` c - WHERE c.`name` = 'PS_LANG_DEFAULT' LIMIT 1) AND tl.`id_meta`=`PREFIX_meta`.`id_meta`), - (SELECT tl.`title` - FROM `PREFIX_meta_lang` tl - WHERE tl.`id_lang` = (SELECT c.`value` - FROM `PREFIX_configuration` c - WHERE c.`name` = 'PS_LANG_DEFAULT' LIMIT 1) AND tl.`id_meta`=`PREFIX_meta`.`id_meta`) - FROM `PREFIX_lang` CROSS JOIN `PREFIX_meta`); - -INSERT IGNORE INTO `PREFIX_order_message_lang` (`id_order_message`, `id_lang`, `name`, `message`) - (SELECT `id_order_message`, id_lang, - (SELECT tl.`name` - FROM `PREFIX_order_message_lang` tl - WHERE tl.`id_lang` = (SELECT c.`value` - FROM `PREFIX_configuration` c - WHERE c.`name` = 'PS_LANG_DEFAULT' LIMIT 1) AND tl.`id_order_message`=`PREFIX_order_message`.`id_order_message`), - (SELECT tl.`message` - FROM `PREFIX_order_message_lang` tl - WHERE tl.`id_lang` = (SELECT c.`value` - FROM `PREFIX_configuration` c - WHERE c.`name` = 'PS_LANG_DEFAULT' LIMIT 1) AND tl.`id_order_message`=`PREFIX_order_message`.`id_order_message`) - FROM `PREFIX_lang` CROSS JOIN `PREFIX_order_message`); - -/* PHP */ -/* PHP:invoice_number_set(); */; -/* PHP:delivery_number_set(); */; -/* PHP:set_payment_module(); */; -/* PHP:set_discount_category(); */; diff --git a/upgrade/sql/1.1.0.2.sql b/upgrade/sql/1.1.0.2.sql deleted file mode 100644 index ee56776c5..000000000 --- a/upgrade/sql/1.1.0.2.sql +++ /dev/null @@ -1,3 +0,0 @@ -SET NAMES 'utf8'; - -/* ##################################### */ diff --git a/upgrade/sql/1.1.0.3.sql b/upgrade/sql/1.1.0.3.sql deleted file mode 100644 index 69e362b29..000000000 --- a/upgrade/sql/1.1.0.3.sql +++ /dev/null @@ -1,10 +0,0 @@ -SET NAMES 'utf8'; - -/* ##################################### */ -/* STRUCTURE */ -/* ##################################### */ - -DROP TABLE IF EXISTS PREFIX_product_picture; - -/* PHP */ -/* PHP:module_reinstall_blockmyaccount(); */; diff --git a/upgrade/sql/1.1.0.4.sql b/upgrade/sql/1.1.0.4.sql deleted file mode 100644 index 1bd039324..000000000 --- a/upgrade/sql/1.1.0.4.sql +++ /dev/null @@ -1,28 +0,0 @@ -SET NAMES 'utf8'; - -/* ##################################### */ -/* STRUCTURE */ -/* ##################################### */ - -ALTER TABLE PREFIX_order_detail - DROP `deleted`, - ADD product_quantity_cancelled INT(10) UNSIGNED NOT NULL AFTER product_quantity_return; - -ALTER TABLE PREFIX_customization ADD quantity INT(10) NOT NULL; - -ALTER TABLE PREFIX_order_return_detail ADD id_customization INT(10) NOT NULL DEFAULT 0 AFTER id_order_detail; -ALTER TABLE PREFIX_order_return_detail DROP PRIMARY KEY; -ALTER TABLE PREFIX_order_return_detail ADD PRIMARY KEY (id_order_return, id_order_detail, id_customization); - - -ALTER TABLE PREFIX_orders - CHANGE payment payment VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, - CHANGE module module VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL; - -/* ################################# */ -/* CONTENTS */ -/* ################################# */ - -INSERT INTO PREFIX_hook (`name`, `title`, `description`, `position`) VALUES - ('productOutOfStock', 'Product out of stock', 'Make action while product is out of stock', 1), - ('updateProductAttribute', 'Product attribute update', NULL, 1); diff --git a/upgrade/sql/1.1.0.5.sql b/upgrade/sql/1.1.0.5.sql deleted file mode 100644 index 08b08b3a5..000000000 --- a/upgrade/sql/1.1.0.5.sql +++ /dev/null @@ -1,20 +0,0 @@ -SET NAMES 'utf8'; - -/* ##################################### */ -/* STRUCTURE */ -/* ##################################### */ - -ALTER TABLE PREFIX_product - CHANGE customizable customizable TINYINT(2) NOT NULL DEFAULT 0; -ALTER TABLE PREFIX_connections - CHANGE ip_address ip_address VARCHAR(16) NULL; -ALTER TABLE PREFIX_customer - ADD newsletter_date_add DATETIME NULL; -ALTER TABLE PREFIX_cart_product - ADD date_add DATETIME NOT NULL; - -/* ################################# */ -/* CONTENTS */ -/* ################################# */ - -/* PHP:add_required_customization_field_flag(); */; diff --git a/upgrade/sql/1.2.0.1.sql b/upgrade/sql/1.2.0.1.sql deleted file mode 100644 index b4fef836e..000000000 --- a/upgrade/sql/1.2.0.1.sql +++ /dev/null @@ -1,1071 +0,0 @@ -SET NAMES 'utf8'; - -/* ##################################### */ -/* STRUCTURE */ -/* ##################################### */ - -DROP TABLE IF EXISTS PREFIX_order_customization_return; - -ALTER TABLE PREFIX_cart - ADD id_guest INT UNSIGNED NULL AFTER id_customer; - -ALTER TABLE PREFIX_tab - ADD `module` varchar(64) NULL AFTER class_name; - -ALTER TABLE PREFIX_product - ADD `indexed` tinyint(1) NOT NULL default '0' AFTER `active`; - -ALTER TABLE PREFIX_orders - DROP INDEX `orders_customer`; -ALTER TABLE PREFIX_orders - ADD INDEX id_customer (id_customer); -ALTER TABLE PREFIX_orders - ADD valid INTEGER(1) UNSIGNED NOT NULL DEFAULT '0' AFTER delivery_date; -ALTER TABLE PREFIX_orders - ADD INDEX `id_cart` (`id_cart`); - -ALTER TABLE PREFIX_customer - ADD deleted TINYINT(1) NOT NULL DEFAULT '0' AFTER active; - -ALTER TABLE PREFIX_employee - ADD stats_date_to DATE NULL DEFAULT NULL AFTER last_passwd_gen; -ALTER TABLE PREFIX_employee - ADD stats_date_from DATE NULL DEFAULT NULL AFTER last_passwd_gen; - -ALTER TABLE PREFIX_order_state - ADD hidden TINYINT(1) UNSIGNED NOT NULL DEFAULT '0' AFTER unremovable; - -ALTER TABLE PREFIX_carrier - ADD is_module TINYINT(1) UNSIGNED NOT NULL DEFAULT '0' AFTER range_behavior; -ALTER TABLE PREFIX_carrier - ADD INDEX deleted (`deleted`, `active`); - -ALTER TABLE PREFIX_state - CHANGE iso_code `iso_code` char(4) NOT NULL; - -ALTER TABLE PREFIX_order_detail - CHANGE product_quantity_cancelled product_quantity_refunded INT(10) UNSIGNED NOT NULL DEFAULT '0'; -ALTER TABLE PREFIX_order_detail - ADD INDEX product_id (product_id); - -ALTER TABLE PREFIX_attribute_lang - ADD INDEX id_lang (`id_lang`, `name`); -ALTER TABLE PREFIX_attribute_lang - ADD INDEX id_lang_2 (`id_lang`); -ALTER TABLE PREFIX_attribute_lang - ADD INDEX id_attribute (`id_attribute`); - -ALTER TABLE PREFIX_block_cms - ADD PRIMARY KEY (`id_block`, `id_cms`); - -/* IGNORE because can raise error data truncated */ -ALTER IGNORE TABLE PREFIX_connections - CHANGE `http_referer` `http_referer` VARCHAR(255) DEFAULT NULL; - -ALTER TABLE PREFIX_connections - ADD INDEX `date_add` (`date_add`); - -ALTER TABLE PREFIX_customer - DROP INDEX `customer_email`; -ALTER TABLE PREFIX_customer - ADD UNIQUE `customer_email` (`email`); - -ALTER TABLE PREFIX_delivery - ADD INDEX id_zone (`id_zone`); -ALTER TABLE PREFIX_delivery - ADD INDEX id_carrier (`id_carrier`, `id_zone`); - -ALTER TABLE PREFIX_feature_product - ADD INDEX `id_feature` (`id_feature`); - -ALTER TABLE PREFIX_hook_module - DROP INDEX `hook_module_index`; -ALTER TABLE PREFIX_hook_module - ADD PRIMARY KEY (id_module,id_hook); -ALTER TABLE PREFIX_hook_module - ADD INDEX id_module (`id_module`); -ALTER TABLE PREFIX_hook_module - ADD INDEX id_hook (`id_hook`); - -ALTER TABLE PREFIX_module - CHANGE `active` `active` TINYINT(1) UNSIGNED NOT NULL DEFAULT '0'; - -ALTER TABLE PREFIX_page - CHANGE `id_object` `id_object` INT UNSIGNED NULL DEFAULT NULL; -ALTER TABLE PREFIX_page - ADD INDEX `id_page_type` (`id_page_type`); -ALTER TABLE PREFIX_page - ADD INDEX `id_object` (`id_object`); - -ALTER TABLE PREFIX_page_type - CHANGE `name` `name` VARCHAR(255) NOT NULL; -ALTER TABLE PREFIX_page_type - ADD INDEX `name` (`name`); - -ALTER TABLE PREFIX_product_attribute - ADD INDEX reference (reference); -ALTER TABLE PREFIX_product_attribute - ADD INDEX supplier_reference (supplier_reference); - -ALTER TABLE PREFIX_product_lang - ADD INDEX id_product (id_product); -ALTER TABLE PREFIX_product_lang - ADD INDEX id_lang (id_lang); -ALTER TABLE PREFIX_product_lang - ADD INDEX `name` (`name`); -ALTER TABLE PREFIX_product_lang - ADD FULLTEXT KEY ftsname (`name`); - -ALTER TABLE PREFIX_cart_discount - ADD INDEX `id_discount` (`id_discount`); - -ALTER TABLE PREFIX_discount_category - ADD PRIMARY KEY (`id_category`,`id_discount`); - -ALTER TABLE PREFIX_image_lang - ADD INDEX id_image (id_image); - -ALTER TABLE PREFIX_range_price - CHANGE `delimiter1` `delimiter1` DECIMAL(13, 6) NOT NULL; -ALTER TABLE PREFIX_range_price - CHANGE `delimiter2` `delimiter2` DECIMAL(13, 6) NOT NULL; -ALTER TABLE PREFIX_range_price - CHANGE `id_carrier` `id_carrier` INT(10) UNSIGNED NOT NULL; -ALTER TABLE PREFIX_range_price - DROP INDEX `range_price_unique`; -ALTER TABLE PREFIX_range_price - ADD UNIQUE KEY `id_carrier` (`id_carrier`,`delimiter1`,`delimiter2`); - -ALTER TABLE PREFIX_range_weight - CHANGE `delimiter1` `delimiter1` DECIMAL(13, 6) NOT NULL; -ALTER TABLE PREFIX_range_weight - CHANGE `delimiter2` `delimiter2` DECIMAL(13, 6) NOT NULL; -ALTER TABLE PREFIX_range_weight - CHANGE `id_carrier` `id_carrier` INT(10) UNSIGNED NOT NULL; -ALTER TABLE PREFIX_range_weight - DROP INDEX `range_weight_unique`; -ALTER TABLE PREFIX_range_weight - ADD UNIQUE KEY `id_carrier` (`id_carrier`,`delimiter1`,`delimiter2`); - -ALTER TABLE PREFIX_scene_products - ADD PRIMARY KEY (`id_scene`, `id_product`, `x_axis`, `y_axis`); - -ALTER TABLE PREFIX_product_lang DROP INDEX fts; -ALTER TABLE PREFIX_product_lang DROP INDEX ftsname ; - -/* KEY management */ -ALTER TABLE PREFIX_attribute_lang DROP INDEX `id_lang_2`; -ALTER TABLE PREFIX_attribute_lang DROP INDEX `id_attribute`; -ALTER TABLE PREFIX_attribute_lang DROP INDEX `attribute_lang_index`, ADD PRIMARY KEY (`id_attribute`, `id_lang`); -ALTER TABLE PREFIX_carrier_zone DROP INDEX `carrier_zone_index`, ADD PRIMARY KEY (`id_carrier`, `id_zone`); -ALTER TABLE PREFIX_discount_category CHANGE `id_discount` `id_discount` int(11) NOT NULL AFTER `id_category`; -ALTER TABLE PREFIX_feature_product DROP INDEX `id_feature`; -ALTER TABLE PREFIX_hook_module DROP INDEX `id_module`; -ALTER TABLE PREFIX_image_lang DROP INDEX `id_image`; -ALTER TABLE PREFIX_product_lang DROP INDEX `id_product`; - -/* ############################################################ */ - -CREATE TABLE `PREFIX_customer_group` ( - `id_customer` int(10) unsigned NOT NULL, - `id_group` int(10) unsigned NOT NULL, - PRIMARY KEY (`id_customer`,`id_group`), - INDEX customer_login(id_group) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; - -CREATE TABLE PREFIX_category_group ( - id_category INTEGER UNSIGNED NOT NULL, - id_group INTEGER UNSIGNED NOT NULL, - INDEX category_group_index(id_category, id_group) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; - -CREATE TABLE `PREFIX_group` ( - id_group INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, - reduction DECIMAL(10,2) NOT NULL DEFAULT 0, - date_add DATETIME NOT NULL, - date_upd DATETIME NOT NULL, - PRIMARY KEY(id_group) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; - -CREATE TABLE PREFIX_group_lang ( - id_group INTEGER UNSIGNED NOT NULL, - id_lang INTEGER UNSIGNED NOT NULL, - name VARCHAR(32) NOT NULL, - UNIQUE INDEX attribute_lang_index(id_group, id_lang) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; - -CREATE TABLE PREFIX_message_readed ( - id_message INTEGER UNSIGNED NOT NULL, - id_employee INTEGER UNSIGNED NOT NULL, - date_add DATETIME NOT NULL, - PRIMARY KEY (id_message,id_employee) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; - -CREATE TABLE `PREFIX_attachment` ( - `id_attachment` int(10) unsigned NOT NULL auto_increment, - `file` varchar(40) NOT NULL, - `mime` varchar(32) NOT NULL, - PRIMARY KEY (`id_attachment`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; - -CREATE TABLE `PREFIX_attachment_lang` ( - `id_attachment` int(10) unsigned NOT NULL auto_increment, - `id_lang` int(10) unsigned NOT NULL, - `name` varchar(32) default NULL, - `description` TEXT, - PRIMARY KEY (`id_attachment`, `id_lang`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; - -CREATE TABLE `PREFIX_product_attachment` ( - `id_product` int(10) NOT NULL, - `id_attachment` int(10) NOT NULL, - PRIMARY KEY (`id_product`,`id_attachment`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; - -CREATE TABLE IF NOT EXISTS `PREFIX_connections_source` ( - id_connections_source INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, - id_connections INTEGER UNSIGNED NOT NULL, - http_referer VARCHAR(255) NULL, - request_uri VARCHAR(255) NULL, - keywords VARCHAR(255) NULL, - date_add DATETIME NOT NULL, - PRIMARY KEY (id_connections_source), - INDEX connections (id_connections), - INDEX orderby (date_add), - INDEX http_referer (`http_referer`), - INDEX request_uri(`request_uri`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; - -CREATE TABLE `PREFIX_referrer` ( - `id_referrer` int(10) unsigned NOT NULL auto_increment, - `name` varchar(64) NOT NULL, - `passwd` varchar(32) default NULL, - `http_referer_regexp` varchar(64) default NULL, - `http_referer_like` varchar(64) default NULL, - `request_uri_regexp` varchar(64) default NULL, - `request_uri_like` varchar(64) default NULL, - `http_referer_regexp_not` varchar(64) default NULL, - `http_referer_like_not` varchar(64) default NULL, - `request_uri_regexp_not` varchar(64) default NULL, - `request_uri_like_not` varchar(64) default NULL, - `base_fee` decimal(5,2) NOT NULL default '0.00', - `percent_fee` decimal(5,2) NOT NULL default '0.00', - `click_fee` decimal(5,2) NOT NULL default '0.00', - `cache_visitors` int(11) default NULL, - `cache_visits` int(11) default NULL, - `cache_pages` int(11) default NULL, - `cache_registrations` int(11) default NULL, - `cache_orders` int(11) default NULL, - `cache_sales` decimal(10,2) default NULL, - `cache_reg_rate` decimal(5,4) default NULL, - `cache_order_rate` decimal(5,4) default NULL, - `date_add` datetime NOT NULL, - PRIMARY KEY (`id_referrer`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; - -CREATE TABLE `PREFIX_referrer_cache` ( - `id_connections_source` int(11) NOT NULL, - `id_referrer` int(11) NOT NULL, - PRIMARY KEY (`id_connections_source`, `id_referrer`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; - -CREATE TABLE IF NOT EXISTS `PREFIX_search_engine` ( - id_search_engine INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, - server VARCHAR(64) NOT NULL, - getvar VARCHAR(16) NOT NULL, - PRIMARY KEY(id_search_engine) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; - -CREATE TABLE `PREFIX_module_group` ( - `id_module` INTEGER UNSIGNED NOT NULL, - `id_group` INTEGER NOT NULL, - PRIMARY KEY (`id_module`, `id_group`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; - -CREATE TABLE `PREFIX_product_attribute_image` ( - `id_product_attribute` int(10) NOT NULL, - `id_image` int(10) NOT NULL, - PRIMARY KEY (`id_product_attribute`,`id_image`), - KEY `id_image` (`id_image`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; - -CREATE TABLE `PREFIX_search_index` ( - `id_product` int(11) NOT NULL, - `id_word` int(11) NOT NULL, - `weight` tinyint(4) NOT NULL default '1', - PRIMARY KEY (`id_word`, `id_product`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; - -CREATE TABLE `PREFIX_search_word` ( - `id_word` int(10) unsigned NOT NULL auto_increment, - `id_lang` int(10) unsigned NOT NULL, - `word` varchar(15) NOT NULL, - PRIMARY KEY (`id_word`), - UNIQUE KEY `id_lang` (`id_lang`,`word`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; - -CREATE TABLE PREFIX_timezone ( - id_timezone INTEGER UNSIGNED NOT NULL auto_increment, - name VARCHAR(32) NOT NULL, - PRIMARY KEY timezone_index(`id_timezone`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; - -/* ##################################### */ -/* CONTENTS */ -/* ##################################### */ - -INSERT INTO `PREFIX_order_state` (`id_order_state`, `invoice`, `send_email`, `color`, `unremovable`, `logable`, `delivery`) VALUES - (11, 0, 0, 'lightblue', 1, 0, 0); - -INSERT INTO `PREFIX_order_state_lang` (`id_order_state`, `id_lang`, `name`, `template`) VALUES - (11, 1, 'Awaiting PayPal payment', ''); -INSERT INTO `PREFIX_order_state_lang` (`id_order_state`, `id_lang`, `name`, `template`) VALUES - (11, 2, 'En attente du paiement par PayPal', ''); - -INSERT INTO `PREFIX_configuration` (`name`, `value`, `date_add`, `date_upd`) VALUES - ('PS_SEARCH_MINWORDLEN', '3', NOW(), NOW()); -INSERT INTO `PREFIX_configuration` (`name`, `value`, `date_add`, `date_upd`) VALUES - ('PS_SEARCH_WEIGHT_PNAME', '6', NOW(), NOW()); -INSERT INTO `PREFIX_configuration` (`name`, `value`, `date_add`, `date_upd`) VALUES - ('PS_SEARCH_WEIGHT_REF', '10', NOW(), NOW()); -INSERT INTO `PREFIX_configuration` (`name`, `value`, `date_add`, `date_upd`) VALUES - ('PS_SEARCH_WEIGHT_SHORTDESC', '1', NOW(), NOW()); -INSERT INTO `PREFIX_configuration` (`name`, `value`, `date_add`, `date_upd`) VALUES - ('PS_SEARCH_WEIGHT_DESC', '1', NOW(), NOW()); -INSERT INTO `PREFIX_configuration` (`name`, `value`, `date_add`, `date_upd`) VALUES - ('PS_SEARCH_WEIGHT_CNAME', '3', NOW(), NOW()); -INSERT INTO `PREFIX_configuration` (`name`, `value`, `date_add`, `date_upd`) VALUES - ('PS_SEARCH_WEIGHT_MNAME', '3', NOW(), NOW()); -INSERT INTO `PREFIX_configuration` (`name`, `value`, `date_add`, `date_upd`) VALUES - ('PS_SEARCH_WEIGHT_TAG', '4', NOW(), NOW()); -INSERT INTO `PREFIX_configuration` (`name`, `value`, `date_add`, `date_upd`) VALUES - ('PS_SEARCH_WEIGHT_ATTRIBUTE', '2', NOW(), NOW()); -INSERT INTO `PREFIX_configuration` (`name`, `value`, `date_add`, `date_upd`) VALUES - ('PS_SEARCH_WEIGHT_FEATURE', '2', NOW(), NOW()); -INSERT INTO `PREFIX_configuration` (`name`, `value`, `date_add`, `date_upd`) VALUES - ('PS_SEARCH_AJAX', '1', NOW(), NOW()); -INSERT INTO `PREFIX_configuration` (`name`, `value`, `date_add`, `date_upd`) VALUES - ('PS_TIMEZONE', '374', NOW(), NOW()); -INSERT INTO `PREFIX_configuration` (`name`, `value`, `date_add`, `date_upd`) VALUES - ('BLOCKTAGS_NBR', '10', NOW(), NOW()); - -INSERT INTO PREFIX_hook (`name`, `title`, `description`, `position`) VALUES - ('extraCarrier', 'Extra carrier (module mode)', NULL, 0); -INSERT INTO PREFIX_hook (`name`, `title`, `description`, `position`) VALUES - ('shoppingCartExtra', 'Shopping cart extra button', 'Display some specific informations', 1); -INSERT INTO PREFIX_hook (`name`, `title`, `description`, `position`) VALUES - ('search', 'Search', NULL, 0); -INSERT INTO PREFIX_hook (`name`, `title`, `description`, `position`) VALUES - ('backBeforePayment', 'Redirect in order process', 'Redirect user to the module instead of displaying payment modules', 0); - -UPDATE PREFIX_orders o SET o.valid = IFNULL(( - SELECT os.logable - FROM PREFIX_order_history oh - LEFT JOIN PREFIX_order_state os ON os.id_order_state = oh.id_order_state - WHERE oh.id_order = o.id_order - ORDER BY oh.date_add DESC, oh.id_order_history DESC - LIMIT 1 -), 0); - -INSERT INTO `PREFIX_search_engine` (`id_search_engine`, `server`,`getvar`) VALUES - (1, 'google','q'), - (2, 'search.aol','query'), - (3, 'yandex.ru','text'), - (4, 'ask.com','q'), - (5, 'nhl.com','q'), - (6, 'search.yahoo','p'), - (7, 'baidu.com','wd'), - (8, 'search.lycos','query'), - (9, 'exalead','q'), - (10, 'search.live.com','q'), - (11, 'search.ke.voila','rdata'), - (12, 'altavista','q') - ON DUPLICATE KEY UPDATE server = server; - -/* GROUPS, CUSTOMERS GROUPS, & CATEGORY GROUPS */ -INSERT INTO `PREFIX_group` (`reduction`, `date_add`, `date_upd`) VALUES (0, NOW(), NOW()); -INSERT INTO `PREFIX_group_lang` (`id_lang`, `id_group`, `name`) ( - SELECT `id_lang`, - (SELECT `id_group` FROM `PREFIX_group` LIMIT 1), - 'Default' FROM `PREFIX_lang`); -UPDATE `PREFIX_group_lang` SET `name` = 'Défaut' - WHERE `id_group` = (SELECT `id_group` FROM `PREFIX_group` LIMIT 1) - AND `id_lang` = (SELECT `id_lang` FROM `PREFIX_lang` l WHERE l.iso_code = 'fr'); -INSERT INTO `PREFIX_customer_group` (`id_customer`, `id_group`) - (SELECT `id_customer`, - (SELECT `id_group` FROM `PREFIX_group` LIMIT 1) FROM `PREFIX_customer`); -INSERT INTO `PREFIX_category_group` (`id_category`, `id_group`) - (SELECT `id_category`, - (SELECT `id_group` FROM `PREFIX_group` LIMIT 1) FROM `PREFIX_category`); - -/* NEW TABS */ -INSERT INTO PREFIX_tab (id_parent, class_name, position) VALUES ((SELECT tmp.`id_tab` FROM (SELECT `id_tab` FROM PREFIX_tab t WHERE t.class_name = 'AdminOrders' LIMIT 1) AS tmp), 'AdminMessages', (SELECT tmp.max FROM (SELECT MAX(position) max FROM `PREFIX_tab` WHERE id_parent = (SELECT tmp.`id_tab` FROM (SELECT `id_tab` FROM PREFIX_tab t WHERE t.class_name = 'AdminOrders' LIMIT 1) AS tmp )) AS tmp)); -INSERT INTO PREFIX_tab_lang (id_lang, id_tab, name) ( - SELECT id_lang, - (SELECT id_tab FROM PREFIX_tab t WHERE t.class_name = 'AdminMessages' LIMIT 1), - 'Customer messages' FROM PREFIX_lang); -UPDATE `PREFIX_tab_lang` SET `name` = 'Messages clients' - WHERE `id_tab` = (SELECT `id_tab` FROM `PREFIX_tab` t WHERE t.class_name = 'AdminMessages') - AND `id_lang` = (SELECT `id_lang` FROM `PREFIX_lang` l WHERE l.iso_code = 'fr'); -INSERT INTO PREFIX_access (id_profile, id_tab, `view`, `add`, edit, `delete`) VALUES ('1', (SELECT id_tab FROM PREFIX_tab t WHERE t.class_name = 'AdminMessages' LIMIT 1), 1, 1, 1, 1); - -INSERT INTO PREFIX_tab (id_parent, class_name, position) VALUES ((SELECT tmp.`id_tab` FROM (SELECT `id_tab` FROM PREFIX_tab t WHERE t.class_name = 'AdminCatalog' LIMIT 1) AS tmp), 'AdminTracking', (SELECT tmp.max FROM (SELECT MAX(position) max FROM `PREFIX_tab` WHERE id_parent = (SELECT tmp.`id_tab` FROM (SELECT `id_tab` FROM PREFIX_tab t WHERE t.class_name = 'AdminCatalog' LIMIT 1) AS tmp )) AS tmp)); -INSERT INTO PREFIX_tab_lang (id_lang, id_tab, name) ( - SELECT id_lang, - (SELECT id_tab FROM PREFIX_tab t WHERE t.class_name = 'AdminTracking' LIMIT 1), - 'Tracking' FROM PREFIX_lang); -UPDATE `PREFIX_tab_lang` SET `name` = 'Suivi' - WHERE `id_tab` = (SELECT `id_tab` FROM `PREFIX_tab` t WHERE t.class_name = 'AdminTracking') - AND `id_lang` = (SELECT `id_lang` FROM `PREFIX_lang` l WHERE l.iso_code = 'fr'); -INSERT INTO PREFIX_access (id_profile, id_tab, `view`, `add`, edit, `delete`) VALUES ('1', (SELECT id_tab FROM PREFIX_tab t WHERE t.class_name = 'AdminTracking' LIMIT 1), 1, 1, 1, 1); - -INSERT INTO PREFIX_tab (id_parent, class_name, position) VALUES ((SELECT tmp.`id_tab` FROM (SELECT `id_tab` FROM PREFIX_tab t WHERE t.class_name = 'AdminStats' LIMIT 1) AS tmp), 'AdminSearchEngines', (SELECT tmp.max FROM (SELECT MAX(position) max FROM `PREFIX_tab` WHERE id_parent = (SELECT tmp.`id_tab` FROM (SELECT `id_tab` FROM PREFIX_tab t WHERE t.class_name = 'AdminStats' LIMIT 1) AS tmp )) AS tmp)); -INSERT INTO PREFIX_tab_lang (id_lang, id_tab, name) ( - SELECT id_lang, - (SELECT id_tab FROM PREFIX_tab t WHERE t.class_name = 'AdminSearchEngines' LIMIT 1), - 'Search Engines' FROM PREFIX_lang); -UPDATE `PREFIX_tab_lang` SET `name` = 'Moteurs de recherche' - WHERE `id_tab` = (SELECT `id_tab` FROM `PREFIX_tab` t WHERE t.class_name = 'AdminSearchEngines') - AND `id_lang` = (SELECT `id_lang` FROM `PREFIX_lang` l WHERE l.iso_code = 'fr'); -INSERT INTO PREFIX_access (id_profile, id_tab, `view`, `add`, edit, `delete`) VALUES ('1', (SELECT id_tab FROM PREFIX_tab t WHERE t.class_name = 'AdminSearchEngines' LIMIT 1), 1, 1, 1, 1); - -INSERT INTO PREFIX_tab (id_parent, class_name, position) VALUES ((SELECT tmp.`id_tab` FROM (SELECT `id_tab` FROM PREFIX_tab t WHERE t.class_name = 'AdminStats' LIMIT 1) AS tmp), 'AdminReferrers', (SELECT tmp.max FROM (SELECT MAX(position) max FROM `PREFIX_tab` WHERE id_parent = (SELECT tmp.`id_tab` FROM (SELECT `id_tab` FROM PREFIX_tab t WHERE t.class_name = 'AdminStats' LIMIT 1) AS tmp )) AS tmp)); -INSERT INTO PREFIX_tab_lang (id_lang, id_tab, name) ( - SELECT id_lang, - (SELECT id_tab FROM PREFIX_tab t WHERE t.class_name = 'AdminReferrers' LIMIT 1), - 'Referrers' FROM PREFIX_lang); -UPDATE `PREFIX_tab_lang` SET `name` = 'Sites affluents' - WHERE `id_tab` = (SELECT `id_tab` FROM `PREFIX_tab` t WHERE t.class_name = 'AdminReferrers') - AND `id_lang` = (SELECT `id_lang` FROM `PREFIX_lang` l WHERE l.iso_code = 'fr'); -INSERT INTO PREFIX_access (id_profile, id_tab, `view`, `add`, edit, `delete`) VALUES ('1', (SELECT id_tab FROM PREFIX_tab t WHERE t.class_name = 'AdminReferrers' LIMIT 1), 1, 1, 1, 1); - -INSERT INTO PREFIX_tab (id_parent, class_name, position) VALUES ((SELECT tmp.`id_tab` FROM (SELECT `id_tab` FROM PREFIX_tab t WHERE t.class_name = 'AdminCustomers' LIMIT 1) AS tmp), 'AdminGroups', (SELECT tmp.max FROM (SELECT MAX(position) max FROM `PREFIX_tab` WHERE id_parent = (SELECT tmp.`id_tab` FROM (SELECT `id_tab` FROM PREFIX_tab t WHERE t.class_name = 'AdminCustomers' LIMIT 1) AS tmp )) AS tmp)); -INSERT INTO PREFIX_tab_lang (id_lang, id_tab, name) ( - SELECT id_lang, - (SELECT id_tab FROM PREFIX_tab t WHERE t.class_name = 'AdminGroups' LIMIT 1), - 'Groups' FROM PREFIX_lang); -UPDATE `PREFIX_tab_lang` SET `name` = 'Groupes' - WHERE `id_tab` = (SELECT `id_tab` FROM `PREFIX_tab` t WHERE t.class_name = 'AdminGroups') - AND `id_lang` = (SELECT `id_lang` FROM `PREFIX_lang` l WHERE l.iso_code = 'fr'); -INSERT INTO PREFIX_access (id_profile, id_tab, `view`, `add`, edit, `delete`) VALUES ('1', (SELECT id_tab FROM PREFIX_tab t WHERE t.class_name = 'AdminGroups' LIMIT 1), 1, 1, 1, 1); - -INSERT INTO PREFIX_tab (id_parent, class_name, position) VALUES ((SELECT tmp.`id_tab` FROM (SELECT `id_tab` FROM PREFIX_tab t WHERE t.class_name = 'AdminCustomers' LIMIT 1) AS tmp), 'AdminCarts', (SELECT tmp.max FROM (SELECT MAX(position) max FROM `PREFIX_tab` WHERE id_parent = (SELECT tmp.`id_tab` FROM (SELECT `id_tab` FROM PREFIX_tab t WHERE t.class_name = 'AdminCustomers' LIMIT 1) AS tmp )) AS tmp)); -INSERT INTO PREFIX_tab_lang (id_lang, id_tab, name) ( - SELECT id_lang, - (SELECT id_tab FROM PREFIX_tab t WHERE t.class_name = 'AdminCarts' LIMIT 1), - 'Carts' FROM PREFIX_lang); -UPDATE `PREFIX_tab_lang` SET `name` = 'Paniers' - WHERE `id_tab` = (SELECT `id_tab` FROM `PREFIX_tab` t WHERE t.class_name = 'AdminCarts') - AND `id_lang` = (SELECT `id_lang` FROM `PREFIX_lang` l WHERE l.iso_code = 'fr'); -INSERT INTO PREFIX_access (id_profile, id_tab, `view`, `add`, edit, `delete`) VALUES ('1', (SELECT id_tab FROM PREFIX_tab t WHERE t.class_name = 'AdminCarts' LIMIT 1), 1, 1, 1, 1); - -INSERT INTO PREFIX_tab (id_parent, class_name, position) VALUES ((SELECT tmp.`id_tab` FROM (SELECT `id_tab` FROM PREFIX_tab t WHERE t.class_name = 'AdminCatalog' LIMIT 1) AS tmp), 'AdminTags', (SELECT tmp.max FROM (SELECT MAX(position) max FROM `PREFIX_tab` WHERE id_parent = (SELECT tmp.`id_tab` FROM (SELECT `id_tab` FROM PREFIX_tab t WHERE t.class_name = 'AdminCatalog' LIMIT 1) AS tmp )) AS tmp)); -INSERT INTO PREFIX_tab_lang (id_lang, id_tab, name) ( - SELECT id_lang, - (SELECT id_tab FROM PREFIX_tab t WHERE t.class_name = 'AdminTags' LIMIT 1), - 'Tags' FROM PREFIX_lang); -INSERT INTO PREFIX_access (id_profile, id_tab, `view`, `add`, edit, `delete`) VALUES ('1', (SELECT id_tab FROM PREFIX_tab t WHERE t.class_name = 'AdminTags' LIMIT 1), 1, 1, 1, 1); - -INSERT INTO PREFIX_tab (id_parent, class_name, position) VALUES ((SELECT tmp.`id_tab` FROM (SELECT `id_tab` FROM PREFIX_tab t WHERE t.class_name = 'AdminPreferences' LIMIT 1) AS tmp), 'AdminSearchConf', (SELECT tmp.max FROM (SELECT MAX(position) max FROM `PREFIX_tab` WHERE id_parent = (SELECT tmp.`id_tab` FROM (SELECT `id_tab` FROM PREFIX_tab t WHERE t.class_name = 'AdminPreferences' LIMIT 1) AS tmp )) AS tmp)); -INSERT INTO PREFIX_tab_lang (id_lang, id_tab, name) ( - SELECT id_lang, - (SELECT id_tab FROM PREFIX_tab t WHERE t.class_name = 'AdminSearchConf' LIMIT 1), - 'Search' FROM PREFIX_lang); -UPDATE `PREFIX_tab_lang` SET `name` = 'Recherche' - WHERE `id_tab` = (SELECT `id_tab` FROM `PREFIX_tab` t WHERE t.class_name = 'AdminSearchConf') - AND `id_lang` = (SELECT `id_lang` FROM `PREFIX_lang` l WHERE l.iso_code = 'fr'); -INSERT INTO PREFIX_access (id_profile, id_tab, `view`, `add`, edit, `delete`) VALUES ('1', (SELECT id_tab FROM PREFIX_tab t WHERE t.class_name = 'AdminSearchConf' LIMIT 1), 1, 1, 1, 1); - -INSERT INTO PREFIX_tab (id_parent, class_name, position) VALUES ((SELECT tmp.`id_tab` FROM (SELECT `id_tab` FROM PREFIX_tab t WHERE t.class_name = 'AdminCatalog' LIMIT 1) AS tmp), 'AdminAttachments', (SELECT tmp.max FROM (SELECT MAX(position) max FROM `PREFIX_tab` WHERE id_parent = (SELECT tmp.`id_tab` FROM (SELECT `id_tab` FROM PREFIX_tab t WHERE t.class_name = 'AdminCatalog' LIMIT 1) AS tmp )) AS tmp)); -INSERT INTO PREFIX_tab_lang (id_lang, id_tab, name) ( - SELECT id_lang, - (SELECT id_tab FROM PREFIX_tab t WHERE t.class_name = 'AdminAttachments' LIMIT 1), - 'Attachments' FROM PREFIX_lang); -UPDATE `PREFIX_tab_lang` SET `name` = 'Documents joints' - WHERE `id_tab` = (SELECT `id_tab` FROM `PREFIX_tab` t WHERE t.class_name = 'AdminAttachments') - AND `id_lang` = (SELECT `id_lang` FROM `PREFIX_lang` l WHERE l.iso_code = 'fr'); -INSERT INTO PREFIX_access (id_profile, id_tab, `view`, `add`, edit, `delete`) VALUES ('1', (SELECT id_tab FROM PREFIX_tab t WHERE t.class_name = 'AdminAttachments' LIMIT 1), 1, 1, 1, 1); - -/* CHANGE TABS */ -UPDATE `PREFIX_tab` SET `class_name` = 'AdminStatuses' WHERE `class_name` = 'AdminOrdersStates'; -UPDATE `PREFIX_tab_lang` SET `name` = 'Statuses' - WHERE `id_tab` = (SELECT `id_tab` FROM `PREFIX_tab` t WHERE t.class_name = 'AdminStatuses') - AND `id_lang` = (SELECT `id_lang` FROM `PREFIX_lang` l WHERE l.iso_code = 'en'); -UPDATE `PREFIX_tab_lang` SET `name` = 'Statuts' - WHERE `id_tab` = (SELECT `id_tab` FROM `PREFIX_tab` t WHERE t.class_name = 'AdminStatuses') - AND `id_lang` = (SELECT `id_lang` FROM `PREFIX_lang` l WHERE l.iso_code = 'fr'); - -INSERT IGNORE INTO PREFIX_product_attribute_image (id_image, id_product_attribute) - (SELECT id_image, id_product_attribute FROM PREFIX_product_attribute WHERE id_image IS NOT NULL); -/* ALTER query must stay here (right after the INSERT INTO PREFIX_product_attribute_image)! */ -ALTER TABLE PREFIX_product_attribute DROP id_image; - -UPDATE PREFIX_category_lang SET link_rewrite = 'home' WHERE id_category = 1; - -/* TIMEZONES */ - -INSERT INTO `PREFIX_timezone` (`id_timezone`, `name`) VALUES -(1, 'Africa/Abidjan'), -(2, 'Africa/Accra'), -(3, 'Africa/Addis_Ababa'), -(4, 'Africa/Algiers'), -(5, 'Africa/Asmara'), -(6, 'Africa/Asmera'), -(7, 'Africa/Bamako'), -(8, 'Africa/Bangui'), -(9, 'Africa/Banjul'), -(10, 'Africa/Bissau'), -(11, 'Africa/Blantyre'), -(12, 'Africa/Brazzaville'), -(13, 'Africa/Bujumbura'), -(14, 'Africa/Cairo'), -(15, 'Africa/Casablanca'), -(16, 'Africa/Ceuta'), -(17, 'Africa/Conakry'), -(18, 'Africa/Dakar'), -(19, 'Africa/Dar_es_Salaam'), -(20, 'Africa/Djibouti'), -(21, 'Africa/Douala'), -(22, 'Africa/El_Aaiun'), -(23, 'Africa/Freetown'), -(24, 'Africa/Gaborone'), -(25, 'Africa/Harare'), -(26, 'Africa/Johannesburg'), -(27, 'Africa/Kampala'), -(28, 'Africa/Khartoum'), -(29, 'Africa/Kigali'), -(30, 'Africa/Kinshasa'), -(31, 'Africa/Lagos'), -(32, 'Africa/Libreville'), -(33, 'Africa/Lome'), -(34, 'Africa/Luanda'), -(35, 'Africa/Lubumbashi'), -(36, 'Africa/Lusaka'), -(37, 'Africa/Malabo'), -(38, 'Africa/Maputo'), -(39, 'Africa/Maseru'), -(40, 'Africa/Mbabane'), -(41, 'Africa/Mogadishu'), -(42, 'Africa/Monrovia'), -(43, 'Africa/Nairobi'), -(44, 'Africa/Ndjamena'), -(45, 'Africa/Niamey'), -(46, 'Africa/Nouakchott'), -(47, 'Africa/Ouagadougou'), -(48, 'Africa/Porto-Novo'), -(49, 'Africa/Sao_Tome'), -(50, 'Africa/Timbuktu'), -(51, 'Africa/Tripoli'), -(52, 'Africa/Tunis'), -(53, 'Africa/Windhoek'), -(54, 'America/Adak'), -(55, 'America/Anchorage '), -(56, 'America/Anguilla'), -(57, 'America/Antigua'), -(58, 'America/Araguaina'), -(59, 'America/Argentina/Buenos_Aires'), -(60, 'America/Argentina/Catamarca'), -(61, 'America/Argentina/ComodRivadavia'), -(62, 'America/Argentina/Cordoba'), -(63, 'America/Argentina/Jujuy'), -(64, 'America/Argentina/La_Rioja'), -(65, 'America/Argentina/Mendoza'), -(66, 'America/Argentina/Rio_Gallegos'), -(67, 'America/Argentina/Salta'), -(68, 'America/Argentina/San_Juan'), -(69, 'America/Argentina/San_Luis'), -(70, 'America/Argentina/Tucuman'), -(71, 'America/Argentina/Ushuaia'), -(72, 'America/Aruba'), -(73, 'America/Asuncion'), -(74, 'America/Atikokan'), -(75, 'America/Atka'), -(76, 'America/Bahia'), -(77, 'America/Barbados'), -(78, 'America/Belem'), -(79, 'America/Belize'), -(80, 'America/Blanc-Sablon'), -(81, 'America/Boa_Vista'), -(82, 'America/Bogota'), -(83, 'America/Boise'), -(84, 'America/Buenos_Aires'), -(85, 'America/Cambridge_Bay'), -(86, 'America/Campo_Grande'), -(87, 'America/Cancun'), -(88, 'America/Caracas'), -(89, 'America/Catamarca'), -(90, 'America/Cayenne'), -(91, 'America/Cayman'), -(92, 'America/Chicago'), -(93, 'America/Chihuahua'), -(94, 'America/Coral_Harbour'), -(95, 'America/Cordoba'), -(96, 'America/Costa_Rica'), -(97, 'America/Cuiaba'), -(98, 'America/Curacao'), -(99, 'America/Danmarkshavn'), -(100, 'America/Dawson'), -(101, 'America/Dawson_Creek'), -(102, 'America/Denver'), -(103, 'America/Detroit'), -(104, 'America/Dominica'), -(105, 'America/Edmonton'), -(106, 'America/Eirunepe'), -(107, 'America/El_Salvador'), -(108, 'America/Ensenada'), -(109, 'America/Fort_Wayne'), -(110, 'America/Fortaleza'), -(111, 'America/Glace_Bay'), -(112, 'America/Godthab'), -(113, 'America/Goose_Bay'), -(114, 'America/Grand_Turk'), -(115, 'America/Grenada'), -(116, 'America/Guadeloupe'), -(117, 'America/Guatemala'), -(118, 'America/Guayaquil'), -(119, 'America/Guyana'), -(120, 'America/Halifax'), -(121, 'America/Havana'), -(122, 'America/Hermosillo'), -(123, 'America/Indiana/Indianapolis'), -(124, 'America/Indiana/Knox'), -(125, 'America/Indiana/Marengo'), -(126, 'America/Indiana/Petersburg'), -(127, 'America/Indiana/Tell_City'), -(128, 'America/Indiana/Vevay'), -(129, 'America/Indiana/Vincennes'), -(130, 'America/Indiana/Winamac'), -(131, 'America/Indianapolis'), -(132, 'America/Inuvik'), -(133, 'America/Iqaluit'), -(134, 'America/Jamaica'), -(135, 'America/Jujuy'), -(136, 'America/Juneau'), -(137, 'America/Kentucky/Louisville'), -(138, 'America/Kentucky/Monticello'), -(139, 'America/Knox_IN'), -(140, 'America/La_Paz'), -(141, 'America/Lima'), -(142, 'America/Los_Angeles'), -(143, 'America/Louisville'), -(144, 'America/Maceio'), -(145, 'America/Managua'), -(146, 'America/Manaus'), -(147, 'America/Marigot'), -(148, 'America/Martinique'), -(149, 'America/Mazatlan'), -(150, 'America/Mendoza'), -(151, 'America/Menominee'), -(152, 'America/Merida'), -(153, 'America/Mexico_City'), -(154, 'America/Miquelon'), -(155, 'America/Moncton'), -(156, 'America/Monterrey'), -(157, 'America/Montevideo'), -(158, 'America/Montreal'), -(159, 'America/Montserrat'), -(160, 'America/Nassau'), -(161, 'America/New_York'), -(162, 'America/Nipigon'), -(163, 'America/Nome'), -(164, 'America/Noronha'), -(165, 'America/North_Dakota/Center'), -(166, 'America/North_Dakota/New_Salem'), -(167, 'America/Panama'), -(168, 'America/Pangnirtung'), -(169, 'America/Paramaribo'), -(170, 'America/Phoenix'), -(171, 'America/Port-au-Prince'), -(172, 'America/Port_of_Spain'), -(173, 'America/Porto_Acre'), -(174, 'America/Porto_Velho'), -(175, 'America/Puerto_Rico'), -(176, 'America/Rainy_River'), -(177, 'America/Rankin_Inlet'), -(178, 'America/Recife'), -(179, 'America/Regina'), -(180, 'America/Resolute'), -(181, 'America/Rio_Branco'), -(182, 'America/Rosario'), -(183, 'America/Santarem'), -(184, 'America/Santiago'), -(185, 'America/Santo_Domingo'), -(186, 'America/Sao_Paulo'), -(187, 'America/Scoresbysund'), -(188, 'America/Shiprock'), -(189, 'America/St_Barthelemy'), -(190, 'America/St_Johns'), -(191, 'America/St_Kitts'), -(192, 'America/St_Lucia'), -(193, 'America/St_Thomas'), -(194, 'America/St_Vincent'), -(195, 'America/Swift_Current'), -(196, 'America/Tegucigalpa'), -(197, 'America/Thule'), -(198, 'America/Thunder_Bay'), -(199, 'America/Tijuana'), -(200, 'America/Toronto'), -(201, 'America/Tortola'), -(202, 'America/Vancouver'), -(203, 'America/Virgin'), -(204, 'America/Whitehorse'), -(205, 'America/Winnipeg'), -(206, 'America/Yakutat'), -(207, 'America/Yellowknife'), -(208, 'Antarctica/Casey'), -(209, 'Antarctica/Davis'), -(210, 'Antarctica/DumontDUrville'), -(211, 'Antarctica/Mawson'), -(212, 'Antarctica/McMurdo'), -(213, 'Antarctica/Palmer'), -(214, 'Antarctica/Rothera'), -(215, 'Antarctica/South_Pole'), -(216, 'Antarctica/Syowa'), -(217, 'Antarctica/Vostok'), -(218, 'Arctic/Longyearbyen'), -(219, 'Asia/Aden'), -(220, 'Asia/Almaty'), -(221, 'Asia/Amman'), -(222, 'Asia/Anadyr'), -(223, 'Asia/Aqtau'), -(224, 'Asia/Aqtobe'), -(225, 'Asia/Ashgabat'), -(226, 'Asia/Ashkhabad'), -(227, 'Asia/Baghdad'), -(228, 'Asia/Bahrain'), -(229, 'Asia/Baku'), -(230, 'Asia/Bangkok'), -(231, 'Asia/Beirut'), -(232, 'Asia/Bishkek'), -(233, 'Asia/Brunei'), -(234, 'Asia/Calcutta'), -(235, 'Asia/Choibalsan'), -(236, 'Asia/Chongqing'), -(237, 'Asia/Chungking'), -(238, 'Asia/Colombo'), -(239, 'Asia/Dacca'), -(240, 'Asia/Damascus'), -(241, 'Asia/Dhaka'), -(242, 'Asia/Dili'), -(243, 'Asia/Dubai'), -(244, 'Asia/Dushanbe'), -(245, 'Asia/Gaza'), -(246, 'Asia/Harbin'), -(247, 'Asia/Ho_Chi_Minh'), -(248, 'Asia/Hong_Kong'), -(249, 'Asia/Hovd'), -(250, 'Asia/Irkutsk'), -(251, 'Asia/Istanbul'), -(252, 'Asia/Jakarta'), -(253, 'Asia/Jayapura'), -(254, 'Asia/Jerusalem'), -(255, 'Asia/Kabul'), -(256, 'Asia/Kamchatka'), -(257, 'Asia/Karachi'), -(258, 'Asia/Kashgar'), -(259, 'Asia/Kathmandu'), -(260, 'Asia/Katmandu'), -(261, 'Asia/Kolkata'), -(262, 'Asia/Krasnoyarsk'), -(263, 'Asia/Kuala_Lumpur'), -(264, 'Asia/Kuching'), -(265, 'Asia/Kuwait'), -(266, 'Asia/Macao'), -(267, 'Asia/Macau'), -(268, 'Asia/Magadan'), -(269, 'Asia/Makassar'), -(270, 'Asia/Manila'), -(271, 'Asia/Muscat'), -(272, 'Asia/Nicosia'), -(273, 'Asia/Novosibirsk'), -(274, 'Asia/Omsk'), -(275, 'Asia/Oral'), -(276, 'Asia/Phnom_Penh'), -(277, 'Asia/Pontianak'), -(278, 'Asia/Pyongyang'), -(279, 'Asia/Qatar'), -(280, 'Asia/Qyzylorda'), -(281, 'Asia/Rangoon'), -(282, 'Asia/Riyadh'), -(283, 'Asia/Saigon'), -(284, 'Asia/Sakhalin'), -(285, 'Asia/Samarkand'), -(286, 'Asia/Seoul'), -(287, 'Asia/Shanghai'), -(288, 'Asia/Singapore'), -(289, 'Asia/Taipei'), -(290, 'Asia/Tashkent'), -(291, 'Asia/Tbilisi'), -(292, 'Asia/Tehran'), -(293, 'Asia/Tel_Aviv'), -(294, 'Asia/Thimbu'), -(295, 'Asia/Thimphu'), -(296, 'Asia/Tokyo'), -(297, 'Asia/Ujung_Pandang'), -(298, 'Asia/Ulaanbaatar'), -(299, 'Asia/Ulan_Bator'), -(300, 'Asia/Urumqi'), -(301, 'Asia/Vientiane'), -(302, 'Asia/Vladivostok'), -(303, 'Asia/Yakutsk'), -(304, 'Asia/Yekaterinburg'), -(305, 'Asia/Yerevan'), -(306, 'Atlantic/Azores'), -(307, 'Atlantic/Bermuda'), -(308, 'Atlantic/Canary'), -(309, 'Atlantic/Cape_Verde'), -(310, 'Atlantic/Faeroe'), -(311, 'Atlantic/Faroe'), -(312, 'Atlantic/Jan_Mayen'), -(313, 'Atlantic/Madeira'), -(314, 'Atlantic/Reykjavik'), -(315, 'Atlantic/South_Georgia'), -(316, 'Atlantic/St_Helena'), -(317, 'Atlantic/Stanley'), -(318, 'Australia/ACT'), -(319, 'Australia/Adelaide'), -(320, 'Australia/Brisbane'), -(321, 'Australia/Broken_Hill'), -(322, 'Australia/Canberra'), -(323, 'Australia/Currie'), -(324, 'Australia/Darwin'), -(325, 'Australia/Eucla'), -(326, 'Australia/Hobart'), -(327, 'Australia/LHI'), -(328, 'Australia/Lindeman'), -(329, 'Australia/Lord_Howe'), -(330, 'Australia/Melbourne'), -(331, 'Australia/North'), -(332, 'Australia/NSW'), -(333, 'Australia/Perth'), -(334, 'Australia/Queensland'), -(335, 'Australia/South'), -(336, 'Australia/Sydney'), -(337, 'Australia/Tasmania'), -(338, 'Australia/Victoria'), -(339, 'Australia/West'), -(340, 'Australia/Yancowinna'), -(341, 'Europe/Amsterdam'), -(342, 'Europe/Andorra'), -(343, 'Europe/Athens'), -(344, 'Europe/Belfast'), -(345, 'Europe/Belgrade'), -(346, 'Europe/Berlin'), -(347, 'Europe/Bratislava'), -(348, 'Europe/Brussels'), -(349, 'Europe/Bucharest'), -(350, 'Europe/Budapest'), -(351, 'Europe/Chisinau'), -(352, 'Europe/Copenhagen'), -(353, 'Europe/Dublin'), -(354, 'Europe/Gibraltar'), -(355, 'Europe/Guernsey'), -(356, 'Europe/Helsinki'), -(357, 'Europe/Isle_of_Man'), -(358, 'Europe/Istanbul'), -(359, 'Europe/Jersey'), -(360, 'Europe/Kaliningrad'), -(361, 'Europe/Kiev'), -(362, 'Europe/Lisbon'), -(363, 'Europe/Ljubljana'), -(364, 'Europe/London'), -(365, 'Europe/Luxembourg'), -(366, 'Europe/Madrid'), -(367, 'Europe/Malta'), -(368, 'Europe/Mariehamn'), -(369, 'Europe/Minsk'), -(370, 'Europe/Monaco'), -(371, 'Europe/Moscow'), -(372, 'Europe/Nicosia'), -(373, 'Europe/Oslo'), -(374, 'Europe/Paris'), -(375, 'Europe/Podgorica'), -(376, 'Europe/Prague'), -(377, 'Europe/Riga'), -(378, 'Europe/Rome'), -(379, 'Europe/Samara'), -(380, 'Europe/San_Marino'), -(381, 'Europe/Sarajevo'), -(382, 'Europe/Simferopol'), -(383, 'Europe/Skopje'), -(384, 'Europe/Sofia'), -(385, 'Europe/Stockholm'), -(386, 'Europe/Tallinn'), -(387, 'Europe/Tirane'), -(388, 'Europe/Tiraspol'), -(389, 'Europe/Uzhgorod'), -(390, 'Europe/Vaduz'), -(391, 'Europe/Vatican'), -(392, 'Europe/Vienna'), -(393, 'Europe/Vilnius'), -(394, 'Europe/Volgograd'), -(395, 'Europe/Warsaw'), -(396, 'Europe/Zagreb'), -(397, 'Europe/Zaporozhye'), -(398, 'Europe/Zurich'), -(399, 'Indian/Antananarivo'), -(400, 'Indian/Chagos'), -(401, 'Indian/Christmas'), -(402, 'Indian/Cocos'), -(403, 'Indian/Comoro'), -(404, 'Indian/Kerguelen'), -(405, 'Indian/Mahe'), -(406, 'Indian/Maldives'), -(407, 'Indian/Mauritius'), -(408, 'Indian/Mayotte'), -(409, 'Indian/Reunion'), -(410, 'Pacific/Apia'), -(411, 'Pacific/Auckland'), -(412, 'Pacific/Chatham'), -(413, 'Pacific/Easter'), -(414, 'Pacific/Efate'), -(415, 'Pacific/Enderbury'), -(416, 'Pacific/Fakaofo'), -(417, 'Pacific/Fiji'), -(418, 'Pacific/Funafuti'), -(419, 'Pacific/Galapagos'), -(420, 'Pacific/Gambier'), -(421, 'Pacific/Guadalcanal'), -(422, 'Pacific/Guam'), -(423, 'Pacific/Honolulu'), -(424, 'Pacific/Johnston'), -(425, 'Pacific/Kiritimati'), -(426, 'Pacific/Kosrae'), -(427, 'Pacific/Kwajalein'), -(428, 'Pacific/Majuro'), -(429, 'Pacific/Marquesas'), -(430, 'Pacific/Midway'), -(431, 'Pacific/Nauru'), -(432, 'Pacific/Niue'), -(433, 'Pacific/Norfolk'), -(434, 'Pacific/Noumea'), -(435, 'Pacific/Pago_Pago'), -(436, 'Pacific/Palau'), -(437, 'Pacific/Pitcairn'), -(438, 'Pacific/Ponape'), -(439, 'Pacific/Port_Moresby'), -(440, 'Pacific/Rarotonga'), -(441, 'Pacific/Saipan'), -(442, 'Pacific/Samoa'), -(443, 'Pacific/Tahiti'), -(444, 'Pacific/Tarawa'), -(445, 'Pacific/Tongatapu'), -(446, 'Pacific/Truk'), -(447, 'Pacific/Wake'), -(448, 'Pacific/Wallis'), -(449, 'Pacific/Yap'), -(450, 'Brazil/Acre'), -(451, 'Brazil/DeNoronha'), -(452, 'Brazil/East'), -(453, 'Brazil/West'), -(454, 'Canada/Atlantic'), -(455, 'Canada/Central'), -(456, 'Canada/East-Saskatchewan'), -(457, 'Canada/Eastern'), -(458, 'Canada/Mountain'), -(459, 'Canada/Newfoundland'), -(460, 'Canada/Pacific'), -(461, 'Canada/Saskatchewan'), -(462, 'Canada/Yukon'), -(463, 'CET'), -(464, 'Chile/Continental'), -(465, 'Chile/EasterIsland'), -(466, 'CST6CDT'), -(467, 'Cuba'), -(468, 'EET'), -(469, 'Egypt'), -(470, 'Eire'), -(471, 'EST'), -(472, 'EST5EDT'), -(473, 'Etc/GMT'), -(474, 'Etc/GMT+0'), -(475, 'Etc/GMT+1'), -(476, 'Etc/GMT+10'), -(477, 'Etc/GMT+11'), -(478, 'Etc/GMT+12'), -(479, 'Etc/GMT+2'), -(480, 'Etc/GMT+3'), -(481, 'Etc/GMT+4'), -(482, 'Etc/GMT+5'), -(483, 'Etc/GMT+6'), -(484, 'Etc/GMT+7'), -(485, 'Etc/GMT+8'), -(486, 'Etc/GMT+9'), -(487, 'Etc/GMT-0'), -(488, 'Etc/GMT-1'), -(489, 'Etc/GMT-10'), -(490, 'Etc/GMT-11'), -(491, 'Etc/GMT-12'), -(492, 'Etc/GMT-13'), -(493, 'Etc/GMT-14'), -(494, 'Etc/GMT-2'), -(495, 'Etc/GMT-3'), -(496, 'Etc/GMT-4'), -(497, 'Etc/GMT-5'), -(498, 'Etc/GMT-6'), -(499, 'Etc/GMT-7'), -(500, 'Etc/GMT-8'), -(501, 'Etc/GMT-9'), -(502, 'Etc/GMT0'), -(503, 'Etc/Greenwich'), -(504, 'Etc/UCT'), -(505, 'Etc/Universal'), -(506, 'Etc/UTC'), -(507, 'Etc/Zulu'), -(508, 'Factory'), -(509, 'GB'), -(510, 'GB-Eire'), -(511, 'GMT'), -(512, 'GMT+0'), -(513, 'GMT-0'), -(514, 'GMT0'), -(515, 'Greenwich'), -(516, 'Hongkong'), -(517, 'HST'), -(518, 'Iceland'), -(519, 'Iran'), -(520, 'Israel'), -(521, 'Jamaica'), -(522, 'Japan'), -(523, 'Kwajalein'), -(524, 'Libya'), -(525, 'MET'), -(526, 'Mexico/BajaNorte'), -(527, 'Mexico/BajaSur'), -(528, 'Mexico/General'), -(529, 'MST'), -(530, 'MST7MDT'), -(531, 'Navajo'), -(532, 'NZ'), -(533, 'NZ-CHAT'), -(534, 'Poland'), -(535, 'Portugal'), -(536, 'PRC'), -(537, 'PST8PDT'), -(538, 'ROC'), -(539, 'ROK'), -(540, 'Singapore'), -(541, 'Turkey'), -(542, 'UCT'), -(543, 'Universal'), -(544, 'US/Alaska'), -(545, 'US/Aleutian'), -(546, 'US/Arizona'), -(547, 'US/Central'), -(548, 'US/East-Indiana'), -(549, 'US/Eastern'), -(550, 'US/Hawaii'), -(551, 'US/Indiana-Starke'), -(552, 'US/Michigan'), -(553, 'US/Mountain'), -(554, 'US/Pacific'), -(555, 'US/Pacific-New'), -(556, 'US/Samoa'), -(557, 'UTC'), -(558, 'W-SU'), -(559, 'WET'), -(560, 'Zulu'); - -/* PHP:blocknewsletter(); */; -/* PHP:set_payment_module_group(); */; -/* PHP:add_new_tab(AdminGenerator, fr:Générateurs|es:Generadores|en:Generators|de:Generatoren|it:Generatori, 9); */; diff --git a/upgrade/sql/1.2.0.2.sql b/upgrade/sql/1.2.0.2.sql deleted file mode 100644 index 605edb065..000000000 --- a/upgrade/sql/1.2.0.2.sql +++ /dev/null @@ -1,610 +0,0 @@ -SET NAMES 'utf8'; - -/* ##################################### */ -/* STRUCTURE */ -/* ##################################### */ - -CREATE TABLE `PREFIX_pack` ( - `id_product_pack` int(10) unsigned NOT NULL, - `id_product_item` int(10) unsigned NOT NULL, - `quantity` int(10) unsigned NOT NULL DEFAULT 1, - PRIMARY KEY (`id_product_pack`,`id_product_item`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; - -ALTER TABLE `PREFIX_manufacturer_lang` - ADD `short_description` VARCHAR( 254 ) NULL DEFAULT NULL; -ALTER TABLE `PREFIX_manufacturer_lang` - ADD `meta_title` VARCHAR( 254 ) NULL DEFAULT NULL; -ALTER TABLE `PREFIX_manufacturer_lang` - ADD `meta_keywords` VARCHAR( 254 ) NULL DEFAULT NULL; -ALTER TABLE `PREFIX_manufacturer_lang` - ADD `meta_description` VARCHAR( 254 ) NULL DEFAULT NULL; - -ALTER TABLE `PREFIX_supplier_lang` - ADD `meta_title` VARCHAR( 254 ) NULL DEFAULT NULL; -ALTER TABLE `PREFIX_supplier_lang` - ADD `meta_keywords` VARCHAR( 254 ) NULL DEFAULT NULL; -ALTER TABLE `PREFIX_supplier_lang` - ADD `meta_description` VARCHAR( 254 ) NULL DEFAULT NULL; - -/* ##################################### */ -/* CONTENTS */ -/* ##################################### */ - -TRUNCATE TABLE `PREFIX_timezone`; -INSERT INTO `PREFIX_timezone` (`name`) VALUES - ('Africa/Abidjan'), - ('Africa/Accra'), - ('Africa/Addis_Ababa'), - ('Africa/Algiers'), - ('Africa/Asmara'), - ('Africa/Asmera'), - ('Africa/Bamako'), - ('Africa/Bangui'), - ('Africa/Banjul'), - ('Africa/Bissau'), - ('Africa/Blantyre'), - ('Africa/Brazzaville'), - ('Africa/Bujumbura'), - ('Africa/Cairo'), - ('Africa/Casablanca'), - ('Africa/Ceuta'), - ('Africa/Conakry'), - ('Africa/Dakar'), - ('Africa/Dar_es_Salaam'), - ('Africa/Djibouti'), - ('Africa/Douala'), - ('Africa/El_Aaiun'), - ('Africa/Freetown'), - ('Africa/Gaborone'), - ('Africa/Harare'), - ('Africa/Johannesburg'), - ('Africa/Kampala'), - ('Africa/Khartoum'), - ('Africa/Kigali'), - ('Africa/Kinshasa'), - ('Africa/Lagos'), - ('Africa/Libreville'), - ('Africa/Lome'), - ('Africa/Luanda'), - ('Africa/Lubumbashi'), - ('Africa/Lusaka'), - ('Africa/Malabo'), - ('Africa/Maputo'), - ('Africa/Maseru'), - ('Africa/Mbabane'), - ('Africa/Mogadishu'), - ('Africa/Monrovia'), - ('Africa/Nairobi'), - ('Africa/Ndjamena'), - ('Africa/Niamey'), - ('Africa/Nouakchott'), - ('Africa/Ouagadougou'), - ('Africa/Porto-Novo'), - ('Africa/Sao_Tome'), - ('Africa/Timbuktu'), - ('Africa/Tripoli'), - ('Africa/Tunis'), - ('Africa/Windhoek'), - ('America/Adak'), - ('America/Anchorage '), - ('America/Anguilla'), - ('America/Antigua'), - ('America/Araguaina'), - ('America/Argentina/Buenos_Aires'), - ('America/Argentina/Catamarca'), - ('America/Argentina/ComodRivadavia'), - ('America/Argentina/Cordoba'), - ('America/Argentina/Jujuy'), - ('America/Argentina/La_Rioja'), - ('America/Argentina/Mendoza'), - ('America/Argentina/Rio_Gallegos'), - ('America/Argentina/Salta'), - ('America/Argentina/San_Juan'), - ('America/Argentina/San_Luis'), - ('America/Argentina/Tucuman'), - ('America/Argentina/Ushuaia'), - ('America/Aruba'), - ('America/Asuncion'), - ('America/Atikokan'), - ('America/Atka'), - ('America/Bahia'), - ('America/Barbados'), - ('America/Belem'), - ('America/Belize'), - ('America/Blanc-Sablon'), - ('America/Boa_Vista'), - ('America/Bogota'), - ('America/Boise'), - ('America/Buenos_Aires'), - ('America/Cambridge_Bay'), - ('America/Campo_Grande'), - ('America/Cancun'), - ('America/Caracas'), - ('America/Catamarca'), - ('America/Cayenne'), - ('America/Cayman'), - ('America/Chicago'), - ('America/Chihuahua'), - ('America/Coral_Harbour'), - ('America/Cordoba'), - ('America/Costa_Rica'), - ('America/Cuiaba'), - ('America/Curacao'), - ('America/Danmarkshavn'), - ('America/Dawson'), - ('America/Dawson_Creek'), - ('America/Denver'), - ('America/Detroit'), - ('America/Dominica'), - ('America/Edmonton'), - ('America/Eirunepe'), - ('America/El_Salvador'), - ('America/Ensenada'), - ('America/Fort_Wayne'), - ('America/Fortaleza'), - ('America/Glace_Bay'), - ('America/Godthab'), - ('America/Goose_Bay'), - ('America/Grand_Turk'), - ('America/Grenada'), - ('America/Guadeloupe'), - ('America/Guatemala'), - ('America/Guayaquil'), - ('America/Guyana'), - ('America/Halifax'), - ('America/Havana'), - ('America/Hermosillo'), - ('America/Indiana/Indianapolis'), - ('America/Indiana/Knox'), - ('America/Indiana/Marengo'), - ('America/Indiana/Petersburg'), - ('America/Indiana/Tell_City'), - ('America/Indiana/Vevay'), - ('America/Indiana/Vincennes'), - ('America/Indiana/Winamac'), - ('America/Indianapolis'), - ('America/Inuvik'), - ('America/Iqaluit'), - ('America/Jamaica'), - ('America/Jujuy'), - ('America/Juneau'), - ('America/Kentucky/Louisville'), - ('America/Kentucky/Monticello'), - ('America/Knox_IN'), - ('America/La_Paz'), - ('America/Lima'), - ('America/Los_Angeles'), - ('America/Louisville'), - ('America/Maceio'), - ('America/Managua'), - ('America/Manaus'), - ('America/Marigot'), - ('America/Martinique'), - ('America/Mazatlan'), - ('America/Mendoza'), - ('America/Menominee'), - ('America/Merida'), - ('America/Mexico_City'), - ('America/Miquelon'), - ('America/Moncton'), - ('America/Monterrey'), - ('America/Montevideo'), - ('America/Montreal'), - ('America/Montserrat'), - ('America/Nassau'), - ('America/New_York'), - ('America/Nipigon'), - ('America/Nome'), - ('America/Noronha'), - ('America/North_Dakota/Center'), - ('America/North_Dakota/New_Salem'), - ('America/Panama'), - ('America/Pangnirtung'), - ('America/Paramaribo'), - ('America/Phoenix'), - ('America/Port-au-Prince'), - ('America/Port_of_Spain'), - ('America/Porto_Acre'), - ('America/Porto_Velho'), - ('America/Puerto_Rico'), - ('America/Rainy_River'), - ('America/Rankin_Inlet'), - ('America/Recife'), - ('America/Regina'), - ('America/Resolute'), - ('America/Rio_Branco'), - ('America/Rosario'), - ('America/Santarem'), - ('America/Santiago'), - ('America/Santo_Domingo'), - ('America/Sao_Paulo'), - ('America/Scoresbysund'), - ('America/Shiprock'), - ('America/St_Barthelemy'), - ('America/St_Johns'), - ('America/St_Kitts'), - ('America/St_Lucia'), - ('America/St_Thomas'), - ('America/St_Vincent'), - ('America/Swift_Current'), - ('America/Tegucigalpa'), - ('America/Thule'), - ('America/Thunder_Bay'), - ('America/Tijuana'), - ('America/Toronto'), - ('America/Tortola'), - ('America/Vancouver'), - ('America/Virgin'), - ('America/Whitehorse'), - ('America/Winnipeg'), - ('America/Yakutat'), - ('America/Yellowknife'), - ('Antarctica/Casey'), - ('Antarctica/Davis'), - ('Antarctica/DumontDUrville'), - ('Antarctica/Mawson'), - ('Antarctica/McMurdo'), - ('Antarctica/Palmer'), - ('Antarctica/Rothera'), - ('Antarctica/South_Pole'), - ('Antarctica/Syowa'), - ('Antarctica/Vostok'), - ('Arctic/Longyearbyen'), - ('Asia/Aden'), - ('Asia/Almaty'), - ('Asia/Amman'), - ('Asia/Anadyr'), - ('Asia/Aqtau'), - ('Asia/Aqtobe'), - ('Asia/Ashgabat'), - ('Asia/Ashkhabad'), - ('Asia/Baghdad'), - ('Asia/Bahrain'), - ('Asia/Baku'), - ('Asia/Bangkok'), - ('Asia/Beirut'), - ('Asia/Bishkek'), - ('Asia/Brunei'), - ('Asia/Calcutta'), - ('Asia/Choibalsan'), - ('Asia/Chongqing'), - ('Asia/Chungking'), - ('Asia/Colombo'), - ('Asia/Dacca'), - ('Asia/Damascus'), - ('Asia/Dhaka'), - ('Asia/Dili'), - ('Asia/Dubai'), - ('Asia/Dushanbe'), - ('Asia/Gaza'), - ('Asia/Harbin'), - ('Asia/Ho_Chi_Minh'), - ('Asia/Hong_Kong'), - ('Asia/Hovd'), - ('Asia/Irkutsk'), - ('Asia/Istanbul'), - ('Asia/Jakarta'), - ('Asia/Jayapura'), - ('Asia/Jerusalem'), - ('Asia/Kabul'), - ('Asia/Kamchatka'), - ('Asia/Karachi'), - ('Asia/Kashgar'), - ('Asia/Kathmandu'), - ('Asia/Katmandu'), - ('Asia/Kolkata'), - ('Asia/Krasnoyarsk'), - ('Asia/Kuala_Lumpur'), - ('Asia/Kuching'), - ('Asia/Kuwait'), - ('Asia/Macao'), - ('Asia/Macau'), - ('Asia/Magadan'), - ('Asia/Makassar'), - ('Asia/Manila'), - ('Asia/Muscat'), - ('Asia/Nicosia'), - ('Asia/Novosibirsk'), - ('Asia/Omsk'), - ('Asia/Oral'), - ('Asia/Phnom_Penh'), - ('Asia/Pontianak'), - ('Asia/Pyongyang'), - ('Asia/Qatar'), - ('Asia/Qyzylorda'), - ('Asia/Rangoon'), - ('Asia/Riyadh'), - ('Asia/Saigon'), - ('Asia/Sakhalin'), - ('Asia/Samarkand'), - ('Asia/Seoul'), - ('Asia/Shanghai'), - ('Asia/Singapore'), - ('Asia/Taipei'), - ('Asia/Tashkent'), - ('Asia/Tbilisi'), - ('Asia/Tehran'), - ('Asia/Tel_Aviv'), - ('Asia/Thimbu'), - ('Asia/Thimphu'), - ('Asia/Tokyo'), - ('Asia/Ujung_Pandang'), - ('Asia/Ulaanbaatar'), - ('Asia/Ulan_Bator'), - ('Asia/Urumqi'), - ('Asia/Vientiane'), - ('Asia/Vladivostok'), - ('Asia/Yakutsk'), - ('Asia/Yekaterinburg'), - ('Asia/Yerevan'), - ('Atlantic/Azores'), - ('Atlantic/Bermuda'), - ('Atlantic/Canary'), - ('Atlantic/Cape_Verde'), - ('Atlantic/Faeroe'), - ('Atlantic/Faroe'), - ('Atlantic/Jan_Mayen'), - ('Atlantic/Madeira'), - ('Atlantic/Reykjavik'), - ('Atlantic/South_Georgia'), - ('Atlantic/St_Helena'), - ('Atlantic/Stanley'), - ('Australia/ACT'), - ('Australia/Adelaide'), - ('Australia/Brisbane'), - ('Australia/Broken_Hill'), - ('Australia/Canberra'), - ('Australia/Currie'), - ('Australia/Darwin'), - ('Australia/Eucla'), - ('Australia/Hobart'), - ('Australia/LHI'), - ('Australia/Lindeman'), - ('Australia/Lord_Howe'), - ('Australia/Melbourne'), - ('Australia/North'), - ('Australia/NSW'), - ('Australia/Perth'), - ('Australia/Queensland'), - ('Australia/South'), - ('Australia/Sydney'), - ('Australia/Tasmania'), - ('Australia/Victoria'), - ('Australia/West'), - ('Australia/Yancowinna'), - ('Europe/Amsterdam'), - ('Europe/Andorra'), - ('Europe/Athens'), - ('Europe/Belfast'), - ('Europe/Belgrade'), - ('Europe/Berlin'), - ('Europe/Bratislava'), - ('Europe/Brussels'), - ('Europe/Bucharest'), - ('Europe/Budapest'), - ('Europe/Chisinau'), - ('Europe/Copenhagen'), - ('Europe/Dublin'), - ('Europe/Gibraltar'), - ('Europe/Guernsey'), - ('Europe/Helsinki'), - ('Europe/Isle_of_Man'), - ('Europe/Istanbul'), - ('Europe/Jersey'), - ('Europe/Kaliningrad'), - ('Europe/Kiev'), - ('Europe/Lisbon'), - ('Europe/Ljubljana'), - ('Europe/London'), - ('Europe/Luxembourg'), - ('Europe/Madrid'), - ('Europe/Malta'), - ('Europe/Mariehamn'), - ('Europe/Minsk'), - ('Europe/Monaco'), - ('Europe/Moscow'), - ('Europe/Nicosia'), - ('Europe/Oslo'), - ('Europe/Paris'), - ('Europe/Podgorica'), - ('Europe/Prague'), - ('Europe/Riga'), - ('Europe/Rome'), - ('Europe/Samara'), - ('Europe/San_Marino'), - ('Europe/Sarajevo'), - ('Europe/Simferopol'), - ('Europe/Skopje'), - ('Europe/Sofia'), - ('Europe/Stockholm'), - ('Europe/Tallinn'), - ('Europe/Tirane'), - ('Europe/Tiraspol'), - ('Europe/Uzhgorod'), - ('Europe/Vaduz'), - ('Europe/Vatican'), - ('Europe/Vienna'), - ('Europe/Vilnius'), - ('Europe/Volgograd'), - ('Europe/Warsaw'), - ('Europe/Zagreb'), - ('Europe/Zaporozhye'), - ('Europe/Zurich'), - ('Indian/Antananarivo'), - ('Indian/Chagos'), - ('Indian/Christmas'), - ('Indian/Cocos'), - ('Indian/Comoro'), - ('Indian/Kerguelen'), - ('Indian/Mahe'), - ('Indian/Maldives'), - ('Indian/Mauritius'), - ('Indian/Mayotte'), - ('Indian/Reunion'), - ('Pacific/Apia'), - ('Pacific/Auckland'), - ('Pacific/Chatham'), - ('Pacific/Easter'), - ('Pacific/Efate'), - ('Pacific/Enderbury'), - ('Pacific/Fakaofo'), - ('Pacific/Fiji'), - ('Pacific/Funafuti'), - ('Pacific/Galapagos'), - ('Pacific/Gambier'), - ('Pacific/Guadalcanal'), - ('Pacific/Guam'), - ('Pacific/Honolulu'), - ('Pacific/Johnston'), - ('Pacific/Kiritimati'), - ('Pacific/Kosrae'), - ('Pacific/Kwajalein'), - ('Pacific/Majuro'), - ('Pacific/Marquesas'), - ('Pacific/Midway'), - ('Pacific/Nauru'), - ('Pacific/Niue'), - ('Pacific/Norfolk'), - ('Pacific/Noumea'), - ('Pacific/Pago_Pago'), - ('Pacific/Palau'), - ('Pacific/Pitcairn'), - ('Pacific/Ponape'), - ('Pacific/Port_Moresby'), - ('Pacific/Rarotonga'), - ('Pacific/Saipan'), - ('Pacific/Samoa'), - ('Pacific/Tahiti'), - ('Pacific/Tarawa'), - ('Pacific/Tongatapu'), - ('Pacific/Truk'), - ('Pacific/Wake'), - ('Pacific/Wallis'), - ('Pacific/Yap'), - ('Brazil/Acre'), - ('Brazil/DeNoronha'), - ('Brazil/East'), - ('Brazil/West'), - ('Canada/Atlantic'), - ('Canada/Central'), - ('Canada/East-Saskatchewan'), - ('Canada/Eastern'), - ('Canada/Mountain'), - ('Canada/Newfoundland'), - ('Canada/Pacific'), - ('Canada/Saskatchewan'), - ('Canada/Yukon'), - ('CET'), - ('Chile/Continental'), - ('Chile/EasterIsland'), - ('CST6CDT'), - ('Cuba'), - ('EET'), - ('Egypt'), - ('Eire'), - ('EST'), - ('EST5EDT'), - ('Etc/GMT'), - ('Etc/GMT+0'), - ('Etc/GMT+1'), - ('Etc/GMT+10'), - ('Etc/GMT+11'), - ('Etc/GMT+12'), - ('Etc/GMT+2'), - ('Etc/GMT+3'), - ('Etc/GMT+4'), - ('Etc/GMT+5'), - ('Etc/GMT+6'), - ('Etc/GMT+7'), - ('Etc/GMT+8'), - ('Etc/GMT+9'), - ('Etc/GMT-0'), - ('Etc/GMT-1'), - ('Etc/GMT-10'), - ('Etc/GMT-11'), - ('Etc/GMT-12'), - ('Etc/GMT-13'), - ('Etc/GMT-14'), - ('Etc/GMT-2'), - ('Etc/GMT-3'), - ('Etc/GMT-4'), - ('Etc/GMT-5'), - ('Etc/GMT-6'), - ('Etc/GMT-7'), - ('Etc/GMT-8'), - ('Etc/GMT-9'), - ('Etc/GMT0'), - ('Etc/Greenwich'), - ('Etc/UCT'), - ('Etc/Universal'), - ('Etc/UTC'), - ('Etc/Zulu'), - ('Factory'), - ('GB'), - ('GB-Eire'), - ('GMT'), - ('GMT+0'), - ('GMT-0'), - ('GMT0'), - ('Greenwich'), - ('Hongkong'), - ('HST'), - ('Iceland'), - ('Iran'), - ('Israel'), - ('Jamaica'), - ('Japan'), - ('Kwajalein'), - ('Libya'), - ('MET'), - ('Mexico/BajaNorte'), - ('Mexico/BajaSur'), - ('Mexico/General'), - ('MST'), - ('MST7MDT'), - ('Navajo'), - ('NZ'), - ('NZ-CHAT'), - ('Poland'), - ('Portugal'), - ('PRC'), - ('PST8PDT'), - ('ROC'), - ('ROK'), - ('Singapore'), - ('Turkey'), - ('UCT'), - ('Universal'), - ('US/Alaska'), - ('US/Aleutian'), - ('US/Arizona'), - ('US/Central'), - ('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'); - -DELETE FROM `PREFIX_discount_category` -WHERE `id_discount` IN ( - SELECT `id_discount` FROM ( - SELECT dc.`id_discount` - FROM `PREFIX_discount_category` dc - LEFT JOIN `PREFIX_discount`d ON (d.`id_discount` = dc.`id_discount`) - WHERE d.`id_discount` IS NULL - GROUP BY dc.`id_discount`) discount_category_tmp - ); - -DELETE FROM `PREFIX_configuration` WHERE `name` = 'PS_DISPLAY_WITHOUT_TAX'; - -INSERT INTO PREFIX_hook (`name`, `title`, `description`, `position`) VALUES - ('updateCarrier', 'Carrier update', 'This hook is called when a carrier is updated', 0); diff --git a/upgrade/sql/1.2.0.3.sql b/upgrade/sql/1.2.0.3.sql deleted file mode 100644 index 9f6f078ee..000000000 --- a/upgrade/sql/1.2.0.3.sql +++ /dev/null @@ -1,33 +0,0 @@ -SET NAMES 'utf8'; - -/* ##################################### */ -/* STRUCTURE */ -/* ##################################### */ - -ALTER TABLE `PREFIX_customization` - ADD `quantity_refunded` INT NOT NULL DEFAULT '0'; -ALTER TABLE `PREFIX_customization` - ADD `quantity_returned` INT NOT NULL DEFAULT '0'; - -ALTER TABLE `PREFIX_alias` - CHANGE `id_alias` `id_alias` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT; -ALTER TABLE `PREFIX_attribute_impact` - CHANGE `id_attribute_impact` `id_attribute_impact` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT; -ALTER TABLE `PREFIX_customization` - CHANGE `id_customization` `id_customization` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT; -ALTER TABLE `PREFIX_customization_field` - CHANGE `id_customization_field` `id_customization_field` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT; -ALTER TABLE `PREFIX_subdomain` - CHANGE `id_subdomain` `id_subdomain` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT; - - -/* ##################################### */ -/* CONTENTS */ -/* ##################################### */ - -INSERT INTO `PREFIX_search_engine` (`server`,`getvar`) VALUES - ('bing.com','q'); - -INSERT INTO `PREFIX_hook_module` (`id_module`, `id_hook`, `position`) VALUES - (19, 9, 1); - diff --git a/upgrade/sql/1.2.0.4.sql b/upgrade/sql/1.2.0.4.sql deleted file mode 100644 index 2b4f66a32..000000000 --- a/upgrade/sql/1.2.0.4.sql +++ /dev/null @@ -1,10 +0,0 @@ -SET NAMES 'utf8'; - -/* ##################################### */ -/* STRUCTURE */ -/* ##################################### */ - -/* ##################################### */ -/* CONTENTS */ -/* ##################################### */ - diff --git a/upgrade/sql/1.2.0.5.sql b/upgrade/sql/1.2.0.5.sql deleted file mode 100644 index 7512ab24a..000000000 --- a/upgrade/sql/1.2.0.5.sql +++ /dev/null @@ -1,17 +0,0 @@ -SET NAMES 'utf8'; - -/* ##################################### */ -/* STRUCTURE */ -/* ##################################### */ - -/* ##################################### */ -/* CONTENTS */ -/* ##################################### */ - -UPDATE `PREFIX_order_state_lang` -SET `name` = 'Shipped' -WHERE `id_order_state` = 4 AND `id_lang` = 1; - -UPDATE `PREFIX_order_state_lang` SET `template` = 'shipped' WHERE `id_order_state` = 4 AND `template` = 'shipping'; - -/* PHP:reorderpositions(); */; \ No newline at end of file diff --git a/upgrade/sql/1.2.0.6.sql b/upgrade/sql/1.2.0.6.sql deleted file mode 100644 index fc88820b8..000000000 --- a/upgrade/sql/1.2.0.6.sql +++ /dev/null @@ -1,14 +0,0 @@ -SET NAMES 'utf8'; - -/* ##################################### */ -/* STRUCTURE */ -/* ##################################### */ - -ALTER TABLE `PREFIX_configuration` DROP INDEX `configuration_name`; -ALTER TABLE `PREFIX_order_detail` ADD `product_quantity_in_stock` INT(10) NOT NULL DEFAULT 0 AFTER `product_quantity`; -ALTER TABLE `PREFIX_order_detail` ADD `product_quantity_reinjected` INT(10) UNSIGNED NOT NULL DEFAULT 0 AFTER `product_quantity_return`; - -/* ##################################### */ -/* CONTENTS */ -/* ##################################### */ -UPDATE `PREFIX_product` SET `out_of_stock` = 0 WHERE `id_product` IN ((SELECT `id_product` FROM `PREFIX_product_download`)); diff --git a/upgrade/sql/1.2.0.7.sql b/upgrade/sql/1.2.0.7.sql deleted file mode 100644 index 5cd1d4109..000000000 --- a/upgrade/sql/1.2.0.7.sql +++ /dev/null @@ -1,12 +0,0 @@ -SET NAMES 'utf8'; - -/* ##################################### */ -/* STRUCTURE */ -/* ##################################### */ - - -/* ##################################### */ -/* CONTENTS */ -/* ##################################### */ - -/* PHP:update_modules_sql(); */; diff --git a/upgrade/sql/1.2.0.8.sql b/upgrade/sql/1.2.0.8.sql deleted file mode 100644 index eeda18cd2..000000000 --- a/upgrade/sql/1.2.0.8.sql +++ /dev/null @@ -1,10 +0,0 @@ -SET NAMES 'utf8'; - -/* ##################################### */ -/* STRUCTURE */ -/* ##################################### */ - - -/* ##################################### */ -/* CONTENTS */ -/* ##################################### */ diff --git a/upgrade/sql/1.2.1.0.sql b/upgrade/sql/1.2.1.0.sql deleted file mode 100644 index fc62c7f4d..000000000 --- a/upgrade/sql/1.2.1.0.sql +++ /dev/null @@ -1,16 +0,0 @@ -SET NAMES 'utf8'; - -/* ##################################### */ -/* STRUCTURE */ -/* ##################################### */ - - -/* ##################################### */ -/* CONTENTS */ -/* ##################################### */ - -INSERT INTO PREFIX_configuration (name, value, date_add, date_upd) VALUES ('PS_THEME_V11', 0, NOW(), NOW()); - -/* PHP */ -/* PHP:update_carrier_url(); */; -/* PHP:module_reinstall_blocksearch(); */; diff --git a/upgrade/sql/1.2.2.0.sql b/upgrade/sql/1.2.2.0.sql deleted file mode 100644 index 27e0498df..000000000 --- a/upgrade/sql/1.2.2.0.sql +++ /dev/null @@ -1,6 +0,0 @@ -SET NAMES 'utf8'; - -ALTER TABLE `PREFIX_discount_category` ADD INDEX ( `id_discount` ); - -DELETE FROM `PREFIX_delivery` WHERE `id_range_weight` != NULL AND `id_range_weight` NOT IN (SELECT `id_range_weight` FROM `PREFIX_range_weight`); -DELETE FROM `PREFIX_delivery` WHERE `id_range_price` != NULL AND `id_range_weight` NOT IN (SELECT `id_range_price` FROM `PREFIX_range_price`); diff --git a/upgrade/sql/1.2.3.0.sql b/upgrade/sql/1.2.3.0.sql deleted file mode 100644 index 3f288763f..000000000 --- a/upgrade/sql/1.2.3.0.sql +++ /dev/null @@ -1,3 +0,0 @@ -SET NAMES 'utf8'; - -ALTER TABLE `PREFIX_category_product` ADD INDEX (`id_product`); diff --git a/upgrade/sql/1.2.4.0.sql b/upgrade/sql/1.2.4.0.sql deleted file mode 100644 index 0b4cf1b2f..000000000 --- a/upgrade/sql/1.2.4.0.sql +++ /dev/null @@ -1 +0,0 @@ -SET NAMES 'utf8'; diff --git a/upgrade/sql/1.2.5.0.sql b/upgrade/sql/1.2.5.0.sql deleted file mode 100644 index 0b4cf1b2f..000000000 --- a/upgrade/sql/1.2.5.0.sql +++ /dev/null @@ -1 +0,0 @@ -SET NAMES 'utf8'; diff --git a/upgrade/sql/1.3.0.1.sql b/upgrade/sql/1.3.0.1.sql deleted file mode 100644 index b043fd51b..000000000 --- a/upgrade/sql/1.3.0.1.sql +++ /dev/null @@ -1,92 +0,0 @@ -SET NAMES 'utf8'; - -/* ##################################### */ -/* STRUCTURE */ -/* ##################################### */ - -ALTER TABLE `PREFIX_product` -CHANGE `reduction_from` `reduction_from` DATE NOT NULL DEFAULT '1970-01-01', -CHANGE `reduction_to` `reduction_to` DATE NOT NULL DEFAULT '1970-01-01'; - -ALTER TABLE `PREFIX_order_detail` CHANGE `tax_rate` `tax_rate` DECIMAL(10, 3) NOT NULL DEFAULT '0.000'; -ALTER TABLE `PREFIX_group` ADD `price_display_method` TINYINT NOT NULL DEFAULT 0 AFTER `reduction`; - -CREATE TABLE `PREFIX_carrier_group` ( - `id_carrier` int(10) unsigned NOT NULL, - `id_group` int(10) unsigned NOT NULL, - UNIQUE KEY `id_carrier` (`id_carrier`,`id_group`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; - -ALTER TABLE `PREFIX_country` ADD `need_identification_number` TINYINT( 1 ) NOT NULL; -ALTER TABLE `PREFIX_customer` ADD `dni` VARCHAR( 16 ) NULL AFTER `firstname`; - -ALTER TABLE `PREFIX_image` ADD INDEX `product_position` (`id_product`, `position`); -ALTER TABLE `PREFIX_hook_module` ADD INDEX `id_module` (`id_module`); -ALTER TABLE `PREFIX_customer` ADD INDEX `id_customer_passwd` (`id_customer`, `passwd`); -ALTER TABLE `PREFIX_tag` ADD INDEX `id_lang` (`id_lang`); -ALTER TABLE `PREFIX_customer_group` ADD INDEX `id_customer` (`id_customer`); -ALTER TABLE `PREFIX_category_group` ADD INDEX `id_category` (`id_category`); -ALTER TABLE `PREFIX_image` ADD INDEX `id_product_cover` (`id_product`, `cover`); -ALTER TABLE `PREFIX_employee` ADD INDEX `id_employee_passwd` (`id_employee`, `passwd`); -ALTER TABLE `PREFIX_product_attribute` ADD INDEX `product_default` (`id_product`, `default_on`); -ALTER TABLE `PREFIX_product_download` ADD INDEX `product_active` (`id_product`, `active`); -ALTER TABLE `PREFIX_tab` ADD INDEX `class_name` (`class_name`); -ALTER TABLE `PREFIX_module_currency` ADD INDEX `id_module` (`id_module`); -ALTER TABLE `PREFIX_product_attribute_combination` ADD INDEX `id_product_attribute` (`id_product_attribute`); -ALTER TABLE `PREFIX_orders` ADD INDEX `invoice_number` (`invoice_number`); -ALTER TABLE `PREFIX_product_tag` ADD INDEX `id_tag` (`id_tag`); -ALTER TABLE `PREFIX_cms_lang` CHANGE `id_cms` `id_cms` INT(10) UNSIGNED NOT NULL; -ALTER TABLE `PREFIX_tax` CHANGE `rate` `rate` DECIMAL(10, 3) NOT NULL; - -ALTER TABLE `PREFIX_order_detail` ADD `discount_quantity_applied` TINYINT(1) NOT NULL DEFAULT 0 AFTER `ecotax`; -ALTER TABLE `PREFIX_orders` ADD `total_products_wt` DECIMAL(10, 2) NOT NULL AFTER `total_products`; - -/* ##################################### */ -/* CONTENTS */ -/* ##################################### */ - -UPDATE IGNORE `PREFIX_group` SET `price_display_method` = IFNULL((SELECT `value` FROM `PREFIX_configuration` WHERE `name` = 'PS_PRICE_DISPLAY'), 0); - -UPDATE `PREFIX_configuration` -SET `value` = ROUND(value / (1 + ( - SELECT rate FROM ( - SELECT t.`rate`, COUNT(*) n - FROM `PREFIX_orders` o - LEFT JOIN `PREFIX_carrier` c ON (o.`id_carrier` = c.`id_carrier`) - LEFT JOIN `PREFIX_tax` t ON (t.`id_tax` = c.`id_tax`) - WHERE c.`deleted` = 0 - AND c.`shipping_handling` = 1 - GROUP BY o.`id_carrier` - ORDER BY n DESC - LIMIT 1 - ) myrate -) / 100), 6) -WHERE `name` = 'PS_SHIPPING_HANDLING'; - -DELETE FROM `PREFIX_configuration` WHERE `name` = 'PS_PRICE_DISPLAY'; -DELETE FROM `PREFIX_product_attachment` WHERE `id_product` NOT IN (SELECT `id_product` FROM `PREFIX_product`); -DELETE FROM `PREFIX_discount_quantity` WHERE `id_product` NOT IN (SELECT `id_product` FROM `PREFIX_product`); -DELETE FROM `PREFIX_pack` WHERE `id_product_pack` NOT IN (SELECT `id_product` FROM `PREFIX_product`) OR `id_product_item` NOT IN (SELECT `id_product` FROM `PREFIX_product`); -DELETE FROM `PREFIX_product_sale` WHERE `id_product` NOT IN (SELECT `id_product` FROM `PREFIX_product`); -DELETE FROM `PREFIX_scene_products` WHERE `id_product` NOT IN (SELECT `id_product` FROM `PREFIX_product`); -DELETE FROM `PREFIX_search_index` WHERE `id_product` NOT IN (SELECT `id_product` FROM `PREFIX_product`); -DELETE FROM `PREFIX_search_word` WHERE `id_word` NOT IN (SELECT `id_word` FROM `PREFIX_search_index`); -DELETE FROM `PREFIX_tag` WHERE `id_lang` NOT IN (SELECT `id_lang` FROM `PREFIX_lang`); -DELETE FROM `PREFIX_search_word` WHERE `id_lang` NOT IN (SELECT `id_lang` FROM `PREFIX_lang`); - -INSERT INTO `PREFIX_configuration` (`name`, `value`, `date_add`, `date_upd`) VALUES -('PRESTASTORE_LIVE', 1, NOW(), NOW()), -('PS_SHOW_ALL_MODULES', 0, NOW(), NOW()), -('PS_BACKUP_ALL', 0, NOW(), NOW()), -('PS_1_3_UPDATE_DATE', NOW(), NOW(), NOW()), -('PS_PRICE_ROUND_MODE', 2, NOW(), NOW()); -INSERT INTO `PREFIX_hook` (`name`, `title`, `description`, `position`) VALUES -('createAccountTop', 'Block above the form for create an account', NULL , '1'), -('backOfficeHeader', 'Administration panel header', NULL , '0'), -('backOfficeTop', 'Administration panel top hover the tabs', NULL , '1'), -('backOfficeFooter', 'Administration panel footer', NULL , '1'); - -INSERT INTO `PREFIX_carrier_group` (id_carrier, id_group) (SELECT id_carrier, id_group FROM `PREFIX_carrier` c, `PREFIX_group` g WHERE c.active = 1); - -/* PHP */ -/* PHP:convert_product_price(); */; diff --git a/upgrade/sql/1.3.0.10.sql b/upgrade/sql/1.3.0.10.sql deleted file mode 100644 index 5354e7131..000000000 --- a/upgrade/sql/1.3.0.10.sql +++ /dev/null @@ -1,5 +0,0 @@ -SET NAMES 'utf8'; - -ALTER TABLE `PREFIX_order_detail` ADD INDEX `id_order_id_order_detail` (`id_order`, `id_order_detail`); -ALTER TABLE `PREFIX_category_group` ADD INDEX `id_group` (`id_group`); -ALTER TABLE `PREFIX_product` ADD INDEX `date_add` (`date_add`); \ No newline at end of file diff --git a/upgrade/sql/1.3.0.2.sql b/upgrade/sql/1.3.0.2.sql deleted file mode 100644 index 9069781e8..000000000 --- a/upgrade/sql/1.3.0.2.sql +++ /dev/null @@ -1,147 +0,0 @@ -SET NAMES 'utf8'; - -/* ##################################### */ -/* STRUCTURE */ -/* ##################################### */ - -ALTER TABLE `PREFIX_product_attachment` -CHANGE `id_product` `id_product` INT(10) UNSIGNED NOT NULL, -CHANGE `id_attachment` `id_attachment` INT(10) UNSIGNED NOT NULL; - -ALTER TABLE `PREFIX_attribute_impact` -CHANGE `id_product` `id_product` INT(11) UNSIGNED NOT NULL, -CHANGE `id_attribute` `id_attribute` INT(11) UNSIGNED NOT NULL; - -ALTER TABLE `PREFIX_block_cms` -CHANGE `id_block` `id_block` INT(10) UNSIGNED NOT NULL, -CHANGE `id_cms` `id_cms` INT(10) UNSIGNED NOT NULL; - -ALTER TABLE `PREFIX_customization` -CHANGE `id_cart` `id_cart` int(10) unsigned NOT NULL, -CHANGE `id_product_attribute` `id_product_attribute` int(10) unsigned NOT NULL default '0'; - -ALTER TABLE `PREFIX_customization_field` -CHANGE `id_product` `id_product` int(10) unsigned NOT NULL; - -ALTER TABLE `PREFIX_customization_field_lang` -CHANGE `id_customization_field` `id_customization_field` int(10) unsigned NOT NULL, -CHANGE `id_lang` `id_lang` int(10) unsigned NOT NULL; - -ALTER TABLE `PREFIX_customized_data` -CHANGE `id_customization` `id_customization` int(10) unsigned NOT NULL; - -ALTER TABLE `PREFIX_discount_category` -CHANGE `id_category` `id_category` int(11) unsigned NOT NULL, -CHANGE `id_discount` `id_discount` int(11) unsigned NOT NULL; - -ALTER TABLE `PREFIX_module_group` -CHANGE `id_group` `id_group` int(11) unsigned NOT NULL; - -ALTER TABLE `PREFIX_order_return_detail` -CHANGE `id_customization` `id_customization` int(10) unsigned NOT NULL default '0'; - -ALTER TABLE `PREFIX_product_attribute_image` -CHANGE `id_product_attribute` `id_product_attribute` int(10) unsigned NOT NULL, -CHANGE `id_image` `id_image` int(10) unsigned NOT NULL; - -ALTER TABLE `PREFIX_referrer_cache` -CHANGE `id_connections_source` `id_connections_source` int(11) unsigned NOT NULL, -CHANGE `id_referrer` `id_referrer` int(11) unsigned NOT NULL; - -ALTER TABLE `PREFIX_scene_category` -CHANGE `id_scene` `id_scene` int(10) unsigned NOT NULL, -CHANGE `id_category` `id_category` int(10) unsigned NOT NULL; - -ALTER TABLE `PREFIX_scene_lang` -CHANGE `id_scene` `id_scene` int(10) unsigned NOT NULL, -CHANGE `id_lang` `id_lang` int(10) unsigned NOT NULL; - -ALTER TABLE `PREFIX_scene_products` -CHANGE `id_scene` `id_scene` int(10) unsigned NOT NULL, -CHANGE `id_product` `id_product` int(10) unsigned NOT NULL; - -ALTER TABLE `PREFIX_search_index` -CHANGE `id_product` `id_product` int(11) unsigned NOT NULL, -CHANGE `id_word` `id_word` int(11) unsigned NOT NULL; - -ALTER TABLE `PREFIX_state` -CHANGE `id_country` `id_country` int(11) unsigned NOT NULL, -CHANGE `id_zone` `id_zone` int(11) unsigned NOT NULL; - -ALTER TABLE `PREFIX_category_lang` -CHANGE `meta_keywords` `meta_keywords` VARCHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, -CHANGE `meta_description` `meta_description` VARCHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL ; - -ALTER TABLE `PREFIX_supplier_lang` -CHANGE `meta_title` `meta_title` VARCHAR( 128 ) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, -CHANGE `meta_keywords` `meta_keywords` VARCHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, -CHANGE `meta_description` `meta_description` VARCHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL ; - -ALTER TABLE `PREFIX_manufacturer_lang` -CHANGE `meta_title` `meta_title` VARCHAR( 128 ) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, -CHANGE `meta_keywords` `meta_keywords` VARCHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, -CHANGE `meta_description` `meta_description` VARCHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL ; - -ALTER TABLE `PREFIX_meta_lang` -CHANGE `title` `title` VARCHAR( 128 ) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL ; - -/* ##################################### */ -/* PRICE RANGE */ -/* ##################################### */ - -ALTER TABLE `PREFIX_attribute_impact` CHANGE `price` `price` DECIMAL(17, 2) NOT NULL; - -ALTER TABLE `PREFIX_delivery` CHANGE `price` `price` DECIMAL(17, 2) NOT NULL; - -ALTER TABLE `PREFIX_discount` CHANGE `value` `value` DECIMAL(17, 2) NOT NULL DEFAULT '0.00', -CHANGE `minimal` `minimal` DECIMAL(17, 2) NULL DEFAULT NULL; - -ALTER TABLE `PREFIX_discount_quantity` CHANGE `value` `value` DECIMAL(17, 2) UNSIGNED NOT NULL; - -ALTER TABLE `PREFIX_group` CHANGE `reduction` `reduction` DECIMAL(17, 2) NOT NULL DEFAULT '0.00'; - -ALTER TABLE `PREFIX_orders` CHANGE `total_discounts` `total_discounts` DECIMAL(17, 2) NOT NULL DEFAULT '0.00', -CHANGE `total_paid` `total_paid` DECIMAL(17, 2) NOT NULL DEFAULT '0.00', -CHANGE `total_paid_real` `total_paid_real` DECIMAL(17, 2) NOT NULL DEFAULT '0.00', -CHANGE `total_products` `total_products` DECIMAL(17, 2) NOT NULL DEFAULT '0.00', -CHANGE `total_products_wt` `total_products_wt` DECIMAL(17, 2) NOT NULL DEFAULT '0.00', -CHANGE `total_shipping` `total_shipping` DECIMAL(17, 2) NOT NULL DEFAULT '0.00', -CHANGE `total_wrapping` `total_wrapping` DECIMAL(17, 2) NOT NULL DEFAULT '0.00'; - -ALTER TABLE `PREFIX_order_detail` CHANGE `product_price` `product_price` DECIMAL(20, 6) NOT NULL DEFAULT '0.000000', -CHANGE `product_quantity_discount` `product_quantity_discount` DECIMAL(20, 6) NOT NULL DEFAULT '0.000000', -CHANGE `ecotax` `ecotax` decimal(17,2) NOT NULL default '0.00'; - -ALTER TABLE `PREFIX_order_discount` CHANGE `value` `value` DECIMAL(17, 2) NOT NULL DEFAULT '0.00'; - -ALTER TABLE `PREFIX_product` CHANGE `price` `price` DECIMAL(20, 6) NOT NULL DEFAULT '0.000000', -CHANGE `wholesale_price` `wholesale_price` DECIMAL(20, 6) NOT NULL DEFAULT '0.000000', -CHANGE `ecotax` `ecotax` DECIMAL(17, 2) NOT NULL DEFAULT '0.00', -CHANGE `reduction_price` `reduction_price` DECIMAL(17, 2) NULL DEFAULT NULL; - -ALTER TABLE `PREFIX_product_attribute` CHANGE `wholesale_price` `wholesale_price` DECIMAL(20, 6) NOT NULL DEFAULT '0.000000', -CHANGE `price` `price` DECIMAL(17, 2) NOT NULL DEFAULT '0.00', -CHANGE `ecotax` `ecotax` DECIMAL(17, 2) NOT NULL DEFAULT '0.00'; - -ALTER TABLE `PREFIX_range_price` CHANGE `delimiter1` `delimiter1` DECIMAL(20, 6) NOT NULL, -CHANGE `delimiter2` `delimiter2` DECIMAL(20, 6) NOT NULL; - -ALTER TABLE `PREFIX_range_weight` CHANGE `delimiter1` `delimiter1` DECIMAL(20, 6) NOT NULL, -CHANGE `delimiter2` `delimiter2` DECIMAL(20, 6) NOT NULL; - -ALTER TABLE `PREFIX_referrer` CHANGE `cache_sales` `cache_sales` DECIMAL(17, 2) NULL DEFAULT NULL; - -UPDATE `PREFIX_configuration` -SET `value` = IFNULL(ROUND(value / (1 + ( - SELECT `rate` - FROM `PREFIX_tax` - WHERE `id_tax` = ( - SELECT `value` - FROM ( - SELECT `value` - FROM `PREFIX_configuration` - WHERE `name` = 'PS_GIFT_WRAPPING_TAX' - )tmp - ) -) / 100), 2), 0) -WHERE `name` = 'PS_GIFT_WRAPPING_PRICE'; diff --git a/upgrade/sql/1.3.0.3.sql b/upgrade/sql/1.3.0.3.sql deleted file mode 100644 index 7adb283eb..000000000 --- a/upgrade/sql/1.3.0.3.sql +++ /dev/null @@ -1,15 +0,0 @@ -SET NAMES 'utf8'; - -ALTER TABLE `PREFIX_tab` CHANGE `id_parent` `id_parent` INT(11) NOT NULL; -INSERT INTO `PREFIX_tab` (`id_tab`, `class_name`, `id_parent`, `position`) -VALUES (43, 'AdminSearch', -1, 0) -ON DUPLICATE KEY -UPDATE `id_parent` = -1; - -ALTER TABLE `PREFIX_search_engine` ADD UNIQUE (`server`,`getvar`); -REPLACE INTO `PREFIX_search_engine` (`server`,`getvar`) -VALUES ('google','q'),('aol','q'),('yandex','text'),('ask.com','q'),('nhl.com','q'),('yahoo','p'),('baidu','wd'), -('lycos','query'),('exalead','q'),('search.live','q'),('voila','rdata'),('altavista','q'),('bing','q'),('daum','q'), -('eniro','search_word'),('naver','query'),('msn','q'),('netscape','query'),('cnn','query'),('about','terms'),('mamma','query'), -('alltheweb','q'),('virgilio','qs'),('alice','qs'),('najdi','q'),('mama','query'),('seznam','q'),('onet','qt'),('szukacz','q'), -('yam','k'),('pchome','q'),('kvasir','q'),('sesam','q'),('ozu','q'),('terra','query'),('mynet','q'),('ekolay','q'),('rambler','words'); \ No newline at end of file diff --git a/upgrade/sql/1.3.0.4.sql b/upgrade/sql/1.3.0.4.sql deleted file mode 100644 index 46ad8ccb4..000000000 --- a/upgrade/sql/1.3.0.4.sql +++ /dev/null @@ -1,83 +0,0 @@ -SET NAMES 'utf8'; - -DELETE FROM `PREFIX_tax_state` WHERE `id_tax` NOT IN (SELECT `id_tax` FROM `PREFIX_tax`); - -ALTER TABLE `PREFIX_product` CHANGE `reduction_from` `reduction_from` DATETIME NOT NULL DEFAULT '1970-01-01 00:00:00', -CHANGE `reduction_to` `reduction_to` DATETIME NOT NULL DEFAULT '1970-01-01 00:00:00'; - -UPDATE `PREFIX_product` -SET `reduction_to` = DATE_ADD(reduction_to, INTERVAL 1 DAY) -WHERE `reduction_from` != `reduction_to`; - -ALTER TABLE `PREFIX_discount` ADD `id_currency` INT UNSIGNED NOT NULL DEFAULT 0 AFTER `id_customer`; -UPDATE `PREFIX_discount` SET `id_currency` = (SELECT `value` FROM `PREFIX_configuration` WHERE `name` = 'PS_CURRENCY_DEFAULT' LIMIT 1) WHERE `id_discount_type` = 2; - -ALTER TABLE `PREFIX_address` ADD INDEX (id_country); -ALTER TABLE `PREFIX_address` ADD INDEX (id_state); -ALTER TABLE `PREFIX_address` ADD INDEX (id_manufacturer); -ALTER TABLE `PREFIX_address` ADD INDEX (id_supplier); -ALTER TABLE `PREFIX_carrier` ADD INDEX (id_tax); -ALTER TABLE `PREFIX_cart` ADD INDEX (id_address_delivery); -ALTER TABLE `PREFIX_cart` ADD INDEX (id_address_invoice); -ALTER TABLE `PREFIX_cart` ADD INDEX (id_carrier); -ALTER TABLE `PREFIX_cart` ADD INDEX (id_lang); -ALTER TABLE `PREFIX_cart` ADD INDEX (id_currency); -ALTER TABLE `PREFIX_cart_product` ADD INDEX (id_product_attribute); -ALTER TABLE `PREFIX_connections` ADD INDEX (id_page); -ALTER TABLE `PREFIX_customer` ADD INDEX (id_gender); -ALTER TABLE `PREFIX_customization` ADD INDEX (id_product_attribute); -ALTER TABLE `PREFIX_customization_field` ADD INDEX (id_product); -ALTER TABLE `PREFIX_delivery` ADD INDEX (id_range_price); -ALTER TABLE `PREFIX_delivery` ADD INDEX (id_range_weight); -ALTER TABLE `PREFIX_discount` ADD INDEX (id_discount_type); -ALTER TABLE `PREFIX_discount_quantity` ADD INDEX (id_discount_type); -ALTER TABLE `PREFIX_discount_quantity` ADD INDEX (id_product); -ALTER TABLE `PREFIX_discount_quantity` ADD INDEX (id_product_attribute); -ALTER TABLE `PREFIX_employee` ADD INDEX (id_profile); -ALTER TABLE `PREFIX_feature_product` ADD INDEX (id_feature_value); -ALTER TABLE `PREFIX_guest` ADD INDEX (id_operating_system); -ALTER TABLE `PREFIX_guest` ADD INDEX (id_web_browser); -ALTER TABLE `PREFIX_hook_module_exceptions` ADD INDEX (id_module); -ALTER TABLE `PREFIX_hook_module_exceptions` ADD INDEX (id_hook); -ALTER TABLE `PREFIX_message` ADD INDEX (id_cart); -ALTER TABLE `PREFIX_message` ADD INDEX (id_customer); -ALTER TABLE `PREFIX_message` ADD INDEX (id_employee); -ALTER TABLE `PREFIX_order_detail` ADD INDEX (product_attribute_id); -ALTER TABLE `PREFIX_order_discount` ADD INDEX (id_discount); -ALTER TABLE `PREFIX_order_history` ADD INDEX (id_employee); -ALTER TABLE `PREFIX_order_history` ADD INDEX (id_order_state); -ALTER TABLE `PREFIX_order_return` ADD INDEX (id_order); -ALTER TABLE `PREFIX_order_slip` ADD INDEX (id_order); -ALTER TABLE `PREFIX_orders` ADD INDEX (id_carrier); -ALTER TABLE `PREFIX_orders` ADD INDEX (id_lang); -ALTER TABLE `PREFIX_orders` ADD INDEX (id_currency); -ALTER TABLE `PREFIX_orders` ADD INDEX (id_address_delivery); -ALTER TABLE `PREFIX_orders` ADD INDEX (id_address_invoice); -ALTER TABLE `PREFIX_product` ADD INDEX (id_tax); -ALTER TABLE `PREFIX_product` ADD INDEX (id_category_default); -ALTER TABLE `PREFIX_product` ADD INDEX (id_color_default); -ALTER TABLE `PREFIX_state` ADD INDEX (id_country); -ALTER TABLE `PREFIX_state` ADD INDEX (id_zone); -ALTER TABLE `PREFIX_tab` ADD INDEX (id_parent); -ALTER TABLE `PREFIX_cart` ADD INDEX (id_guest); - -INSERT INTO `PREFIX_configuration` (`name`, `value`, `date_add`, `date_upd`) -( - SELECT 'MA_LAST_QTIES', '3', NOW(), NOW() - FROM `PREFIX_module` WHERE `name` = 'mailalerts' -); - -ALTER TABLE `PREFIX_customer` ADD `id_default_group` INT UNSIGNED NOT NULL DEFAULT '1' AFTER `id_gender`; - -UPDATE `PREFIX_customer` c SET `id_default_group` = ( - SELECT ( - IFNULL( - (SELECT g.`id_group` - FROM `PREFIX_group` g - LEFT JOIN `PREFIX_customer_group` cg ON (cg.`id_group` = g.`id_group`) - WHERE g.`reduction` > 0 AND cg.`id_customer` = c.`id_customer` - ORDER BY g.`reduction` - LIMIT 1) - , 1) - ) -); diff --git a/upgrade/sql/1.3.0.5.sql b/upgrade/sql/1.3.0.5.sql deleted file mode 100644 index 0b4cf1b2f..000000000 --- a/upgrade/sql/1.3.0.5.sql +++ /dev/null @@ -1 +0,0 @@ -SET NAMES 'utf8'; diff --git a/upgrade/sql/1.3.0.6.sql b/upgrade/sql/1.3.0.6.sql deleted file mode 100644 index 0b4cf1b2f..000000000 --- a/upgrade/sql/1.3.0.6.sql +++ /dev/null @@ -1 +0,0 @@ -SET NAMES 'utf8'; diff --git a/upgrade/sql/1.3.0.7.sql b/upgrade/sql/1.3.0.7.sql deleted file mode 100755 index 158212ef5..000000000 --- a/upgrade/sql/1.3.0.7.sql +++ /dev/null @@ -1,3 +0,0 @@ -SET NAMES 'utf8'; - -/* PHP:setAllGroupsOnHomeCategory(); */; diff --git a/upgrade/sql/1.3.0.8.sql b/upgrade/sql/1.3.0.8.sql deleted file mode 100644 index e988c8279..000000000 --- a/upgrade/sql/1.3.0.8.sql +++ /dev/null @@ -1,5 +0,0 @@ -SET NAMES 'utf8'; - -ALTER TABLE `PREFIX_product_attribute` ADD INDEX `id_product_id_product_attribute` (`id_product_attribute` , `id_product`); -ALTER TABLE `PREFIX_image_lang` ADD INDEX `id_image` (`id_image`); - diff --git a/upgrade/sql/1.3.0.9.sql b/upgrade/sql/1.3.0.9.sql deleted file mode 100644 index 0b4cf1b2f..000000000 --- a/upgrade/sql/1.3.0.9.sql +++ /dev/null @@ -1 +0,0 @@ -SET NAMES 'utf8'; diff --git a/upgrade/sql/1.3.1.1.sql b/upgrade/sql/1.3.1.1.sql deleted file mode 100644 index 0b4cf1b2f..000000000 --- a/upgrade/sql/1.3.1.1.sql +++ /dev/null @@ -1 +0,0 @@ -SET NAMES 'utf8'; diff --git a/upgrade/sql/1.3.2.1.sql b/upgrade/sql/1.3.2.1.sql deleted file mode 100755 index da21b32f2..000000000 --- a/upgrade/sql/1.3.2.1.sql +++ /dev/null @@ -1,3 +0,0 @@ -SET NAMES 'utf8'; - - diff --git a/upgrade/sql/1.3.2.2.sql b/upgrade/sql/1.3.2.2.sql deleted file mode 100755 index 180ac77b6..000000000 --- a/upgrade/sql/1.3.2.2.sql +++ /dev/null @@ -1,27 +0,0 @@ -SET NAMES 'utf8'; - -ALTER TABLE `PREFIX_order_detail` ADD `reduction_percent` DECIMAL(10, 2) NOT NULL AFTER `product_price`; -ALTER TABLE `PREFIX_order_detail` ADD `reduction_amount` DECIMAL(20, 6) NOT NULL AFTER `reduction_percent`; - -ALTER TABLE `PREFIX_country` CHANGE `need_identification_number` `need_identification_number` TINYINT(1) NOT NULL DEFAULT '0'; - -INSERT INTO `PREFIX_configuration` (`name`, `value`, `date_add`, `date_upd`) VALUES -('PS_1_3_2_UPDATE_DATE', NOW(), NOW(), NOW()); - -ALTER TABLE `PREFIX_search_index` CHANGE `weight` `weight` SMALLINT(4) unsigned NOT NULL DEFAULT '1'; - -ALTER TABLE `PREFIX_image` DROP INDEX `product_position`, ADD UNIQUE `product_position` (`id_product`, `position`); - -ALTER TABLE `PREFIX_zone` DROP `enabled`; - -SET @id_hook = (SELECT id_hook FROM PREFIX_hook WHERE name = 'backOfficeHeader'); -SET @position = (SELECT IFNULL(MAX(position),0)+1 FROM PREFIX_hook_module WHERE id_hook = @id_hook); -INSERT IGNORE INTO PREFIX_hook_module (id_hook, id_module, position) VALUES (@id_hook, (SELECT id_module FROM PREFIX_module WHERE name = 'statsbestcustomers'), @position); -SET @position = @position + 1; -INSERT IGNORE INTO PREFIX_hook_module (id_hook, id_module, position) VALUES (@id_hook, (SELECT id_module FROM PREFIX_module WHERE name = 'statsbestproducts'), @position); -SET @position = @position + 1; -INSERT IGNORE INTO PREFIX_hook_module (id_hook, id_module, position) VALUES (@id_hook, (SELECT id_module FROM PREFIX_module WHERE name = 'statsbestvouchers'), @position); -SET @position = @position + 1; -INSERT IGNORE INTO PREFIX_hook_module (id_hook, id_module, position) VALUES (@id_hook, (SELECT id_module FROM PREFIX_module WHERE name = 'statsbestcategories'), @position); -SET @position = @position + 1; -INSERT IGNORE INTO PREFIX_hook_module (id_hook, id_module, position) VALUES (@id_hook, (SELECT id_module FROM PREFIX_module WHERE name = 'statsbestcarriers'), @position); diff --git a/upgrade/sql/1.3.2.3.sql b/upgrade/sql/1.3.2.3.sql deleted file mode 100755 index 0b4cf1b2f..000000000 --- a/upgrade/sql/1.3.2.3.sql +++ /dev/null @@ -1 +0,0 @@ -SET NAMES 'utf8'; diff --git a/upgrade/sql/1.3.3.0.sql b/upgrade/sql/1.3.3.0.sql deleted file mode 100644 index a8c43bb44..000000000 --- a/upgrade/sql/1.3.3.0.sql +++ /dev/null @@ -1,8 +0,0 @@ -SET NAMES 'utf8'; - -ALTER TABLE `PREFIX_order_detail` ADD `group_reduction` DECIMAL(10, 2) NOT NULL AFTER `reduction_amount`; -ALTER TABLE `PREFIX_order_detail` ADD `ecotax_tax_rate` DECIMAL(5, 3) NOT NULL AFTER `ecotax`; -ALTER TABLE `PREFIX_product` CHANGE `ecotax` `ecotax` DECIMAL(21, 6) NOT NULL DEFAULT '0.00'; - -INSERT INTO `PREFIX_configuration` (`name`, `value`, `date_add`, `date_upd`) SELECT 'PS_LOCALE_LANGUAGE', l.`iso_code`, NOW(), NOW() FROM `PREFIX_configuration` c INNER JOIN `PREFIX_lang` l ON (l.`id_lang` = c.`value`) WHERE c.`name` = 'PS_LANG_DEFAULT'; -INSERT INTO `PREFIX_configuration` (`name`, `value`, `date_add`, `date_upd`) SELECT 'PS_LOCALE_COUNTRY', co.`iso_code`, NOW(), NOW() FROM `PREFIX_configuration` c INNER JOIN `PREFIX_country` co ON (co.`id_country` = c.`value`) WHERE c.`name` = 'PS_COUNTRY_DEFAULT'; diff --git a/upgrade/sql/1.3.4.0.sql b/upgrade/sql/1.3.4.0.sql deleted file mode 100644 index 22c382dd4..000000000 --- a/upgrade/sql/1.3.4.0.sql +++ /dev/null @@ -1 +0,0 @@ -SET NAMES 'utf8'; \ No newline at end of file diff --git a/upgrade/sql/1.3.5.0.sql b/upgrade/sql/1.3.5.0.sql deleted file mode 100644 index 22c382dd4..000000000 --- a/upgrade/sql/1.3.5.0.sql +++ /dev/null @@ -1 +0,0 @@ -SET NAMES 'utf8'; \ No newline at end of file diff --git a/upgrade/sql/1.3.6.0.sql b/upgrade/sql/1.3.6.0.sql deleted file mode 100755 index 083171282..000000000 --- a/upgrade/sql/1.3.6.0.sql +++ /dev/null @@ -1,3 +0,0 @@ -SET NAMES 'utf8'; - -/* PHP:update_products_ecotax_v133(); */; diff --git a/upgrade/sql/1.3.7.0.sql b/upgrade/sql/1.3.7.0.sql deleted file mode 100644 index 0b4cf1b2f..000000000 --- a/upgrade/sql/1.3.7.0.sql +++ /dev/null @@ -1 +0,0 @@ -SET NAMES 'utf8'; diff --git a/upgrade/sql/1.4.0.1.sql b/upgrade/sql/1.4.0.1.sql deleted file mode 100644 index 525c317c0..000000000 --- a/upgrade/sql/1.4.0.1.sql +++ /dev/null @@ -1,2 +0,0 @@ -SET NAMES 'utf8'; - diff --git a/upgrade/sql/1.4.0.10.sql b/upgrade/sql/1.4.0.10.sql deleted file mode 100644 index 64833005c..000000000 --- a/upgrade/sql/1.4.0.10.sql +++ /dev/null @@ -1,20 +0,0 @@ -SET NAMES 'utf8'; - -INSERT INTO `PREFIX_configuration` (`name`, `value`, `date_add`, `date_upd`) VALUES ('PS_CATALOG_MODE', '0', NOW(), NOW()); - -ALTER TABLE `PREFIX_specific_price` DROP `priority`; - -INSERT INTO `PREFIX_configuration` (`name`, `value`, `date_add`, `date_upd`) VALUES -('PS_GEOLOCATION_WHITELIST', '209.185.108;209.185.253;209.85.238;209.85.238.11;209.85.238.4;216.239.33.96;216.239.33.97;216.239.33.98;216.239.33.99;216.239.37.98;216.239.37.99;216.239.39.98;216.239.39.99;216.239.41.96;216.239.41.97;216.239.41.98;216.239.41.99;216.239.45.4;216.239.46;216.239.51.96;216.239.51.97;216.239.51.98;216.239.51.99;216.239.53.98;216.239.53.99;216.239.57.96;216.239.57.97;216.239.57.98;216.239.57.99;216.239.59.98;216.239.59.99;216.33.229.163;64.233.173.193;64.233.173.194;64.233.173.195;64.233.173.196;64.233.173.197;64.233.173.198;64.233.173.199;64.233.173.200;64.233.173.201;64.233.173.202;64.233.173.203;64.233.173.204;64.233.173.205;64.233.173.206;64.233.173.207;64.233.173.208;64.233.173.209;64.233.173.210;64.233.173.211;64.233.173.212;64.233.173.213;64.233.173.214;64.233.173.215;64.233.173.216;64.233.173.217;64.233.173.218;64.233.173.219;64.233.173.220;64.233.173.221;64.233.173.222;64.233.173.223;64.233.173.224;64.233.173.225;64.233.173.226;64.233.173.227;64.233.173.228;64.233.173.229;64.233.173.230;64.233.173.231;64.233.173.232;64.233.173.233;64.233.173.234;64.233.173.235;64.233.173.236;64.233.173.237;64.233.173.238;64.233.173.239;64.233.173.240;64.233.173.241;64.233.173.242;64.233.173.243;64.233.173.244;64.233.173.245;64.233.173.246;64.233.173.247;64.233.173.248;64.233.173.249;64.233.173.250;64.233.173.251;64.233.173.252;64.233.173.253;64.233.173.254;64.233.173.255;64.68.80;64.68.81;64.68.82;64.68.83;64.68.84;64.68.85;64.68.86;64.68.87;64.68.88;64.68.89;64.68.90.1;64.68.90.10;64.68.90.11;64.68.90.12;64.68.90.129;64.68.90.13;64.68.90.130;64.68.90.131;64.68.90.132;64.68.90.133;64.68.90.134;64.68.90.135;64.68.90.136;64.68.90.137;64.68.90.138;64.68.90.139;64.68.90.14;64.68.90.140;64.68.90.141;64.68.90.142;64.68.90.143;64.68.90.144;64.68.90.145;64.68.90.146;64.68.90.147;64.68.90.148;64.68.90.149;64.68.90.15;64.68.90.150;64.68.90.151;64.68.90.152;64.68.90.153;64.68.90.154;64.68.90.155;64.68.90.156;64.68.90.157;64.68.90.158;64.68.90.159;64.68.90.16;64.68.90.160;64.68.90.161;64.68.90.162;64.68.90.163;64.68.90.164;64.68.90.165;64.68.90.166;64.68.90.167;64.68.90.168;64.68.90.169;64.68.90.17;64.68.90.170;64.68.90.171;64.68.90.172;64.68.90.173;64.68.90.174;64.68.90.175;64.68.90.176;64.68.90.177;64.68.90.178;64.68.90.179;64.68.90.18;64.68.90.180;64.68.90.181;64.68.90.182;64.68.90.183;64.68.90.184;64.68.90.185;64.68.90.186;64.68.90.187;64.68.90.188;64.68.90.189;64.68.90.19;64.68.90.190;64.68.90.191;64.68.90.192;64.68.90.193;64.68.90.194;64.68.90.195;64.68.90.196;64.68.90.197;64.68.90.198;64.68.90.199;64.68.90.2;64.68.90.20;64.68.90.200;64.68.90.201;64.68.90.202;64.68.90.203;64.68.90.204;64.68.90.205;64.68.90.206;64.68.90.207;64.68.90.208;64.68.90.21;64.68.90.22;64.68.90.23;64.68.90.24;64.68.90.25;64.68.90.26;64.68.90.27;64.68.90.28;64.68.90.29;64.68.90.3;64.68.90.30;64.68.90.31;64.68.90.32;64.68.90.33;64.68.90.34;64.68.90.35;64.68.90.36;64.68.90.37;64.68.90.38;64.68.90.39;64.68.90.4;64.68.90.40;64.68.90.41;64.68.90.42;64.68.90.43;64.68.90.44;64.68.90.45;64.68.90.46;64.68.90.47;64.68.90.48;64.68.90.49;64.68.90.5;64.68.90.50;64.68.90.51;64.68.90.52;64.68.90.53;64.68.90.54;64.68.90.55;64.68.90.56;64.68.90.57;64.68.90.58;64.68.90.59;64.68.90.6;64.68.90.60;64.68.90.61;64.68.90.62;64.68.90.63;64.68.90.64;64.68.90.65;64.68.90.66;64.68.90.67;64.68.90.68;64.68.90.69;64.68.90.7;64.68.90.70;64.68.90.71;64.68.90.72;64.68.90.73;64.68.90.74;64.68.90.75;64.68.90.76;64.68.90.77;64.68.90.78;64.68.90.79;64.68.90.8;64.68.90.80;64.68.90.9;64.68.91;64.68.92;66.249.64;66.249.65;66.249.66;66.249.67;66.249.68;66.249.69;66.249.70;66.249.71;66.249.72;66.249.73;66.249.78;66.249.79;72.14.199;8.6.48', NOW(), NOW()); - -ALTER TABLE `PREFIX_address` ADD `dni` VARCHAR(16) NULL AFTER `vat_number`; - -UPDATE `PREFIX_address` a SET `dni` = ( - SELECT `dni` - FROM `PREFIX_customer` c - WHERE c.`id_customer` = a.`id_customer` -); - -ALTER TABLE `PREFIX_customer` DROP `dni`; - -INSERT INTO `PREFIX_hook` (`name`, `title`, `description`, `position`) VALUES ('paymentTop', 'Top of payment page', 'Top of payment page', 0); diff --git a/upgrade/sql/1.4.0.11.sql b/upgrade/sql/1.4.0.11.sql deleted file mode 100644 index f0ea8d56a..000000000 --- a/upgrade/sql/1.4.0.11.sql +++ /dev/null @@ -1,35 +0,0 @@ -CREATE TEMPORARY TABLE `PREFIX_tab_tmp` ( - `position` int(10) -); - -INSERT INTO `PREFIX_tab_tmp` (SELECT * FROM (SELECT `position` FROM `PREFIX_tab` WHERE `class_name` = 'AdminTaxes') AS tmp); -UPDATE `PREFIX_tab` SET `position` = (SELECT position FROM PREFIX_tab_tmp tmp) + 1 WHERE `class_name` = 'AdminTaxRulesGroup'; -DROP TABLE PREFIX_tab_tmp; - -DELETE FROM `PREFIX_configuration` WHERE `name` = 'PS_INVOICE_NUMBER'; - -CREATE TABLE `PREFIX_log` ( - `id_log` int(10) unsigned NOT NULL AUTO_INCREMENT, - `severity` tinyint(1) NOT NULL, - `error_code` int(11) DEFAULT NULL, - `message` text NOT NULL, - `object_type` varchar(32) DEFAULT NULL, - `object_id` int(10) unsigned DEFAULT NULL, - `date_add` datetime NOT NULL, - `date_upd` datetime NOT NULL, - PRIMARY KEY (`id_log`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; - -INSERT INTO `PREFIX_configuration` (`name`, `value`, `date_add`, `date_upd`) VALUES ('PS_LOGS_BY_EMAIL', '5', NOW(), NOW()); - -ALTER TABLE `PREFIX_tax_rules_group` CHANGE `name` `name` VARCHAR( 50 ) NOT NULL; - -CREATE TABLE `PREFIX_import_match` ( - `id_import_match` int(10) NOT NULL AUTO_INCREMENT, - `name` varchar(32) NOT NULL, - `match` text NOT NULL, - `skip` int(2) NOT NULL, - PRIMARY KEY (`id_import_match`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; - -/* PHP:add_new_tab(AdminLogs, en:Log|fr:Log|es:Log|de:Log|it:Log, 9); */; diff --git a/upgrade/sql/1.4.0.12.sql b/upgrade/sql/1.4.0.12.sql deleted file mode 100644 index 9af34e070..000000000 --- a/upgrade/sql/1.4.0.12.sql +++ /dev/null @@ -1,7 +0,0 @@ -ALTER TABLE `PREFIX_product` CHANGE `ecotax` `ecotax` DECIMAL( 17, 6 ) NOT NULL DEFAULT '0.00'; - -INSERT INTO `PREFIX_configuration` (`name`, `value`, `date_add`, `date_upd`) VALUES ('PS_LAST_SHOP_UPDATE', NOW(), NOW(), NOW()); - -INSERT INTO `PREFIX_configuration` (`name`, `value`, `date_add`, `date_upd`) VALUES ('PS_STORES_DISPLAY_SITEMAP', 1, NOW(), NOW()); - -INSERT INTO `PREFIX_configuration` (`name`, `value`, `date_add`, `date_upd`) VALUES ('PS_COOKIE_CHECKIP', 1, NOW(), NOW()); \ No newline at end of file diff --git a/upgrade/sql/1.4.0.13.sql b/upgrade/sql/1.4.0.13.sql deleted file mode 100644 index 22c382dd4..000000000 --- a/upgrade/sql/1.4.0.13.sql +++ /dev/null @@ -1 +0,0 @@ -SET NAMES 'utf8'; \ No newline at end of file diff --git a/upgrade/sql/1.4.0.14.sql b/upgrade/sql/1.4.0.14.sql deleted file mode 100644 index 959066ac0..000000000 --- a/upgrade/sql/1.4.0.14.sql +++ /dev/null @@ -1,24 +0,0 @@ -SET NAMES 'utf8'; - -ALTER TABLE `PREFIX_tax_rule` DROP PRIMARY KEY ; -ALTER TABLE `PREFIX_tax_rule` ADD `id_tax_rule` INT NOT NULL AUTO_INCREMENT PRIMARY KEY FIRST ; -ALTER TABLE `PREFIX_tax_rule` ADD INDEX ( `id_tax` ) ; -ALTER TABLE `PREFIX_tax_rule` ADD INDEX ( `id_tax_rules_group` ) ; - -ALTER TABLE `PREFIX_address` MODIFY `dni` VARCHAR(16) NULL AFTER `vat_number`; - -INSERT INTO `PREFIX_configuration` (`name`, `value`, `date_add`, `date_upd`) VALUES -('BLOCKSTORE_IMG', 'store.jpg', NOW(), NOW()), -('PS_STORES_CENTER_LAT', '25.948969', NOW(), NOW()), -('PS_STORES_CENTER_LONG', '-80.226439', NOW(), NOW()); - -/* PHP:add_new_tab(AdminInformation, en:Configuration Information|fr:Informations|es:Informations|it:Informazioni di configurazione|de:Konfigurationsinformationen, 9); */; -/* PHP:add_new_tab(AdminPerformance, de:Leistung|en:Performance|it:Performance|fr:Performances|es:Rendimiento, 8); */; -/* PHP:add_new_tab(AdminCustomerThreads, en:Customer Service|de:Kundenservice|fr:SAV|es:Servicio al cliente|it:Servizio clienti, 29); */; -/* PHP:add_new_tab(AdminWebservice, fr:Service web|es:Web service|en:Webservice|de:Webservice|it:Webservice, 9); */; -/* PHP:add_new_tab(AdminAddonsCatalog, fr:Catalogue de modules et thèmes|de:Module und Themenkatalog|en:Modules & Themes Catalog|it:Moduli & Temi catalogo, 7); */; -/* PHP:add_new_tab(AdminAddonsMyAccount, it:Il mio Account|de:Mein Konto|fr:Mon compte|en:My Account, 7); */; -/* PHP:add_new_tab(AdminThemes, es:Temas|it:Temi|de:Themen|en:Themes|fr:Thèmes, 7); */; -/* PHP:add_new_tab(AdminGeolocation, es:Geolocalización|it:Geolocalizzazione|en:Geolocation|de:Geotargeting|fr:Géolocalisation, 8); */; -/* PHP:add_new_tab(AdminTaxRulesGroup, it:Regimi fiscali|es:Reglas de Impuestos|fr:Règles de taxes|de:Steuerregeln|en:Tax Rules, 4); */; -/* PHP:add_new_tab(AdminLogs, en:Log|fr:Log|es:Log|de:Log|it:Log, 9); */; diff --git a/upgrade/sql/1.4.0.15.sql b/upgrade/sql/1.4.0.15.sql deleted file mode 100644 index f58669a52..000000000 --- a/upgrade/sql/1.4.0.15.sql +++ /dev/null @@ -1,41 +0,0 @@ -/* PHP:add_new_tab(AdminCounty, fr:Comtés|es:Condados|en:Counties|de:Counties|it:Counties, 5); */; - -ALTER TABLE `PREFIX_tax_rule` ADD `county_behavior` INT NOT NULL AFTER `state_behavior`; -ALTER TABLE `PREFIX_tax_rule` ADD `id_county` INT NOT NULL AFTER `id_country`; - -ALTER TABLE `PREFIX_tax_rule` ADD UNIQUE ( -`id_tax_rules_group` , -`id_country` , -`id_state` , -`id_county` -); - -CREATE TABLE `PREFIX_county` ( - `id_county` int(11) NOT NULL AUTO_INCREMENT, - `name` varchar(64) NOT NULL, - `id_state` int(11) NOT NULL, - `active` tinyint(1) NOT NULL, - PRIMARY KEY (`id_county`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8 ; - - -CREATE TABLE `PREFIX_county_zip_code` ( - `id_county` INT NOT NULL , - `from_zip_code` INT NOT NULL , - `to_zip_code` INT NOT NULL , - PRIMARY KEY ( `id_county` , `from_zip_code` , `to_zip_code` ) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; - - -INSERT INTO `PREFIX_configuration` (`name`, `value`, `date_add`, `date_upd`) VALUES ('PS_HOMEPAGE_PHP_SELF', 'index.php', NOW(), NOW()); - - -INSERT INTO `PREFIX_configuration` (`name`, `value`, `date_add`, `date_upd`) -VALUES ('PS_USE_ECOTAX', - (SELECT IF((SELECT `ecotax` FROM `PREFIX_product` WHERE `ecotax` != 0 LIMIT 1),'1','0')), - NOW(), - NOW()); - -ALTER TABLE `PREFIX_hook` ADD `live_edit` TINYINT NOT NULL DEFAULT '0'; - -UPDATE `PREFIX_hook` SET `live_edit` = '1' WHERE `PREFIX_hook`.`name` IN ('rightColumn', 'leftColumn', 'home'); diff --git a/upgrade/sql/1.4.0.16.sql b/upgrade/sql/1.4.0.16.sql deleted file mode 100644 index ed45cf3d2..000000000 --- a/upgrade/sql/1.4.0.16.sql +++ /dev/null @@ -1,38 +0,0 @@ -INSERT INTO `PREFIX_hook` (`id_hook`, `name`, `title`, `description`, `position`) -VALUES (NULL, 'afterCreateHtaccess', 'After htaccess creation', 'After htaccess creation', 0); - -UPDATE `PREFIX_meta_lang` SET `url_rewrite` = 'kontaktieren-sie-uns' WHERE id_meta = 3 AND id_lang = 4 AND url_rewrite = 'Kontaktieren Sie uns'; -UPDATE `PREFIX_meta_lang` SET `url_rewrite` = 'kennwort-wiederherstellung' WHERE id_meta = 7 AND id_lang = 4 AND url_rewrite = 'Kennwort Wiederherstellung'; -UPDATE `PREFIX_meta_lang` SET `url_rewrite` = 'il-mio-account' WHERE id_meta = 18 AND id_lang = 5 AND url_rewrite = 'il mio-account'; -UPDATE `PREFIX_meta_lang` SET `url_rewrite` = 'nota-di-ordine' WHERE id_meta = 20 AND id_lang = 5 AND url_rewrite = 'nota di-ordine'; - -INSERT INTO `PREFIX_meta` (`page`) VALUES ('order-opc'); -INSERT INTO `PREFIX_meta_lang` (`id_lang`, `id_meta`, `title`, `url_rewrite`) -( - SELECT `id_lang`, (SELECT `id_meta` FROM `PREFIX_meta` WHERE `page` = 'order-opc'), 'Order', 'quick-order' - FROM `PREFIX_lang` -); -INSERT INTO `PREFIX_meta` (`page`) VALUES ('guest-tracking'); -INSERT INTO `PREFIX_meta_lang` (`id_lang`, `id_meta`, `title`, `url_rewrite`) -( - SELECT `id_lang`, (SELECT `id_meta` FROM `PREFIX_meta` WHERE `page` = 'guest-tracking'), 'Guest tracking', 'guest-tracking' - FROM `PREFIX_lang` -); - -UPDATE `PREFIX_hook` SET `live_edit` = '1' WHERE `PREFIX_hook`.`name` IN ('productfooter', 'payment'); - -UPDATE `PREFIX_configuration` SET name = 'PS_GEOLOCATION_ENABLED' WHERE name = 'PS_GEOLOCALIZATION_ENABLED'; -UPDATE `PREFIX_configuration` SET name = 'PS_GEOLOCATION_BEHAVIOR' WHERE name = 'PS_GEOLOCALIZATION_BEHAVIOR'; -UPDATE `PREFIX_configuration` SET name = 'PS_GEOLOCATION_WHITELIST' WHERE name = 'PS_GEOLOCALIZATION_WHITELIST'; -UPDATE `PREFIX_tab` SET class_name = 'AdminGeolocation' WHERE class_name = 'AdminGeolocalization'; - -INSERT INTO `PREFIX_configuration` (`name`, `value`, `date_add`, `date_upd`) VALUES -('PS_CANONICAL_REDIRECT', '0', NOW(), NOW()); - -ALTER TABLE `PREFIX_webservice_account` ADD `class_name` VARCHAR( 50 ) NOT NULL DEFAULT 'WebserviceRequest' AFTER `key`; -ALTER TABLE `PREFIX_webservice_account` ADD `description` text NULL AFTER `key`; - -/* PHP:add_new_tab(AdminHome, en:Home|fr:Accueil|es:Home|de:Home|it:Home, -1); */; -/* PHP:add_new_tab(AdminStockMvt, de:Lagerbewegungen|fr:Mouvements de Stock|it:Movimenti magazzino|en:Stock Movements, 1); */; -/* PHP:update_for_13version(); */; - diff --git a/upgrade/sql/1.4.0.17.sql b/upgrade/sql/1.4.0.17.sql deleted file mode 100644 index bf8cb320f..000000000 --- a/upgrade/sql/1.4.0.17.sql +++ /dev/null @@ -1,22 +0,0 @@ -SET NAMES 'utf8'; - -ALTER TABLE `PREFIX_stock_mvt_reason` ADD `sign` TINYINT(1) NOT NULL DEFAULT '1' AFTER `id_stock_mvt_reason`; -UPDATE `PREFIX_stock_mvt_reason` SET `sign`=-1; -UPDATE `PREFIX_stock_mvt_reason` SET `sign`=1 WHERE `id_stock_mvt_reason`=3; -UPDATE `PREFIX_stock_mvt_reason` SET `id_stock_mvt_reason`=`id_stock_mvt_reason`+2 ORDER BY `id_stock_mvt_reason` DESC; -UPDATE `PREFIX_stock_mvt` SET `id_stock_mvt_reason`=`id_stock_mvt_reason`+2; -UPDATE `PREFIX_stock_mvt_reason_lang` SET `id_stock_mvt_reason`=`id_stock_mvt_reason`+2 ORDER BY `id_stock_mvt_reason` DESC; -INSERT INTO `PREFIX_stock_mvt_reason` (`id_stock_mvt_reason` ,`sign` ,`date_add` ,`date_upd`) VALUES ('1', '1', NOW(), NOW()), ('2', '-1', NOW(), NOW()); - -INSERT INTO `PREFIX_stock_mvt_reason_lang` (`id_stock_mvt_reason` ,`id_lang` ,`name`) VALUES -('1', '1', 'Increase'), -('1', '2', 'Augmenter'), -('1', '3', 'Aumentar'), -('1', '4', 'Erhöhen'), -('1', '5', 'Aumento'), -('2', '1', 'Decrease'), -('2', '2', 'Diminuer'), -('2', '3', 'Disminuir'), -('2', '4', 'Reduzieren'), -('2', '5', 'Diminuzione'); - diff --git a/upgrade/sql/1.4.0.2.sql b/upgrade/sql/1.4.0.2.sql deleted file mode 100644 index c472041c4..000000000 --- a/upgrade/sql/1.4.0.2.sql +++ /dev/null @@ -1,694 +0,0 @@ -SET NAMES 'utf8'; - -ALTER TABLE `PREFIX_employee` ADD `bo_color` varchar(32) default NULL AFTER `stats_date_to`; -ALTER TABLE `PREFIX_employee` ADD `bo_theme` varchar(32) default NULL AFTER `bo_color`; -ALTER TABLE `PREFIX_employee` ADD `bo_uimode` ENUM('hover','click') default 'click' AFTER `bo_theme`; -ALTER TABLE `PREFIX_employee` ADD `id_lang` int(10) unsigned NOT NULL default 0 AFTER `id_profile`; - -ALTER TABLE `PREFIX_cms` ADD `id_cms_category` int(10) unsigned NOT NULL default '0' AFTER `id_cms`; -ALTER TABLE `PREFIX_cms` ADD `position` int(10) unsigned NOT NULL default '0' AFTER `id_cms_category`; - -CREATE TABLE `PREFIX_cms_category` ( - `id_cms_category` int(10) unsigned NOT NULL AUTO_INCREMENT, - `id_parent` int(10) unsigned NOT NULL, - `level_depth` tinyint(3) unsigned NOT NULL DEFAULT '0', - `active` tinyint(1) unsigned NOT NULL DEFAULT '0', - `date_add` datetime NOT NULL, - `date_upd` datetime NOT NULL, - `position` int(10) unsigned NOT NULL default '0', - PRIMARY KEY (`id_cms_category`), - KEY `category_parent` (`id_parent`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; - -CREATE TABLE `PREFIX_cms_category_lang` ( - `id_cms_category` int(10) unsigned NOT NULL, - `id_lang` int(10) unsigned NOT NULL, - `name` varchar(128) NOT NULL, - `description` text, - `link_rewrite` varchar(128) NOT NULL, - `meta_title` varchar(128) DEFAULT NULL, - `meta_keywords` varchar(255) DEFAULT NULL, - `meta_description` varchar(255) DEFAULT NULL, - UNIQUE KEY `category_lang_index` (`id_cms_category`,`id_lang`), - KEY `category_name` (`name`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; - -INSERT INTO `PREFIX_cms_category_lang` VALUES(1, 1, 'Home', '', 'home', NULL, NULL, NULL); -INSERT INTO `PREFIX_cms_category_lang` VALUES(1, 2, 'Accueil', '', 'home', NULL, NULL, NULL); -INSERT INTO `PREFIX_cms_category_lang` VALUES(1, 3, 'Inicio', '', 'home', NULL, NULL, NULL); - -INSERT INTO `PREFIX_cms_category` VALUES(1, 0, 0, 1, NOW(), NOW(),0); - -UPDATE `PREFIX_cms_category` SET `position` = 0; -UPDATE `PREFIX_cms` SET `position` = 0; -UPDATE `PREFIX_cms` SET `id_cms_category` = 0; - -ALTER TABLE `PREFIX_category` ADD `position` int(10) unsigned NOT NULL default '0' AFTER `date_upd`; - -UPDATE `PREFIX_employee` SET `id_lang` = (SELECT `value` FROM `PREFIX_configuration` WHERE `name` = "PS_LANG_DEFAULT"); - -ALTER TABLE `PREFIX_customer` ADD `note` text AFTER `secure_key`; - -ALTER TABLE `PREFIX_contact` ADD `customer_service` tinyint(1) NOT NULL DEFAULT 0 AFTER `email`; - -CREATE TABLE `PREFIX_customer_thread` ( - `id_customer_thread` int(11) unsigned NOT NULL auto_increment, - `id_lang` int(10) unsigned NOT NULL, - `id_contact` int(10) unsigned NOT NULL, - `id_customer` int(10) unsigned default NULL, - `id_order` int(10) unsigned default NULL, - `id_product` int(10) unsigned default NULL, - `status` enum('open','closed','pending1','pending2') NOT NULL default 'open', - `email` varchar(128) NOT NULL, - `token` varchar(12) default NULL, - `date_add` datetime NOT NULL, - `date_upd` datetime NOT NULL, - PRIMARY KEY (`id_customer_thread`), - KEY `id_customer_thread` (`id_customer_thread`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; - -CREATE TABLE `PREFIX_customer_message` ( - `id_customer_message` int(10) unsigned NOT NULL auto_increment, - `id_customer_thread` int(11) default NULL, - `id_employee` int(10) unsigned default NULL, - `message` text NOT NULL, - `file_name` varchar(18) DEFAULT NULL, - `ip_address` int(11) default NULL, - `user_agent` varchar(128) default NULL, - `date_add` datetime NOT NULL, - PRIMARY KEY (`id_customer_message`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; - -CREATE TABLE `PREFIX_payment_cc` ( - `id_payment_cc` INT NOT NULL auto_increment, - `id_order` INT UNSIGNED NULL, - `id_currency` INT UNSIGNED NOT NULL, - `amount` DECIMAL(10,2) NOT NULL, - `transaction_id` VARCHAR(254) NULL, - `card_number` VARCHAR(254) NULL, - `card_brand` VARCHAR(254) NULL, - `card_expiration` CHAR(7) NULL, - `card_holder` VARCHAR(254) NULL, - `date_add` DATETIME NOT NULL, - PRIMARY KEY (`id_payment_cc`), - KEY `id_order` (`id_order`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; - -CREATE TABLE `PREFIX_specific_price` ( - `id_specific_price` INT UNSIGNED NOT NULL AUTO_INCREMENT, - `id_product` INT UNSIGNED NOT NULL, - `id_shop` TINYINT UNSIGNED NOT NULL, - `id_currency` INT UNSIGNED NOT NULL, - `id_country` INT UNSIGNED NOT NULL, - `id_group` INT UNSIGNED NOT NULL, - `priority` SMALLINT UNSIGNED NOT NULL, - `price` DECIMAL(20, 6) NOT NULL, - `from_quantity` SMALLINT UNSIGNED NOT NULL, - `reduction` DECIMAL(20, 6) NOT NULL, - `reduction_type` ENUM('amount', 'percentage') NOT NULL, - `from` DATETIME NOT NULL, - `to` DATETIME NOT NULL, - PRIMARY KEY(`id_specific_price`), - KEY (`id_product`, `id_shop`, `id_currency`, `id_country`, `id_group`, `from_quantity`, `from`, `to`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; - -INSERT INTO `PREFIX_specific_price` (`id_product`, `id_shop`, `id_currency`, `id_country`, `id_group`, `priority`, `price`, `from_quantity`, `reduction`, `reduction_type`, `from`, `to`) - ( SELECT dq.`id_product`, 1, 1, 0, 1, 0, 0.00, dq.`quantity`, IF(dq.`id_discount_type` = 2, dq.`value`, dq.`value` / 100), IF (dq.`id_discount_type` = 2, 'amount', 'percentage'), '0000-00-00 00:00:00', '0000-00-00 00:00:00' - FROM `PREFIX_discount_quantity` dq - INNER JOIN `PREFIX_product` p ON (p.`id_product` = dq.`id_product`) - ); -DROP TABLE `PREFIX_discount_quantity`; - -INSERT INTO `PREFIX_specific_price` (`id_product`, `id_shop`, `id_currency`, `id_country`, `id_group`, `priority`, `price`, `from_quantity`, `reduction`, `reduction_type`, `from`, `to`) ( - SELECT - p.`id_product`, - 1, - 0, - 0, - 0, - 0, - 0.00, - 1, - IF(p.`reduction_price` > 0, p.`reduction_price`, p.`reduction_percent` / 100), - IF(p.`reduction_price` > 0, 'amount', 'percentage'), - IF (p.`reduction_from` = p.`reduction_to`, '0000-00-00 00:00:00', p.`reduction_from`), - IF (p.`reduction_from` = p.`reduction_to`, '0000-00-00 00:00:00', p.`reduction_to`) - FROM `PREFIX_product` p - WHERE p.`reduction_price` OR p.`reduction_percent` -); -ALTER TABLE `PREFIX_product` - DROP `reduction_price`, - DROP `reduction_percent`, - DROP `reduction_from`, - DROP `reduction_to`; - -INSERT INTO `PREFIX_configuration` (`name`, `value`, `date_add`, `date_upd`) VALUES -('PS_SPECIFIC_PRICE_PRIORITIES', 'id_shop;id_currency;id_country;id_group', NOW(), NOW()), -('PS_TAX_DISPLAY', 0, NOW(), NOW()), -('PS_SMARTY_FORCE_COMPILE', 1, NOW(), NOW()), -('PS_DISTANCE_UNIT', 'km', NOW(), NOW()), -('PS_STORES_DISPLAY_CMS', 0, NOW(), NOW()), -('PS_STORES_DISPLAY_FOOTER', 0, NOW(), NOW()), -('PS_STORES_SIMPLIFIED', 0, NOW(), NOW()), -('PS_STATSDATA_CUSTOMER_PAGESVIEWS', 1, NOW(), NOW()), -('PS_STATSDATA_PAGESVIEWS', 1, NOW(), NOW()), -('PS_STATSDATA_PLUGINS', 1, NOW(), NOW()); - -CREATE TABLE `PREFIX_group_reduction` ( - `id_group_reduction` MEDIUMINT UNSIGNED NOT NULL AUTO_INCREMENT, - `id_group` INT(10) UNSIGNED NOT NULL, - `id_category` INT(10) UNSIGNED NOT NULL, - `reduction` DECIMAL(4, 3) NOT NULL, - PRIMARY KEY(`id_group_reduction`), - UNIQUE KEY(`id_group`, `id_category`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; - -CREATE TABLE `PREFIX_product_group_reduction_cache` ( - `id_product` INT UNSIGNED NOT NULL, - `id_group` INT UNSIGNED NOT NULL, - `reduction` DECIMAL(4, 3) NOT NULL, - PRIMARY KEY(`id_product`, `id_group`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; - -ALTER TABLE `PREFIX_currency` ADD `iso_code_num` varchar(3) NOT NULL default '0' AFTER `iso_code`; -UPDATE `PREFIX_currency` SET iso_code_num = '978' WHERE iso_code = 'EUR' LIMIT 1; -UPDATE `PREFIX_currency` SET iso_code_num = '840' WHERE iso_code = 'USD' LIMIT 1; -UPDATE `PREFIX_currency` SET iso_code_num = '826' WHERE iso_code = 'GBP' LIMIT 1; - -ALTER TABLE `PREFIX_country` ADD `call_prefix` int(10) NOT NULL default '0' AFTER `iso_code`; - -UPDATE `PREFIX_country` SET `call_prefix` = 49 WHERE `iso_code` = 'DE' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 43 WHERE `iso_code` = 'AT' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 32 WHERE `iso_code` = 'BE' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 1 WHERE `iso_code` = 'CA' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 86 WHERE `iso_code` = 'CN' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 34 WHERE `iso_code` = 'ES' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 358 WHERE `iso_code` = 'FI' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 33 WHERE `iso_code` = 'FR' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 30 WHERE `iso_code` = 'GR' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 39 WHERE `iso_code` = 'IT' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 81 WHERE `iso_code` = 'JP' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 352 WHERE `iso_code` = 'LU' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 31 WHERE `iso_code` = 'NL' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 48 WHERE `iso_code` = 'PL' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 351 WHERE `iso_code` = 'PT' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 420 WHERE `iso_code` = 'CZ' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 44 WHERE `iso_code` = 'GB' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 46 WHERE `iso_code` = 'SE' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 41 WHERE `iso_code` = 'CH' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 45 WHERE `iso_code` = 'DK' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 1 WHERE `iso_code` = 'US' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 852 WHERE `iso_code` = 'HK' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 47 WHERE `iso_code` = 'NO' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 61 WHERE `iso_code` = 'AU' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 65 WHERE `iso_code` = 'SG' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 353 WHERE `iso_code` = 'IE' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 64 WHERE `iso_code` = 'NZ' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 82 WHERE `iso_code` = 'KR' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 972 WHERE `iso_code` = 'IL' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 27 WHERE `iso_code` = 'ZA' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 234 WHERE `iso_code` = 'NG' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 225 WHERE `iso_code` = 'CI' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 228 WHERE `iso_code` = 'TG' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 591 WHERE `iso_code` = 'BO' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 230 WHERE `iso_code` = 'MU' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 40 WHERE `iso_code` = 'RO' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 421 WHERE `iso_code` = 'SK' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 213 WHERE `iso_code` = 'DZ' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 376 WHERE `iso_code` = 'AD' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 244 WHERE `iso_code` = 'AO' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 54 WHERE `iso_code` = 'AR' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 374 WHERE `iso_code` = 'AM' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 297 WHERE `iso_code` = 'AW' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 994 WHERE `iso_code` = 'AZ' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 973 WHERE `iso_code` = 'BH' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 880 WHERE `iso_code` = 'BD' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 501 WHERE `iso_code` = 'BZ' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 229 WHERE `iso_code` = 'BJ' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 975 WHERE `iso_code` = 'BT' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 267 WHERE `iso_code` = 'BW' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 55 WHERE `iso_code` = 'BR' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 673 WHERE `iso_code` = 'BN' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 226 WHERE `iso_code` = 'BF' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 95 WHERE `iso_code` = 'MM' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 257 WHERE `iso_code` = 'BI' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 855 WHERE `iso_code` = 'KH' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 237 WHERE `iso_code` = 'CM' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 238 WHERE `iso_code` = 'CV' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 236 WHERE `iso_code` = 'CF' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 235 WHERE `iso_code` = 'TD' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 56 WHERE `iso_code` = 'CL' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 57 WHERE `iso_code` = 'CO' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 269 WHERE `iso_code` = 'KM' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 242 WHERE `iso_code` = 'CD' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 243 WHERE `iso_code` = 'CG' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 506 WHERE `iso_code` = 'CR' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 385 WHERE `iso_code` = 'HR' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 53 WHERE `iso_code` = 'CU' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 357 WHERE `iso_code` = 'CY' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 253 WHERE `iso_code` = 'DJ' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 670 WHERE `iso_code` = 'TL' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 593 WHERE `iso_code` = 'EC' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 20 WHERE `iso_code` = 'EG' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 503 WHERE `iso_code` = 'SV' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 240 WHERE `iso_code` = 'GQ' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 291 WHERE `iso_code` = 'ER' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 372 WHERE `iso_code` = 'EE' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 251 WHERE `iso_code` = 'ET' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 298 WHERE `iso_code` = 'FO' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 679 WHERE `iso_code` = 'FJ' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 241 WHERE `iso_code` = 'GA' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 220 WHERE `iso_code` = 'GM' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 995 WHERE `iso_code` = 'GE' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 233 WHERE `iso_code` = 'GH' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 299 WHERE `iso_code` = 'GL' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 350 WHERE `iso_code` = 'GI' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 590 WHERE `iso_code` = 'GP' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 502 WHERE `iso_code` = 'GT' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 224 WHERE `iso_code` = 'GN' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 245 WHERE `iso_code` = 'GW' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 592 WHERE `iso_code` = 'GY' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 509 WHERE `iso_code` = 'HT' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 379 WHERE `iso_code` = 'VA' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 504 WHERE `iso_code` = 'HN' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 354 WHERE `iso_code` = 'IS' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 91 WHERE `iso_code` = 'IN' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 62 WHERE `iso_code` = 'ID' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 98 WHERE `iso_code` = 'IR' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 964 WHERE `iso_code` = 'IQ' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 962 WHERE `iso_code` = 'JO' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 7 WHERE `iso_code` = 'KZ' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 254 WHERE `iso_code` = 'KE' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 686 WHERE `iso_code` = 'KI' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 850 WHERE `iso_code` = 'KP' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 965 WHERE `iso_code` = 'KW' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 996 WHERE `iso_code` = 'KG' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 856 WHERE `iso_code` = 'LA' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 371 WHERE `iso_code` = 'LV' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 961 WHERE `iso_code` = 'LB' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 266 WHERE `iso_code` = 'LS' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 231 WHERE `iso_code` = 'LR' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 218 WHERE `iso_code` = 'LY' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 423 WHERE `iso_code` = 'LI' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 370 WHERE `iso_code` = 'LT' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 853 WHERE `iso_code` = 'MO' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 389 WHERE `iso_code` = 'MK' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 261 WHERE `iso_code` = 'MG' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 265 WHERE `iso_code` = 'MW' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 60 WHERE `iso_code` = 'MY' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 960 WHERE `iso_code` = 'MV' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 223 WHERE `iso_code` = 'ML' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 356 WHERE `iso_code` = 'MT' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 692 WHERE `iso_code` = 'MH' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 596 WHERE `iso_code` = 'MQ' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 222 WHERE `iso_code` = 'MR' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 36 WHERE `iso_code` = 'HU' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 262 WHERE `iso_code` = 'YT' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 52 WHERE `iso_code` = 'MX' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 691 WHERE `iso_code` = 'FM' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 373 WHERE `iso_code` = 'MD' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 377 WHERE `iso_code` = 'MC' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 976 WHERE `iso_code` = 'MN' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 382 WHERE `iso_code` = 'ME' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 212 WHERE `iso_code` = 'MA' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 258 WHERE `iso_code` = 'MZ' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 264 WHERE `iso_code` = 'NA' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 674 WHERE `iso_code` = 'NR' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 977 WHERE `iso_code` = 'NP' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 599 WHERE `iso_code` = 'AN' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 687 WHERE `iso_code` = 'NC' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 505 WHERE `iso_code` = 'NI' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 227 WHERE `iso_code` = 'NE' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 683 WHERE `iso_code` = 'NU' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 968 WHERE `iso_code` = 'OM' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 92 WHERE `iso_code` = 'PK' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 680 WHERE `iso_code` = 'PW' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 507 WHERE `iso_code` = 'PA' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 675 WHERE `iso_code` = 'PG' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 595 WHERE `iso_code` = 'PY' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 51 WHERE `iso_code` = 'PE' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 63 WHERE `iso_code` = 'PH' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 974 WHERE `iso_code` = 'QA' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 262 WHERE `iso_code` = 'RE' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 7 WHERE `iso_code` = 'RU' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 250 WHERE `iso_code` = 'RW' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 508 WHERE `iso_code` = 'PM' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 685 WHERE `iso_code` = 'WS' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 378 WHERE `iso_code` = 'SM' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 239 WHERE `iso_code` = 'ST' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 966 WHERE `iso_code` = 'SA' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 221 WHERE `iso_code` = 'SN' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 381 WHERE `iso_code` = 'RS' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 248 WHERE `iso_code` = 'SC' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 232 WHERE `iso_code` = 'SL' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 386 WHERE `iso_code` = 'SI' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 677 WHERE `iso_code` = 'SB' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 252 WHERE `iso_code` = 'SO' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 94 WHERE `iso_code` = 'LK' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 249 WHERE `iso_code` = 'SD' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 597 WHERE `iso_code` = 'SR' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 268 WHERE `iso_code` = 'SZ' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 963 WHERE `iso_code` = 'SY' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 886 WHERE `iso_code` = 'TW' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 992 WHERE `iso_code` = 'TJ' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 255 WHERE `iso_code` = 'TZ' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 66 WHERE `iso_code` = 'TH' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 690 WHERE `iso_code` = 'TK' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 676 WHERE `iso_code` = 'TO' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 216 WHERE `iso_code` = 'TN' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 90 WHERE `iso_code` = 'TR' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 993 WHERE `iso_code` = 'TM' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 688 WHERE `iso_code` = 'TV' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 256 WHERE `iso_code` = 'UG' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 380 WHERE `iso_code` = 'UA' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 971 WHERE `iso_code` = 'AE' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 598 WHERE `iso_code` = 'UY' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 998 WHERE `iso_code` = 'UZ' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 678 WHERE `iso_code` = 'VU' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 58 WHERE `iso_code` = 'VE' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 84 WHERE `iso_code` = 'VN' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 681 WHERE `iso_code` = 'WF' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 967 WHERE `iso_code` = 'YE' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 260 WHERE `iso_code` = 'ZM' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 263 WHERE `iso_code` = 'ZW' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 355 WHERE `iso_code` = 'AL' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 93 WHERE `iso_code` = 'AF' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 387 WHERE `iso_code` = 'BA' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 359 WHERE `iso_code` = 'BG' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 682 WHERE `iso_code` = 'CK' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 594 WHERE `iso_code` = 'GF' LIMIT 1; -UPDATE `PREFIX_country` SET `call_prefix` = 689 WHERE `iso_code` = 'PF' LIMIT 1; - -INSERT INTO `PREFIX_configuration` (`name`, `value`, `date_add`, `date_upd`) VALUES ('PS_CONDITIONS_CMS_ID', IFNULL((SELECT `id_cms` FROM `PREFIX_cms` WHERE `id_cms` = 3), 0), NOW(), NOW()); -CREATE TEMPORARY TABLE `PREFIX_configuration_tmp` ( - `value` text -); -INSERT INTO `PREFIX_configuration_tmp` (SELECT value FROM (SELECT `value` FROM `PREFIX_configuration` WHERE `name` = 'PREFIX_CONDITIONS_CMS_ID') AS tmp); - -UPDATE `PREFIX_configuration` SET `value` = IF((SELECT value FROM PREFIX_configuration_tmp), 1, 0) WHERE `name` = 'PREFIX_CONDITIONS'; -DROP TABLE PREFIX_configuration_tmp; - -INSERT INTO `PREFIX_configuration` (`name`, `value`, `date_add`, `date_upd`) VALUES ('PS_CIPHER_ALGORITHM', 0, NOW(), NOW()); -INSERT INTO `PREFIX_configuration` (`name`, `value`, `date_add`, `date_upd`) VALUES ('PS_ORDER_PROCESS_TYPE', 0, NOW(), NOW()); - -ALTER TABLE `PREFIX_product` ADD `minimal_quantity` INT NOT NULL DEFAULT '1' AFTER `quantity`; -ALTER TABLE `PREFIX_product` ADD `cache_default_attribute` int(10) unsigned default NULL AFTER `indexed`; -ALTER TABLE `PREFIX_product` ADD `cache_has_attachments` TINYINT(1) NOT NULL default '0' AFTER `indexed`; -ALTER TABLE `PREFIX_product` ADD `cache_is_pack` TINYINT(1) NOT NULL default '0' AFTER `indexed`; -ALTER TABLE `PREFIX_product` ADD `available_for_order` TINYINT(1) NOT NULL DEFAULT '1' AFTER `active`; -ALTER TABLE `PREFIX_product` ADD `show_price` TINYINT(1) NOT NULL DEFAULT '1' AFTER `available_for_order`; -ALTER TABLE `PREFIX_product` ADD `online_only` TINYINT(1) NOT NULL DEFAULT '0' AFTER `on_sale`; -ALTER TABLE `PREFIX_product` ADD `condition` ENUM('new', 'used', 'refurbished') NOT NULL DEFAULT 'new' AFTER `available_for_order`; -ALTER TABLE `PREFIX_product` ADD `upc` VARCHAR( 12 ) NULL AFTER `ean13`; - -ALTER TABLE `PREFIX_product_attribute` ADD `upc` VARCHAR( 12 ) NULL AFTER `ean13`; - -SET @defaultOOS = (SELECT value FROM `PREFIX_configuration` WHERE name = 'PS_ORDER_OUT_OF_STOCK'); -/* Set 0 for every non-attribute product */ -UPDATE `PREFIX_product` p SET `cache_default_attribute` = 0 WHERE `id_product` NOT IN (SELECT `id_product` FROM `PREFIX_product_attribute`); -/* First default attribute in stock */ -UPDATE `PREFIX_product` p SET `cache_default_attribute` = (SELECT `id_product_attribute` FROM `PREFIX_product_attribute` WHERE `id_product` = p.`id_product` AND default_on = 1 AND quantity > 0 LIMIT 1) WHERE `cache_default_attribute` IS NULL; -/* Then default attribute without stock if we don't care */ -UPDATE `PREFIX_product` p SET `cache_default_attribute` = (SELECT `id_product_attribute` FROM `PREFIX_product_attribute` WHERE `id_product` = p.`id_product` AND default_on = 1 LIMIT 1) WHERE `cache_default_attribute` IS NULL AND `out_of_stock` = 1 OR `out_of_stock` = IF(@defaultOOS = 1, 2, 1); -/* Next, the default attribute can be any attribute with stock */ -UPDATE `PREFIX_product` p SET `cache_default_attribute` = (SELECT `id_product_attribute` FROM `PREFIX_product_attribute` WHERE `id_product` = p.`id_product` AND quantity > 0 LIMIT 1) WHERE `cache_default_attribute` IS NULL; -/* If there is still no default attribute, then we go back to the default one */ -UPDATE `PREFIX_product` p SET `cache_default_attribute` = (SELECT `id_product_attribute` FROM `PREFIX_product_attribute` WHERE `id_product` = p.`id_product` AND default_on = 1 LIMIT 1) WHERE `cache_default_attribute` IS NULL; - -UPDATE `PREFIX_product` p SET -cache_is_pack = (SELECT IF(COUNT(*) > 0, 1, 0) FROM `PREFIX_pack` pp WHERE pp.`id_product_pack` = p.`id_product`), -cache_has_attachments = (SELECT IF(COUNT(*) > 0, 1, 0) FROM `PREFIX_product_attachment` pa WHERE pa.`id_product` = p.`id_product`); - -INSERT INTO `PREFIX_hook` (`name`, `title`, `description`, `position`) VALUES ('deleteProductAttribute', 'Product Attribute Deletion', NULL, 0); -INSERT INTO `PREFIX_hook` (`name` ,`title` ,`description` ,`position`) VALUES ('beforeCarrier', 'Before carrier list', 'This hook is display before the carrier list on Front office', 1); -INSERT INTO `PREFIX_hook` (`name`, `title`, `description`, `position`) VALUES ('orderDetailDisplayed', 'Order detail displayed', 'Displayed on order detail on front office', 1); - -INSERT INTO `PREFIX_hook_module` (`id_module`, `id_hook`, `position`) VALUES -((SELECT IFNULL((SELECT `id_module` FROM `PREFIX_module` WHERE `name` = 'mailalerts'), 0)), -(SELECT `id_hook` FROM `PREFIX_hook` WHERE `name` = 'deleteProductAttribute'), 1); - -DELETE FROM `PREFIX_hook_module` WHERE `id_module` = 0; - -ALTER TABLE `PREFIX_country` ADD `need_zip_code` TINYINT(1) NOT NULL DEFAULT '1'; -ALTER TABLE `PREFIX_country` ADD `zip_code_format` VARCHAR(12) NOT NULL DEFAULT ''; - -ALTER TABLE `PREFIX_product` ADD `unit_price` DECIMAL(20,6) NOT NULL DEFAULT '0.000000' AFTER `wholesale_price`; -ALTER TABLE `PREFIX_product` ADD `unity` VARCHAR(10) NOT NULL DEFAULT '0.000000' AFTER `unit_price` ; -ALTER TABLE `PREFIX_product_attribute` ADD `unit_price_impact` DECIMAL(17,2) NOT NULL DEFAULT '0.00' AFTER `weight`; - -INSERT INTO `PREFIX_configuration` (`name`, `value`, `date_add`, `date_upd`) VALUES ('PS_VOLUME_UNIT', 'cl', NOW(), NOW()); - -ALTER TABLE `PREFIX_carrier` ADD `shipping_external` TINYINT( 1 ) UNSIGNED NOT NULL; -ALTER TABLE `PREFIX_carrier` ADD `external_module_name` varchar(64) DEFAULT NULL; -ALTER TABLE `PREFIX_carrier` ADD `need_range` TINYINT( 1 ) UNSIGNED NOT NULL; - -INSERT INTO `PREFIX_hook` (`name`, `title`, `description`, `position`) VALUES ('processCarrier', 'Carrier Process', NULL, 0); -INSERT INTO `PREFIX_hook` (`name`, `title`, `description`, `position`) VALUES ('orderDetail', 'Order Detail', 'To set the follow-up in smarty when order detail is called', 0); -INSERT INTO `PREFIX_hook` (`name`, `title`, `description`, `position`) VALUES ('paymentCCAdded', 'Payment CC added', 'Payment CC added', '0'); -INSERT INTO `PREFIX_hook` (`name`, `title`, `description`, `position`) VALUES ('extraProductComparison', 'Extra Product Comparison', 'Extra Product Comparison', '0'); - -ALTER TABLE `PREFIX_address` ADD `vat_number` varchar(32) NULL DEFAULT NULL AFTER `phone_mobile`; -INSERT INTO `PREFIX_configuration` (`name`, `value`, `date_add`, `date_upd`) VALUES ('PS_TAX_ADDRESS_TYPE', 'id_address_delivery', NOW(), NOW()); - - -/* PHP:add_module_to_hook(blockpaymentlogo, header); */; -/* PHP:add_module_to_hook(blockpermanentlinks, header); */; -/* PHP:add_module_to_hook(blockviewed, header); */; -/* PHP:add_module_to_hook(blockcart, header); */; -/* PHP:add_module_to_hook(editorial, header); */; -/* PHP:add_module_to_hook(blockbestsellers, header); */; -/* PHP:add_module_to_hook(blockcategories, header); */; -/* PHP:add_module_to_hook(blockspecials, header); */; -/* PHP:add_module_to_hook(blockcurrencies, header); */; -/* PHP:add_module_to_hook(blocknewproducts, header); */; -/* PHP:add_module_to_hook(blockuserinfo, header); */; -/* PHP:migrate_block_info_to_cms_block(); */; -/* PHP:add_module_to_hook(blockcms, header); */; -/* PHP:add_module_to_hook(blocklanguages, header); */; -/* PHP:add_module_to_hook(blockmanufacturer, header); */; -/* PHP:add_module_to_hook(blockadvertising, header); */; -/* PHP:add_module_to_hook(blocktags, header); */; -/* PHP:add_module_to_hook(blockmyaccount, header); */; - -ALTER TABLE `PREFIX_product` ADD `additional_shipping_cost` DECIMAL(20,2) NOT NULL DEFAULT '0.000000' AFTER `unit_price`; - -ALTER TABLE `PREFIX_currency` ADD `active` TINYINT(1) NOT NULL DEFAULT '1'; -ALTER TABLE `PREFIX_tax` ADD `active` TINYINT(1) NOT NULL DEFAULT '1'; - -INSERT INTO `PREFIX_configuration` (`name`, `value`, `date_add`, `date_upd`) VALUES ('PS_ATTRIBUTE_CATEGORY_DISPLAY', 1, NOW(), NOW()); - -ALTER TABLE `PREFIX_discount` ADD `cart_display` TINYINT( 4 ) NOT NULL AFTER `active` , ADD `date_add` DATETIME NOT NULL AFTER `cart_display` , ADD `date_upd` DATETIME NOT NULL AFTER `date_add` ; - -ALTER TABLE `PREFIX_carrier` ADD `shipping_method` INT( 2 ) NOT NULL DEFAULT '0'; - -CREATE TABLE `PREFIX_stock_mvt` ( - `id_stock_mvt` int(11) unsigned NOT NULL AUTO_INCREMENT, - `id_product` int(11) unsigned DEFAULT NULL, - `id_product_attribute` int(11) unsigned DEFAULT NULL, - `id_order` int(11) unsigned DEFAULT NULL, - `id_stock_mvt_reason` int(11) unsigned NOT NULL, - `id_employee` int(11) unsigned NOT NULL, - `quantity` int(11) NOT NULL, - `date_add` datetime NOT NULL, - `date_upd` datetime NOT NULL, - PRIMARY KEY (`id_stock_mvt`), - KEY `id_order` (`id_order`), - KEY `id_product` (`id_product`), - KEY `id_product_attribute` (`id_product_attribute`), - KEY `id_stock_mvt_reason` (`id_stock_mvt_reason`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; - -CREATE TABLE `PREFIX_stock_mvt_reason` ( - `id_stock_mvt_reason` int(11) NOT NULL AUTO_INCREMENT, - `date_add` datetime NOT NULL, - `date_upd` datetime NOT NULL, - PRIMARY KEY (`id_stock_mvt_reason`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; - - -ALTER TABLE `PREFIX_product` CHANGE `quantity` `quantity` INT( 10 ) NOT NULL DEFAULT '0'; -ALTER TABLE `PREFIX_product_attribute` CHANGE `quantity` `quantity` INT( 10 ) NOT NULL DEFAULT '0'; - -CREATE TABLE `PREFIX_stock_mvt_reason_lang` ( - `id_stock_mvt_reason` int(11) NOT NULL, - `id_lang` int(11) NOT NULL, - `name` varchar(255) CHARACTER SET utf8 NOT NULL, - PRIMARY KEY (`id_stock_mvt_reason`,`id_lang`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; - -INSERT INTO `PREFIX_stock_mvt_reason` (`id_stock_mvt_reason`, `date_add`, `date_upd`) VALUES -(1, NOW(), NOW()), (2, NOW(), NOW()), (3, NOW(), NOW()); - -INSERT INTO `PREFIX_stock_mvt_reason_lang` (`id_stock_mvt_reason`, `id_lang`, `name`) VALUES -(1, 1, 'Order'), -(1, 2, 'Commande'), -(2, 1, 'Missing Stock Movement'), -(2, 2, 'Mouvement de stock manquant'), -(3, 1, 'Restocking'), -(3, 2, 'Réassort'); - -INSERT INTO `PREFIX_configuration` (`name`, `value`, `date_add`, `date_upd`) VALUES ('PS_COMPARATOR_MAX_ITEM', 0, NOW(), NOW()); - -ALTER TABLE `PREFIX_meta_lang` ADD `url_rewrite` VARCHAR( 255 ) NOT NULL , ADD INDEX ( `url_rewrite` ); -INSERT INTO `PREFIX_meta` (`page`) VALUES ('address'); -INSERT INTO `PREFIX_meta_lang` (`id_lang`, `id_meta`, `title`, `url_rewrite`) VALUES -(1, (SELECT `id_meta` FROM `PREFIX_meta` WHERE `page` = 'address'), 'Address', 'address'), -(2, (SELECT `id_meta` FROM `PREFIX_meta` WHERE `page` = 'address'), 'Adresse', 'adresse'), -(3, (SELECT `id_meta` FROM `PREFIX_meta` WHERE `page` = 'address'), 'Dirección', 'direccion'); -INSERT INTO `PREFIX_meta` (`page`) VALUES ('addresses'); -INSERT INTO `PREFIX_meta_lang` (`id_lang`, `id_meta`, `title`, `url_rewrite`) VALUES -(1, (SELECT `id_meta` FROM `PREFIX_meta` WHERE `page` = 'addresses'), 'Addresses', 'addresses'), -(2, (SELECT `id_meta` FROM `PREFIX_meta` WHERE `page` = 'addresses'), 'Adresses', 'adresses'), -(3, (SELECT `id_meta` FROM `PREFIX_meta` WHERE `page` = 'addresses'), 'Direcciones', 'direcciones'); -INSERT INTO `PREFIX_meta` (`page`) VALUES ('authentication'); -INSERT INTO `PREFIX_meta_lang` (`id_lang`, `id_meta`, `title`, `url_rewrite`) VALUES -(1, (SELECT `id_meta` FROM `PREFIX_meta` WHERE `page` = 'authentication'), 'Authentication', 'authentication'), -(2, (SELECT `id_meta` FROM `PREFIX_meta` WHERE `page` = 'authentication'), 'Authentification', 'authentification'), -(3, (SELECT `id_meta` FROM `PREFIX_meta` WHERE `page` = 'authentication'), 'Autenticación', 'autenticacion'); -INSERT INTO `PREFIX_meta` (`page`) VALUES ('cart'); -INSERT INTO `PREFIX_meta_lang` (`id_lang`, `id_meta`, `title`, `url_rewrite`) VALUES -(1, (SELECT `id_meta` FROM `PREFIX_meta` WHERE `page` = 'cart'), 'Cart', 'cart'), -(2, (SELECT `id_meta` FROM `PREFIX_meta` WHERE `page` = 'cart'), 'Panier', 'panier'), -(3, (SELECT `id_meta` FROM `PREFIX_meta` WHERE `page` = 'cart'), 'Carro de la compra', 'carro-de-la-compra'); -INSERT INTO `PREFIX_meta` (`page`) VALUES ('discount'); -INSERT INTO `PREFIX_meta_lang` (`id_lang`, `id_meta`, `title`, `url_rewrite`) VALUES -(1, (SELECT `id_meta` FROM `PREFIX_meta` WHERE `page` = 'discount'), 'Discount', 'discount'), -(2, (SELECT `id_meta` FROM `PREFIX_meta` WHERE `page` = 'discount'), 'Bons de réduction', 'bons-de-reduction'), -(3, (SELECT `id_meta` FROM `PREFIX_meta` WHERE `page` = 'discount'), 'Descuento', 'descuento'); -INSERT INTO `PREFIX_meta` (`page`) VALUES ('history'); -INSERT INTO `PREFIX_meta_lang` (`id_lang`, `id_meta`, `title`, `url_rewrite`) VALUES -(1, (SELECT `id_meta` FROM `PREFIX_meta` WHERE `page` = 'history'), 'Order history', 'order-history'), -(2, (SELECT `id_meta` FROM `PREFIX_meta` WHERE `page` = 'history'), 'Historique des commandes', 'historique-des-commandes'), -(3, (SELECT `id_meta` FROM `PREFIX_meta` WHERE `page` = 'history'), 'Historial de pedidos', 'historial-de-pedidos'); -INSERT INTO `PREFIX_meta` (`page`) VALUES ('identity'); -INSERT INTO `PREFIX_meta_lang` (`id_lang`, `id_meta`, `title`, `url_rewrite`) VALUES -(1, (SELECT `id_meta` FROM `PREFIX_meta` WHERE `page` = 'identity'), 'Identity', 'identity'), -(2, (SELECT `id_meta` FROM `PREFIX_meta` WHERE `page` = 'identity'), 'Identité', 'identite'), -(3, (SELECT `id_meta` FROM `PREFIX_meta` WHERE `page` = 'identity'), 'Identidad', 'identidad'); -INSERT INTO `PREFIX_meta` (`page`) VALUES ('my-account'); -INSERT INTO `PREFIX_meta_lang` (`id_lang`, `id_meta`, `title`, `url_rewrite`) VALUES -(1, (SELECT `id_meta` FROM `PREFIX_meta` WHERE `page` = 'my-account'), 'My account', 'my-account'), -(2, (SELECT `id_meta` FROM `PREFIX_meta` WHERE `page` = 'my-account'), 'Mon compte', 'mon-compte'), -(3, (SELECT `id_meta` FROM `PREFIX_meta` WHERE `page` = 'my-account'), 'Mi Cuenta', 'mi-cuenta'); -INSERT INTO `PREFIX_meta` (`page`) VALUES ('order-follow'); -INSERT INTO `PREFIX_meta_lang` (`id_lang`, `id_meta`, `title`, `url_rewrite`) VALUES -(1, (SELECT `id_meta` FROM `PREFIX_meta` WHERE `page` = 'order-follow'), 'Order follow', 'order-follow'), -(2, (SELECT `id_meta` FROM `PREFIX_meta` WHERE `page` = 'order-follow'), 'Détails de la commande', 'details-de-la-commande'), -(3, (SELECT `id_meta` FROM `PREFIX_meta` WHERE `page` = 'order-follow'), 'Devolución de productos', 'devolucion-de-productos'); -INSERT INTO `PREFIX_meta` (`page`) VALUES ('order-slip'); -INSERT INTO `PREFIX_meta_lang` (`id_lang`, `id_meta`, `title`, `url_rewrite`) VALUES -(1, (SELECT `id_meta` FROM `PREFIX_meta` WHERE `page` = 'order-slip'), 'Order slip', 'order-slip'), -(2, (SELECT `id_meta` FROM `PREFIX_meta` WHERE `page` = 'order-slip'), 'Avoirs', 'avoirs'), -(3, (SELECT `id_meta` FROM `PREFIX_meta` WHERE `page` = 'order-slip'), 'Vales', 'vales'); -INSERT INTO `PREFIX_meta` (`page`) VALUES ('order'); -INSERT INTO `PREFIX_meta_lang` (`id_lang`, `id_meta`, `title`, `url_rewrite`) VALUES -(1, (SELECT `id_meta` FROM `PREFIX_meta` WHERE `page` = 'order'), 'Order', 'order'), -(2, (SELECT `id_meta` FROM `PREFIX_meta` WHERE `page` = 'order'), 'Commande', 'commande'), -(3, (SELECT `id_meta` FROM `PREFIX_meta` WHERE `page` = 'order'), 'Carrito', 'carrito'); -INSERT INTO `PREFIX_meta` (`page`) VALUES ('search'); -INSERT INTO `PREFIX_meta_lang` (`id_lang`, `id_meta`, `title`, `url_rewrite`) VALUES -(1, (SELECT `id_meta` FROM `PREFIX_meta` WHERE `page` = 'search' LIMIT 1), 'Search', 'search'), -(2, (SELECT `id_meta` FROM `PREFIX_meta` WHERE `page` = 'search' LIMIT 1), 'Recherche', 'recherche'), -(3, (SELECT `id_meta` FROM `PREFIX_meta` WHERE `page` = 'search' LIMIT 1), 'Buscar', 'buscar'); -INSERT INTO `PREFIX_meta` (`page`) VALUES ('stores'); -INSERT INTO `PREFIX_meta_lang` (`id_lang`, `id_meta`, `title`, `url_rewrite`) VALUES -(1, (SELECT `id_meta` FROM `PREFIX_meta` WHERE `page` = 'stores'), 'Stores', 'stores'), -(2, (SELECT `id_meta` FROM `PREFIX_meta` WHERE `page` = 'stores'), 'Magagins', 'magasins'), -(3, (SELECT `id_meta` FROM `PREFIX_meta` WHERE `page` = 'stores'), 'Tiendas', 'tiendas'); - -ALTER TABLE `PREFIX_manufacturer` ADD `active` tinyint(1) NOT NULL default 0; -ALTER TABLE `PREFIX_supplier` ADD `active` tinyint(1) NOT NULL default 0; -UPDATE `PREFIX_manufacturer` SET `active` = 1; -UPDATE `PREFIX_supplier` SET `active` = 1; -ALTER TABLE `PREFIX_cms` ADD `active` tinyint(1) unsigned NOT NULL default 0; -UPDATE `PREFIX_cms` SET `active` = 1; - -ALTER TABLE `PREFIX_cart` ADD `secure_key` varchar(32) NOT NULL default '-1' AFTER `id_guest`; - -ALTER TABLE `PREFIX_order_detail` ADD `product_upc` varchar(12) default NULL AFTER `product_ean13`; - -ALTER TABLE `PREFIX_discount` ADD `id_group` int(10) unsigned NOT NULL default 0; - -CREATE TABLE `PREFIX_store` ( - `id_store` int(10) unsigned NOT NULL AUTO_INCREMENT, - `id_country` int(10) unsigned NOT NULL, - `id_state` int(10) unsigned DEFAULT NULL, - `name` varchar(128) NOT NULL, - `address1` varchar(128) NOT NULL, - `address2` varchar(128) DEFAULT NULL, - `city` varchar(64) NOT NULL, - `postcode` varchar(12) NOT NULL, - `latitude` float(10,6) DEFAULT NULL, - `longitude` float(10,6) DEFAULT NULL, - `hours` varchar(254) DEFAULT NULL, - `phone` varchar(16) DEFAULT NULL, - `fax` varchar(16) DEFAULT NULL, - `email` varchar(128) DEFAULT NULL, - `note` text, - `active` tinyint(1) unsigned NOT NULL DEFAULT '0', - `date_add` datetime NOT NULL, - `date_upd` datetime NOT NULL, - PRIMARY KEY (`id_store`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; - -INSERT INTO `PREFIX_hook` (`name`, `title`, `description`, `position`) VALUES -('categoryAddition', '', 'Temporary hook. Must NEVER be used. Will soon be replaced by a generic CRUD hook system.', 0), -('categoryUpdate', '', 'Temporary hook. Must NEVER be used. Will soon be replaced by a generic CRUD hook system.', 0), -('categoryDeletion', '', 'Temporary hook. Must NEVER be used. Will soon be replaced by a generic CRUD hook system.', 0); - - -/* PHP:add_module_to_hook(blockcategories, categoryAddition); */; -/* PHP:add_module_to_hook(blockcategories, categoryUpdate); */; -/* PHP:add_module_to_hook(blockcategories, categoryDeletion); */; - -DELETE FROM `PREFIX_hook_module` WHERE `id_module` = 0; - -CREATE TABLE `PREFIX_required_field` ( - `id_required_field` int(11) NOT NULL AUTO_INCREMENT, - `object_name` varchar(32) NOT NULL, - `field_name` varchar(32) NOT NULL, - PRIMARY KEY (`id_required_field`), - KEY `object_name` (`object_name`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; - -CREATE TABLE `PREFIX_memcached_servers` ( -`id_memcached_server` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY , -`ip` VARCHAR( 254 ) NOT NULL , -`port` INT(11) UNSIGNED NOT NULL , -`weight` INT(11) UNSIGNED NOT NULL -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; - -CREATE TABLE `PREFIX_webservice_account` ( - `id_webservice_account` int(11) NOT NULL AUTO_INCREMENT, - `key` varchar(32) NOT NULL, - `active` tinyint(2) NOT NULL, - PRIMARY KEY (`id_webservice_account`), - KEY `key` (`key`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; - -CREATE TABLE `PREFIX_webservice_permission` ( - `id_webservice_permission` int(11) NOT NULL AUTO_INCREMENT, - `resource` varchar(50) NOT NULL, - `method` enum('GET','POST','PUT','DELETE') NOT NULL, - `id_webservice_account` int(11) NOT NULL, - PRIMARY KEY (`id_webservice_permission`), - UNIQUE KEY `resource_2` (`resource`,`method`,`id_webservice_account`), - KEY `resource` (`resource`), - KEY `method` (`method`), - KEY `id_webservice_account` (`id_webservice_account`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; - - -/* PHP */ -/* PHP:editorial_update(); */; -/* PHP:reorderpositions(); */; -/* PHP:update_image_size_in_db(); */; -/* PHP:update_order_details(); */; -/* PHP:add_new_tab(AdminInformation, en:Configuration Information|fr:Informations|es:Informations|it:Informazioni di configurazione|de:Konfigurationsinformationen, 9); */; -/* PHP:add_new_tab(AdminCustomerThreads, en:Customer Service|de:Kundenservice|fr:SAV|es:Servicio al cliente|it:Servizio clienti, 29); */; -/* PHP:add_new_tab(AdminAddonsCatalog, fr:Catalogue de modules et thèmes|de:Module und Themenkatalog|en:Modules & Themes Catalog|it:Moduli & Temi catalogo, 7); */; -/* PHP:add_new_tab(AdminAddonsMyAccount, it:Il mio Account|de:Mein Konto|fr:Mon compte|en:My Account, 7); */; -/* PHP:add_new_tab(AdminPerformance, de:Leistung|en:Performance|it:Performance|fr:Performances|es:Rendimiento, 8); */; -/* PHP:add_new_tab(AdminThemes, es:Temas|it:Temi|de:Themen|en:Themes|fr:Thèmes, 7); */; -/* PHP:add_new_tab(AdminWebservice, fr:Service web|es:Web service|en:Webservice|de:Webservice|it:Webservice, 9); */; - diff --git a/upgrade/sql/1.4.0.3.sql b/upgrade/sql/1.4.0.3.sql deleted file mode 100644 index 1df6fd470..000000000 --- a/upgrade/sql/1.4.0.3.sql +++ /dev/null @@ -1,67 +0,0 @@ -SET NAMES 'utf8'; - -CREATE TABLE IF NOT EXISTS `PREFIX_country_tax` ( - `id_country_tax` int(11) NOT NULL AUTO_INCREMENT, - `id_country` int(11) NOT NULL, - `id_tax` int(11) NOT NULL, - PRIMARY KEY (`id_country_tax`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; - -CREATE TABLE IF NOT EXISTS `PREFIX_product_country_tax` ( - `id_product` int(11) NOT NULL, - `id_country` int(11) NOT NULL, - `id_tax` int(11) NOT NULL, - UNIQUE KEY `id_product` (`id_product`,`id_country`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; - -DELETE FROM `PREFIX_tab` WHERE `class_name` = 'AdminStatsModules' LIMIT 1; -DELETE FROM `PREFIX_tab_lang` WHERE `id_tab` NOT IN (SELECT id_tab FROM `PREFIX_tab`); -DELETE FROM `PREFIX_access` WHERE `id_tab` NOT IN (SELECT id_tab FROM `PREFIX_tab`); - -INSERT INTO `PREFIX_module` (`name`, `active`) VALUES ('statsforecast', 1); -INSERT INTO `PREFIX_hook_module` (`id_module`, `id_hook` , `position`) (SELECT id_module, 32, (SELECT max_position from (SELECT MAX(position)+1 as max_position FROM `PREFIX_hook_module` WHERE `id_hook` = 32) tmp) FROM `PREFIX_module` WHERE `name` = 'statsforecast'); - -INSERT INTO `PREFIX_configuration` (`name`, `value`, `date_add`, `date_upd`) VALUES -('PS_GEOLOCATION_ENABLED', '0', NOW(), NOW()), -('PS_ALLOWED_COUNTRIES', -'AF;ZA;AX;AL;DZ;DE;AD;AO;AI;AQ;AG;AN;SA;AR;AM;AW;AU;AT;AZ;BS;BH;BD;BB;BY;BE;BZ;BJ;BM;BT;BO;BA;BW;BV;BR;BN;BG;BF;MM;BI;KY;KH;CM;CA;CV;CF;CL;CN;CX;CY;CC;CO;KM;CG;CD;CK;KR;KP;CR;CI;HR;CU;DK;DJ;DM;EG;IE;SV;AE;EC;ER;ES;EE;ET;FK;FO;FJ;FI;FR;GA;GM;GE;GS;GH;GI;GR;GD;GL;GP;GU;GT;GG;GN;GQ;GW;GY;GF;HT;HM;HN;HK;HU;IM;MU;VG;VI;IN;ID;IR;IQ;IS;IL;IT;JM;JP;JE;JO;KZ;KE;KG;KI;KW;LA;LS;LV;LB;LR;LY;LI;LT;LU;MO;MK;MG;MY;MW;MV;ML;MT;MP;MA;MH;MQ;MR;YT;MX;FM;MD;MC;MN;ME;MS;MZ;NA;NR;NP;NI;NE;NG;NU;NF;NO;NC;NZ;IO;OM;UG;UZ;PK;PW;PS;PA;PG;PY;NL;PE;PH;PN;PL;PF;PR;PT;QA;DO;CZ;RE;RO;UK;RU;RW;EH;BL;KN;SM;MF;PM;VA;VC;LC;SB;WS;AS;ST;SN;RS;SC;SL;SG;SK;SI;SO;SD;LK;SE;CH;SR;SJ;SZ;SY;TJ;TW;TZ;TD;TF;TH;TL;TG;TK;TO;TT;TN;TM;TC;TR;TV;UA;UY;US;VU;VE;VN;WF;YE;ZM;ZW', NOW(), NOW()), -('PS_GEOLOCATION_BEHAVIOR', '0', NOW(), NOW()); - -ALTER TABLE `PREFIX_orders` ADD `conversion_rate` decimal(13,6) NOT NULL default 1 AFTER `payment`; -UPDATE `PREFIX_orders` o SET o.`conversion_rate` = IFNULL(( - SELECT c.`conversion_rate` - FROM `PREFIX_currency` c - WHERE c.`id_currency` = o.`id_currency` - LIMIT 1), 0 -); - -ALTER TABLE `PREFIX_order_slip` ADD `conversion_rate` decimal(13,6) NOT NULL default 1 AFTER `id_order`; -UPDATE `PREFIX_order_slip` os SET os.`conversion_rate` = IFNULL(( - SELECT o.`conversion_rate` - FROM `PREFIX_orders` o - WHERE os.`id_order` = o.`id_order` - LIMIT 1), 0 -); - -UPDATE `PREFIX_configuration` SET `value` = 'gridhtml' WHERE `name` = 'PS_STATS_GRID_RENDER' LIMIT 1; -UPDATE `PREFIX_module` SET `name` = 'gridhtml' WHERE `name` = 'gridextjs' LIMIT 1; - -ALTER TABLE `PREFIX_attachment` CHANGE `mime` `mime` varchar(64) NOT NULL; -ALTER TABLE `PREFIX_attachment` ADD `file_name` varchar(128) NOT NULL default '' AFTER `file`; -UPDATE `PREFIX_attachment` a SET `file_name` = ( - SELECT `name` FROM `PREFIX_attachment_lang` al WHERE al.`id_attachment` = a.`id_attachment` AND al.`id_lang` = ( - SELECT `value` FROM `PREFIX_configuration` WHERE `name` = 'PS_LANG_DEFAULT') - ); - -UPDATE `PREFIX_tab` SET `class_name` = 'AdminCMSContent' WHERE `class_name` = 'AdminCMS' LIMIT 1; - -SET @id_timezone = (SELECT `name` FROM `PREFIX_timezone` WHERE `id_timezone` = (SELECT `value` FROM `PREFIX_configuration` WHERE `name` = 'PS_TIMEZONE' LIMIT 1) LIMIT 1); -UPDATE `PREFIX_configuration` SET `value` = @id_timezone WHERE `name` = "PS_TIMEZONE" LIMIT 1; - -ALTER TABLE `PREFIX_country` ADD `id_currency` INT NOT NULL DEFAULT '0' AFTER `id_zone`; - -/* PHP */ -/* PHP:group_reduction_column_fix(); */; -/* PHP:ecotax_tax_application_fix(); */; -/* PHP:cms_block(); */; -/* PHP:add_new_tab(AdminGeolocation, es:Geolocalización|it:Geolocalizzazione|en:Geolocation|de:Geotargeting|fr:Géolocalisation, 8); */; diff --git a/upgrade/sql/1.4.0.4.sql b/upgrade/sql/1.4.0.4.sql deleted file mode 100644 index 4ad45113c..000000000 --- a/upgrade/sql/1.4.0.4.sql +++ /dev/null @@ -1,21 +0,0 @@ -SET NAMES 'utf8'; -ALTER TABLE `PREFIX_product` CHANGE `ecotax` `ecotax` DECIMAL(21, 6) NOT NULL DEFAULT '0.00'; -/* PHP:move_crossselling(); */; - -UPDATE `PREFIX_cms` SET `id_cms_category` = 1; - -/* PHP:add_new_tab(AdminStores, fr:Magasins|es:Tiendas|en:Stores|de:Shops|it:Negozi, 9); */; - -INSERT IGNORE INTO `PREFIX_configuration` (`name`, `value`, `date_add`, `date_upd`) SELECT 'PS_LOCALE_LANGUAGE', l.`iso_code`, NOW(), NOW() FROM `PREFIX_configuration` c INNER JOIN `PREFIX_lang` l ON (l.`id_lang` = c.`value`) WHERE c.`name` = 'PS_LANG_DEFAULT'; -INSERT IGNORE INTO `PREFIX_configuration` (`name`, `value`, `date_add`, `date_upd`) SELECT 'PS_LOCALE_COUNTRY', co.`iso_code`, NOW(), NOW() FROM `PREFIX_configuration` c INNER JOIN `PREFIX_country` co ON (co.`id_country` = c.`value`) WHERE c.`name` = 'PS_COUNTRY_DEFAULT'; -/* PHP:reorderpositions(); */; - -ALTER TABLE `PREFIX_webservice_permission` CHANGE `method` `method` ENUM( 'GET', 'POST', 'PUT', 'DELETE', 'HEAD' ) NOT NULL; - -INSERT INTO `PREFIX_configuration` (`name`, `value`, `date_add`, `date_upd`) VALUES -('PS_ATTACHMENT_MAXIMUM_SIZE', '2', NOW(), NOW()), -('PS_SMARTY_CACHE', '1', NOW(), NOW()); - -ALTER TABLE `PREFIX_product_attribute` CHANGE `price` `price` decimal(20,6) NOT NULL default '0.000000'; -UPDATE `PREFIX_product_attribute` pa SET pa.`price` = pa.`price` / (1 + IFNULL((SELECT t.`rate` FROM `PREFIX_tax` t INNER JOIN `PREFIX_product` p ON (p.`id_tax` = t.`id_tax`) WHERE p.`id_product` = pa.`id_product`) ,0) / 100); - diff --git a/upgrade/sql/1.4.0.5.sql b/upgrade/sql/1.4.0.5.sql deleted file mode 100644 index 42a62d345..000000000 --- a/upgrade/sql/1.4.0.5.sql +++ /dev/null @@ -1,73 +0,0 @@ -SET NAMES 'utf8'; - -SET @alias = (SELECT IFNULL((SELECT `id_tab` FROM `PREFIX_tab` WHERE `class_name` = "AdminAliases" LIMIT 1), '0')); -UPDATE `PREFIX_tab` SET `id_parent` = 8 WHERE `id_tab` = @alias LIMIT 1; -SET @stores = (SELECT IFNULL((SELECT `id_tab` FROM `PREFIX_tab` WHERE `class_name` = "AdminStores" LIMIT 1), '0')); -UPDATE `PREFIX_tab` SET `id_parent` = 9 WHERE `id_tab` = @stores LIMIT 1; -SET @pdf = (SELECT IFNULL((SELECT `id_tab` FROM `PREFIX_tab` WHERE `class_name` = "AdminPDF" LIMIT 1), '0')); -UPDATE `PREFIX_tab` SET `id_parent` = 3 WHERE `id_tab` = @pdf LIMIT 1; -SET @tabs = (SELECT IFNULL((SELECT `id_tab` FROM `PREFIX_tab` WHERE `class_name` = "AdminTabs" LIMIT 1), '0')); -UPDATE `PREFIX_tab` SET `id_parent` = 29 WHERE `id_tab` = @tabs LIMIT 1; - -ALTER TABLE `PREFIX_image_type` ADD `stores` tinyint(1) NOT NULL default '1'; - -INSERT INTO `PREFIX_configuration` (`name`, `value`, `date_add`, `date_upd`) VALUES -('PS_FORCE_SMARTY_2', '0', NOW(), NOW()), -('PS_DIMENSION_UNIT', 'cm', NOW(), NOW()); - -ALTER TABLE `PREFIX_product` -ADD `width` FLOAT NOT NULL AFTER `location`, -ADD `height` FLOAT NOT NULL AFTER `width`, -ADD `depth` FLOAT NOT NULL AFTER `height`; - -SET @id_module = (SELECT IFNULL((SELECT `id_module` FROM `PREFIX_module` WHERE `name` = "statshome" LIMIT 1), '0')); -DELETE FROM `PREFIX_module` WHERE `id_module` = @id_module; -DELETE FROM `PREFIX_hook_module` WHERE `id_module` = @id_module; - -ALTER TABLE `PREFIX_customer` ADD `is_guest` TINYINT(1) NOT NULL DEFAULT '0' AFTER `deleted`; -INSERT INTO `PREFIX_configuration` (`name`, `value`, `date_add`, `date_upd`) VALUES ('PS_GUEST_CHECKOUT_ENABLED', '0', NOW(), NOW()); - -ALTER TABLE `PREFIX_category` ADD `nleft` INT UNSIGNED NOT NULL DEFAULT '0' AFTER `level_depth`; -ALTER TABLE `PREFIX_category` ADD `nright` INT UNSIGNED NOT NULL DEFAULT '0' AFTER `nleft`; -ALTER TABLE `PREFIX_category` ADD INDEX `nleftright` (`nleft`, `nright`); - -ALTER TABLE `PREFIX_product` ADD `id_tax_rules_group` int(10) unsigned NOT NULL AFTER `id_tax`; -ALTER TABLE `PREFIX_carrier` ADD `id_tax_rules_group` int(10) unsigned NOT NULL AFTER `id_tax`; -ALTER TABLE `PREFIX_carrier` ADD INDEX ( `id_tax_rules_group` ) ; - -CREATE TABLE `PREFIX_tax_rule` ( -`id_tax_rules_group` INT NOT NULL , -`id_country` INT NOT NULL , -`id_state` INT NOT NULL , -`id_tax` INT NOT NULL , -`state_behavior` INT NOT NULL , -PRIMARY KEY ( `id_tax_rules_group`, `id_country` , `id_state` ) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; - -CREATE TABLE `PREFIX_tax_rules_group` ( -`id_tax_rules_group` INT NOT NULL AUTO_INCREMENT PRIMARY KEY , -`name` VARCHAR( 32 ) NOT NULL , -`active` INT NOT NULL -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; - -CREATE TABLE IF NOT EXISTS `PREFIX_help_access` ( - `id_help_access` int(11) NOT NULL AUTO_INCREMENT, - `label` varchar(45) NOT NULL, - `version` varchar(8) NOT NULL, - PRIMARY KEY (`id_help_access`), - UNIQUE KEY `label` (`label`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; - -/* PHP:add_new_tab(AdminTaxRulesGroup, it:Regimi fiscali|es:Reglas de Impuestos|fr:Règles de taxes|de:Steuerregeln|en:Tax Rules, 4); */; -/* PHP:generate_ntree(); */; -/* PHP:generate_tax_rules(); */; -/* PHP:id_currency_country_fix(); */; -/* PHP:update_modules_sql(); */; - -ALTER TABLE `PREFIX_product` DROP `id_tax`; -ALTER TABLE `PREFIX_carrier` DROP `id_tax`; - -DROP TABLE `PREFIX_tax_state`, `PREFIX_tax_zone`, `PREFIX_country_tax`; -ALTER TABLE `PREFIX_orders` ADD `carrier_tax_rate` DECIMAL(10, 3) NOT NULL default '0.00' AFTER `total_shipping`; - -INSERT INTO `PREFIX_hook` (`id_hook`, `name`, `title`, `description`, `position`) VALUES (NULL, 'beforeAuthentication', 'Before Authentication', 'Before authentication', 0); diff --git a/upgrade/sql/1.4.0.6.sql b/upgrade/sql/1.4.0.6.sql deleted file mode 100644 index f3b33b76d..000000000 --- a/upgrade/sql/1.4.0.6.sql +++ /dev/null @@ -1,12 +0,0 @@ -SET NAMES 'utf8'; - -ALTER TABLE `PREFIX_customer` DROP INDEX `customer_email`; -ALTER TABLE `PREFIX_customer` ADD INDEX `customer_email` (`email`); - -ALTER TABLE `PREFIX_lang` ADD `language_code` char(5) NULL AFTER `iso_code`; -UPDATE `PREFIX_lang` SET language_code = iso_code; -ALTER TABLE `PREFIX_lang` MODIFY `language_code` char(5) NOT NULL; - -DELETE FROM `PREFIX_module` WHERE `name` = 'gridextjs' LIMIT 1; -DELETE FROM `PREFIX_hook_module` WHERE `id_module` NOT IN (SELECT id_module FROM `PREFIX_module`); -UPDATE `PREFIX_configuration` SET `value` = 'gridhtml' WHERE `name` = 'PS_STATS_GRID_RENDER' AND `value` = 'gridextjs' LIMIT 1; diff --git a/upgrade/sql/1.4.0.7.sql b/upgrade/sql/1.4.0.7.sql deleted file mode 100644 index 1edfbdac1..000000000 --- a/upgrade/sql/1.4.0.7.sql +++ /dev/null @@ -1,10 +0,0 @@ -SET NAMES 'utf8'; - -ALTER TABLE `PREFIX_product_attribute` ADD `minimal_quantity` int(10) unsigned NOT NULL DEFAULT '1' AFTER `default_on`; - -ALTER TABLE `PREFIX_orders` ADD `reference` VARCHAR(14) NOT NULL AFTER `id_address_invoice`; - -INSERT INTO `PREFIX_configuration` (`name`, `value`, `date_add`, `date_upd`) VALUES('PS_DISPLAY_SUPPLIERS', '1', NOW(), NOW()); - -/* PHP:update_products_ecotax_v133(); */; - diff --git a/upgrade/sql/1.4.0.8.sql b/upgrade/sql/1.4.0.8.sql deleted file mode 100644 index da0a17fcf..000000000 --- a/upgrade/sql/1.4.0.8.sql +++ /dev/null @@ -1,35 +0,0 @@ -SET NAMES 'utf8'; - -CREATE TEMPORARY TABLE `PREFIX_tab_tmp1` ( - `id_parent` int(11) -); -INSERT INTO `PREFIX_tab_tmp1` (SELECT * FROM (SELECT `id_parent` FROM `PREFIX_tab` WHERE `class_name` = 'AdminTaxes') AS tmp); - -CREATE TEMPORARY TABLE `PREFIX_tab_tmp2` ( - `position` int(10) -); - -INSERT INTO `PREFIX_tab_tmp2` (SELECT * FROM (SELECT `position` FROM `PREFIX_tab` WHERE `class_name` = 'AdminTaxes') AS tmp2); - -UPDATE `PREFIX_tab` SET `position` = `position` + 1 WHERE `id_parent` = (SELECT id_parent FROM PREFIX_tab_tmp1 AS tmp) AND `position` > (SELECT position FROM PREFIX_tab_tmp2 AS tmp2); -DROP TABLE PREFIX_tab_tmp1; -DROP TABLE PREFIX_tab_tmp2; - -CREATE TEMPORARY TABLE `PREFIX_tab_tmp` ( - `position` int(10) -); - -INSERT INTO `PREFIX_tab_tmp` (SELECT * FROM (SELECT `position` FROM `PREFIX_tab` WHERE `class_name` = 'AdminTaxes') AS tmp); -UPDATE `PREFIX_tab` SET `position` = (SELECT position FROM PREFIX_tab_tmp tmp) + 1 WHERE `class_name` = 'AdminTaxRulesGroup'; -DROP TABLE PREFIX_tab_tmp; - -UPDATE `PREFIX_hook` SET `title` = 'Category creation', description = '' WHERE `name` = 'categoryAddition' LIMIT 1; -UPDATE `PREFIX_hook` SET `title` = 'Category modification', description = '' WHERE `name` = 'categoryUpdate' LIMIT 1; -UPDATE `PREFIX_hook` SET `title` = 'Category removal', description = '' WHERE `name` = 'categoryDeletion' LIMIT 1; - -DELETE FROM `PREFIX_module` WHERE `name` = 'canonicalurl' LIMIT 1; -DELETE FROM `PREFIX_hook_module` WHERE `id_module` NOT IN (SELECT id_module FROM `PREFIX_module`); - -/* PHP:gridextjs_deprecated(); */; -/* PHP:shop_url(); */; -/* PHP:updateproductcomments(); */; \ No newline at end of file diff --git a/upgrade/sql/1.4.0.9.sql b/upgrade/sql/1.4.0.9.sql deleted file mode 100644 index a975b0927..000000000 --- a/upgrade/sql/1.4.0.9.sql +++ /dev/null @@ -1,16 +0,0 @@ -SET NAMES 'utf8'; - -CREATE TABLE `PREFIX_specific_price_priority` ( -`id_specific_price_priority` INT NOT NULL AUTO_INCREMENT , -`id_product` INT NOT NULL , -`priority` VARCHAR( 80 ) NOT NULL , -PRIMARY KEY ( `id_specific_price_priority` , `id_product` ) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; - -ALTER TABLE `PREFIX_product` ADD `unit_price_ratio` DECIMAL(20, 6) NOT NULL default '0.00' AFTER `unit_price`; - -UPDATE `PREFIX_product` SET `unit_price_ratio` = IF (`unit_price` != 0, `price` / `unit_price`, 0); - -ALTER TABLE `PREFIX_product` DROP `unit_price`; - -ALTER TABLE `PREFIX_discount` ADD `behavior_not_exhausted` TINYINT(3) DEFAULT '1' AFTER `id_discount_type`; diff --git a/upgrade/sql/1.4.1.0.sql b/upgrade/sql/1.4.1.0.sql deleted file mode 100755 index fb914c24a..000000000 --- a/upgrade/sql/1.4.1.0.sql +++ /dev/null @@ -1,43 +0,0 @@ -SET NAMES 'utf8'; - -INSERT INTO `PREFIX_hook` (`name`, `title`, `description`, `position`, `live_edit`) VALUES ('afterSaveAdminMeta', 'After save configuration in AdminMeta', 'After save configuration in AdminMeta', 0, 0); - -ALTER TABLE `PREFIX_webservice_account` ADD `is_module` TINYINT( 2 ) NOT NULL DEFAULT '0' AFTER `class_name` , -ADD `module_name` VARCHAR( 50 ) NULL DEFAULT NULL AFTER `is_module`; - -INSERT INTO `PREFIX_configuration` (`name`, `value`, `date_add`, `date_upd`) VALUES -('PS_IMG_UPDATE_TIME', UNIX_TIMESTAMP(), NOW(), NOW()); - -UPDATE `PREFIX_cms_lang` set link_rewrite = "uber-uns" where link_rewrite like "%ber-uns"; - -ALTER TABLE `PREFIX_connections` CHANGE `ip_address` `ip_address` BIGINT NULL DEFAULT NULL; - - -UPDATE `PREFIX_meta_lang` -SET `title` = 'Angebote', `keywords` = 'besonders, Angebote', `url_rewrite` = 'angebote' WHERE url_rewrite = 'preise-fallen'; - -ALTER TABLE `PREFIX_country` ADD `display_tax_label` BOOLEAN NOT NULL DEFAULT '1'; -DROP TABLE IF EXISTS `PREFIX_country_tax`; - -ALTER TABLE `PREFIX_order_detail` -CHANGE `product_quantity_in_stock` `product_quantity_in_stock` INT(10) NOT NULL DEFAULT '0'; - -CREATE TABLE `PREFIX_address_format` ( - `id_country` int(10) unsigned NOT NULL, - `format` varchar(255) NOT NULL DEFAULT '', - KEY `country` (`id_country`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; - -INSERT INTO `PREFIX_address_format` (`id_country`, `format`) -(SELECT `id_country` as id_country, 'firstname lastname\ncompany\nvat_number\naddress1\naddress2\npostcode city\ncountry\nphone' as format FROM PREFIX_country); - -UPDATE `PREFIX_address_format` set `format`='firstname lastname -company -address1 -address2 -city State:name postcode -country -phone' where `id_country`=21; - -/* PHP:alter_cms_block(); */; -/* PHP:add_module_to_hook(blockcategories, afterSaveAdminMeta); */; diff --git a/upgrade/sql/1.4.2.0.sql b/upgrade/sql/1.4.2.0.sql deleted file mode 100644 index b4920b207..000000000 --- a/upgrade/sql/1.4.2.0.sql +++ /dev/null @@ -1,20 +0,0 @@ -SET NAMES 'utf8'; - -ALTER TABLE `PREFIX_tab_lang` MODIFY `id_lang` int(10) unsigned NOT NULL AFTER `id_tab`; -ALTER TABLE `PREFIX_carrier` ADD `is_free` tinyint(1) unsigned NOT NULL DEFAULT '0' AFTER `is_module`; - -UPDATE `PREFIX_address_format` SET `format`=REPLACE(REPLACE(`format`, 'state_iso', 'State:name'), 'country', 'Country:name'); - -ALTER TABLE `PREFIX_orders` ADD INDEX `date_add`(`date_add`); - -/* PHP:update_module_followup(); */; - -INSERT IGNORE INTO `PREFIX_configuration` (`name`, `value`, `date_add`, `date_upd`) VALUES -('PS_STOCK_MVT_REASON_DEFAULT', 3, NOW(), NOW()); - -/* PHP:add_order_state(PS_OS_WS_PAYMENT, en:Payment remotely accepted|fr:Paiement à distance accepté, 1, 0, #DDEEFF, 1, 1, 0); */; -/* PHP:alter_blocklink(); */; -/* PHP:update_module_loyalty(); */; -/* PHP:remove_module_from_hook(blockcategories, afterCreateHtaccess); */; -/* PHP:updatetabicon_from_11version(); */; - diff --git a/upgrade/sql/1.4.2.1.sql b/upgrade/sql/1.4.2.1.sql deleted file mode 100644 index bb1503351..000000000 --- a/upgrade/sql/1.4.2.1.sql +++ /dev/null @@ -1,3 +0,0 @@ -SET NAMES 'utf8'; - -DELETE FROM `PREFIX_configuration_lang` WHERE 1 AND `value` is NULL AND `date_upd` is NULL; diff --git a/upgrade/sql/1.4.2.2.sql b/upgrade/sql/1.4.2.2.sql deleted file mode 100644 index 35f908ba5..000000000 --- a/upgrade/sql/1.4.2.2.sql +++ /dev/null @@ -1,11 +0,0 @@ -SET NAMES 'utf8'; - -UPDATE `PREFIX_country` SET `display_tax_label` = '1' WHERE `id_country` = 21; - -/* PHP:check_webservice_account_table(); */; -/* PHP:add_module_to_hook(blockcms, leftColumn); */; -/* PHP:add_module_to_hook(blockcms, rightColumn); */; -/* PHP:add_module_to_hook(blockcms, footer); */; - -UPDATE `PREFIX_cart` ca SET `secure_key` = IFNULL((SELECT `secure_key` from `PREFIX_customer` `cu` WHERE `cu`.`id_customer` = `ca`.`id_customer`), -1) WHERE `ca`.`secure_key` = -1; - diff --git a/upgrade/sql/1.4.2.3.sql b/upgrade/sql/1.4.2.3.sql deleted file mode 100644 index 6022be885..000000000 --- a/upgrade/sql/1.4.2.3.sql +++ /dev/null @@ -1,30 +0,0 @@ -SET NAMES 'utf8'; - -UPDATE `PREFIX_address_format` SET `format`=REPLACE(`format`, 'state', 'State:name'); - -SET @defaultOOS = (SELECT value FROM `PREFIX_configuration` WHERE name = 'PS_ORDER_OUT_OF_STOCK'); -/* Set 0 for every non-attribute product */ -UPDATE `PREFIX_product` p SET `cache_default_attribute` = 0 WHERE `id_product` NOT IN (SELECT `id_product` FROM `PREFIX_product_attribute`); -/* First default attribute in stock */ -UPDATE `PREFIX_product` p SET `cache_default_attribute` = (SELECT `id_product_attribute` FROM `PREFIX_product_attribute` WHERE `id_product` = p.`id_product` AND default_on = 1 AND quantity > 0 LIMIT 1) WHERE `cache_default_attribute` IS NULL; -/* Then default attribute without stock if we don't care */ -UPDATE `PREFIX_product` p SET `cache_default_attribute` = (SELECT `id_product_attribute` FROM `PREFIX_product_attribute` WHERE `id_product` = p.`id_product` AND default_on = 1 LIMIT 1) WHERE `cache_default_attribute` IS NULL AND `out_of_stock` = 1 OR `out_of_stock` = IF(@defaultOOS = 1, 2, 1); -/* Next, the default attribute can be any attribute with stock */ -UPDATE `PREFIX_product` p SET `cache_default_attribute` = (SELECT `id_product_attribute` FROM `PREFIX_product_attribute` WHERE `id_product` = p.`id_product` AND quantity > 0 LIMIT 1) WHERE `cache_default_attribute` IS NULL; -/* If there is still no default attribute, then we go back to the default one */ -UPDATE `PREFIX_product` p SET `cache_default_attribute` = (SELECT `id_product_attribute` FROM `PREFIX_product_attribute` WHERE `id_product` = p.`id_product` AND default_on = 1 LIMIT 1) WHERE `cache_default_attribute` IS NULL; - -UPDATE `PREFIX_order_state_lang` SET `name` = 'Zahlung eingegangen' WHERE `PREFIX_order_state_lang`.`id_order_state` =2 AND `PREFIX_order_state_lang`.`id_lang` = (SELECT id_lang FROM `PREFIX_lang` WHERE `iso_code` = 'de'); -UPDATE `PREFIX_order_state_lang` SET `name` = 'Bestellung eingegangen' WHERE `PREFIX_order_state_lang`.`id_order_state` =3 AND `PREFIX_order_state_lang`.`id_lang` = (SELECT id_lang FROM `PREFIX_lang` WHERE `iso_code` = 'de'); -UPDATE `PREFIX_order_state_lang` SET `name` = 'Versendet' WHERE `PREFIX_order_state_lang`.`id_order_state` =4 AND `PREFIX_order_state_lang`.`id_lang` = (SELECT id_lang FROM `PREFIX_lang` WHERE `iso_code` = 'de'); -UPDATE `PREFIX_order_state_lang` SET `name` = 'Erfolgreich abgeschlossen' WHERE `PREFIX_order_state_lang`.`id_order_state` =5 AND `PREFIX_order_state_lang`.`id_lang` = (SELECT id_lang FROM `PREFIX_lang` WHERE `iso_code` = 'de'); -UPDATE `PREFIX_order_state_lang` SET `name` = 'Storniert' WHERE `PREFIX_order_state_lang`.`id_order_state` =6 AND `PREFIX_order_state_lang`.`id_lang` = (SELECT id_lang FROM `PREFIX_lang` WHERE `iso_code` = 'de'); -UPDATE `PREFIX_order_state_lang` SET `name` = 'Fehler bei der Bezahlung' WHERE `PREFIX_order_state_lang`.`id_order_state` =8 AND `PREFIX_order_state_lang`.`id_lang` = (SELECT id_lang FROM `PREFIX_lang` WHERE `iso_code` = 'de'); -UPDATE `PREFIX_order_state_lang` SET `name` = 'Artikel erwartet' WHERE `PREFIX_order_state_lang`.`id_order_state` =9 AND `PREFIX_order_state_lang`.`id_lang` = (SELECT id_lang FROM `PREFIX_lang` WHERE `iso_code` = 'de'); -UPDATE `PREFIX_order_state_lang` SET `name` = 'Warten auf Zahlungseingang' WHERE `PREFIX_order_state_lang`.`id_order_state` =10 AND `PREFIX_order_state_lang`.`id_lang` = (SELECT id_lang FROM `PREFIX_lang` WHERE `iso_code` = 'de'); -UPDATE `PREFIX_order_state_lang` SET `name` = 'Warten auf Zahlungseingang von PayPal' WHERE `PREFIX_order_state_lang`.`id_order_state` =11 AND `PREFIX_order_state_lang`.`id_lang` = (SELECT id_lang FROM `PREFIX_lang` WHERE `iso_code` = 'de'); -UPDATE `PREFIX_order_state_lang` SET `name` = 'PayPal Anmeldung erfolgreich' WHERE `PREFIX_order_state_lang`.`id_order_state` =12 AND `PREFIX_order_state_lang`.`id_lang` = (SELECT id_lang FROM `PREFIX_lang` WHERE `iso_code` = 'de'); - -UPDATE `PREFIX_meta_lang` SET `url_rewrite` = 'identita' WHERE `url_rewrite` = 'Identità'; - -/* PHP:add_missing_rewrite_value(); */; diff --git a/upgrade/sql/1.4.2.4.sql b/upgrade/sql/1.4.2.4.sql deleted file mode 100644 index 1d5c1fd1c..000000000 --- a/upgrade/sql/1.4.2.4.sql +++ /dev/null @@ -1,10 +0,0 @@ -SET NAMES 'utf8'; - -INSERT IGNORE INTO `PREFIX_configuration` (`name`, `value`, `date_add`, `date_upd`) VALUES ('PS_BACKUP_DROP_TABLE', 1, NOW(), NOW()); - -UPDATE `PREFIX_tab_lang` SET `name` = 'SEO & URLs' WHERE `id_tab` = (SELECT `id_tab` FROM `PREFIX_tab` WHERE `class_name` = 'AdminMeta' LIMIT 1) AND `id_lang` IN (SELECT `id_lang` FROM `PREFIX_lang` WHERE `iso_code` IN ('en','fr','es','de','it')); - -/* These 3 lines (remove_duplicate, drop index, add unique) MUST stay together in this order */ -/* PHP:remove_duplicate_category_groups(); */; -ALTER TABLE `PREFIX_category_group` DROP INDEX `category_group_index`; -ALTER TABLE `PREFIX_category_group` ADD UNIQUE `category_group_index` (`id_category`,`id_group`); \ No newline at end of file diff --git a/upgrade/sql/1.4.2.5.sql b/upgrade/sql/1.4.2.5.sql deleted file mode 100644 index a5787c654..000000000 --- a/upgrade/sql/1.4.2.5.sql +++ /dev/null @@ -1,4 +0,0 @@ -SET NAMES 'utf8'; - -/* Fix wrong category level_depth caused by bug in 1.4.0.13 upgrade script */ -/* PHP:regenerate_level_depth(); */; \ No newline at end of file diff --git a/upgrade/sql/1.4.3.0.sql b/upgrade/sql/1.4.3.0.sql deleted file mode 100644 index e5be50568..000000000 --- a/upgrade/sql/1.4.3.0.sql +++ /dev/null @@ -1,16 +0,0 @@ -SET NAMES 'utf8'; - -UPDATE `PREFIX_address_format` SET `format`='firstname lastname -company -address1 -address2 -city -State:name -postcode -Country:name' -WHERE `id_country` = (SELECT `id_country` FROM `PREFIX_country` WHERE `iso_code`='GB'); - -UPDATE `PREFIX_country` SET `contains_states` = 1 WHERE `id_country` = 145; - -INSERT INTO `PREFIX_configuration` (`name`, `value`, `date_add`, `date_upd`) VALUES -('PS_LEGACY_IMAGES', '1', NOW(), NOW()); \ No newline at end of file diff --git a/upgrade/sql/1.4.4.0.sql b/upgrade/sql/1.4.4.0.sql deleted file mode 100644 index 06165111b..000000000 --- a/upgrade/sql/1.4.4.0.sql +++ /dev/null @@ -1,79 +0,0 @@ -SET NAMES 'utf8'; - -ALTER TABLE `PREFIX_image` MODIFY COLUMN `position` SMALLINT(2) UNSIGNED NOT NULL DEFAULT 0; - -INSERT IGNORE INTO `PREFIX_configuration` (`name`, `value`, `date_add`, `date_upd`) VALUES -('PS_OS_CHEQUE', '1', NOW(), NOW()), -('PS_OS_PAYMENT', '2', NOW(), NOW()), -('PS_OS_PREPARATION', '3', NOW(), NOW()), -('PS_OS_SHIPPING', '4', NOW(), NOW()), -('PS_OS_DELIVERED', '5', NOW(), NOW()), -('PS_OS_CANCELED', '6', NOW(), NOW()), -('PS_OS_REFUND', '7', NOW(), NOW()), -('PS_OS_ERROR', '8', NOW(), NOW()), -('PS_OS_OUTOFSTOCK', '9', NOW(), NOW()), -('PS_OS_BANKWIRE', '10', NOW(), NOW()), -('PS_OS_PAYPAL', '11', NOW(), NOW()), -('PS_OS_WS_PAYMENT', '12', NOW(), NOW()), -('PS_IMAGE_QUALITY', 'jpg', NOW(), NOW()), -('PS_PNG_QUALITY', '7', NOW(), NOW()), -('PS_JPEG_QUALITY', '90', NOW(), NOW()), -('PS_COOKIE_LIFETIME_FO', '480', NOW(), NOW()), -('PS_COOKIE_LIFETIME_BO', '480', NOW(), NOW()); - -ALTER TABLE `PREFIX_lang` ADD `is_rtl` TINYINT(1) NOT NULL DEFAULT '0'; - -UPDATE `PREFIX_country_lang` -SET `name` = 'United States' -WHERE `name` = 'USA' -AND `id_lang` = ( - SELECT `id_lang` - FROM `PREFIX_lang` - WHERE `iso_code` = 'en' - LIMIT 1 -); - -UPDATE `PREFIX_hook` -SET `live_edit` = 1 -WHERE `name` = 'leftColumn' -OR `name` = 'home' -OR `name` = 'rightColumn' -OR `name` = 'productfooter' -OR `name` = 'payment'; - -ALTER TABLE `PREFIX_stock_mvt_reason` MODIFY `sign` TINYINT(1) NOT NULL DEFAULT '1' AFTER `id_stock_mvt_reason`; - -UPDATE `PREFIX_tab_lang` -SET `name` = 'Geolocation' -WHERE `name` = 'Geolocalization'; - -UPDATE `PREFIX_tab_lang` -SET `name` = 'Counties' -WHERE `name` = 'County'; - -ALTER TABLE `PREFIX_tax_rule` MODIFY `id_county` INT NOT NULL AFTER `id_country`; - -UPDATE `PREFIX_address_format` set `format`='firstname lastname -company -address1 address2 -city, State:name postcode -Country:name -phone' -WHERE `id_country` = (SELECT `id_country` FROM `PREFIX_country` WHERE `iso_code`='US'); - -ALTER TABLE `PREFIX_attachment` CHANGE `mime` `mime` VARCHAR(128) NOT NULL; - -CREATE TABLE IF NOT EXISTS `PREFIX_compare_product` ( - `id_compare_product` int(10) unsigned NOT NULL AUTO_INCREMENT, - `id_product` int(10) unsigned NOT NULL, - `id_guest` int(10) unsigned NOT NULL, - `id_customer` int(10) unsigned NOT NULL, - `date_add` datetime NOT NULL, - `date_upd` datetime NOT NULL, - PRIMARY KEY (`id_compare_product`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; - -DELETE FROM `PREFIX_configuration` WHERE name = 'PS_LAYERED_NAVIGATION_CHECKBOXES' LIMIT 1; - -/* PHP:alter_productcomments_guest_index(); */; - diff --git a/upgrade/sql/1.4.4.1.sql b/upgrade/sql/1.4.4.1.sql deleted file mode 100755 index 0b4cf1b2f..000000000 --- a/upgrade/sql/1.4.4.1.sql +++ /dev/null @@ -1 +0,0 @@ -SET NAMES 'utf8'; diff --git a/upgrade/sql/1.4.5.0.sql b/upgrade/sql/1.4.5.0.sql deleted file mode 100644 index f5d05001a..000000000 --- a/upgrade/sql/1.4.5.0.sql +++ /dev/null @@ -1,55 +0,0 @@ -SET NAMES 'utf8'; - -INSERT IGNORE INTO `PREFIX_configuration` (`name`, `value`, `date_add`, `date_upd`) VALUES -('PS_RESTRICT_DELIVERED_COUNTRIES', '0', NOW(), NOW()); - -UPDATE `PREFIX_country_lang` SET `name` = 'United States' WHERE `name` = 'United State'; - -ALTER TABLE `PREFIX_discount` ADD `include_tax` TINYINT(1) NOT NULL DEFAULT '0'; - -UPDATE `PREFIX_order_detail` SET `product_price` = `product_price` /( 1-(`group_reduction`/100)); - -DELETE FROM `PREFIX_configuration` WHERE name IN ('PS_LAYERED_BITLY_USERNAME', 'PS_LAYERED_BITLY_API_KEY', 'PS_LAYERED_SHARE') LIMIT 3; - -ALTER TABLE `PREFIX_delivery` CHANGE `price` `price` DECIMAL(20, 6) NOT NULL; - -ALTER TABLE `PREFIX_store` CHANGE `latitude` `latitude` DECIMAL(10, 8) NULL DEFAULT NULL; -ALTER TABLE `PREFIX_store` CHANGE `longitude` `longitude` DECIMAL(10, 8) NULL DEFAULT NULL; - -INSERT INTO `PREFIX_hook` (`name`, `title`, `description`, `position`, `live_edit`) VALUES -('attributeGroupForm', 'Add fields to the form "attribute group"', 'Add fields to the form "attribute group"', 0, 0), -('afterSaveAttributeGroup', 'On saving attribute group', 'On saving attribute group', 0, 0), -('afterDeleteAttributeGroup', 'On deleting attribute group', 'On deleting "attribute group', 0, 0), -('featureForm', 'Add fields to the form "feature"', 'Add fields to the form "feature"', 0, 0), -('afterSaveFeature', 'On saving attribute feature', 'On saving attribute feature', 0, 0), -('afterDeleteFeature', 'On deleting attribute feature', 'On deleting attribute feature', 0, 0), -('afterSaveProduct', 'On saving products', 'On saving products', 0, 0), -('productListAssign', 'Assign product list to a category', 'Assign product list to a category', 0, 0), -('postProcessAttributeGroup', 'On post-process in admin attribute group', 'On post-process in admin attribute group', 0, 0), -('postProcessFeature', 'On post-process in admin feature', 'On post-process in admin feature', 0, 0), -('featureValueForm', 'Add fields to the form "feature value"', 'Add fields to the form "feature value"', 0, 0), -('postProcessFeatureValue', 'On post-process in admin feature value', 'On post-process in admin feature value', 0, 0), -('afterDeleteFeatureValue', 'On deleting attribute feature value', 'On deleting attribute feature value', 0, 0), -('afterSaveFeatureValue', 'On saving attribute feature value', 'On saving attribute feature value', 0, 0), -('attributeForm', 'Add fields to the form "feature value"', 'Add fields to the form "feature value"', 0, 0), -('postProcessAttribute', 'On post-process in admin feature value', 'On post-process in admin feature value', 0, 0), -('afterDeleteAttribute', 'On deleting attribute feature value', 'On deleting attribute feature value', 0, 0), -('afterSaveAttribute', 'On saving attribute feature value', 'On saving attribute feature value', 0, 0); - -ALTER TABLE `PREFIX_employee` ADD `bo_show_screencast` TINYINT(1) NOT NULL DEFAULT '1' AFTER `bo_uimode`; - -UPDATE `PREFIX_country` SET id_zone = (SELECT id_zone FROM `PREFIX_zone` WHERE name = 'Oceania' LIMIT 1) WHERE iso_code = 'KI' LIMIT 1; - -ALTER TABLE `PREFIX_lang` ADD `date_format_lite` char(32) NOT NULL DEFAULT 'Y-m-d' AFTER language_code; -ALTER TABLE `PREFIX_lang` ADD `date_format_full` char(32) NOT NULL DEFAULT 'Y-m-d H:i:s' AFTER date_format_lite; -UPDATE `PREFIX_lang` SET `date_format_lite` = 'd/m/Y' WHERE `iso_code` IN ('fr', 'es', 'it'); -UPDATE `PREFIX_lang` SET `date_format_full` = 'd/m/Y H:i:s' WHERE `iso_code` IN ('fr', 'es', 'it'); -UPDATE `PREFIX_lang` SET `date_format_lite` = 'd.m.Y' WHERE `iso_code` = 'de'; -UPDATE `PREFIX_lang` SET `date_format_full` = 'd.m.Y H:i:s' WHERE `iso_code` = 'de'; -UPDATE `PREFIX_lang` SET `date_format_lite` = 'm/d/Y' WHERE `iso_code` = 'en'; -UPDATE `PREFIX_lang` SET `date_format_full` = 'm/d/Y H:i:s' WHERE `iso_code` = 'en'; - -ALTER IGNORE TABLE `PREFIX_specific_price_priority` ADD UNIQUE ( -`id_product` -); - diff --git a/upgrade/sql/1.4.5.1.sql b/upgrade/sql/1.4.5.1.sql deleted file mode 100755 index 0b4cf1b2f..000000000 --- a/upgrade/sql/1.4.5.1.sql +++ /dev/null @@ -1 +0,0 @@ -SET NAMES 'utf8'; diff --git a/upgrade/sql/1.4.6.0.sql b/upgrade/sql/1.4.6.0.sql deleted file mode 100644 index 11a9fee16..000000000 --- a/upgrade/sql/1.4.6.0.sql +++ /dev/null @@ -1,25 +0,0 @@ -SET NAMES 'utf8'; - -/* PHP:update_order_canada(); */; - -CREATE TABLE IF NOT EXISTS `PREFIX_compare` ( - `id_compare` int(10) unsigned NOT NULL AUTO_INCREMENT, - `id_customer` int(10) unsigned NOT NULL, - PRIMARY KEY (`id_compare`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; - -ALTER TABLE `PREFIX_compare_product` DROP `id_compare_product` , DROP `id_guest` , DROP `id_customer` ; - -ALTER TABLE `PREFIX_compare_product` - ADD `id_compare` int(10) unsigned NOT NULL, - ADD PRIMARY KEY( - `id_compare`, - `id_product`); - -ALTER TABLE `PREFIX_store` CHANGE `latitude` `latitude` DECIMAL(11, 8) NULL DEFAULT NULL; -ALTER TABLE `PREFIX_store` CHANGE `longitude` `longitude` DECIMAL(11, 8) NULL DEFAULT NULL; - -ALTER TABLE `PREFIX_address_format` ADD PRIMARY KEY (`id_country`); -ALTER TABLE `PREFIX_address_format` DROP INDEX `country`; - -/* PHP:hook_blocksearch_on_header(); */; diff --git a/upgrade/sql/1.4.6.1.sql b/upgrade/sql/1.4.6.1.sql deleted file mode 100644 index b90e4fe4a..000000000 --- a/upgrade/sql/1.4.6.1.sql +++ /dev/null @@ -1,3 +0,0 @@ -SET NAMES 'utf8'; - -/* PHP:add_module_to_hook(authorizeaim, header); */; diff --git a/upgrade/sql/1.4.6.2.sql b/upgrade/sql/1.4.6.2.sql deleted file mode 100755 index 5fb900efb..000000000 --- a/upgrade/sql/1.4.6.2.sql +++ /dev/null @@ -1,5 +0,0 @@ -SET NAMES 'utf8'; - -INSERT IGNORE INTO `PREFIX_configuration` (`name`, `value`, `date_add`, `date_upd`) VALUES -('PS_LIMIT_UPLOAD_IMAGE_VALUE', '2', NOW(), NOW()), -('PS_LIMIT_UPLOAD_FILE_VALUE', '2', NOW(), NOW()); \ No newline at end of file diff --git a/upgrade/sql/1.4.7.0.sql b/upgrade/sql/1.4.7.0.sql deleted file mode 100644 index 3cef2a5c3..000000000 --- a/upgrade/sql/1.4.7.0.sql +++ /dev/null @@ -1,17 +0,0 @@ -SET NAMES 'utf8'; - -/* PHP:category_product_index_unique(); */; - -CREATE TABLE IF NOT EXISTS `PREFIX_order_tax` ( - `id_order` int(10) NOT NULL, - `tax_name` varchar(40) NOT NULL, - `tax_rate` decimal(6,3) NOT NULL, - `amount` decimal(20,6) NOT NULL -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; - -INSERT INTO `PREFIX_hook` (`name`, `title`, `description`, `position`, `live_edit`) VALUES -('frontCanonicalRedirect', 'Front Canonical Redirect', 'Check for 404 errors before canonical redirects', 0, 0); - -/* PHP:update_module_pagesnotfound(); */; - -ALTER TABLE `PREFIX_order_state` ADD COLUMN `deleted` tinyint(1) UNSIGNED NOT NULL default '0' AFTER `delivery`; \ No newline at end of file diff --git a/upgrade/sql/1.4.7.1.sql b/upgrade/sql/1.4.7.1.sql deleted file mode 100644 index 525c317c0..000000000 --- a/upgrade/sql/1.4.7.1.sql +++ /dev/null @@ -1,2 +0,0 @@ -SET NAMES 'utf8'; - diff --git a/upgrade/sql/1.4.7.2.sql b/upgrade/sql/1.4.7.2.sql deleted file mode 100644 index 525c317c0..000000000 --- a/upgrade/sql/1.4.7.2.sql +++ /dev/null @@ -1,2 +0,0 @@ -SET NAMES 'utf8'; - diff --git a/upgrade/sql/1.4.8.0.sql b/upgrade/sql/1.4.8.0.sql deleted file mode 100644 index 6d9d85353..000000000 --- a/upgrade/sql/1.4.8.0.sql +++ /dev/null @@ -1,3 +0,0 @@ -SET NAMES 'utf8'; - -ALTER TABLE `PREFIX_feature_product` ADD INDEX `id_product`(`id_product`); diff --git a/upgrade/sql/1.4.9.0.sql b/upgrade/sql/1.4.9.0.sql deleted file mode 100644 index 3f03b2ccf..000000000 --- a/upgrade/sql/1.4.9.0.sql +++ /dev/null @@ -1,27 +0,0 @@ -SET NAMES 'utf8'; - -ALTER TABLE `PREFIX_image` ADD UNIQUE KEY `idx_product_image` (`id_image` , `id_product` , `cover`); - -/* PHP:clean_category_product(); */; -ALTER TABLE `PREFIX_category_product` DROP INDEX `category_product_index`, ADD PRIMARY KEY (`id_category`, `id_product`); - -ALTER TABLE `PREFIX_cms_category_lang` DROP INDEX `category_lang_index`, ADD PRIMARY KEY (`id_cms_category`, `id_lang`); -ALTER TABLE `PREFIX_order_tax` ADD `id_order_tax` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY FIRST; -ALTER TABLE `PREFIX_feature_lang` ADD INDEX feature_name (`id_lang`, `name`); -ALTER TABLE `PREFIX_state` ADD INDEX statename (`name`); -ALTER TABLE `PREFIX_category` ADD INDEX nleftrightactive (`nleft`, `nright`, `active`); -ALTER TABLE `PREFIX_category` ADD INDEX level_depth (`level_depth`); -ALTER TABLE `PREFIX_category` ADD INDEX nright (`nright`); -ALTER TABLE `PREFIX_category` ADD INDEX nleft (`nleft`); -ALTER TABLE `PREFIX_specific_price` ADD INDEX from_quantity (`from_quantity`); -ALTER TABLE `PREFIX_product` ADD INDEX indexed (`indexed`); - -UPDATE `PREFIX_country` SET `zip_code_format` = 'NNNNN' WHERE `iso_code` = 'MC' LIMIT 1; -UPDATE `PREFIX_county_zip_code` SET `to_zip_code` = `from_zip_code` WHERE `to_zip_code` = 0; -UPDATE `PREFIX_configuration` SET `value` = 0 WHERE `name` = 'PS_HIGH_HTML_THEME_COMPRESSION' LIMIT 1; - -INSERT INTO `PREFIX_configuration` (`name`, `value`, `date_add`, `date_upd`)(SELECT 'PS_TAX_DISPLAY_ALL', `value`, NOW(), NOW() FROM `PREFIX_configuration` WHERE name = 'PS_TAX_DISPLAY' LIMIT 1); - -DELETE FROM `PREFIX_referrer_cache` WHERE id_referrer NOT IN (SELECT id_referrer FROM `PREFIX_referrer`); - -/* PHP:update_module_blocklayered(); */; \ No newline at end of file diff --git a/upgrade/sql/1.5.0.0.sql b/upgrade/sql/1.5.0.0.sql deleted file mode 100755 index 45f9278a1..000000000 --- a/upgrade/sql/1.5.0.0.sql +++ /dev/null @@ -1,318 +0,0 @@ -SET NAMES 'utf8'; - -CREATE TABLE IF NOT EXISTS `PREFIX_group_shop` ( - `id_group_shop` int(11) unsigned NOT NULL AUTO_INCREMENT, - `name` varchar(64) CHARACTER SET utf8 NOT NULL, - `share_customer` TINYINT(1) NOT NULL, - `share_order` TINYINT(1) NOT NULL, - `share_stock` TINYINT(1) NOT NULL, - `active` tinyint(1) NOT NULL DEFAULT '1', - `deleted` tinyint(1) NOT NULL DEFAULT '0', - PRIMARY KEY (`id_group_shop`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; -INSERT INTO `PREFIX_group_shop` (`id_group_shop`, `name`, `active`, `deleted`, `share_stock`, `share_customer`, `share_order`) VALUES (1, 'Default', 1, 0, 0, 0, 0); - -CREATE TABLE IF NOT EXISTS `PREFIX_shop` ( - `id_shop` int(11) unsigned NOT NULL AUTO_INCREMENT, - `id_group_shop` int(11) unsigned NOT NULL, - `name` varchar(64) CHARACTER SET utf8 NOT NULL, - `id_category` INT(11) UNSIGNED NOT NULL DEFAULT '1', - `id_theme` INT(1) UNSIGNED NOT NULL, - `active` tinyint(1) NOT NULL DEFAULT '1', - `deleted` tinyint(1) NOT NULL DEFAULT '0', - PRIMARY KEY (`id_shop`), - KEY `id_group_shop` (`id_group_shop`), - KEY `id_category` (`id_category`), - KEY `id_theme` (`id_theme`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; - -INSERT INTO `PREFIX_shop` - (`id_shop`, `id_group_shop`, `name`, `id_category`, `id_theme`, `active`, `deleted`) - VALUES - (1, 1, (SELECT value FROM `PREFIX_configuration` WHERE name = 'PS_SHOP_NAME'), 1, 1, 1, 0); - -ALTER TABLE `PREFIX_configuration` ADD `id_group_shop` INT(11) UNSIGNED DEFAULT NULL AFTER `id_configuration` , ADD `id_shop` INT(11) UNSIGNED DEFAULT NULL AFTER `id_group_shop`; -ALTER TABLE `PREFIX_configuration` DROP INDEX `name` , ADD INDEX `name` ( `name` ) ; -ALTER TABLE `PREFIX_configuration` ADD INDEX (`id_group_shop`); -ALTER TABLE `PREFIX_configuration` ADD INDEX (`id_shop`); -INSERT INTO `PREFIX_configuration` (`id_configuration`, `name`, `value`, `date_add`, `date_upd`) VALUES (NULL, 'PS_SHOP_DEFAULT', '1', NOW(), NOW()); - -CREATE TABLE IF NOT EXISTS `PREFIX_shop_url` ( - `id_shop_url` int(11) unsigned NOT NULL AUTO_INCREMENT, - `id_shop` int(11) unsigned NOT NULL, - `domain` varchar(255) NOT NULL, - `domain_ssl` varchar(255) NOT NULL, - `physical_uri` varchar(64) NOT NULL, - `virtual_uri` varchar(64) NOT NULL, - `main` TINYINT(1) NOT NULL, - `active` TINYINT(1) NOT NULL, - PRIMARY KEY (`id_shop_url`), - KEY `id_shop` (`id_shop`), - UNIQUE KEY `shop_url` (`domain`, `virtual_uri`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; - -CREATE TABLE IF NOT EXISTS `PREFIX_theme` ( - `id_theme` int(11) NOT NULL AUTO_INCREMENT, - `name` varchar(64) NOT NULL, - PRIMARY KEY (`id_theme`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; -INSERT INTO `PREFIX_theme` (`id_theme`, `name`) VALUES (1, 'prestashop'); - -CREATE TABLE IF NOT EXISTS `PREFIX_theme_specific` ( - `id_theme` int(11) unsigned NOT NULL, - `id_shop` INT(11) UNSIGNED NOT NULL, - `entity` int(11) unsigned NOT NULL, - `id_object` int(11) unsigned NOT NULL, - PRIMARY KEY (`id_theme`,`id_shop`, `entity`,`id_object`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; - -CREATE TABLE `PREFIX_stock` ( -`id_stock` INT( 11 ) UNSIGNED NOT NULL AUTO_INCREMENT, -`id_product` INT( 11 ) UNSIGNED NOT NULL, -`id_product_attribute` INT( 11 ) UNSIGNED NOT NULL, -`id_shop` INT(11) UNSIGNED NOT NULL, -`quantity` INT(11) NOT NULL, - PRIMARY KEY (`id_stock`), - KEY `id_product` (`id_product`), - KEY `id_product_attribute` (`id_product_attribute`), - KEY `id_shop` (`id_shop`), - UNIQUE KEY `product_stock` (`id_product` ,`id_product_attribute` ,`id_shop`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; - -INSERT INTO `PREFIX_stock` (id_product, id_product_attribute, id_shop, quantity) (SELECT id_product, id_product_attribute, 1, quantity FROM PREFIX_product_attribute); -INSERT INTO `PREFIX_stock` (id_product, id_product_attribute, id_shop, quantity) (SELECT id_product, 0, 1, IF( - (SELECT COUNT(*) FROM PREFIX_product_attribute pa WHERE p.id_product = pa.id_product) > 0, - (SELECT SUM(pa2.quantity) FROM PREFIX_product_attribute pa2 WHERE p.id_product = pa2.id_product), - quantity -) FROM PREFIX_product p); - -ALTER TABLE PREFIX_stock_mvt ADD id_stock INT UNSIGNED NOT NULL AFTER id_stock_mvt; -UPDATE PREFIX_stock_mvt sm SET sm.id_stock = IFNULL(( - SELECT IFNULL(s.id_stock, 0) - FROM PREFIX_stock s - WHERE s.id_product = sm.id_product - AND s.id_product_attribute = sm.id_product_attribute - ORDER BY s.id_shop -), 0); -DELETE FROM PREFIX_stock_mvt WHERE id_stock = 0; -ALTER TABLE PREFIX_stock_mvt DROP id_product, DROP id_product_attribute; - -CREATE TABLE `PREFIX_country_shop` ( -`id_country` INT( 11 ) UNSIGNED NOT NULL, -`id_shop` INT( 11 ) UNSIGNED NOT NULL , - PRIMARY KEY (`id_country`, `id_shop`), - KEY `id_shop` (`id_shop`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; -INSERT INTO `PREFIX_country_shop` (id_shop, id_country) (SELECT 1, id_country FROM PREFIX_country); - -CREATE TABLE `PREFIX_carrier_shop` ( -`id_carrier` INT( 11 ) UNSIGNED NOT NULL , -`id_shop` INT( 11 ) UNSIGNED NOT NULL , - PRIMARY KEY (`id_carrier`, `id_shop`), - KEY `id_shop` (`id_shop`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; -INSERT INTO `PREFIX_carrier_shop` (id_shop, id_carrier) (SELECT 1, id_carrier FROM PREFIX_carrier); - -/* PHP:upgrade_cms_15(); */; - -CREATE TABLE `PREFIX_lang_shop` ( -`id_lang` INT( 11 ) UNSIGNED NOT NULL, -`id_shop` INT( 11 ) UNSIGNED NOT NULL, - PRIMARY KEY (`id_lang`, `id_shop`), - KEY `id_shop` (`id_shop`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; -INSERT INTO `PREFIX_lang_shop` (id_shop, id_lang) (SELECT 1, id_lang FROM PREFIX_lang); - -CREATE TABLE `PREFIX_currency_shop` ( -`id_currency` INT( 11 ) UNSIGNED NOT NULL, -`id_shop` INT( 11 ) UNSIGNED NOT NULL, - PRIMARY KEY (`id_currency`, `id_shop`), - KEY `id_shop` (`id_shop`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; -INSERT INTO `PREFIX_currency_shop` (id_shop, id_currency) (SELECT 1, id_currency FROM PREFIX_currency); - -ALTER TABLE `PREFIX_cart` ADD `id_group_shop` INT(11) UNSIGNED NOT NULL DEFAULT '1' AFTER `id_cart` , ADD `id_shop` INT(11) UNSIGNED NOT NULL DEFAULT '1' AFTER `id_group_shop`, ADD INDEX `id_group_shop` (`id_group_shop`), ADD INDEX `id_shop` (`id_shop`); - -ALTER TABLE `PREFIX_customer` ADD `id_group_shop` INT(11) UNSIGNED NOT NULL DEFAULT '1' AFTER `id_customer` , ADD `id_shop` INT(11) UNSIGNED NOT NULL DEFAULT '1' AFTER `id_group_shop`, ADD INDEX `id_group_shop` (`id_group_shop`), ADD INDEX `id_shop` (`id_shop`); - -ALTER TABLE `PREFIX_orders` ADD `id_group_shop` INT(11) UNSIGNED NOT NULL DEFAULT '1' AFTER `id_order` , ADD `id_shop` INT(11) UNSIGNED NOT NULL DEFAULT '1' AFTER `id_group_shop`, ADD INDEX `id_group_shop` (`id_group_shop`), ADD INDEX `id_shop` (`id_shop`); - -ALTER TABLE `PREFIX_customer_thread` ADD `id_shop` INT(11) UNSIGNED NOT NULL DEFAULT '1' AFTER `id_customer_thread`; -ALTER TABLE `PREFIX_customer_thread` ADD INDEX `id_shop` (`id_shop`), ADD INDEX `id_lang` (`id_lang`), ADD INDEX `id_contact` (`id_contact`), ADD INDEX `id_customer` (`id_customer`), ADD INDEX `id_order` (`id_order`), ADD INDEX `id_product` (`id_product`); - -ALTER TABLE `PREFIX_customer_message` ADD INDEX `id_employee` (`id_employee`); - -ALTER TABLE `PREFIX_meta_lang` ADD `id_shop` INT(11) UNSIGNED NOT NULL DEFAULT '1' AFTER `id_meta`; -ALTER TABLE `PREFIX_meta_lang` DROP PRIMARY KEY, ADD PRIMARY KEY (`id_meta`, `id_shop`, `id_lang`), ADD INDEX `id_shop` (`id_shop`), ADD INDEX `id_lang` (`id_lang`); - -CREATE TABLE `PREFIX_contact_shop` ( - `id_contact` INT(11) UNSIGNED NOT NULL, - `id_shop` INT(11) UNSIGNED NOT NULL, - PRIMARY KEY (`id_contact`, `id_shop`), - KEY `id_shop` (`id_shop`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; -INSERT INTO `PREFIX_contact_shop` (id_shop, id_contact) (SELECT 1, id_contact FROM `PREFIX_contact`); - -CREATE TABLE `PREFIX_image_shop` ( -`id_image` INT( 11 ) UNSIGNED NOT NULL, -`id_shop` INT( 11 ) UNSIGNED NOT NULL, - PRIMARY KEY (`id_image`, `id_shop`), - KEY `id_shop` (`id_shop`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; -INSERT INTO `PREFIX_image_shop` (id_shop, id_image) (SELECT 1, id_image FROM `PREFIX_image`); - -CREATE TABLE `PREFIX_attribute_group_shop` ( -`id_attribute` INT(11) UNSIGNED NOT NULL, -`id_group_shop` INT(11) UNSIGNED NOT NULL, - PRIMARY KEY (`id_attribute`, `id_group_shop`), - KEY `id_group_shop` (`id_group_shop`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; -INSERT INTO `PREFIX_attribute_group_shop` (id_group_shop, id_attribute) (SELECT 1, id_attribute FROM `PREFIX_attribute`); - -CREATE TABLE `PREFIX_feature_group_shop` ( -`id_feature` INT(11) UNSIGNED NOT NULL, -`id_group_shop` INT(11) UNSIGNED NOT NULL , - PRIMARY KEY (`id_feature`, `id_group_shop`), - KEY `id_group_shop` (`id_group_shop`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; -INSERT INTO `PREFIX_feature_group_shop` (id_group_shop, id_feature) (SELECT 1, id_feature FROM `PREFIX_feature`); - -CREATE TABLE `PREFIX_group_group_shop` ( -`id_group` INT( 11 ) UNSIGNED NOT NULL, -`id_group_shop` INT( 11 ) UNSIGNED NOT NULL, - PRIMARY KEY (`id_group`, `id_group_shop`), - KEY `id_group_shop` (`id_group_shop`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; -INSERT INTO `PREFIX_group_group_shop` (id_group_shop, id_group) (SELECT 1, id_group FROM `PREFIX_group`); - -CREATE TABLE `PREFIX_attribute_group_group_shop` ( -`id_attribute_group` INT( 11 ) UNSIGNED NOT NULL , -`id_group_shop` INT( 11 ) UNSIGNED NOT NULL , - PRIMARY KEY (`id_attribute_group`, `id_group_shop`), - KEY `id_group_shop` (`id_group_shop`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; -INSERT INTO `PREFIX_attribute_group_group_shop` (id_group_shop, id_attribute_group) (SELECT 1, id_attribute_group FROM `PREFIX_attribute_group`); - -CREATE TABLE `PREFIX_tax_rules_group_group_shop` ( - `id_tax_rules_group` INT( 11 ) UNSIGNED NOT NULL, - `id_group_shop` INT( 11 ) UNSIGNED NOT NULL, - PRIMARY KEY (`id_tax_rules_group`, `id_group_shop`), - KEY `id_group_shop` (`id_group_shop`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; -INSERT INTO `PREFIX_tax_rules_group_group_shop` (`id_tax_rules_group`, `id_group_shop`) (SELECT `id_tax_rules_group`, 1 FROM `PREFIX_tax_rules_group`); - -CREATE TABLE `PREFIX_zone_group_shop` ( -`id_zone` INT( 11 ) UNSIGNED NOT NULL , -`id_group_shop` INT( 11 ) UNSIGNED NOT NULL , - PRIMARY KEY (`id_zone`, `id_group_shop`), - KEY `id_group_shop` (`id_group_shop`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; -INSERT INTO `PREFIX_zone_group_shop` (id_group_shop, id_zone) (SELECT 1, id_zone FROM `PREFIX_zone`); - -CREATE TABLE `PREFIX_manufacturer_group_shop` ( -`id_manufacturer` INT( 11 ) UNSIGNED NOT NULL , -`id_group_shop` INT( 11 ) UNSIGNED NOT NULL , - PRIMARY KEY (`id_manufacturer`, `id_group_shop`), - KEY `id_group_shop` (`id_group_shop`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; -INSERT INTO `PREFIX_manufacturer_group_shop` (id_group_shop, id_manufacturer) (SELECT 1, id_manufacturer FROM `PREFIX_manufacturer`); - -CREATE TABLE `PREFIX_supplier_group_shop` ( -`id_supplier` INT( 11 ) UNSIGNED NOT NULL, -`id_group_shop` INT( 11 ) UNSIGNED NOT NULL, -PRIMARY KEY (`id_supplier`, `id_group_shop`), - KEY `id_group_shop` (`id_group_shop`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; -INSERT INTO `PREFIX_supplier_group_shop` (id_group_shop, id_supplier) (SELECT 1, id_supplier FROM `PREFIX_supplier`); - -CREATE TABLE `PREFIX_store_shop` ( -`id_store` INT( 11 ) UNSIGNED NOT NULL , -`id_shop` INT( 11 ) UNSIGNED NOT NULL, -PRIMARY KEY (`id_store`, `id_shop`), - KEY `id_shop` (`id_shop`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; -INSERT INTO `PREFIX_store_shop` (id_shop, id_store) (SELECT 1, id_store FROM `PREFIX_store`); - -CREATE TABLE `PREFIX_product_shop` ( -`id_product` INT( 11 ) UNSIGNED NOT NULL, -`id_shop` INT( 11 ) UNSIGNED NOT NULL, -PRIMARY KEY ( `id_shop` , `id_product` ), - KEY `id_shop` (`id_shop`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; -INSERT INTO `PREFIX_product_shop` (id_shop, id_product) (SELECT 1, id_product FROM `PREFIX_product`); - -ALTER TABLE `PREFIX_category_lang` ADD `id_shop` INT( 11 ) UNSIGNED NOT NULL DEFAULT '1' AFTER `id_category`; -ALTER TABLE `PREFIX_category_lang` ADD UNIQUE KEY( `id_category`, `id_shop`, `id_lang`); - -ALTER TABLE `PREFIX_product_lang` ADD `id_shop` INT( 11 ) UNSIGNED NOT NULL DEFAULT '1' AFTER `id_product`; -ALTER TABLE `PREFIX_product_lang` ADD UNIQUE KEY ( `id_product`, `id_shop` , `id_lang`); - -ALTER TABLE `PREFIX_specific_price` CHANGE `id_shop` `id_shop` INT(11) UNSIGNED NOT NULL DEFAULT '1'; - -ALTER TABLE `PREFIX_hook_module` ADD `id_shop` INT(11) UNSIGNED NOT NULL DEFAULT '1' AFTER `id_hook`; -ALTER TABLE `PREFIX_hook_module` DROP PRIMARY KEY; -ALTER TABLE `PREFIX_hook_module` ADD PRIMARY KEY (`id_module`,`id_hook`,`id_shop` ); -ALTER TABLE `PREFIX_hook_module_exceptions` ADD `id_shop` INT(11) UNSIGNED NOT NULL DEFAULT '1' AFTER `id_hook`; - -ALTER TABLE `PREFIX_connections` ADD `id_group_shop` INT(11) UNSIGNED NOT NULL DEFAULT '1', ADD `id_shop` INT(11) UNSIGNED NOT NULL DEFAULT '1'; -ALTER TABLE `PREFIX_page_viewed` ADD `id_group_shop` INT UNSIGNED NOT NULL DEFAULT '1' AFTER `id_page`, ADD `id_shop` INT UNSIGNED NOT NULL DEFAULT '1' AFTER `id_group_shop`; -ALTER TABLE `PREFIX_page_viewed` DROP PRIMARY KEY, ADD PRIMARY KEY (`id_page`, `id_date_range`, `id_shop`); - -CREATE TABLE `PREFIX_module_shop` ( -`id_module` INT( 11 ) UNSIGNED NOT NULL, -`id_shop` INT( 11 ) UNSIGNED NOT NULL, -PRIMARY KEY (`id_module` , `id_shop`), - KEY `id_shop` (`id_shop`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; -INSERT INTO `PREFIX_module_shop` (`id_module`, `id_shop`) (SELECT `id_module`, 1 FROM `PREFIX_module` WHERE active = 1); - -ALTER TABLE `PREFIX_module_currency` ADD `id_shop` INT(11) UNSIGNED NOT NULL DEFAULT '1' AFTER `id_module`; -ALTER TABLE `PREFIX_module_currency` DROP PRIMARY KEY; -ALTER TABLE `PREFIX_module_currency` ADD PRIMARY KEY (`id_module`, `id_shop`, `id_currency`); - -ALTER TABLE `PREFIX_module_country` ADD `id_shop` INT(11) UNSIGNED NOT NULL DEFAULT '1' AFTER `id_module`; -ALTER TABLE `PREFIX_module_country` DROP PRIMARY KEY; -ALTER TABLE `PREFIX_module_country` ADD PRIMARY KEY (`id_module`, `id_shop`, `id_country`); - -ALTER TABLE `PREFIX_module_group` ADD `id_shop` INT(11) UNSIGNED NOT NULL DEFAULT '1' AFTER `id_module`; -ALTER TABLE `PREFIX_module_group` DROP PRIMARY KEY; -ALTER TABLE `PREFIX_module_group` ADD PRIMARY KEY (`id_module`, `id_shop`, `id_group`); - -ALTER TABLE `PREFIX_carrier_lang` ADD `id_shop` INT(11) UNSIGNED NOT NULL DEFAULT '1' AFTER `id_carrier`; - -/* PHP:add_id_shop_to_shipper_lang_index(); */; - -ALTER TABLE `PREFIX_search_word` ADD `id_shop` INT(11) NOT NULL DEFAULT '1' AFTER `id_word`; -ALTER TABLE `PREFIX_search_word` DROP INDEX `id_lang`, ADD UNIQUE `id_lang` (`id_lang`,`id_shop`,`word`); - -CREATE TABLE `PREFIX_referrer_shop` ( - `id_referrer` int(10) unsigned NOT NULL auto_increment, - `id_shop` int(10) unsigned NOT NULL default '1', - `cache_visitors` int(11) default NULL, - `cache_visits` int(11) default NULL, - `cache_pages` int(11) default NULL, - `cache_registrations` int(11) default NULL, - `cache_orders` int(11) default NULL, - `cache_sales` decimal(17,2) default NULL, - `cache_reg_rate` decimal(5,4) default NULL, - `cache_order_rate` decimal(5,4) default NULL, - PRIMARY KEY (`id_referrer`, `id_shop`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; -INSERT INTO `PREFIX_referrer_shop` (`id_referrer`, `id_shop`) SELECT `id_referrer`, 1 FROM `PREFIX_referrer`; -ALTER TABLE `PREFIX_referrer` DROP `cache_visitors`, DROP `cache_visits`, DROP `cache_pages`, DROP `cache_registrations`, DROP `cache_orders`, DROP `cache_sales`, DROP `cache_reg_rate`, DROP `cache_order_rate`; - -ALTER TABLE `PREFIX_cart_product` ADD `id_shop` INT NOT NULL DEFAULT '1' AFTER `id_product`; - -ALTER TABLE `PREFIX_customization` ADD `in_cart` TINYINT(1) UNSIGNED NOT NULL DEFAULT '0'; - -CREATE TABLE `PREFIX_scene_shop` ( -`id_scene` INT( 11 ) UNSIGNED NOT NULL , -`id_shop` INT( 11 ) UNSIGNED NOT NULL, -PRIMARY KEY (`id_scene`, `id_shop`), - KEY `id_shop` (`id_shop`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; -INSERT INTO `PREFIX_scene_shop` (id_shop, id_scene) (SELECT 1, id_scene FROM PREFIX_scene); - -/* PHP:create_multistore(); */; - -UPDATE `PREFIX_customization` INNER JOIN `PREFIX_orders` USING(id_cart) SET in_cart = 1; diff --git a/upgrade/sql/1.5.0.1.sql b/upgrade/sql/1.5.0.1.sql deleted file mode 100644 index b5cada9a2..000000000 --- a/upgrade/sql/1.5.0.1.sql +++ /dev/null @@ -1,682 +0,0 @@ -SET NAMES 'utf8'; - -ALTER TABLE `PREFIX_delivery` ADD `id_shop` INT UNSIGNED NULL DEFAULT NULL AFTER `id_delivery`; -ALTER TABLE `PREFIX_delivery` ADD `id_group_shop` INT UNSIGNED NULL DEFAULT NULL AFTER `id_shop`; - -CREATE TABLE IF NOT EXISTS `PREFIX_module_access` ( - `id_profile` int(10) unsigned NOT NULL, - `id_module` int(10) unsigned NOT NULL, - `view` tinyint(1) NOT NULL, - `configure` tinyint(1) NOT NULL, - PRIMARY KEY (`id_profile`,`id_module`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; - -/* Create SuperAdmin */ -UPDATE `PREFIX_profile_lang` SET `name` = 'SuperAdmin' WHERE `id_profile` = 1; - -CREATE TABLE IF NOT EXISTS `PREFIX_accounting_zone_shop` ( - `id_accounting_zone_shop` int(11) NOT NULL AUTO_INCREMENT, - `id_zone` int(11) NOT NULL, - `id_shop` int(11) NOT NULL, - `account_number` varchar(64) NOT NULL, - PRIMARY KEY (`id_accounting_zone_shop`), - UNIQUE KEY `id_zone` (`id_zone`,`id_shop`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; - -CREATE TABLE IF NOT EXISTS `PREFIX_accounting_product_zone_shop` ( - `id_accounting_product_zone_shop` int(11) NOT NULL AUTO_INCREMENT, - `id_product` int(11) NOT NULL, - `id_shop` int(11) NOT NULL, - `id_zone` int(11) NOT NULL, - `account_number` varchar(64) NOT NULL, - PRIMARY KEY (`id_accounting_product_zone_shop`), - UNIQUE KEY `id_product` (`id_product`,`id_shop`,`id_zone`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; - -/* PHP:add_accounting_tab(); */; - - -INSERT INTO `PREFIX_module_access` (`id_profile`, `id_module`, `configure`, `view`) ( - SELECT `id_profile`, `id_module`, 0, 1 - FROM `PREFIX_access` a, PREFIX_module m - WHERE `id_tab` = (SELECT `id_tab` FROM `PREFIX_tab` WHERE `class_name` != "" LIMIT 1) - AND a.`view` = 0 -); - -INSERT INTO `PREFIX_module_access` (`id_profile`, `id_module`, `configure`, `view`) ( - SELECT `id_profile`, `id_module`, 1, 1 - FROM `PREFIX_access` a, PREFIX_module m - WHERE `id_tab` = (SELECT `id_tab` FROM `PREFIX_tab` WHERE `class_name` != "" LIMIT 1) - AND a.`view` = 1 -); - - -UPDATE `PREFIX_tab` SET `class_name` = 'AdminThemes' WHERE `class_name` = 'AdminAppearance'; - -INSERT INTO `PREFIX_hook` ( -`name` , -`title` , -`description` , -`position` , -`live_edit` -) -VALUES ('taxmanager', 'taxmanager', NULL , '1', '0'); - -ALTER TABLE `PREFIX_tax_rule` - ADD `zipcode_from` INT NOT NULL AFTER `id_state` , - ADD `zipcode_to` INT NOT NULL AFTER `zipcode_from` , - ADD `behavior` INT NOT NULL AFTER `zipcode_to`, - ADD `description` VARCHAR( 100 ) NOT NULL AFTER `id_tax`; - -INSERT INTO `PREFIX_tax_rule` - (`id_tax_rules_group`, `id_country`, `id_state`, `id_tax`, - `behavior`, `zipcode_from`, `zipcode_to`, `id_county`, - `description`, `state_behavior`, `county_behavior`) - SELECT r.`id_tax_rules_group`, r.`id_country`, r.`id_state`, r.`id_tax`, - 0, z.`from_zip_code`, z.`to_zip_code`, r.`id_county`, - r.`description`, r.`state_behavior`, r.county_behavior - FROM - `PREFIX_tax_rule` r - INNER JOIN - `PREFIX_county_zip_code` z - ON (z.`id_county` = r.`id_county`); - -UPDATE `PREFIX_tax_rule` SET `behavior` = GREATEST(`state_behavior`, `county_behavior`); - -DELETE FROM `PREFIX_tax_rule` -WHERE `id_county` != 0 -AND `zipcode_from` = 0; - -ALTER TABLE `PREFIX_tax_rule` - DROP `id_county`, - DROP `state_behavior`, - DROP `county_behavior`; - -/* PHP:remove_tab(AdminCounty); */; -DROP TABLE `PREFIX_county_zip_code`; -DROP TABLE `PREFIX_county`; - -ALTER TABLE `PREFIX_employee` - ADD `id_last_order` tinyint(1) unsigned NOT NULL default '0', - ADD `id_last_customer_message` tinyint(1) unsigned NOT NULL default '0', - ADD `id_last_customer` tinyint(1) unsigned NOT NULL default '0'; - -INSERT INTO `PREFIX_configuration` (`name`, `value`, `date_add`, `date_upd`) VALUES -('PS_SHOW_NEW_ORDERS', '1', NOW(), NOW()), -('PS_SHOW_NEW_CUSTOMERS', '1', NOW(), NOW()), -('PS_SHOW_NEW_MESSAGES', '1', NOW(), NOW()), -('PS_FEATURE_FEATURE_ACTIVE', '1', NOW(), NOW()), -('PS_COMBINATION_FEATURE_ACTIVE', '1', NOW(), NOW()), -('PS_ADMINREFRESH_NOTIFICATION', '1', NOW(), NOW()); - -/* PHP:update_feature_detachable_cache(); */; - -ALTER TABLE `PREFIX_product` ADD `available_date` DATE NOT NULL AFTER `available_for_order`; - -ALTER TABLE `PREFIX_product_attribute` ADD `available_date` DATE NOT NULL; - -/* Index was only used by deprecated function Image::positionImage() */ -ALTER TABLE `PREFIX_image` DROP INDEX `product_position`; - -CREATE TABLE IF NOT EXISTS `PREFIX_gender` ( - `id_gender` int(11) NOT NULL AUTO_INCREMENT, - `type` tinyint(1) NOT NULL, - PRIMARY KEY (`id_gender`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; - -CREATE TABLE IF NOT EXISTS `PREFIX_gender_lang` ( - `id_gender` int(10) unsigned NOT NULL, - `id_lang` int(10) unsigned NOT NULL, - `name` varchar(20) NOT NULL, - PRIMARY KEY (`id_gender`,`id_lang`), - KEY `id_gender` (`id_gender`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; - -INSERT INTO `PREFIX_gender` (`id_gender`, `type`) VALUES -(1, 0), -(2, 1), -(3, 1); - -INSERT INTO `PREFIX_gender_lang` (`id_gender`, `id_lang`, `name`) VALUES -(1, 1, 'Mr.'), -(1, 2, 'M.'), -(1, 3, 'Sr.'), -(1, 4, 'Herr'), -(1, 5, 'Sig.'), -(2, 1, 'Ms.'), -(2, 2, 'Mme'), -(2, 3, 'Sra.'), -(2, 4, 'Frau'), -(2, 5, 'Sig.ra'), -(3, 1, 'Miss'), -(3, 2, 'Mlle'), -(3, 3, 'Miss'), -(3, 4, 'Miss'), -(3, 5, 'Miss'); - -DELETE FROM `PREFIX_configuration` WHERE `name` = 'PS_FORCE_SMARTY_2'; - -CREATE TABLE IF NOT EXISTS `PREFIX_order_detail_tax` ( -`id_order_detail` INT NOT NULL , -`id_tax` INT NOT NULL -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; - -ALTER TABLE `PREFIX_tax` ADD `deleted` INT NOT NULL AFTER `active`; - -/* PHP:update_order_detail_taxes(); */; - -CREATE TABLE `PREFIX_customer_message_sync_imap` ( - `md5_header` varbinary(32) NOT NULL, - KEY `md5_header_index` (`md5_header`(4)) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; - -ALTER TABLE `PREFIX_customer_message` ADD `private` TINYINT NOT NULL DEFAULT '0' AFTER `user_agent`; - -/* PHP:add_new_tab(AdminGenders, fr:Genres|es:Genders|en:Genders|de:Genders|it:Genders, 2); */; - -ALTER TABLE `PREFIX_attribute` ADD `position` INT( 10 ) UNSIGNED NOT NULL DEFAULT '0'; - -/* PHP:add_attribute_position(); */; - -ALTER TABLE `PREFIX_product_download` CHANGE `date_deposit` `date_add` DATETIME NOT NULL ; -ALTER TABLE `PREFIX_product_download` CHANGE `physically_filename` `filename` VARCHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL; -ALTER TABLE `PREFIX_product_download` ADD `id_product_attribute` INT( 10 ) UNSIGNED NOT NULL AFTER `id_product` , ADD INDEX ( `id_product_attribute` ); -ALTER TABLE `PREFIX_product_download` ADD `is_shareable` TINYINT( 1 ) UNSIGNED NOT NULL DEFAULT '0' AFTER `active`; - -ALTER TABLE `PREFIX_attribute_group` ADD `position` INT( 10 ) UNSIGNED NOT NULL DEFAULT '0'; - -ALTER TABLE `PREFIX_attribute_group` ADD `group_type` ENUM('select', 'radio', 'color') NOT NULL DEFAULT 'select'; -UPDATE `PREFIX_attribute_group` SET `group_type`='color' WHERE `is_color_group` = 1; -ALTER TABLE `PREFIX_product` DROP `id_color_default`; - -/* PHP:add_group_attribute_position(); */; - -ALTER TABLE `PREFIX_feature` ADD `position` INT( 10 ) UNSIGNED NOT NULL DEFAULT '0'; - -/* PHP:add_feature_position(); */; - -CREATE TABLE IF NOT EXISTS `PREFIX_request_sql` ( - `id_request_sql` int(11) NOT NULL AUTO_INCREMENT, - `name` varchar(200) NOT NULL, - `sql` text NOT NULL, - PRIMARY KEY (`id_request_sql`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; - -/* PHP:add_new_tab(AdminRequestSql, fr:SQL Manager|es:SQL Manager|en:SQL Manager|de:Wunsh|it:SQL Manager, 9); */; - -ALTER TABLE `PREFIX_carrier` ADD COLUMN `id_reference` int(10) NOT NULL AFTER `id_carrier`; -UPDATE `PREFIX_carrier` SET id_reference = id_carrier; - -ALTER TABLE `PREFIX_product` ADD `is_virtual` TINYINT( 1 ) NOT NULL DEFAULT '0' AFTER `cache_has_attachments`; - -/* PHP:add_new_tab(AdminProducts, fr:Produits|es:Productos|en:Products|de:Produkten|it:Prodotti, 1); */; -/* PHP:add_new_tab(AdminCategories, fr:Catégories|es:Categoria|en:Categories|de:Kategorien|it:Categories, 1); */; - -CREATE TABLE IF NOT EXISTS `PREFIX_employee_shop` ( -`id_employee` INT( 11 ) UNSIGNED NOT NULL , -`id_shop` INT( 11 ) UNSIGNED NOT NULL , -PRIMARY KEY ( `id_employee` , `id_shop` ) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; - -INSERT INTO `PREFIX_employee_shop` (`id_employee`, `id_shop`) (SELECT `id_employee`, 1 FROM `PREFIX_employee`); - -UPDATE `PREFIX_access` SET `view` = 0, `add` = 0, `edit` = 0, `delete` = 0 WHERE `id_tab` = (SELECT `id_tab` FROM `PREFIX_tab` t WHERE t.`class_name` = 'AdminShop' LIMIT 1) AND `id_profile` != 1; - -ALTER TABLE `PREFIX_carrier` ADD `position` INT( 10 ) UNSIGNED NOT NULL DEFAULT '0'; - -/* PHP:add_carrier_position(); */; - -ALTER TABLE `PREFIX_order_state` ADD COLUMN `shipped` TINYINT(1) UNSIGNED NOT NULL DEFAULT 0 AFTER `delivery`; -UPDATE `PREFIX_order_state` SET `shipped` = 1 WHERE id_order_state IN (4, 5); - -CREATE TABLE `PREFIX_order_invoice` ( - `id_order_invoice` int(11) NOT NULL AUTO_INCREMENT, - `id_order` int(11) NOT NULL, - `number` int(11) NOT NULL, - `total_discount_tax_excl` decimal(17,2) NOT NULL DEFAULT '0.00', - `total_discount_tax_incl` decimal(17,2) NOT NULL DEFAULT '0.00', - `total_paid_tax_excl` decimal(17,2) NOT NULL DEFAULT '0.00', - `total_paid_tax_incl` decimal(17,2) NOT NULL DEFAULT '0.00', - `total_products` decimal(17,2) NOT NULL DEFAULT '0.00', - `total_products_wt` decimal(17,2) NOT NULL DEFAULT '0.00', - `total_shipping_tax_excl` decimal(17,2) NOT NULL DEFAULT '0.00', - `total_shipping_tax_incl` decimal(17,2) NOT NULL DEFAULT '0.00', - `total_wrapping_tax_excl` decimal(17,2) NOT NULL DEFAULT '0.00', - `total_wrapping_tax_incl` decimal(17,2) NOT NULL DEFAULT '0.00', - `date_add` datetime NOT NULL, - PRIMARY KEY (`id_order_invoice`), - KEY `id_order` (`id_order`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; - -ALTER TABLE `PREFIX_order_detail` ADD `id_order_invoice` int(11) NOT NULL DEFAULT 0 AFTER `id_order`; - -ALTER TABLE `PREFIX_payment_cc` CHANGE `id_payment_cc` `id_order_payment` INT NOT NULL auto_increment; -ALTER TABLE `PREFIX_payment_cc` ADD `id_order_invoice` varchar(255) NOT NULL AFTER `id_order_payment`; -ALTER TABLE `PREFIX_payment_cc` ADD `payment_method` varchar(255) NOT NULL AFTER `amount`; -ALTER TABLE `PREFIX_payment_cc` ADD `conversion_rate` decimal(13,6) NOT NULL DEFAULT 1 AFTER `payment_method`; - -RENAME TABLE `PREFIX_payment_cc` TO `PREFIX_order_payment`; - -ALTER TABLE `PREFIX_carrier` - ADD COLUMN `max_width` int(10) DEFAULT 0 AFTER `position`, - ADD COLUMN `max_height` int(10) DEFAULT 0 AFTER `max_width`, - ADD COLUMN `max_depth` int(10) DEFAULT 0 AFTER `max_height`, - ADD COLUMN `max_weight` int(10) DEFAULT 0 AFTER `max_depth`, - ADD COLUMN `grade` int(10) DEFAULT 0 AFTER `max_weight`; - -ALTER TABLE `PREFIX_cart_product` - ADD COLUMN `id_address_delivery` int(10) UNSIGNED DEFAULT 0 AFTER `date_add`; - -UPDATE `PREFIX_cart_product` SET id_address_delivery = 0; - -ALTER TABLE `PREFIX_cart` ADD COLUMN `allow_seperated_package` TINYINT(1) UNSIGNED NOT NULL DEFAULT 0 AFTER `gift_message`; -CREATE TABLE `PREFIX_product_carrier` ( - `id_product` int(10) unsigned NOT NULL, - `id_carrier_reference` int(10) unsigned NOT NULL, - `id_shop` int(10) unsigned NOT NULL, - PRIMARY KEY (`id_product`, `id_carrier_reference`, `id_shop`) -) ENGINE = ENGINE_TYPE DEFAULT CHARSET=utf8; - -ALTER TABLE `PREFIX_customization` ADD COLUMN `id_address_delivery` int(10) UNSIGNED NOT NULL DEFAULT 0 AFTER `id_product_attribute`, - DROP PRIMARY KEY, - ADD PRIMARY KEY (`id_customization`, `id_cart`, `id_product`, `id_address_delivery`); - -CREATE TABLE `PREFIX_cart_rule` ( - `id_cart_rule` int(10) unsigned NOT NULL auto_increment, - `id_customer` int unsigned NOT NULL default 0, - `date_from` datetime NOT NULL, - `date_to` datetime NOT NULL, - `description` text, - `quantity` int(10) unsigned NOT NULL default 0, - `quantity_per_user` int(10) unsigned NOT NULL default 0, - `priority` int(10) unsigned NOT NULL default 1, - `code` varchar(254) NOT NULL, - `minimum_amount` decimal(17,2) NOT NULL default 0, - `minimum_amount_tax` tinyint(1) NOT NULL default 0, - `minimum_amount_currency` int unsigned NOT NULL default 0, - `minimum_amount_shipping` tinyint(1) NOT NULL default 0, - `country_restriction` tinyint(1) unsigned NOT NULL default 0, - `carrier_restriction` tinyint(1) unsigned NOT NULL default 0, - `group_restriction` tinyint(1) unsigned NOT NULL default 0, - `cart_rule_restriction` tinyint(1) unsigned NOT NULL default 0, - `product_restriction` tinyint(1) unsigned NOT NULL default 0, - `free_shipping` tinyint(1) NOT NULL default 0, - `reduction_percent` decimal(5,2) NOT NULL default 0, - `reduction_amount` decimal(17,2) NOT NULL default 0, - `reduction_tax` tinyint(1) unsigned NOT NULL default 0, - `reduction_currency` int(10) unsigned NOT NULL default 0, - `reduction_product` int(10) NOT NULL default 0, - `gift_product` int(10) unsigned NOT NULL default 0, - `active` tinyint(1) unsigned NOT NULL default 0, - `date_add` datetime NOT NULL, - `date_upd` datetime NOT NULL, - PRIMARY KEY (`id_cart_rule`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; - -CREATE TABLE `PREFIX_cart_rule_country` ( - `id_cart_rule` int(10) unsigned NOT NULL, - `id_country` int(10) unsigned NOT NULL, - PRIMARY KEY (`id_cart_rule`, `id_country`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; - -CREATE TABLE `PREFIX_cart_rule_group` ( - `id_cart_rule` int(10) unsigned NOT NULL, - `id_group` int(10) unsigned NOT NULL, - PRIMARY KEY (`id_cart_rule`, `id_group`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; - -CREATE TABLE `PREFIX_cart_rule_carrier` ( - `id_cart_rule` int(10) unsigned NOT NULL, - `id_carrier` int(10) unsigned NOT NULL, - PRIMARY KEY (`id_cart_rule`, `id_carrier`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; - -CREATE TABLE `PREFIX_cart_rule_combination` ( - `id_cart_rule_1` int(10) unsigned NOT NULL, - `id_cart_rule_2` int(10) unsigned NOT NULL, - PRIMARY KEY (`id_cart_rule_1`, `id_cart_rule_2`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; - -CREATE TABLE `PREFIX_cart_rule_product_rule` ( - `id_product_rule` int(10) unsigned NOT NULL auto_increment, - `id_cart_rule` int(10) unsigned NOT NULL, - `quantity` int(10) unsigned NOT NULL default 1, - `type` ENUM('products', 'categories', 'attributes') NOT NULL, - PRIMARY KEY (`id_product_rule`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; - -SET @id_currency_default = (SELECT value FROM `PREFIX_configuration` WHERE name = 'PS_CURRENCY_DEFAULT' LIMIT 1); -INSERT INTO `PREFIX_cart_rule` ( - `id_cart_rule`, - `id_customer`, - `date_from`, - `date_to`, - `description`, - `quantity`, - `quantity_per_user`, - `priority`, - `code`, - `minimum_amount`, - `minimum_amount_tax`, - `minimum_amount_currency`, - `minimum_amount_shipping`, - `country_restriction`, - `carrier_restriction`, - `group_restriction`, - `cart_rule_restriction`, - `product_restriction`, - `free_shipping`, - `reduction_percent`, - `reduction_amount`, - `reduction_tax`, - `reduction_currency`, - `reduction_product`, - `gift_product`, - `active`, - `date_add`, - `date_upd` -) ( - SELECT - `id_discount`, - `id_customer`, - `date_from`, - `date_to`, - `name`, - `quantity`, - `quantity_per_user`, - 1, - `name`, - `minimal`, - 1, - @id_currency_default, - 1, - 0, - 0, - IF(id_group = 0, 0, 1), - IF(cumulable = 1, 0, 1), - 0, - IF(id_discount_type = 3, 1, 0), - IF(id_discount_type = 1, value, 0), - IF(id_discount_type = 2, value, 0), - 1, - `id_currency`, - 0, - 0, - `active`, - `date_add`, - `date_upd` - FROM `PREFIX_discount` -); - -RENAME TABLE `PREFIX_discount_lang` TO `PREFIX_cart_rule_lang`; -ALTER TABLE `PREFIX_cart_rule_lang` CHANGE `id_discount` `id_cart_rule` int(10) unsigned NOT NULL; -ALTER TABLE `PREFIX_cart_rule_lang` CHANGE `description` `name` varchar(254) NOT NULL; -RENAME TABLE `PREFIX_discount_category` TO `PREFIX_cart_rule_product_rule_value`; -ALTER TABLE `PREFIX_cart_rule_product_rule_value` CHANGE `id_category` `id_item` int(10) unsigned NOT NULL; -ALTER TABLE `PREFIX_cart_rule_product_rule_value` CHANGE `id_discount` `id_product_rule` int(10) unsigned NOT NULL; -INSERT INTO `PREFIX_cart_rule_product_rule` (`id_product_rule`, `id_cart_rule`, `quantity`, `type`) ( - SELECT DISTINCT `id_product_rule`, `id_product_rule`, 1, 'categories' FROM `PREFIX_cart_rule_product_rule_value` -); -UPDATE `PREFIX_cart_rule` SET product_restriction = 1 WHERE `id_cart_rule` IN (SELECT `id_cart_rule` FROM `PREFIX_cart_rule_product_rule`); - -ALTER TABLE `PREFIX_cart_discount` CHANGE `id_discount` `id_cart_rule` int(10) unsigned NOT NULL; -ALTER TABLE `PREFIX_order_discount` CHANGE `id_discount` `id_cart_rule` int(10) unsigned NOT NULL; -ALTER TABLE `PREFIX_order_discount` CHANGE `id_order_discount` `id_order_cart_rule` int(10) unsigned NOT NULL AUTO_INCREMENT; - -RENAME TABLE `PREFIX_order_discount` TO `PREFIX_order_cart_rule`; -RENAME TABLE `PREFIX_cart_discount` TO `PREFIX_cart_cart_rule`; - -INSERT INTO `PREFIX_configuration` (`name`, `value`, `date_add`, `date_upd`) ( - SELECT 'PS_CART_RULE_FEATURE_ACTIVE', `value`, NOW(), NOW() FROM `PREFIX_configuration` WHERE `name` = 'PS_DISCOUNT_FEATURE_ACTIVE' LIMIT 1 -); - -UPDATE `PREFIX_tab` SET class_name = 'AdminCartRules' WHERE class_name = 'AdminDiscounts'; - -UPDATE `PREFIX_hook` SET `name` = 'displayPayment' WHERE `name` = 'payment'; -UPDATE `PREFIX_hook` SET `name` = 'actionValidateOrder' WHERE `name` = 'newOrder'; -UPDATE `PREFIX_hook` SET `name` = 'actionPaymentConfirmation' WHERE `name` = 'paymentConfirm'; -UPDATE `PREFIX_hook` SET `name` = 'displayPaymentReturn' WHERE `name` = 'paymentReturn'; -UPDATE `PREFIX_hook` SET `name` = 'actionUpdateQuantity' WHERE `name` = 'updateQuantity'; -UPDATE `PREFIX_hook` SET `name` = 'displayRightColumn' WHERE `name` = 'rightColumn'; -UPDATE `PREFIX_hook` SET `name` = 'displayLeftColumn' WHERE `name` = 'leftColumn'; -UPDATE `PREFIX_hook` SET `name` = 'displayHome' WHERE `name` = 'home'; -UPDATE `PREFIX_hook` SET `name` = 'displayHeader' WHERE `name` = 'header'; -UPDATE `PREFIX_hook` SET `name` = 'actionCartSave' WHERE `name` = 'cart'; -UPDATE `PREFIX_hook` SET `name` = 'actionAuthentication' WHERE `name` = 'authentication'; -UPDATE `PREFIX_hook` SET `name` = 'actionProductAdd' WHERE `name` = 'addproduct'; -UPDATE `PREFIX_hook` SET `name` = 'actionProductUpdate' WHERE `name` = 'updateproduct'; -UPDATE `PREFIX_hook` SET `name` = 'displayTop' WHERE `name` = 'top'; -UPDATE `PREFIX_hook` SET `name` = 'displayRightColumnProduct' WHERE `name` = 'extraRight'; -UPDATE `PREFIX_hook` SET `name` = 'actionProductDelete' WHERE `name` = 'deleteproduct'; -UPDATE `PREFIX_hook` SET `name` = 'displayFooterProduct' WHERE `name` = 'productfooter'; -UPDATE `PREFIX_hook` SET `name` = 'displayInvoice' WHERE `name` = 'invoice'; -UPDATE `PREFIX_hook` SET `name` = 'actionOrderStatusUpdate' WHERE `name` = 'updateOrderStatus'; -UPDATE `PREFIX_hook` SET `name` = 'displayAdminOrder' WHERE `name` = 'adminOrder'; -UPDATE `PREFIX_hook` SET `name` = 'displayFooter' WHERE `name` = 'footer'; -UPDATE `PREFIX_hook` SET `name` = 'displayPDFInvoice' WHERE `name` = 'PDFInvoice'; -UPDATE `PREFIX_hook` SET `name` = 'displayAdminCustomers' WHERE `name` = 'adminCustomers'; -UPDATE `PREFIX_hook` SET `name` = 'displayOrderConfirmation' WHERE `name` = 'orderConfirmation'; -UPDATE `PREFIX_hook` SET `name` = 'actionCustomerAccountAdd' WHERE `name` = 'createAccount'; -UPDATE `PREFIX_hook` SET `name` = 'displayCustomerAccount' WHERE `name` = 'customerAccount'; -UPDATE `PREFIX_hook` SET `name` = 'actionOrderSlipAdd' WHERE `name` = 'orderSlip'; -UPDATE `PREFIX_hook` SET `name` = 'displayProductTab' WHERE `name` = 'productTab'; -UPDATE `PREFIX_hook` SET `name` = 'displayProductTabContent' WHERE `name` = 'productTabContent'; -UPDATE `PREFIX_hook` SET `name` = 'displayShoppingCartFooter' WHERE `name` = 'shoppingCart'; -UPDATE `PREFIX_hook` SET `name` = 'displayCustomerAccountForm' WHERE `name` = 'createAccountForm'; -UPDATE `PREFIX_hook` SET `name` = 'displayAdminStatsModules' WHERE `name` = 'AdminStatsModules'; -UPDATE `PREFIX_hook` SET `name` = 'displayAdminStatsGraphEngine' WHERE `name` = 'GraphEngine'; -UPDATE `PREFIX_hook` SET `name` = 'actionOrderReturn' WHERE `name` = 'orderReturn'; -UPDATE `PREFIX_hook` SET `name` = 'displayProductButtons' WHERE `name` = 'productActions'; -UPDATE `PREFIX_hook` SET `name` = 'displayBackOfficeHome' WHERE `name` = 'backOfficeHome'; -UPDATE `PREFIX_hook` SET `name` = 'displayAdminStatsGridEngine' WHERE `name` = 'GridEngine'; -UPDATE `PREFIX_hook` SET `name` = 'actionWatermark' WHERE `name` = 'watermark'; -UPDATE `PREFIX_hook` SET `name` = 'actionProductCancel' WHERE `name` = 'cancelProduct'; -UPDATE `PREFIX_hook` SET `name` = 'displayLeftColumnProduct' WHERE `name` = 'extraLeft'; -UPDATE `PREFIX_hook` SET `name` = 'actionProductOutOfStock' WHERE `name` = 'productOutOfStock'; -UPDATE `PREFIX_hook` SET `name` = 'actionProductAttributeUpdate' WHERE `name` = 'updateProductAttribute'; -UPDATE `PREFIX_hook` SET `name` = 'displayCarrierList' WHERE `name` = 'extraCarrier'; -UPDATE `PREFIX_hook` SET `name` = 'displayShoppingCart' WHERE `name` = 'shoppingCartExtra'; -UPDATE `PREFIX_hook` SET `name` = 'actionSearch' WHERE `name` = 'search'; -UPDATE `PREFIX_hook` SET `name` = 'displayBeforePayment' WHERE `name` = 'backBeforePayment'; -UPDATE `PREFIX_hook` SET `name` = 'actionCarrierUpdate' WHERE `name` = 'updateCarrier'; -UPDATE `PREFIX_hook` SET `name` = 'actionOrderStatusPostUpdate' WHERE `name` = 'postUpdateOrderStatus'; -UPDATE `PREFIX_hook` SET `name` = 'displayCustomerAccountFormTop' WHERE `name` = 'createAccountTop'; -UPDATE `PREFIX_hook` SET `name` = 'displayBackOfficeHeader' WHERE `name` = 'backOfficeHeader'; -UPDATE `PREFIX_hook` SET `name` = 'displayBackOfficeTop' WHERE `name` = 'backOfficeTop'; -UPDATE `PREFIX_hook` SET `name` = 'displayBackOfficeFooter' WHERE `name` = 'backOfficeFooter'; -UPDATE `PREFIX_hook` SET `name` = 'actionProductAttributeDelete' WHERE `name` = 'deleteProductAttribute'; -UPDATE `PREFIX_hook` SET `name` = 'actionCarrierProcess' WHERE `name` = 'processCarrier'; -UPDATE `PREFIX_hook` SET `name` = 'actionOrderDetail' WHERE `name` = 'orderDetail'; -UPDATE `PREFIX_hook` SET `name` = 'displayBeforeCarrier' WHERE `name` = 'beforeCarrier'; -UPDATE `PREFIX_hook` SET `name` = 'displayOrderDetail' WHERE `name` = 'orderDetailDisplayed'; -UPDATE `PREFIX_hook` SET `name` = 'actionPaymentCCAdd' WHERE `name` = 'paymentCCAdded'; -UPDATE `PREFIX_hook` SET `name` = 'displayProductComparison' WHERE `name` = 'extraProductComparison'; -UPDATE `PREFIX_hook` SET `name` = 'actionCategoryAdd' WHERE `name` = 'categoryAddition'; -UPDATE `PREFIX_hook` SET `name` = 'actionCategoryUpdate' WHERE `name` = 'categoryUpdate'; -UPDATE `PREFIX_hook` SET `name` = 'actionCategoryDelete' WHERE `name` = 'categoryDeletion'; -UPDATE `PREFIX_hook` SET `name` = 'actionBeforeAuthentication' WHERE `name` = 'beforeAuthentication'; -UPDATE `PREFIX_hook` SET `name` = 'displayPaymentTop' WHERE `name` = 'paymentTop'; -UPDATE `PREFIX_hook` SET `name` = 'actionHtaccessCreate' WHERE `name` = 'afterCreateHtaccess'; -UPDATE `PREFIX_hook` SET `name` = 'actionAdminMetaSave' WHERE `name` = 'afterSaveAdminMeta'; -UPDATE `PREFIX_hook` SET `name` = 'displayAttributeGroupForm' WHERE `name` = 'attributeGroupForm'; -UPDATE `PREFIX_hook` SET `name` = 'actionAttributeGroupSave' WHERE `name` = 'afterSaveAttributeGroup'; -UPDATE `PREFIX_hook` SET `name` = 'actionAttributeGroupDelete' WHERE `name` = 'afterDeleteAttributeGroup'; -UPDATE `PREFIX_hook` SET `name` = 'displayFeatureForm' WHERE `name` = 'featureForm'; -UPDATE `PREFIX_hook` SET `name` = 'actionFeatureSave' WHERE `name` = 'afterSaveFeature'; -UPDATE `PREFIX_hook` SET `name` = 'actionFeatureDelete' WHERE `name` = 'afterDeleteFeature'; -UPDATE `PREFIX_hook` SET `name` = 'actionProductSave' WHERE `name` = 'afterSaveProduct'; -UPDATE `PREFIX_hook` SET `name` = 'actionProductListOverride' WHERE `name` = 'productListAssign'; -UPDATE `PREFIX_hook` SET `name` = 'displayAttributeGroupPostProcess' WHERE `name` = 'postProcessAttributeGroup'; -UPDATE `PREFIX_hook` SET `name` = 'displayFeaturePostProcess' WHERE `name` = 'postProcessFeature'; -UPDATE `PREFIX_hook` SET `name` = 'displayFeatureValueForm' WHERE `name` = 'featureValueForm'; -UPDATE `PREFIX_hook` SET `name` = 'displayFeatureValuePostProcess' WHERE `name` = 'postProcessFeatureValue'; -UPDATE `PREFIX_hook` SET `name` = 'actionFeatureValueDelete' WHERE `name` = 'afterDeleteFeatureValue'; -UPDATE `PREFIX_hook` SET `name` = 'actionFeatureValueSave' WHERE `name` = 'afterSaveFeatureValue'; -UPDATE `PREFIX_hook` SET `name` = 'displayAttributeForm' WHERE `name` = 'attributeForm'; -UPDATE `PREFIX_hook` SET `name` = 'actionAttributePostProcess' WHERE `name` = 'postProcessAttribute'; -UPDATE `PREFIX_hook` SET `name` = 'actionAttributeDelete' WHERE `name` = 'afterDeleteAttribute'; -UPDATE `PREFIX_hook` SET `name` = 'actionAttributeSave' WHERE `name` = 'afterSaveAttribute'; -UPDATE `PREFIX_hook` SET `name` = 'actionTaxManager' WHERE `name` = 'taxManager'; - -ALTER TABLE `PREFIX_order_detail_tax` -ADD `unit_amount` DECIMAL(16, 6) NOT NULL AFTER `id_tax`, -ADD `total_amount` DECIMAL(16, 6) NOT NULL AFTER `unit_amount`; - - -ALTER TABLE `PREFIX_specific_price` ADD `id_product_attribute` INT UNSIGNED NOT NULL AFTER `id_product`; -ALTER TABLE `PREFIX_specific_price` DROP INDEX `id_product`; -ALTER TABLE `PREFIX_specific_price` ADD INDEX `id_product` (`id_product`, `id_product_attribute`, `id_shop`, `id_currency`, `id_country`, `id_group`, `from_quantity`, `from`, `to`); - - -/* PHP:add_column_orders_reference_if_not_exists(); */; -ALTER TABLE `PREFIX_orders` ADD COLUMN `id_warehouse` int(10) unsigned DEFAULT 0 AFTER `id_carrier`; - -ALTER TABLE `PREFIX_cart` ADD COLUMN `order_reference` varchar(9) AFTER `id_cart`; -ALTER TABLE `PREFIX_cart` ADD COLUMN `delivery_option` varchar(100) AFTER `id_carrier`; - -ALTER TABLE `PREFIX_tax` ADD COLUMN `account_number` VARCHAR(64) NOT NULL; - -/* PHP:add_new_tab(AdminAttributeGenerator, fr:Générateur de déclinaisons|es:Combinations generator|en:Combinations generator|de:Combinations generator|it:Combinations generator, -1); */; -/* PHP:add_new_tab(AdminCMSCategories, fr:Catégories CMS|es:CMS categories|en:CMS categories|de:CMS categories|it:CMS categories, -1); */; -/* 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` = '0', `add` = '0', `edit` = '0', `delete` = '0' WHERE `id_tab` = (SELECT `id_tab` FROM `PREFIX_tab` t WHERE t.`class_name` = 'AdminCmsCategories' LIMIT 1) AND `id_profile` = '3'; -UPDATE `PREFIX_access` SET `view` = '0', `add` = '0', `edit` = '0', `delete` = '0' WHERE `id_tab` = (SELECT `id_tab` FROM `PREFIX_tab` t WHERE t.`class_name` = 'AdminCmsCategories' LIMIT 1) AND `id_profile` = '5'; - -UPDATE `PREFIX_access` SET `view` = '0', `add` = '0', `edit` = '0', `delete` = '0' WHERE `id_tab` = (SELECT `id_tab` FROM `PREFIX_tab` t WHERE t.`class_name` = 'AdminCms' LIMIT 1) AND `id_profile` = '3'; -UPDATE `PREFIX_access` SET `view` = '0', `add` = '0', `edit` = '0', `delete` = '0' WHERE `id_tab` = (SELECT `id_tab` FROM `PREFIX_tab` t WHERE t.`class_name` = 'AdminCms' LIMIT 1) AND `id_profile` = '5'; - -INSERT INTO `PREFIX_configuration` (`name`, `value`, `date_add`, `date_upd`) VALUES ('PS_CUSTOMER_GROUP', '1', NOW(), NOW()); - -/* PHP:add_new_groups('Visiteur', 'Visitor'); */; -/* PHP:add_new_groups('Invité', 'Guest'); */; - -UPDATE `PREFIX_employee` SET `bo_theme` = 'default'; - -UPDATE `PREFIX_tab` SET `class_name` = 'AdminCmsContent' WHERE `class_name` = 'AdminCMSContent'; -UPDATE `PREFIX_tab` SET `class_name` = 'AdminCms' WHERE `class_name` = 'AdminCMS'; -UPDATE `PREFIX_tab` SET `class_name` = 'AdminCmsCategories' WHERE `class_name` = 'AdminCMSCategories'; -UPDATE `PREFIX_tab` SET `class_name` = 'AdminPdf' WHERE `class_name` = 'AdminPDF'; - -CREATE TABLE `PREFIX_order_carrier` ( - `id_order_carrier` int(11) NOT NULL AUTO_INCREMENT, - `id_order` int(11) unsigned NOT NULL, - `id_carrier` int(11) unsigned NOT NULL, - `id_order_invoice` int(11) unsigned DEFAULT NULL, - `weight` float DEFAULT NULL, - `shipping_cost_tax_excl` decimal(20,6) DEFAULT NULL, - `shipping_cost_tax_incl` decimal(20,6) DEFAULT NULL, - `tracking_number` varchar(64) DEFAULT NULL, - `date_add` datetime NOT NULL, - PRIMARY KEY (`id_order_carrier`), - KEY `id_order` (`id_order`), - KEY `id_carrier` (`id_carrier`), - KEY `id_order_invoice` (`id_order_invoice`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; - -ALTER TABLE `PREFIX_order_slip` ADD COLUMN `amount` DECIMAL(10,2) NOT NULL AFTER `shipping_cost`; -ALTER TABLE `PREFIX_order_slip` ADD COLUMN `shipping_cost_amount` DECIMAL(10,2) NOT NULL AFTER `amount`; -ALTER TABLE `PREFIX_order_slip` ADD COLUMN `partial` TINYINT(1) NOT NULL AFTER `shipping_cost_amount`; -ALTER TABLE `PREFIX_order_slip_detail` ADD COLUMN `amount` DECIMAL(10,2) NOT NULL AFTER `product_quantity`; - -INSERT INTO `PREFIX_tab` (`id_parent`, `class_name`, `position`) VALUES (-1, 'AdminLogin', 0); - -CREATE TABLE `PREFIX_hook_alias` ( - `id_hook_alias` int(10) unsigned NOT NULL auto_increment, - `alias` varchar(64) NOT NULL, - `name` varchar(64) NOT NULL, - PRIMARY KEY (`id_hook_alias`), - UNIQUE KEY `alias` (`alias`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; - -INSERT INTO `PREFIX_hook_alias` (`id_hook_alias`, `name`, `alias`) VALUES -(1, 'displayPayment', 'payment'), -(2, 'actionValidateOrder', 'newOrder'), -(3, 'actionPaymentConfirmation', 'paymentConfirm'), -(4, 'displayPaymentReturn', 'paymentReturn'), -(5, 'actionUpdateQuantity', 'updateQuantity'), -(6, 'displayRightColumn', 'rightColumn'), -(7, 'displayLeftColumn', 'leftColumn'), -(8, 'displayHome', 'home'), -(9, 'displayHeader', 'header'), -(10, 'actionCartSave', 'cart'), -(11, 'actionAuthentication', 'authentication'), -(12, 'actionProductAdd', 'addproduct'), -(13, 'actionProductUpdate', 'updateproduct'), -(14, 'displayTop', 'top'), -(15, 'displayRightColumnProduct', 'extraRight'), -(16, 'actionProductDelete', 'deleteproduct'), -(17, 'displayFooterProduct', 'productfooter'), -(18, 'displayInvoice', 'invoice'), -(19, 'actionOrderStatusUpdate', 'updateOrderStatus'), -(20, 'displayAdminOrder', 'adminOrder'), -(21, 'displayFooter', 'footer'), -(22, 'displayPDFInvoice', 'PDFInvoice'), -(23, 'displayAdminCustomers', 'adminCustomers'), -(24, 'displayOrderConfirmation', 'orderConfirmation'), -(25, 'actionCustomerAccountAdd', 'createAccount'), -(26, 'displayCustomerAccount', 'customerAccount'), -(27, 'actionOrderSlipAdd', 'orderSlip'), -(28, 'displayProductTab', 'productTab'), -(29, 'displayProductTabContent', 'productTabContent'), -(30, 'displayShoppingCartFooter', 'shoppingCart'), -(31, 'displayCustomerAccountForm', 'createAccountForm'), -(32, 'displayAdminStatsModules', 'AdminStatsModules'), -(33, 'displayAdminStatsGraphEngine', 'GraphEngine'), -(34, 'actionOrderReturn', 'orderReturn'), -(35, 'displayProductButtons', 'productActions'), -(36, 'displayBackOfficeHome', 'backOfficeHome'), -(37, 'displayAdminStatsGridEngine', 'GridEngine'), -(38, 'actionWatermark', 'watermark'), -(39, 'actionProductCancel', 'cancelProduct'), -(40, 'displayLeftColumnProduct', 'extraLeft'), -(41, 'actionProductOutOfStock', 'productOutOfStock'), -(42, 'actionProductAttributeUpdate', 'updateProductAttribute'), -(43, 'displayCarrierList', 'extraCarrier'), -(44, 'displayShoppingCart', 'shoppingCartExtra'), -(45, 'actionSearch', 'search'), -(46, 'displayBeforePayment', 'backBeforePayment'), -(47, 'actionCarrierUpdate', 'updateCarrier'), -(48, 'actionOrderStatusPostUpdate', 'postUpdateOrderStatus'), -(49, 'displayCustomerAccountFormTop', 'createAccountTop'), -(50, 'displayBackOfficeHeader', 'backOfficeHeader'), -(51, 'displayBackOfficeTop', 'backOfficeTop'), -(52, 'displayBackOfficeFooter', 'backOfficeFooter'), -(53, 'actionProductAttributeDelete', 'deleteProductAttribute'), -(54, 'actionCarrierProcess', 'processCarrier'), -(55, 'actionOrderDetail', 'orderDetail'), -(56, 'displayBeforeCarrier', 'beforeCarrier'), -(57, 'displayOrderDetail', 'orderDetailDisplayed'), -(58, 'actionPaymentCCAdd', 'paymentCCAdded'), -(59, 'displayProductComparison', 'extraProductComparison'), -(60, 'actionCategoryAdd', 'categoryAddition'), -(61, 'actionCategoryUpdate', 'categoryUpdate'), -(62, 'actionCategoryDelete', 'categoryDeletion'), -(63, 'actionBeforeAuthentication', 'beforeAuthentication'), -(64, 'displayPaymentTop', 'paymentTop'), -(65, 'actionHtaccessCreate', 'afterCreateHtaccess'), -(66, 'actionAdminMetaSave', 'afterSaveAdminMeta'), -(67, 'displayAttributeGroupForm', 'attributeGroupForm'), -(68, 'actionAttributeGroupSave', 'afterSaveAttributeGroup'), -(69, 'actionAttributeGroupDelete', 'afterDeleteAttributeGroup'), -(70, 'displayFeatureForm', 'featureForm'), -(71, 'actionFeatureSave', 'afterSaveFeature'), -(72, 'actionFeatureDelete', 'afterDeleteFeature'), -(73, 'actionProductSave', 'afterSaveProduct'), -(74, 'actionProductListOverride', 'productListAssign'), -(75, 'displayAttributeGroupPostProcess', 'postProcessAttributeGroup'), -(76, 'displayFeaturePostProcess', 'postProcessFeature'), -(77, 'displayFeatureValueForm', 'featureValueForm'), -(78, 'displayFeatureValuePostProcess', 'postProcessFeatureValue'), -(79, 'actionFeatureValueDelete', 'afterDeleteFeatureValue'), -(80, 'actionFeatureValueSave', 'afterSaveFeatureValue'), -(81, 'displayAttributeForm', 'attributeForm'), -(82, 'actionAttributePostProcess', 'postProcessAttribute'), -(83, 'actionAttributeDelete', 'afterDeleteAttribute'), -(84, 'actionAttributeSave', 'afterSaveAttribute'), -(85, 'actionTaxManager', 'taxManager'); - diff --git a/upgrade/sql/1.5.0.10.sql b/upgrade/sql/1.5.0.10.sql deleted file mode 100644 index 82899d281..000000000 --- a/upgrade/sql/1.5.0.10.sql +++ /dev/null @@ -1,147 +0,0 @@ -/* PHP:module_blockwishlist_multishop(); */; - -/* PHP:p15010_drop_column_id_address_if_exists(); */; - -UPDATE `PREFIX_meta` SET `page` = 'contact' WHERE `page` = 'contact-form'; - -DROP TABLE IF EXISTS `PREFIX_shop_group`; - -RENAME TABLE `PREFIX_group_shop` TO `PREFIX_shop_group`; -ALTER TABLE `PREFIX_shop_group` CHANGE `id_group_shop` `id_shop_group` INT( 11 ) UNSIGNED NOT NULL AUTO_INCREMENT; -ALTER TABLE `PREFIX_shop` CHANGE `id_group_shop` `id_shop_group` INT( 11 ) UNSIGNED NOT NULL; -ALTER TABLE `PREFIX_stock_available` CHANGE `id_group_shop` `id_shop_group` INT( 11 ) UNSIGNED NOT NULL; -ALTER TABLE `PREFIX_cart` CHANGE `id_group_shop` `id_shop_group` INT( 11 ) UNSIGNED NOT NULL; -ALTER TABLE `PREFIX_configuration` CHANGE `id_group_shop` `id_shop_group` INT( 11 ) UNSIGNED NULL; -ALTER TABLE `PREFIX_connections` CHANGE `id_group_shop` `id_shop_group` INT( 11 ) UNSIGNED NOT NULL; -ALTER TABLE `PREFIX_customer` CHANGE `id_group_shop` `id_shop_group` INT( 11 ) UNSIGNED NOT NULL; -ALTER TABLE `PREFIX_delivery` CHANGE `id_group_shop` `id_shop_group` INT( 11 ) UNSIGNED NULL; -ALTER TABLE `PREFIX_orders` CHANGE `id_group_shop` `id_shop_group` INT( 11 ) UNSIGNED NOT NULL; -ALTER TABLE `PREFIX_page_viewed` CHANGE `id_group_shop` `id_shop_group` INT( 11 ) UNSIGNED NOT NULL; -ALTER TABLE `PREFIX_specific_price` CHANGE `id_group_shop` `id_shop_group` INT( 11 ) UNSIGNED NOT NULL; -ALTER TABLE `PREFIX_product` ADD `id_tax_rules_group` int(10) unsigned NOT NULL; - -CREATE TABLE IF NOT EXISTS `PREFIX_product_shop_TMP` ( - `id_product` int(10) unsigned NOT NULL, - `id_shop` int(10) unsigned NOT NULL, - `id_category_default` int(10) unsigned DEFAULT NULL, - `id_tax_rules_group` INT(11) UNSIGNED NOT NULL, - `on_sale` tinyint(1) unsigned NOT NULL DEFAULT '0', - `online_only` tinyint(1) unsigned NOT NULL DEFAULT '0', - `ecotax` decimal(17,6) NOT NULL DEFAULT '0.000000', - `minimal_quantity` int(10) unsigned NOT NULL DEFAULT '1', - `price` decimal(20,6) NOT NULL DEFAULT '0.000000', - `wholesale_price` decimal(20,6) NOT NULL DEFAULT '0.000000', - `unity` varchar(255) DEFAULT NULL, - `unit_price_ratio` decimal(20,6) NOT NULL DEFAULT '0.000000', - `additional_shipping_cost` decimal(20,2) NOT NULL DEFAULT '0.00', - `customizable` tinyint(2) NOT NULL DEFAULT '0', - `text_fields` tinyint(4) NOT NULL DEFAULT '0', - `active` tinyint(1) unsigned NOT NULL DEFAULT '0', - `available_for_order` tinyint(1) NOT NULL DEFAULT '1', - `available_date` date NOT NULL, - `condition` enum('new','used','refurbished') NOT NULL DEFAULT 'new', - `show_price` tinyint(1) NOT NULL DEFAULT '1', - `indexed` tinyint(1) NOT NULL DEFAULT '0', - `visibility` enum('both','catalog','search','none') NOT NULL DEFAULT 'both', - `cache_default_attribute` int(10) unsigned DEFAULT NULL, - `advanced_stock_management` tinyint(1) default '0' NOT NULL, - `date_add` datetime NOT NULL, - `date_upd` datetime NOT NULL, - PRIMARY KEY (`id_product`, `id_shop`), - KEY `id_category_default` (`id_category_default`), - KEY `date_add` (`date_add`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; -INSERT INTO `PREFIX_product_shop_TMP` (`id_product`, `id_shop`, `id_category_default`, `on_sale`, `online_only`, `ecotax`, `minimal_quantity`, `price`, `wholesale_price`, `unity`, `unit_price_ratio`, `additional_shipping_cost`, `customizable`, `text_fields`, `active`, `available_for_order`, `available_date`, `condition`, `show_price`, `indexed`, `visibility`, `cache_default_attribute`, `advanced_stock_management`, `date_add`, `date_upd`, `id_tax_rules_group`) - (SELECT a.`id_product`, a.`id_shop`, b.`id_category_default`, b.`on_sale`, b.`online_only`, b.`ecotax`, b.`minimal_quantity`, b.`price`, b.`wholesale_price`, b.`unity`, b.`unit_price_ratio`, b.`additional_shipping_cost`, b.`customizable`, b.`text_fields`, b.`active`, b.`available_for_order`, b.`available_date`, b.`condition`, b.`show_price`, b.`indexed`, b.`visibility`, b.`cache_default_attribute`, b.`advanced_stock_management`, b.`date_add`, b.`date_upd`, c.`id_tax_rules_group` FROM `PREFIX_product_shop` a INNER JOIN `PREFIX_product` b ON a.id_product = b.id_product LEFT JOIN `PREFIX_product_tax_rules_group_shop` c ON b.id_product = c.id_product AND a.id_shop = c.id_shop); -DROP TABLE `PREFIX_product_shop`; -DROP TABLE `PREFIX_product_tax_rules_group_shop`; -RENAME TABLE `PREFIX_product_shop_TMP` TO `PREFIX_product_shop`; - -CREATE TABLE `PREFIX_product_attribute_shop` ( - `id_product_attribute` int(10) unsigned NOT NULL, - `id_shop` int(10) unsigned NOT NULL, - `wholesale_price` decimal(20,6) NOT NULL default '0.000000', - `price` decimal(20,6) NOT NULL default '0.000000', - `ecotax` decimal(17,6) NOT NULL default '0.00', - `weight` float NOT NULL default '0', - `unit_price_impact` decimal(17,2) NOT NULL default '0.00', - `default_on` tinyint(1) unsigned NOT NULL default '0', - `minimal_quantity` int(10) unsigned NOT NULL DEFAULT '1', - `available_date` date NOT NULL, - PRIMARY KEY (`id_product_attribute`, `id_shop`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; -INSERT INTO `PREFIX_product_attribute_shop` (`id_product_attribute`, `id_shop`, `wholesale_price`, `price`, `ecotax`, `weight`, `unit_price_impact`, `default_on`, `minimal_quantity`, `available_date`) (SELECT `id_product_attribute`, (SELECT `value` FROM `PREFIX_configuration` WHERE `name` = 'PS_SHOP_DEFAULT'), `wholesale_price`, `price`, `ecotax`, `weight`, `unit_price_impact`, `default_on`, `minimal_quantity`, `available_date` FROM `PREFIX_product_attribute`); - -CREATE TABLE `PREFIX_attribute_shop` ( -`id_attribute` INT(11) UNSIGNED NOT NULL, -`id_shop` INT(11) UNSIGNED NOT NULL, - PRIMARY KEY (`id_attribute`, `id_shop`), - KEY `id_shop` (`id_shop`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; -INSERT INTO `PREFIX_attribute_shop` (`id_attribute`, `id_shop`) (SELECT a.id_attribute, c.id_shop FROM PREFIX_attribute_group_shop a LEFT JOIN PREFIX_shop_group b ON a.id_group_shop = b.id_shop_group INNER JOIN PREFIX_shop c ON b.id_shop_group = c.id_shop_group); -DROP TABLE `PREFIX_attribute_group_shop`; - -CREATE TABLE `PREFIX_feature_shop` ( -`id_feature` INT(11) UNSIGNED NOT NULL, -`id_shop` INT(11) UNSIGNED NOT NULL , - PRIMARY KEY (`id_feature`, `id_shop`), - KEY `id_shop` (`id_shop`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; -INSERT INTO `PREFIX_feature_shop` (`id_feature`, `id_shop`) (SELECT a.id_feature, c.id_shop FROM PREFIX_feature_group_shop a LEFT JOIN PREFIX_shop_group b ON a.id_group_shop = b.id_shop_group INNER JOIN PREFIX_shop c ON b.id_shop_group = c.id_shop_group); -DROP TABLE `PREFIX_feature_group_shop`; - -CREATE TABLE `PREFIX_group_shop` ( -`id_group` INT( 11 ) UNSIGNED NOT NULL, -`id_shop` INT( 11 ) UNSIGNED NOT NULL, - PRIMARY KEY (`id_group`, `id_shop`), - KEY `id_shop` (`id_shop`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; -INSERT INTO `PREFIX_group_shop` (`id_group`, `id_shop`) (SELECT a.id_group, c.id_shop FROM PREFIX_group_group_shop a LEFT JOIN PREFIX_shop_group b ON a.id_group_shop = b.id_shop_group INNER JOIN PREFIX_shop c ON b.id_shop_group = c.id_shop_group); -DROP TABLE `PREFIX_group_group_shop`; - -CREATE TABLE `PREFIX_attribute_group_shop` ( -`id_attribute_group` INT( 11 ) UNSIGNED NOT NULL , -`id_shop` INT( 11 ) UNSIGNED NOT NULL , - PRIMARY KEY (`id_attribute_group`, `id_shop`), - KEY `id_shop` (`id_shop`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; -INSERT INTO `PREFIX_attribute_group_shop` (`id_attribute_group`, `id_shop`) (SELECT a.id_attribute_group, c.id_shop FROM PREFIX_attribute_group_group_shop a LEFT JOIN PREFIX_shop_group b ON a.id_group_shop = b.id_shop_group INNER JOIN PREFIX_shop c ON b.id_shop_group = c.id_shop_group); -DROP TABLE `PREFIX_attribute_group_group_shop`; - -CREATE TABLE `PREFIX_tax_rules_group_shop` ( - `id_tax_rules_group` INT( 11 ) UNSIGNED NOT NULL, - `id_shop` INT( 11 ) UNSIGNED NOT NULL, - PRIMARY KEY (`id_tax_rules_group`, `id_shop`), - KEY `id_shop` (`id_shop`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; -INSERT INTO `PREFIX_tax_rules_group_shop` (`id_tax_rules_group`, `id_shop`) (SELECT a.id_tax_rules_group, c.id_shop FROM PREFIX_tax_rules_group_group_shop a LEFT JOIN PREFIX_shop_group b ON a.id_group_shop = b.id_shop_group INNER JOIN PREFIX_shop c ON b.id_shop_group = c.id_shop_group); -DROP TABLE `PREFIX_tax_rules_group_group_shop`; - -CREATE TABLE `PREFIX_zone_shop` ( -`id_zone` INT( 11 ) UNSIGNED NOT NULL , -`id_shop` INT( 11 ) UNSIGNED NOT NULL , - PRIMARY KEY (`id_zone`, `id_shop`), - KEY `id_shop` (`id_shop`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; -INSERT INTO `PREFIX_zone_shop` (`id_zone`, `id_shop`) (SELECT a.id_zone, c.id_shop FROM PREFIX_zone_group_shop a LEFT JOIN PREFIX_shop_group b ON a.id_group_shop = b.id_shop_group INNER JOIN PREFIX_shop c ON b.id_shop_group = c.id_shop_group); -DROP TABLE `PREFIX_zone_group_shop`; - -CREATE TABLE `PREFIX_manufacturer_shop` ( -`id_manufacturer` INT( 11 ) UNSIGNED NOT NULL , -`id_shop` INT( 11 ) UNSIGNED NOT NULL , - PRIMARY KEY (`id_manufacturer`, `id_shop`), - KEY `id_shop` (`id_shop`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; -INSERT INTO `PREFIX_manufacturer_shop` (`id_manufacturer`, `id_shop`) (SELECT a.id_manufacturer, c.id_shop FROM PREFIX_manufacturer_group_shop a LEFT JOIN PREFIX_shop_group b ON a.id_group_shop = b.id_shop_group INNER JOIN PREFIX_shop c ON b.id_shop_group = c.id_shop_group); -DROP TABLE `PREFIX_manufacturer_group_shop`; - -CREATE TABLE `PREFIX_supplier_shop` ( -`id_supplier` INT( 11 ) UNSIGNED NOT NULL, -`id_shop` INT( 11 ) UNSIGNED NOT NULL, -PRIMARY KEY (`id_supplier`, `id_shop`), - KEY `id_shop` (`id_shop`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; -INSERT INTO `PREFIX_supplier_shop` (`id_supplier`, `id_shop`) (SELECT a.id_supplier, c.id_shop FROM PREFIX_supplier_group_shop a LEFT JOIN PREFIX_shop_group b ON a.id_group_shop = b.id_shop_group INNER JOIN PREFIX_shop c ON b.id_shop_group = c.id_shop_group); -DROP TABLE `PREFIX_supplier_group_shop`; - -ALTER TABLE `PREFIX_product_download` DROP COLUMN `id_product_attribute`; diff --git a/upgrade/sql/1.5.0.11.sql b/upgrade/sql/1.5.0.11.sql deleted file mode 100644 index da21b32f2..000000000 --- a/upgrade/sql/1.5.0.11.sql +++ /dev/null @@ -1,3 +0,0 @@ -SET NAMES 'utf8'; - - diff --git a/upgrade/sql/1.5.0.12.sql b/upgrade/sql/1.5.0.12.sql deleted file mode 100644 index 466fd372d..000000000 --- a/upgrade/sql/1.5.0.12.sql +++ /dev/null @@ -1,67 +0,0 @@ -SET NAMES 'utf8'; - -ALTER TABLE `PREFIX_state` CHANGE `iso_code` `iso_code` varchar(7) NOT NULL; - -DROP TABLE `PREFIX_accounting_export`; -DROP TABLE `PREFIX_accounting_zone_shop`; -DROP TABLE `PREFIX_accounting_product_zone_shop`; -ALTER TABLE `PREFIX_tax` DROP `account_number`; -ALTER TABLE `PREFIX_customer` DROP `account_number`; - -DELETE FROM `PREFIX_tab_lang` WHERE `id_tab` IN ( - SELECT `id_tab` FROM `PREFIX_tab` WHERE `class_name` LIKE('%Accounting%') -); - -DELETE FROM `PREFIX_tab` WHERE `class_name` LIKE('%Accounting%'); - -/* PHP:move_translations_module_file(); */; - -ALTER TABLE `PREFIX_tax_rule` CHANGE `zipcode_from` `zipcode_from` VARCHAR(12) NOT NULL, CHANGE `zipcode_to` `zipcode_to` VARCHAR(12) NOT NULL; - -UPDATE PREFIX_order_detail_tax odt -LEFT JOIN PREFIX_tax t ON (t.id_tax = odt.id_tax) -SET unit_amount = IFNULL(ROUND((t.rate / 100) * ( - SELECT od.unit_price_tax_excl - ( o.total_discounts_tax_excl * ( od.unit_price_tax_excl / o.total_products )) - FROM PREFIX_order_detail od - LEFT JOIN PREFIX_orders o ON ( o.id_order = od.id_order) - WHERE odt.id_order_detail = od.id_order_detail -), 2), 0); - - -UPDATE PREFIX_order_detail_tax odt -LEFT JOIN PREFIX_order_detail od ON (od.id_order_detail = odt.id_order_detail) -SET total_amount = IFNULL(odt.unit_amount * od.product_quantity, 0); - -/* PHP:add_missing_shop_column_pagenotfound(); */; - -/* PHP:editorial_update_multishop(); */; -/* PHP:update_module_product_comments(); */; - -/* PHP:add_missing_columns_customer(); */; - -CREATE TABLE IF NOT EXISTS `PREFIX_risk` ( - `id_risk` int(11) NOT NULL AUTO_INCREMENT, - `percent` tinyint(3) NOT NULL, - `color` varchar(32) NULL, - PRIMARY KEY (`id_risk`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; - -CREATE TABLE IF NOT EXISTS `PREFIX_risk_lang` ( - `id_risk` int(10) unsigned NOT NULL, - `id_lang` int(10) unsigned NOT NULL, - `name` varchar(20) NOT NULL, - PRIMARY KEY (`id_risk`,`id_lang`), - KEY `id_risk` (`id_risk`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; - -UPDATE `PREFIX_tab` SET `class_name`="AdminShopGroup" WHERE class_name="AdminGroupShop"; - -/* PHP:upgrade_cms_15_rename(); */; -/* PHP:migrate_tabs_multi_shop(); */; -/* PHP:add_default_restrictions_modules_groups(); */; - -UPDATE `PREFIX_order_payment` SET `id_order_invoice` = 0 WHERE `id_order_invoice` LIKE "" OR `id_order_invoice` IS NULL; - -/* PHP:p15012_add_missing_columns(); */; - -UPDATE `PREFIX_specific_price` SET `price` = -1 WHERE `price` = 0; \ No newline at end of file diff --git a/upgrade/sql/1.5.0.13.sql b/upgrade/sql/1.5.0.13.sql deleted file mode 100644 index c89ae965e..000000000 --- a/upgrade/sql/1.5.0.13.sql +++ /dev/null @@ -1,50 +0,0 @@ -SET NAMES 'utf8'; - -DROP TABLE IF EXISTS `PREFIX_discount`; -DROP TABLE IF EXISTS `PREFIX_discount_type`; -DROP TABLE IF EXISTS `PREFIX_discount_type_lang`; - -/* PHP:add_missing_image_key(); */; - --- Update order_payment structure for multishipping - --- Step 1: Add the table ps_order_invoice_payment and populate it -CREATE TABLE `PREFIX_order_invoice_payment` ( - `id_order_invoice` int(11) unsigned NOT NULL, - `id_order_payment` int(11) unsigned NOT NULL, - `id_order` int(11) unsigned NOT NULL, - PRIMARY KEY (`id_order_invoice`,`id_order_payment`), - KEY `order_payment` (`id_order_payment`), - KEY `id_order` (`id_order`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; - -INSERT INTO `PREFIX_order_invoice_payment` - (SELECT id_order_invoice, id_order_payment, id_order FROM `PREFIX_order_payment` WHERE id_order_invoice > 0); - --- Step 2: Add the collumn id_order_reference -ALTER TABLE `PREFIX_order_payment` - ADD COLUMN `order_reference` VARCHAR(10) AFTER `id_order`, - ADD INDEX `order_reference`(`order_reference`); - - --- Step 3: Fill in id_order_reference and merge duplicate lines -/* PHP:add_order_reference_in_order_payment(); */; - --- Step 4: Drop collumn id_order -ALTER TABLE `PREFIX_order_payment` - DROP COLUMN `id_order`, - DROP COLUMN `id_order_invoice`; - --- update for all employee the last ids for notifications -UPDATE `PREFIX_employee` - SET `id_last_order`= (SELECT IFNULL(MAX(`id_order`), 0) FROM `PREFIX_orders`), - `id_last_customer_message`= (SELECT IFNULL(MAX(`id_customer_message`), 0) FROM `PREFIX_customer_message`), - `id_last_customer`= (SELECT IFNULL(MAX(`id_customer`), 0) FROM `PREFIX_customer`); - -UPDATE `PREFIX_category_shop` cs - SET `position` = (SELECT `position` FROM `PREFIX_category` c WHERE cs.`id_category` = c.`id_category`); - -ALTER TABLE `PREFIX_stock_available` CHANGE `out_of_stock` `out_of_stock` INT(2) UNSIGNED NOT NULL DEFAULT '0'; - -/* PHP:p15013_add_missing_columns(); */; - diff --git a/upgrade/sql/1.5.0.14.sql b/upgrade/sql/1.5.0.14.sql deleted file mode 100644 index 64ada0cd0..000000000 --- a/upgrade/sql/1.5.0.14.sql +++ /dev/null @@ -1,27 +0,0 @@ -SET NAMES 'utf8'; - -/* PHP:p15014_copy_missing_images_tab_from_installer(); */; - -/* PHP:p15014_add_missing_columns(); */; - -/* PHP:p15014_upgrade_sekeywords(); */; - - -UPDATE `PREFIX_orders` SET `reference` = LPAD(reference, 9 , '0'); - -INSERT INTO `PREFIX_hook_alias` (`name`, `alias`) VALUES ('displayMyAccountBlock', 'myAccountBlock'); - - -UPDATE `PREFIX_image_type` SET height = 189, width = 520 WHERE name = 'large_scene'; - -CREATE TABLE IF NOT EXISTS `PREFIX_order_invoice_tax` ( - `id_order_invoice` int(11) NOT NULL, - `type` varchar(15) NOT NULL, - `id_tax` int(11) NOT NULL, - `amount` decimal(10,6) NOT NULL DEFAULT '0.000000' -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; - -ALTER TABLE `PREFIX_order_invoice` -ADD `shipping_tax_computation_method` INT NOT NULL AFTER `total_shipping_tax_incl`; - -INSERT INTO `PREFIX_configuration`(`name`, `value`, `date_add`, `date_upd`) VALUES ('PS_SEARCH_INDEXATION', '1', NOW(), NOW()); diff --git a/upgrade/sql/1.5.0.15.sql b/upgrade/sql/1.5.0.15.sql deleted file mode 100644 index bfee984a9..000000000 --- a/upgrade/sql/1.5.0.15.sql +++ /dev/null @@ -1,13 +0,0 @@ -SET NAMES 'utf8'; - -/* PHP:p15015_blockadvertising_extension(); */; - -ALTER TABLE `PREFIX_order_state` ADD `module_name` VARCHAR(255) NULL DEFAULT NULL AFTER `send_email`; - -UPDATE `PREFIX_order_state` SET `module_name` = 'cheque' WHERE `id_order_state` = (SELECT `value` FROM `PREFIX_configuration` WHERE `name` = 'PS_OS_CHEQUE' LIMIT 1); - -UPDATE `PREFIX_order_state` SET `module_name` = 'bankwire' WHERE `id_order_state` = (SELECT `value` FROM `PREFIX_configuration` WHERE `name` = 'PS_OS_BANKWIRE' LIMIT 1); - -ALTER TABLE `PREFIX_product_shop` ADD `uploadable_files` TINYINT NOT NULL DEFAULT 0 AFTER `customizable`; - -UPDATE `PREFIX_product_shop` product_shop SET `uploadable_files` = (SELECT uploadable_files FROM `PREFIX_product` WHERE `id_product` = product_shop.`id_product`); \ No newline at end of file diff --git a/upgrade/sql/1.5.0.16.sql b/upgrade/sql/1.5.0.16.sql deleted file mode 100644 index 19c7b3c71..000000000 --- a/upgrade/sql/1.5.0.16.sql +++ /dev/null @@ -1,21 +0,0 @@ -SET NAMES 'utf8'; - -/* PHP:p15016_add_missing_columns(); */; - -ALTER TABLE `PREFIX_order_detail` ADD `id_shop` INT(11) UNSIGNED NOT NULL AFTER `id_warehouse`, ADD INDEX (`id_shop`); - -UPDATE `PREFIX_order_detail` od SET `id_shop`=(SELECT `id_shop` FROM `PREFIX_orders` WHERE `id_order`=od.`id_order`); - -DELETE FROM `PREFIX_tab` WHERE `class_name` = 'AdminAddonsMyAccount'; -DELETE FROM `PREFIX_tab_lang` WHERE `id_tab` NOT IN (SELECT `id_tab` FROM `PREFIX_tab`); -DELETE FROM `PREFIX_access` WHERE `id_tab` NOT IN (SELECT `id_tab` FROM `PREFIX_tab`); - -UPDATE `PREFIX_employee` SET bo_theme = 'default'; - -ALTER TABLE `PREFIX_tax_rule` ADD INDEX `category_getproducts` ( `id_tax_rules_group` , `id_country` , `id_state` , `zipcode_from` ); -ALTER TABLE `PREFIX_stock_available` ADD INDEX `product_sqlstock` ( `id_product` , `id_product_attribute` , `id_shop` ); - -ALTER TABLE `PREFIX_product` ADD `id_shop_default` int(10) unsigned NOT NULL default 1 AFTER `id_category_default`; -UPDATE `PREFIX_product` p SET `id_shop_default` = IFNULL((SELECT MIN(id_shop) FROM `PREFIX_product_shop` ps WHERE ps.`id_product` = p.`id_product`), 1); -ALTER TABLE `PREFIX_category` ADD `id_shop_default` int(10) unsigned NOT NULL default 1 AFTER `id_parent`; -UPDATE `PREFIX_category` c SET `id_shop_default` = IFNULL((SELECT MIN(id_shop) FROM `PREFIX_category_shop` cs WHERE cs.`id_category` = c.`id_category`), 1); diff --git a/upgrade/sql/1.5.0.17.sql b/upgrade/sql/1.5.0.17.sql deleted file mode 100644 index f2bbbe62b..000000000 --- a/upgrade/sql/1.5.0.17.sql +++ /dev/null @@ -1,14 +0,0 @@ -SET NAMES 'utf8'; - -ALTER TABLE `PREFIX_order_detail_tax` CHANGE `unit_amount` `unit_amount` DECIMAL(16, 6) NOT NULL DEFAULT '0.000000'; -ALTER TABLE `PREFIX_order_detail_tax` CHANGE `total_amount` `total_amount` DECIMAL(16, 6) NOT NULL DEFAULT '0.000000'; - -ALTER TABLE `PREFIX_customer_message` ADD `read` tinyint(1) NOT NULL default '0' AFTER `private`; - -INSERT INTO `PREFIX_configuration`(`name`, `value`, `date_add`, `date_upd`) VALUES ('PS_ALLOW_MOBILE_DEVICE', '1', NOW(), NOW()); - -/* PHP:p15017_add_id_shop_to_primary_key(); */; - -UPDATE `PREFIX_tab_lang` SET `name` = 'Menus' WHERE `name` = 'tabs' AND `id_tab` = (SELECT `id_tab` FROM `PREFIX_tab` WHERE `class_name` = 'AdminTabs' LIMIT 1) AND `id_lang` IN (SELECT `id_lang` FROM `PREFIX_lang` WHERE `iso_code` IN ('en','fr','es','de','it')); - -/* PHP:clean_tabs_15(); */; \ No newline at end of file diff --git a/upgrade/sql/1.5.0.2.sql b/upgrade/sql/1.5.0.2.sql deleted file mode 100755 index bc1f269db..000000000 --- a/upgrade/sql/1.5.0.2.sql +++ /dev/null @@ -1,422 +0,0 @@ -SET NAMES 'utf8'; - -DELETE FROM `PREFIX_tab` WHERE `id_tab` = 59; -DELETE FROM `PREFIX_tab_lang` WHERE `id_tab` = 59 AND `id_lang` = 1; -DELETE FROM `PREFIX_tab_lang` WHERE `id_tab` = 59 AND `id_lang` = 2; -DELETE FROM `PREFIX_tab_lang` WHERE `id_tab` = 59 AND `id_lang` = 3; -DELETE FROM `PREFIX_tab_lang` WHERE `id_tab` = 59 AND `id_lang` = 4; -DELETE FROM `PREFIX_tab_lang` WHERE `id_tab` = 59 AND `id_lang` = 5; - -ALTER TABLE `PREFIX_module` ADD `version` VARCHAR( 8 ) NOT NULL; - -CREATE TABLE IF NOT EXISTS `PREFIX_specific_price_rule` ( - `id_specific_price_rule` int(10) unsigned NOT NULL AUTO_INCREMENT, - `name` VARCHAR(255) NOT NULL, - `id_shop` int(11) unsigned NOT NULL DEFAULT '1', - `id_currency` int(10) unsigned NOT NULL, - `id_country` int(10) unsigned NOT NULL, - `id_group` int(10) unsigned NOT NULL, - `from_quantity` mediumint(8) unsigned NOT NULL, - `price` DECIMAL(20,6), - `reduction` decimal(20,6) NOT NULL, - `reduction_type` enum('amount','percentage') NOT NULL, - `from` datetime NOT NULL, - `to` datetime NOT NULL, - PRIMARY KEY (`id_specific_price_rule`), - KEY `id_product` (`id_shop`,`id_currency`,`id_country`,`id_group`,`from_quantity`,`from`,`to`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; - -CREATE TABLE `PREFIX_specific_price_rule_condition_group` ( - `id_specific_price_rule_condition_group` INT(11) UNSIGNED NOT NULL, - `id_specific_price_rule` INT(11) UNSIGNED NOT NULL, - PRIMARY KEY ( `id_specific_price_rule_condition_group`, `id_specific_price_rule` ) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; - -CREATE TABLE `PREFIX_specific_price_rule_condition` ( - `id_specific_price_rule_condition` INT(11) UNSIGNED NOT NULL, - `id_specific_price_rule_condition_group` INT(11) UNSIGNED NOT NULL, - `type` VARCHAR(255) NOT NULL, - `value` VARCHAR(255) NOT NULL, -PRIMARY KEY (`id_specific_price_rule_condition`), -INDEX (`id_specific_price_rule_condition_group`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; - -ALTER TABLE `PREFIX_specific_price` ADD `id_specific_price_rule` INT(11) UNSIGNED NOT NULL AFTER `id_specific_price`, ADD INDEX (`id_specific_price_rule`); -/* PHP:add_new_tab(AdminSpecificPriceRule, es:Catalog price rules|it:Catalog price rules|en:Catalog price rules|de:Catalog price rules|fr:Règles de prix catalogue, 1); */; - -ALTER TABLE `PREFIX_order_invoice` ADD `note` TEXT NOT NULL AFTER `total_wrapping_tax_incl`; - -/* ORDER STATES */ -ALTER TABLE `PREFIX_order_state` ADD `paid` TINYINT( 1 ) UNSIGNED NOT NULL DEFAULT '0' AFTER `shipped`; -UPDATE `PREFIX_order_state` SET `paid` = 1 WHERE `id_order_state` IN (2, 3, 4, 5, 9, 12); - -/* SPECIFIC PRICE */ -ALTER TABLE `PREFIX_specific_price` ADD `id_customer` INT UNSIGNED NOT NULL AFTER `id_group`; -ALTER TABLE `PREFIX_specific_price` DROP INDEX `id_product` , -ADD INDEX `id_product` (`id_product`, `id_shop`, `id_currency`, `id_country`, `id_group`, `id_customer`, `from_quantity`, `from`, `to`); - -/************************ - * STOCK MANAGEMENT -*************************/ - -/* PHP:add_stock_tab(); */; - -UPDATE `PREFIX_access` SET `view` = '1' WHERE `id_profile` = 5 AND `id_tab` = (SELECT `id_tab` FROM `PREFIX_tab` t WHERE t.`class_name` = 'AdminStock' LIMIT 1); - -UPDATE `PREFIX_access` SET `view` = '0', `add` = '0', `edit` = '0', `delete` = '0' WHERE `id_tab` = (SELECT `id_tab` FROM `PREFIX_tab` t WHERE t.`class_name` = 'AdminSupplyOrders' LIMIT 1) AND `id_profile` = '4'; -UPDATE `PREFIX_access` SET `view` = '0', `add` = '0', `edit` = '0', `delete` = '0' WHERE `id_tab` = (SELECT `id_tab` FROM `PREFIX_tab` t WHERE t.`class_name` = 'AdminSupplyOrders' LIMIT 1) AND `id_profile` = '5'; -UPDATE `PREFIX_access` SET `view` = '0', `add` = '0', `edit` = '0', `delete` = '0' WHERE `id_tab` = (SELECT `id_tab` FROM `PREFIX_tab` t WHERE t.`class_name` = 'AdminStockConfiguration' LIMIT 1) AND `id_profile` = '4'; -UPDATE `PREFIX_access` SET `view` = '0', `add` = '0', `edit` = '0', `delete` = '0' WHERE `id_tab` = (SELECT `id_tab` FROM `PREFIX_tab` t WHERE t.`class_name` = 'AdminStockConfiguration' LIMIT 1) AND `id_profile` = '5'; - -/* New tables */ -CREATE TABLE IF NOT EXISTS `PREFIX_product_supplier` ( - `id_product_supplier` int(11) unsigned NOT NULL AUTO_INCREMENT, - `id_product` int(11) unsigned NOT NULL, - `id_product_attribute` int(11) unsigned NOT NULL DEFAULT '0', - `id_supplier` int(11) unsigned NOT NULL, - `product_supplier_reference` varchar(32) DEFAULT NULL, - `product_supplier_price_te` decimal(20,6) NOT NULL DEFAULT '0.000000', - `id_currency` int(11) unsigned NOT NULL, - PRIMARY KEY (`id_product_supplier`), - UNIQUE KEY `id_product` (`id_product`,`id_product_attribute`,`id_supplier`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; - -CREATE TABLE IF NOT EXISTS `PREFIX_stock_available` ( - `id_stock_available` int(11) unsigned NOT NULL AUTO_INCREMENT, - `id_product` int(11) unsigned NOT NULL, - `id_product_attribute` int(11) unsigned NOT NULL, - `id_shop` int(11) unsigned NOT NULL, - `id_group_shop` int(11) unsigned NOT NULL, - `quantity` int(10) NOT NULL DEFAULT '0', - `depends_on_stock` tinyint(1) unsigned NOT NULL DEFAULT '0', - `out_of_stock` int(2) unsigned NOT NULL DEFAULT '0', - PRIMARY KEY (`id_stock_available`), - KEY `id_shop` (`id_shop`), - KEY `id_group_shop` (`id_group_shop`), - KEY `id_product` (`id_product`), - KEY `id_product_attribute` (`id_product_attribute`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; - -CREATE TABLE IF NOT EXISTS `PREFIX_supply_order` ( - `id_supply_order` int(11) unsigned NOT NULL AUTO_INCREMENT, - `id_supplier` int(11) unsigned NOT NULL, - `supplier_name` varchar(64) NOT NULL, - `id_lang` int(11) unsigned NOT NULL, - `id_warehouse` int(11) unsigned NOT NULL, - `id_supply_order_state` int(11) unsigned NOT NULL, - `id_currency` int(11) unsigned NOT NULL, - `id_ref_currency` int(11) unsigned NOT NULL, - `reference` varchar(32) NOT NULL, - `date_add` datetime NOT NULL, - `date_upd` datetime NOT NULL, - `date_delivery_expected` datetime DEFAULT NULL, - `total_te` decimal(20,6) DEFAULT '0.000000', - `total_with_discount_te` decimal(20,6) DEFAULT '0.000000', - `total_tax` decimal(20,6) DEFAULT '0.000000', - `total_ti` decimal(20,6) DEFAULT '0.000000', - `discount_rate` decimal(20,6) DEFAULT '0.000000', - `discount_value_te` decimal(20,6) DEFAULT '0.000000', - `is_template` tinyint(1) DEFAULT '0', - PRIMARY KEY (`id_supply_order`), - KEY `id_supplier` (`id_supplier`), - KEY `id_warehouse` (`id_warehouse`), - KEY `reference` (`reference`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; - -CREATE TABLE IF NOT EXISTS `PREFIX_supply_order_detail` ( - `id_supply_order_detail` int(11) unsigned NOT NULL AUTO_INCREMENT, - `id_supply_order` int(11) unsigned NOT NULL, - `id_currency` int(11) unsigned NOT NULL, - `id_product` int(11) unsigned NOT NULL, - `id_product_attribute` int(11) unsigned NOT NULL, - `reference` varchar(32) NOT NULL, - `supplier_reference` varchar(32) NOT NULL, - `name` varchar(128) NOT NULL, - `ean13` varchar(13) DEFAULT NULL, - `upc` varchar(12) DEFAULT NULL, - `exchange_rate` decimal(20,6) DEFAULT '0.000000', - `unit_price_te` decimal(20,6) DEFAULT '0.000000', - `quantity_expected` int(11) unsigned NOT NULL, - `quantity_received` int(11) unsigned NOT NULL, - `price_te` decimal(20,6) DEFAULT '0.000000', - `discount_rate` decimal(20,6) DEFAULT '0.000000', - `discount_value_te` decimal(20,6) DEFAULT '0.000000', - `price_with_discount_te` decimal(20,6) DEFAULT '0.000000', - `tax_rate` decimal(20,6) DEFAULT '0.000000', - `tax_value` decimal(20,6) DEFAULT '0.000000', - `price_ti` decimal(20,6) DEFAULT '0.000000', - `tax_value_with_order_discount` decimal(20,6) DEFAULT '0.000000', - `price_with_order_discount_te` decimal(20,6) DEFAULT '0.000000', - PRIMARY KEY (`id_supply_order_detail`), - KEY `id_supply_order` (`id_supply_order`), - KEY `id_product` (`id_product`), - KEY `id_product_attribute` (`id_product_attribute`), - KEY `id_product_product_attribute` (`id_product`,`id_product_attribute`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; - -CREATE TABLE IF NOT EXISTS `PREFIX_supply_order_history` ( - `id_supply_order_history` int(11) unsigned NOT NULL AUTO_INCREMENT, - `id_supply_order` int(11) unsigned NOT NULL, - `id_employee` int(11) unsigned NOT NULL, - `employee_lastname` varchar(32) DEFAULT '', - `employee_firstname` varchar(32) DEFAULT '', - `id_state` int(11) unsigned NOT NULL, - `date_add` datetime NOT NULL, - PRIMARY KEY (`id_supply_order_history`), - KEY `id_supply_order` (`id_supply_order`), - KEY `id_employee` (`id_employee`), - KEY `id_state` (`id_state`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; - -CREATE TABLE IF NOT EXISTS `PREFIX_supply_order_receipt_history` ( - `id_supply_order_receipt_history` int(11) unsigned NOT NULL AUTO_INCREMENT, - `id_supply_order_detail` int(11) unsigned NOT NULL, - `id_employee` int(11) unsigned NOT NULL, - `employee_lastname` varchar(32) DEFAULT '', - `employee_firstname` varchar(32) DEFAULT '', - `id_supply_order_state` int(11) unsigned NOT NULL, - `quantity` int(11) unsigned NOT NULL, - `date_add` datetime NOT NULL, - PRIMARY KEY (`id_supply_order_receipt_history`), - KEY `id_supply_order_detail` (`id_supply_order_detail`), - KEY `id_supply_order_state` (`id_supply_order_state`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; - -CREATE TABLE IF NOT EXISTS `PREFIX_supply_order_state` ( - `id_supply_order_state` int(11) unsigned NOT NULL AUTO_INCREMENT, - `delivery_note` tinyint(1) NOT NULL DEFAULT '0', - `editable` tinyint(1) NOT NULL DEFAULT '0', - `receipt_state` tinyint(1) NOT NULL DEFAULT '0', - `pending_receipt` tinyint(1) NOT NULL DEFAULT '0', - `enclosed` tinyint(1) NOT NULL DEFAULT '0', - `color` varchar(32) DEFAULT NULL, - PRIMARY KEY (`id_supply_order_state`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; - -CREATE TABLE IF NOT EXISTS `PREFIX_supply_order_state_lang` ( - `id_supply_order_state` int(11) unsigned NOT NULL, - `id_lang` int(11) unsigned NOT NULL, - `name` varchar(128) DEFAULT NULL, - PRIMARY KEY (`id_supply_order_state`,`id_lang`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; - -CREATE TABLE IF NOT EXISTS `PREFIX_warehouse` ( - `id_warehouse` int(11) unsigned NOT NULL AUTO_INCREMENT, - `id_currency` int(11) unsigned NOT NULL, - `id_address` int(11) unsigned NOT NULL, - `id_employee` int(11) unsigned NOT NULL, - `reference` varchar(32) DEFAULT NULL, - `name` varchar(45) NOT NULL, - `management_type` enum('WA','FIFO','LIFO') NOT NULL DEFAULT 'WA', - `deleted` tinyint(1) unsigned NOT NULL DEFAULT '0', - PRIMARY KEY (`id_warehouse`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; - -CREATE TABLE IF NOT EXISTS `PREFIX_warehouse_carrier` ( - `id_carrier` int(11) unsigned NOT NULL, - `id_warehouse` int(11) unsigned NOT NULL, - PRIMARY KEY (`id_warehouse`,`id_carrier`), - KEY `id_warehouse` (`id_warehouse`), - KEY `id_carrier` (`id_carrier`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; - -CREATE TABLE IF NOT EXISTS `PREFIX_warehouse_product_location` ( - `id_warehouse_product_location` int(11) unsigned NOT NULL AUTO_INCREMENT, - `id_product` int(11) unsigned NOT NULL, - `id_product_attribute` int(11) unsigned NOT NULL, - `id_warehouse` int(11) unsigned NOT NULL, - `location` varchar(64) DEFAULT NULL, - PRIMARY KEY (`id_warehouse_product_location`), - UNIQUE KEY `id_product` (`id_product`,`id_product_attribute`,`id_warehouse`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; - -CREATE TABLE IF NOT EXISTS `PREFIX_warehouse_shop` ( - `id_shop` int(11) unsigned NOT NULL, - `id_warehouse` int(11) unsigned NOT NULL, - PRIMARY KEY (`id_warehouse`,`id_shop`), - KEY `id_warehouse` (`id_warehouse`), - KEY `id_shop` (`id_shop`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; - -/* Update records before alter tables */ -/* PHP:set_stock_available(); */; -/* PHP:set_product_suppliers(); */; - -/* Update tables */ -DROP TABLE IF EXISTS `PREFIX_stock`; -CREATE TABLE IF NOT EXISTS `PREFIX_stock` ( -`id_stock` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT, -`id_warehouse` INT(11) UNSIGNED NOT NULL, -`id_product` INT(11) UNSIGNED NOT NULL, -`id_product_attribute` INT(11) UNSIGNED NOT NULL, -`reference` VARCHAR(32) NOT NULL, -`ean13` VARCHAR(13) DEFAULT NULL, -`upc` VARCHAR(12) DEFAULT NULL, -`physical_quantity` INT(11) UNSIGNED NOT NULL, -`usable_quantity` INT(11) UNSIGNED NOT NULL, -`price_te` DECIMAL(20,6) DEFAULT '0.000000', - PRIMARY KEY (`id_stock`), - KEY `id_warehouse` (`id_warehouse`), - KEY `id_product` (`id_product`), - KEY `id_product_attribute` (`id_product_attribute`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; - -DROP TABLE IF EXISTS `PREFIX_stock_mvt`; -CREATE TABLE IF NOT EXISTS `PREFIX_stock_mvt` ( - `id_stock_mvt` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT, - `id_stock` INT(11) UNSIGNED NOT NULL, - `id_order` INT(11) UNSIGNED DEFAULT NULL, - `id_supply_order` INT(11) UNSIGNED DEFAULT NULL, - `id_stock_mvt_reason` INT(11) UNSIGNED NOT NULL, - `id_employee` INT(11) UNSIGNED NOT NULL, - `employee_lastname` varchar(32) DEFAULT '', - `employee_firstname` varchar(32) DEFAULT '', - `physical_quantity` INT(11) UNSIGNED NOT NULL, - `date_add` DATETIME NOT NULL, - `sign` tinyint(1) NOT NULL DEFAULT 1, - `price_te` DECIMAL(20,6) DEFAULT '0.000000', - `last_wa` DECIMAL(20,6) DEFAULT '0.000000', - `current_wa` DECIMAL(20,6) DEFAULT '0.000000', - `referer` bigint UNSIGNED DEFAULT NULL, - PRIMARY KEY (`id_stock_mvt`), - KEY `id_stock` (`id_stock`), - KEY `id_stock_mvt_reason` (`id_stock_mvt_reason`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; - -ALTER TABLE `PREFIX_orders` DROP COLUMN `id_warehouse`; -ALTER TABLE `PREFIX_supplier` ADD COLUMN `id_address` int(10) unsigned NOT NULL default '0' AFTER `id_supplier`; -ALTER TABLE `PREFIX_address` ADD COLUMN `id_warehouse` int(10) unsigned NOT NULL DEFAULT 0 AFTER `id_supplier`; -ALTER TABLE `PREFIX_order_detail` ADD COLUMN `id_warehouse` int(10) unsigned NOT NULL default '0' AFTER `id_order_invoice`; - - -ALTER TABLE `PREFIX_stock_mvt_reason` ADD COLUMN `deleted` tinyint(1) unsigned NOT NULL default '0' AFTER `date_upd`; -ALTER TABLE `PREFIX_product` ADD COLUMN `advanced_stock_management` tinyint(1) default '0' NOT NULL; - -/* Update records after alter tables */ -/* PHP:update_stock_mvt_reason(); */; - -DELETE FROM `PREFIX_configuration` WHERE `name` = 'PS_PDF_ENCODING'; -DELETE FROM `PREFIX_configuration` WHERE `name` = 'PS_PDF_FONT'; - - -ALTER TABLE `PREFIX_order_detail` -ADD `reduction_amount_tax_incl` DECIMAL( 20, 6 ) NOT NULL AFTER `reduction_amount` , -ADD `reduction_amount_tax_excl` DECIMAL( 20, 6 ) NOT NULL AFTER `reduction_amount_tax_incl`, -ADD `total_price_tax_incl` DECIMAL(20, 6) NOT NULL AFTER `download_deadline`, -ADD `total_price_tax_excl` DECIMAL(20, 6) NOT NULL AFTER `total_price_tax_incl`, -ADD `unit_price_tax_incl` DECIMAL(20, 6) NOT NULL AFTER `total_price_tax_excl`, -ADD `unit_price_tax_excl` DECIMAL(20, 6) NOT NULL AFTER `unit_price_tax_incl`, -ADD `total_shipping_price_tax_incl` DECIMAL(20, 6) NOT NULL AFTER `unit_price_tax_excl`, -ADD `total_shipping_price_tax_excl` DECIMAL(20, 6) NOT NULL AFTER `total_shipping_price_tax_incl`, -ADD `purchase_supplier_price` DECIMAL(20, 6) NOT NULL AFTER `total_shipping_price_tax_excl`, -ADD `original_product_price` DECIMAL(20, 6) NOT NULL AFTER `purchase_supplier_price`; - -ALTER TABLE `PREFIX_orders` -ADD `total_discounts_tax_excl` decimal(17,2) NOT NULL AFTER `total_discounts`, -ADD `total_discounts_tax_incl` decimal(17,2) NOT NULL AFTER `total_discounts_tax_excl`, -ADD `total_paid_tax_excl` decimal(17,2) NOT NULL AFTER `total_paid`, -ADD `total_paid_tax_incl` decimal(17,2) NOT NULL AFTER `total_paid_tax_excl`, -ADD `total_shipping_tax_excl` decimal(17,2) NOT NULL AFTER `total_shipping`, -ADD `total_shipping_tax_incl` decimal(17,2) NOT NULL AFTER `total_shipping_tax_excl`, -ADD `total_wrapping_tax_excl` decimal(17,2) NOT NULL AFTER `total_wrapping`, -ADD `total_wrapping_tax_incl` decimal(17,2) NOT NULL AFTER `total_wrapping_tax_excl`; - -ALTER TABLE `PREFIX_order_cart_rule` ADD `value_tax_excl` DECIMAL(17, 2) NOT NULL DEFAULT '0.00'; -ALTER TABLE `PREFIX_order_cart_rule` ADD `id_order_invoice` INT UNSIGNED NOT NULL DEFAULT '0' AFTER `id_cart_rule`; - -ALTER TABLE `PREFIX_specific_price` ADD `id_group_shop` INT(11) UNSIGNED NOT NULL AFTER `id_shop`; - -/* Generate order references */ -UPDATE `PREFIX_orders` SET `reference` = id_order; - -ALTER TABLE `PREFIX_order_detail` ADD `tax_computation_method` tinyint(1) unsigned NOT NULL default '0' AFTER `product_weight`; - -/* PHP:migrate_orders(); */; - -ALTER TABLE `PREFIX_order_invoice` ADD `delivery_number` int(0) NOT NULL DEFAULT '0' AFTER `number`; -ALTER TABLE `PREFIX_order_invoice` ADD `delivery_date` datetime AFTER `delivery_number`; - -INSERT INTO `PREFIX_order_invoice` (`id_order`, `number`, `total_discount_tax_excl`, `total_discount_tax_incl`, `total_paid_tax_excl`, `total_paid_tax_incl`, `total_products`, `total_products_wt`, `total_shipping_tax_excl`, `total_shipping_tax_incl`, `total_wrapping_tax_excl`, `total_wrapping_tax_incl`, `note`, `date_add`) ( - SELECT `id_order`, `invoice_number`, `total_discounts_tax_excl`, `total_discounts_tax_incl`, `total_paid_tax_excl`, `total_paid_tax_incl`, `total_products`, `total_products_wt`, `total_shipping_tax_excl`, `total_shipping_tax_incl`, `total_wrapping_tax_excl`, `total_wrapping_tax_incl`, '', `invoice_date` - FROM `PREFIX_orders` - WHERE `invoice_number` != 0 -); - -ALTER TABLE `PREFIX_tab` ADD `active` TINYINT(1) UNSIGNED NOT NULL DEFAULT '1'; - -UPDATE `PREFIX_order_detail` od -SET od.`id_order_invoice` = IFNULL(( - SELECT oi.`id_order_invoice` - FROM `PREFIX_order_invoice` oi - WHERE oi.`id_order` = od.`id_order` LIMIT 1 -), 0); - -INSERT INTO `PREFIX_order_carrier` (`id_order`, `id_carrier`, `id_order_invoice`, `weight`, `shipping_cost_tax_excl`, `shipping_cost_tax_incl`, `tracking_number`, `date_add`) ( - SELECT `id_order`, `id_carrier`, ( - SELECT oi.`id_order_invoice` - FROM `PREFIX_order_invoice` oi - WHERE oi.`id_order` = o.`id_order` LIMIT 1 - ), ( - SELECT SUM(`product_weight`) - FROM `PREFIX_order_detail` od - WHERE od.`id_order` = o.`id_order` LIMIT 1 - ), `total_shipping_tax_excl`, `total_shipping_tax_incl`, `shipping_number`, `date_add` - FROM `PREFIX_orders` o -); - -INSERT IGNORE INTO `PREFIX_order_payment` (`id_order_invoice`, `id_order`, `id_currency`, `amount`, `payment_method`, `conversion_rate`, `date_add`) - ( - SELECT - ( - SELECT oi.`id_order_invoice` - FROM `PREFIX_order_invoice` oi - WHERE oi.`id_order` = o.`id_order` LIMIT 1 - ), - o.`id_order`, o.`id_currency`, o.`total_paid_real`, o.`payment`, o.`conversion_rate`, o.`date_add` - FROM `PREFIX_orders` o - LEFT JOIN `PREFIX_order_payment` op ON (op.`id_order` = o.`id_order`) - WHERE op.`id_order_payment` IS NULL - ); - -INSERT INTO `PREFIX_configuration` (`name`, `value`, `date_add`, `date_upd`) VALUES -('PS_SMARTY_CONSOLE', '0', NOW(), NOW()),('PS_INVOICE_MODEL', 'invoice', NOW(), NOW()); -ALTER TABLE `PREFIX_specific_price` ADD `id_cart` INT(11) UNSIGNED NOT NULL AFTER `id_specific_price_rule`; -ALTER TABLE `PREFIX_specific_price` ADD INDEX `id_cart` (`id_cart`); -/* PHP:update_modules_multishop(); */; - -UPDATE `PREFIX_tab` -SET `position` = ( - SELECT `position` FROM ( - SELECT MAX(`position`)+1 as `position` - FROM `PREFIX_tab` - WHERE `id_parent` = 0 - ) tmp -) -WHERE `class_name` = 'AdminStock'; - -UPDATE `PREFIX_tab` -SET `position` = ( - SELECT `position` FROM ( - SELECT MAX(`position`)+1 as `position` - FROM `PREFIX_tab` - WHERE `id_parent` = 0 - ) tmp -) -WHERE `class_name` = 'AdminAccounting'; - -ALTER TABLE `PREFIX_order_slip_detail` CHANGE `amount` `amount_tax_excl` DECIMAL( 10, 2 ) default NULL; -ALTER TABLE `PREFIX_order_slip_detail` ADD COLUMN `amount_tax_incl` DECIMAL(10,2) default NULL AFTER `amount_tax_excl`; -/* PHP:drop_image_type_non_unique_index(); */; -ALTER TABLE `PREFIX_image_type` ADD `id_theme` INT(11) NOT NULL AFTER `id_image_type`; -ALTER TABLE `PREFIX_image_type` ADD UNIQUE (`id_theme` ,`name`); -UPDATE `PREFIX_image_type` SET `id_theme`=1; - -CREATE TABLE IF NOT EXISTS `PREFIX_webservice_account_shop` ( -`id_webservice_account` INT( 11 ) UNSIGNED NOT NULL, -`id_shop` INT( 11 ) UNSIGNED NOT NULL, -PRIMARY KEY (`id_webservice_account` , `id_shop`), - KEY `id_shop` (`id_shop`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; - -ALTER TABLE `PREFIX_group` ADD `show_prices` tinyint(1) unsigned NOT NULL DEFAULT '1' AFTER `price_display_method`; - diff --git a/upgrade/sql/1.5.0.3.sql b/upgrade/sql/1.5.0.3.sql deleted file mode 100644 index 9f9fb78d7..000000000 --- a/upgrade/sql/1.5.0.3.sql +++ /dev/null @@ -1,10 +0,0 @@ -SET NAMES 'utf8'; - -ALTER TABLE `PREFIX_theme` ADD COLUMN directory varchar(64) NOT NULL; - -UPDATE `PREFIX_theme` SET directory = name; - -/* Supply Order modification as of 1.5.0.3 */ -ALTER TABLE `PREFIX_supply_order` DROP INDEX `reference`; -ALTER TABLE `PREFIX_supply_order` ADD UNIQUE (`reference`); - diff --git a/upgrade/sql/1.5.0.4.sql b/upgrade/sql/1.5.0.4.sql deleted file mode 100644 index d7eccc813..000000000 --- a/upgrade/sql/1.5.0.4.sql +++ /dev/null @@ -1,50 +0,0 @@ -SET NAMES 'utf8'; - -/* PHP:add_column_order_state_deleted_if_not_exists(); */; - -ALTER TABLE `PREFIX_category` ADD COLUMN `is_root_category` tinyint(1) NOT NULL default '0' AFTER `position`; - -UPDATE `PREFIX_category` SET `is_root_category` = 1 WHERE `id_category` = 1; - -ALTER TABLE `PREFIX_image_type` DROP `id_theme`; - -ALTER TABLE `PREFIX_specific_price_rule_condition` CHANGE `id_specific_price_rule_condition` `id_specific_price_rule_condition` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT; -ALTER TABLE `PREFIX_specific_price_rule_condition_group` CHANGE `id_specific_price_rule_condition_group` `id_specific_price_rule_condition_group` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT; - -UPDATE `PREFIX_supply_order_state_lang` -SET `name` = "order canceled" -WHERE `name` = "order fenced" AND (`id_lang` = 1 OR `id_lang` = 3 OR `id_lang` = 4 OR `id_lang` = 5); - -UPDATE `PREFIX_supply_order_state_lang` -SET `name` = "Commande cloturée" -WHERE `name` = "order fenced" AND id_lang = 2; - - -CREATE TABLE `PREFIX_category_shop` ( - `id_category` int(11) NOT NULL, - `id_shop` int(11) NOT NULL, - PRIMARY KEY (`id_category`, `id_shop`), - UNIQUE KEY `id_category_shop` (`id_category`,`id_shop`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; - -/* PHP:generate_root_category_for_multishop(); */; - -/* PHP:update_mailalerts_add_column_idshop(); */; - -CREATE TABLE `PREFIX_cart_rule_product_rule_group` ( - `id_product_rule_group` int(10) unsigned NOT NULL auto_increment, - `id_cart_rule` int(10) unsigned NOT NULL, - `quantity` int(10) unsigned NOT NULL default 1, - PRIMARY KEY (`id_product_rule_group`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; - -INSERT INTO `PREFIX_cart_rule_product_rule_group` (`id_product_rule_group`, `id_cart_rule`, `quantity`) ( - SELECT `id_cart_rule`, `id_cart_rule`, `quantity` FROM `PREFIX_cart_rule_product_rule` -); - -ALTER TABLE `PREFIX_cart_rule_product_rule` CHANGE `id_cart_rule` `id_product_rule_group` int(10) unsigned NOT NULL; -ALTER TABLE `PREFIX_cart_rule_product_rule` CHANGE `type` `type` ENUM('products', 'categories', 'attributes', 'manufacturers', 'suppliers') NOT NULL; - -ALTER TABLE `PREFIX_cart_rule` ADD `partial_use` tinyint(1) unsigned NOT NULL default 0 AFTER `priority`; - -ALTER TABLE `PREFIX_orders` ADD `current_state` int(10) unsigned NOT NULL default 0 AFTER `id_address_invoice`; diff --git a/upgrade/sql/1.5.0.5.sql b/upgrade/sql/1.5.0.5.sql deleted file mode 100644 index 84aafd4e6..000000000 --- a/upgrade/sql/1.5.0.5.sql +++ /dev/null @@ -1,33 +0,0 @@ -SET NAMES 'utf8'; - -ALTER TABLE `PREFIX_cart_rule` ADD `shop_restriction` tinyint(1) unsigned NOT NULL default 0 AFTER `product_restriction`; - -CREATE TABLE `PREFIX_cart_rule_shop` ( - `id_cart_rule` int(10) unsigned NOT NULL, - `id_shop` int(10) unsigned NOT NULL, - PRIMARY KEY (`id_cart_rule`, `id_shop`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; - -INSERT INTO `PREFIX_configuration`(`id_group_shop`, `id_shop`, `name`, `value`, `date_add`, `date_upd`) -VALUES - (NULL, NULL, 'PS_LOGO_MAIL', 'logo_mail.jpg', NOw(), NOW()), - (NULL, NULL, 'PS_LOGO_INVOICE', 'logo_invoice.jpg', NOW(), NOW()), - (NULL, NULL, 'PS_FAVICON', 'favicon.jpg', NOW(), NOW()), - (NULL, NULL, 'PS_STORES_ICON', 'logo_stores.gif', NOW(), NOW()); - -SET @id_configuration = (SELECT id_configuration FROM `PREFIX_configuration` WHERE `name` LIKE 'PS_LOGO' LIMIT 1); - -REPLACE INTO `PREFIX_configuration`(`id_group_shop`, `id_shop`, `name`, `value`, `date_add`, `date_upd`) -VALUES((SELECT IFNULL(@id_configuration, NULL)), NULL, 'PS_LOGO', 'logo.jpg', '0000-00-00 00:00:00', '0000-00-00 00:00:00'); - -CREATE TABLE `PREFIX_module_preference` ( - `id_module_preference` int(11) NOT NULL auto_increment, - `id_employee` int(11) NOT NULL, - `module` varchar(255) NOT NULL, - `interest` tinyint(1) default NULL, - `favorite` tinyint(1) default NULL, - PRIMARY KEY (`id_module_preference`), - UNIQUE KEY `employee_module` (`id_employee`, `module`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; - -ALTER TABLE `PREFIX_category_shop` ADD `position` int(10) unsigned NOT NULL default 0 AFTER `id_shop`; \ No newline at end of file diff --git a/upgrade/sql/1.5.0.6.sql b/upgrade/sql/1.5.0.6.sql deleted file mode 100644 index 29bcb05b7..000000000 --- a/upgrade/sql/1.5.0.6.sql +++ /dev/null @@ -1,11 +0,0 @@ -SET NAMES 'utf8'; - -UPDATE `PREFIX_orders` o -SET o.`current_state` = IFNULL(( - SELECT oh.`id_order_state` - FROM `PREFIX_order_history` oh - WHERE oh.`id_order` = o.`id_order` - ORDER BY oh.`date_add` DESC - LIMIT 1 -), 0); - diff --git a/upgrade/sql/1.5.0.7.sql b/upgrade/sql/1.5.0.7.sql deleted file mode 100644 index ffe21edef..000000000 --- a/upgrade/sql/1.5.0.7.sql +++ /dev/null @@ -1,43 +0,0 @@ -SET NAMES 'utf8'; - -/* PHP:add_unknown_gender(); */; - -ALTER TABLE `PREFIX_cart_rule` ADD `gift_product_attribute` int(10) unsigned NOT NULL default 0 AFTER `gift_product`; - -UPDATE `PREFIX_product` set is_virtual = 1 WHERE id_product IN (SELECT id_product FROM `PREFIX_product_download` WHERE active = 1); - -ALTER TABLE `PREFIX_product_shop` ADD `id_category_default` int(11) UNSIGNED DEFAULT NULL; - -ALTER TABLE `PREFIX_employee` ADD `bo_width` int(10) unsigned NOT NULL DEFAULT 0 AFTER `bo_theme`; - -CREATE TABLE `PREFIX_product_tax_rules_group_shop` ( - `id_product` int(11) UNSIGNED NOT NULL, - `id_tax_rules_group` int(11) UNSIGNED NOT NULL, - `id_shop` int(11) UNSIGNED NOT NULL, - PRIMARY KEY ( `id_product`, `id_tax_rules_group`, `id_shop` ) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; - -INSERT INTO `PREFIX_product_tax_rules_group_shop` (`id_product`, `id_tax_rules_group`, `id_shop`) - (SELECT `id_product`, `id_tax_rules_group`, `id_shop` FROM `PREFIX_product`, `PREFIX_shop`); -ALTER TABLE `PREFIX_product` DROP `id_tax_rules_group`; - -CREATE TABLE `PREFIX_carrier_tax_rules_group_shop` ( - `id_carrier` int(11) unsigned NOT NULL, - `id_tax_rules_group` int(11) unsigned NOT NULL, - `id_shop` int(11) unsigned NOT NULL, - PRIMARY KEY (`id_carrier`, `id_tax_rules_group`, `id_shop`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; - -INSERT INTO `PREFIX_carrier_tax_rules_group_shop` (`id_carrier`, `id_tax_rules_group`, `id_shop`) - (SELECT `id_carrier`, `id_tax_rules_group`, `id_shop` FROM `PREFIX_carrier`, `PREFIX_shop`); - -ALTER TABLE `PREFIX_carrier` DROP `id_tax_rules_group`; - -ALTER TABLE `PREFIX_customer` ADD `account_number` VARCHAR(128) NULL AFTER `birthday`; - -/* PHP:fix_unique_specific_price(); */; - -ALTER TABLE `PREFIX_specific_price` DROP INDEX `id_product`; -ALTER TABLE `PREFIX_specific_price` ADD INDEX (`id_product`, `id_shop`, `id_currency`, `id_country`, `id_group`, `id_customer`, `from_quantity`, `from`, `to`); -ALTER TABLE `PREFIX_specific_price` ADD UNIQUE (`id_product`,`id_shop`,`id_group_shop`,`id_currency`,`id_country`,`id_group`,`id_customer`,`id_product_attribute`,`from_quantity`,`from`,`to`); -ALTER TABLE `PREFIX_specific_price` ADD INDEX (`id_cart`); diff --git a/upgrade/sql/1.5.0.8.sql b/upgrade/sql/1.5.0.8.sql deleted file mode 100644 index bef7be94b..000000000 --- a/upgrade/sql/1.5.0.8.sql +++ /dev/null @@ -1,13 +0,0 @@ -SET NAMES 'utf8'; - -ALTER TABLE `PREFIX_product` ADD `visibility` ENUM('both', 'catalog', 'search', 'none') NOT NULL default 'both' AFTER `indexed`; - -CREATE TABLE IF NOT EXISTS `PREFIX_accounting_export` ( - `id_accounting_export` int(11) NOT NULL AUTO_INCREMENT, - `begin_to` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', - `end_to` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', - `type` int(11) NOT NULL, - `file` varchar(256) NOT NULL, - `date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - PRIMARY KEY (`id_accounting_export`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; diff --git a/upgrade/sql/1.5.0.9.sql b/upgrade/sql/1.5.0.9.sql deleted file mode 100644 index 68f812858..000000000 --- a/upgrade/sql/1.5.0.9.sql +++ /dev/null @@ -1,15 +0,0 @@ -SET NAMES 'utf8'; - -ALTER TABLE `PREFIX_employee` - MODIFY COLUMN `id_last_order` INT(10) UNSIGNED NOT NULL DEFAULT 0, - MODIFY COLUMN `id_last_customer_message` INT(10) UNSIGNED NOT NULL DEFAULT 0, - MODIFY COLUMN `id_last_customer` INT(10) UNSIGNED NOT NULL DEFAULT 0; - -ALTER TABLE `PREFIX_employee` ADD `default_tab` int(10) unsigned NOT NULL default 0 AFTER `bo_theme`; - -DROP TABLE `PREFIX_subdomain`; - -/* PHP:migrate_tabs_15(); */; - -DROP TABLE IF EXISTS `PREFIX_order_tax`; - diff --git a/upgrade/sql/1.5.1.0.sql b/upgrade/sql/1.5.1.0.sql deleted file mode 100644 index 035ef027d..000000000 --- a/upgrade/sql/1.5.1.0.sql +++ /dev/null @@ -1,20 +0,0 @@ -SET NAMES 'utf8'; - -/* PHP:image_shop1510(); */; -ALTER TABLE `PREFIX_image_shop` DROP PRIMARY KEY; -ALTER TABLE `PREFIX_image_shop` ADD INDEX (`id_image`, `id_shop`, `cover`); -UPDATE `PREFIX_image_shop` image_shop SET image_shop.`cover`=1 WHERE `id_image` IN (SELECT `id_image` FROM `PREFIX_image` i WHERE i.`cover`=1); - -INSERT INTO `PREFIX_configuration`(`name`, `value`, `date_add`, `date_upd`) VALUES ('PS_ONE_PHONE_AT_LEAST', '1', NOW(), NOW()); - -/* PHP:p15018_change_image_types(); */; - -ALTER TABLE `PREFIX_product` CHANGE `width` `width` DECIMAL(20, 6) NOT NULL DEFAULT '0', CHANGE `height` `height` DECIMAL(20, 6) NOT NULL DEFAULT '0', CHANGE `depth` `depth` DECIMAL(20, 6) NOT NULL DEFAULT '0', CHANGE `weight` `weight` DECIMAL(20, 6) NOT NULL DEFAULT '0'; -ALTER TABLE `PREFIX_product_attribute` CHANGE `weight` `weight` DECIMAL(20, 6) NOT NULL DEFAULT '0'; -ALTER TABLE `PREFIX_product_attribute_shop` CHANGE `weight` `weight` DECIMAL(20, 6) NOT NULL DEFAULT '0'; -ALTER IGNORE TABLE `PREFIX_order_carrier` CHANGE `weight` `weight` DECIMAL(20, 6) NOT NULL DEFAULT '0'; -ALTER TABLE `PREFIX_attribute_impact` CHANGE `weight` `weight` DECIMAL(20, 6) NOT NULL DEFAULT '0'; -ALTER TABLE `PREFIX_order_detail` CHANGE `product_weight` `product_weight` DECIMAL(20, 6) NOT NULL DEFAULT '0'; -ALTER TABLE `PREFIX_stock_available` DROP INDEX `product_sqlstock`; -ALTER TABLE `PREFIX_stock_available` ADD UNIQUE `product_sqlstock` (`id_product`, `id_product_attribute`, `id_shop`); -ALTER TABLE `PREFIX_cms` ADD INDEX (`id_cms_category`); diff --git a/upgrade/sql/1.5.2.0.sql b/upgrade/sql/1.5.2.0.sql deleted file mode 100644 index 993ac13b1..000000000 --- a/upgrade/sql/1.5.2.0.sql +++ /dev/null @@ -1,5 +0,0 @@ -SET NAMES 'utf8'; - -ALTER TABLE `PREFIX_address` CHANGE `company` `company` VARCHAR(32) NULL; - -/* PHP:fix_cms_shop_1520(); */; \ No newline at end of file diff --git a/upgrade/sql/1.5.3.0.sql b/upgrade/sql/1.5.3.0.sql deleted file mode 100644 index 2f8108f90..000000000 --- a/upgrade/sql/1.5.3.0.sql +++ /dev/null @@ -1,42 +0,0 @@ -SET NAMES 'utf8'; - -/* PHP:outstanding_allow_amount1530(); */; - -/* PHP:blocknewsletter1530(); */; - -/* PHP:block_category_1521(); */; - -/* PHP:update_order_messages(); */; - -UPDATE `PREFIX_order_state` SET `delivery` = 0 WHERE `id_order_state` = 3; - -ALTER TABLE `PREFIX_product_shop` ADD `id_product_redirected` int(10) unsigned NOT NULL default '0' AFTER `active` ; - -ALTER TABLE `PREFIX_product` ADD `id_product_redirected` int(10) unsigned NOT NULL default '0' AFTER `active` ; - -UPDATE `PREFIX_order_state` SET `send_email` = 1 WHERE `id_order_state` = (SELECT `value` FROM `PREFIX_configuration` WHERE `name` = 'PS_OS_WS_PAYMENT' LIMIT 1); - -UPDATE `PREFIX_order_state_lang` SET `template` = 'payment' WHERE `id_order_state` = (SELECT `value` FROM `PREFIX_configuration` WHERE `name` = 'PS_OS_WS_PAYMENT' LIMIT 1); - -DELETE FROM `PREFIX_configuration` WHERE `name`= 'PS_HIGH_HTML_THEME_COMPRESSION'; - -INSERT INTO `PREFIX_configuration`(`name`, `value`, `date_add`, `date_upd`) VALUES ('PS_MAIL_COLOR', '#db3484', NOW(), NOW()); - -ALTER TABLE `PREFIX_order_cart_rule` CHANGE `name` `name` VARCHAR(254); - -ALTER IGNORE TABLE `PREFIX_cart` CHANGE `delivery_option` `delivery_option` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL; - -ALTER TABLE `PREFIX_currency_shop` ADD `conversion_rate` DECIMAL( 13, 6 ) NOT NULL; -UPDATE `PREFIX_currency_shop` a SET `conversion_rate` = (SELECT `conversion_rate` FROM `PREFIX_currency` b WHERE a.id_currency = b.id_currency); - -INSERT INTO `PREFIX_configuration`(`name`, `value`, `id_shop`, `id_shop_group`, `date_add`, `date_upd`) - (SELECT 'PS_GIFT_WRAPPING_TAX_RULES_GROUP', b.`id_tax_rules_group`, a.`id_shop`, a.`id_shop_group`, NOW(), NOW() - FROM `PREFIX_configuration` a - JOIN `PREFIX_tax_rule` b ON (a.value = b.id_tax) - WHERE a.name='PS_GIFT_WRAPPING_TAX' - GROUP BY a.`id_shop`, a.`id_shop_group` - ); - -DELETE FROM `PREFIX_configuration` WHERE name='PS_GIFT_WRAPPING_TAX'; - -ALTER TABLE `PREFIX_cart_rule` ADD `highlight` tinyint(1) unsigned NOT NULL default 0 AFTER `gift_product_attribute`; \ No newline at end of file diff --git a/upgrade/sql/1.5.3.1.sql b/upgrade/sql/1.5.3.1.sql deleted file mode 100644 index 4146e75a1..000000000 --- a/upgrade/sql/1.5.3.1.sql +++ /dev/null @@ -1,5 +0,0 @@ -SET NAMES 'utf8'; - -/* PHP:p1531_redirect_type(); */; - -ALTER IGNORE TABLE `PREFIX_cart` CHANGE `delivery_option` `delivery_option` TEXT NOT NULL; diff --git a/upgrade/sql/1.5.4.0.sql b/upgrade/sql/1.5.4.0.sql deleted file mode 100644 index 9f486c66c..000000000 --- a/upgrade/sql/1.5.4.0.sql +++ /dev/null @@ -1,55 +0,0 @@ -SET NAMES 'utf8'; - -/* PHP:update_customer_default_group(); */; - -UPDATE `PREFIX_meta` SET `page` = 'supplier' WHERE `page` = 'supply'; - -ALTER TABLE `PREFIX_image_type` CHANGE `name` `name` VARCHAR( 64 ) NOT NULL; - -ALTER TABLE `PREFIX_customer` ADD `id_lang` INT UNSIGNED NULL AFTER `id_default_group`; -UPDATE `PREFIX_customer` SET id_lang = (SELECT `value` FROM `PREFIX_configuration` WHERE name = 'PS_LANG_DEFAULT' LIMIT 1); -UPDATE `PREFIX_customer` c, `PREFIX_orders` o SET c.id_lang = o.id_lang WHERE c.id_customer = o.id_customer; - -UPDATE `PREFIX_quick_access` SET `link` = 'index.php?controller=AdminCartRules&addcart_rule' WHERE `link` = 'index.php?tab=AdminDiscounts&adddiscount'; - -ALTER TABLE `PREFIX_order_cart_rule` ADD `free_shipping` tinyint(1) NOT NULL DEFAULT 0 AFTER `value_tax_excl`; - -UPDATE `PREFIX_order_cart_rule` ocr, `PREFIX_cart_rule` cr SET ocr.free_shipping = 1 WHERE ocr.id_cart_rule = cr.id_cart_rule AND cr.free_shipping = 1; - -UPDATE `PREFIX_orders` o, `PREFIX_order_cart_rule` ocr SET - o.`total_discounts` = o.total_discounts + o.`total_shipping_tax_incl`, - o.`total_discounts_tax_incl` = o.`total_discounts_tax_incl` + o.`total_shipping_tax_incl`, - o.`total_discounts_tax_excl` = o.`total_discounts_tax_excl` + o.`total_shipping_tax_excl` -WHERE o.id_order = ocr.id_order AND ocr.free_shipping = 1; - -CREATE TABLE `PREFIX_tab_module_preference` ( - `id_tab_module_preference` int(11) NOT NULL auto_increment, - `id_employee` int(11) NOT NULL, - `id_tab` int(11) NOT NULL, - `module` varchar(255) NOT NULL, - PRIMARY KEY (`id_tab_module_preference`), - UNIQUE KEY `employee_module` (`id_employee`, `id_tab`, `module`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; - -/* PHP:add_new_tab(AdminMarketing, es:Marketing|it:Marketing|en:Marketing|de:Marketing|fr:Marketing, 0, false, AdminPriceRule); */; - -/* PHP:p1540_add_missing_columns(); */; - -ALTER TABLE `PREFIX_stock_available` ADD UNIQUE `product_sqlstock` (`id_product`, `id_product_attribute`, `id_shop`, `id_shop_group`); - -UPDATE PREFIX_configuration SET `value` = '8388608' WHERE `name` = 'PS_PRODUCT_PICTURE_MAX_SIZE' AND `value` <= '524288'; - -ALTER TABLE `PREFIX_guest` ADD `mobile_theme` tinyint(1) NOT NULL DEFAULT 0; -ALTER TABLE `PREFIX_orders` ADD `mobile_theme` tinyint(1) NOT NULL DEFAULT 0 AFTER `gift_message`; -ALTER TABLE `PREFIX_cart` ADD `mobile_theme` tinyint(1) NOT NULL DEFAULT 0 AFTER `gift_message`; - -ALTER TABLE `PREFIX_address` CHANGE `phone` `phone` varchar(32) default NULL; -ALTER TABLE `PREFIX_address` CHANGE `phone_mobile` `phone_mobile` varchar(32) default NULL; - -/* PHP:update_genders_images(); */; - -UPDATE `PREFIX_customer` SET `id_gender` = 1 WHERE `email` LIKE 'pub@prestashop.com' AND `id_customer` = 1 AND `id_gender` = 4; - -UPDATE `PREFIX_cart_rule_carrier` crc INNER JOIN `PREFIX_carrier` c ON crc.`id_carrier` = c.`id_carrier` SET crc.`id_carrier` = c.`id_reference`; - -UPDATE `PREFIX_order_payment` SET `order_reference` = LPAD(order_reference, 9 , '0'); \ No newline at end of file diff --git a/upgrade/sql/1.5.4.1.sql b/upgrade/sql/1.5.4.1.sql deleted file mode 100644 index 4d6f37c0e..000000000 --- a/upgrade/sql/1.5.4.1.sql +++ /dev/null @@ -1,11 +0,0 @@ -SET NAMES 'utf8'; - -ALTER TABLE `PREFIX_carrier` CHANGE `max_weight` `max_weight` DECIMAL( 20, 6 ) NULL DEFAULT '0'; - -DELETE ms.*, hm.* FROM `PREFIX_module_shop` ms INNER JOIN `PREFIX_hook_module` hm USING (`id_module`) INNER JOIN `PREFIX_module` m USING (`id_module`) WHERE m.`name` LIKE 'backwardcompatibility'; - -UPDATE `PREFIX_module` SET `active` = 0 WHERE `name` LIKE 'backwardcompatibility'; - -ALTER TABLE `PREFIX_orders` CHANGE `reference` `reference` VARCHAR( 10 ) NULL DEFAULT NULL; - -ALTER TABLE `PREFIX_order_payment` CHANGE `order_reference` `order_reference` VARCHAR( 10 ) NULL DEFAULT NULL; \ No newline at end of file diff --git a/upgrade/sql/1.5.5.0.sql b/upgrade/sql/1.5.5.0.sql deleted file mode 100644 index cb8b489d1..000000000 --- a/upgrade/sql/1.5.5.0.sql +++ /dev/null @@ -1,38 +0,0 @@ -SET NAMES 'utf8'; - -ALTER TABLE `PREFIX_store` CHANGE `latitude` `latitude` DECIMAL( 13, 8 ) NULL DEFAULT NULL , CHANGE `longitude` `longitude` DECIMAL( 13, 8 ) NULL DEFAULT NULL ; - -INSERT INTO `PREFIX_configuration` (`name`, `value`, `date_add`, `date_upd`) VALUES('PS_CUSTOMER_CREATION_EMAIL', 1, NOW(), NOW()); - -ALTER TABLE `PREFIX_webservice_account` CHANGE `class_name` `class_name` VARCHAR(64) NOT NULL DEFAULT 'WebserviceRequest'; - -/* PHP:add_module_to_hook(blockcart, actionCartListOverride); */; -/* PHP:add_module_to_hook(blockmanufacturer, actionObjectManufacturerDeleteAfter); */; -/* PHP:add_module_to_hook(blockmanufacturer, actionObjectManufacturerAddAfter); */; -/* PHP:add_module_to_hook(blockmanufacturer, actionObjectManufacturerUpdateAfter); */; -/* PHP:add_module_to_hook(blocksupplier, actionObjectSupplierDeleteAfter); */; -/* PHP:add_module_to_hook(blocksupplier, actionObjectSupplierAddAfter); */; -/* PHP:add_module_to_hook(blocksupplier, actionObjectSupplierUpdateAfter); */; -/* PHP:fix_download_product_feature_active(); */; -/* PHP:add_module_to_hook(blockmyaccount, actionModuleRegisterHookAfter); */; -/* PHP:add_module_to_hook(blockmyaccountfooter, actionModuleRegisterHookAfter); */; -/* PHP:add_module_to_hook(blockmyaccount, actionModuleUnRegisterHookAfter); */; -/* PHP:add_module_to_hook(blockmyaccountfooter, actionModuleUnRegisterHookAfter); */; -/* PHP:remove_tab(AdminRangePrice); */; -/* PHP:remove_tab(AdminRangeWeight); */; - - -ALTER TABLE `PREFIX_log` ADD `id_employee` INT(10) UNSIGNED NULL DEFAULT NULL AFTER `object_id`; - -SET @id_parent = (SELECT IFNULL(id_tab, 1) FROM `PREFIX_tab` WHERE `class_name` = 'AdminPriceRule' LIMIT 1); -UPDATE `PREFIX_tab` SET id_parent = @id_parent WHERE `id_parent` = 1 AND `class_name` = 'AdminMarketing' LIMIT 1; - -UPDATE `PREFIX_hook` SET `description` = 'This hook is called when a new credit slip is added regarding client order' WHERE `name` = 'actionOrderSlipAdd'; - -ALTER TABLE `PREFIX_product_shop` DROP INDEX `date_add`, ADD INDEX `date_add` (`date_add` , `active` , `visibility`); - -UPDATE `PREFIX_hook` SET `live_edit` = '1' WHERE `name` LIKE 'leftcolumn'; - -UPDATE `PREFIX_configuration` SET `value` = '0' WHERE `name` LIKE 'PS_LEGACY_IMAGES'; - -INSERT INTO `PREFIX_configuration` (`name`, `value`, `date_add`, `date_upd`) VALUES('PS_SMARTY_CONSOLE_KEY', 'SMARTY_DEBUG', NOW(), NOW()); diff --git a/upgrade/sql/1.5.6.0.sql b/upgrade/sql/1.5.6.0.sql deleted file mode 100644 index 84f374101..000000000 --- a/upgrade/sql/1.5.6.0.sql +++ /dev/null @@ -1,17 +0,0 @@ -ALTER TABLE `PREFIX_manufacturer_lang` CHANGE `short_description` `short_description` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL; - -/* PHP:add_module_to_hook(blockcart, actionCartListOverride); */; -/* PHP:add_module_to_hook(blockmanufacturer, actionObjectManufacturerDeleteAfter); */; -/* PHP:add_module_to_hook(blockmanufacturer, actionObjectManufacturerAddAfter); */; -/* PHP:add_module_to_hook(blockmanufacturer, actionObjectManufacturerUpdateAfter); */; -/* PHP:add_module_to_hook(blocksupplier, actionObjectSupplierDeleteAfter); */; -/* PHP:add_module_to_hook(blocksupplier, actionObjectSupplierAddAfter); */; -/* PHP:add_module_to_hook(blocksupplier, actionObjectSupplierUpdateAfter); */; -/* PHP:add_module_to_hook(blockmyaccount, actionModuleRegisterHookAfter); */; -/* PHP:add_module_to_hook(blockmyaccountfooter, actionModuleRegisterHookAfter); */; -/* PHP:add_module_to_hook(blockmyaccount, actionModuleUnRegisterHookAfter); */; -/* PHP:add_module_to_hook(blockmyaccountfooter, actionModuleUnRegisterHookAfter); */; -/* PHP:remove_tab(AdminRangePrice); */; -/* PHP:remove_tab(AdminRangeWeight); */; - -UPDATE `PREFIX_employee` SET default_tab = (SELECT `id_tab` FROM `PREFIX_tab` WHERE `class_name` LIKE 'AdminOrders' LIMIT 0 , 1) WHERE default_tab = 0; diff --git a/upgrade/sql/1.5.6.1.sql b/upgrade/sql/1.5.6.1.sql deleted file mode 100644 index f657cb087..000000000 --- a/upgrade/sql/1.5.6.1.sql +++ /dev/null @@ -1,13 +0,0 @@ -ALTER TABLE `PREFIX_customer_message` CHANGE `ip_address` `ip_address` VARCHAR( 15 ) NULL DEFAULT NULL; - -UPDATE `PREFIX_currency` SET `conversion_rate` = 1 WHERE `conversion_rate` = 0; - -ALTER TABLE `PREFIX_currency` CHANGE `conversion_rate` `conversion_rate` DECIMAL( 13, 6 ) NOT NULL DEFAULT '1'; - -UPDATE `PREFIX_orders` SET conversion_rate = 1 WHERE conversion_rate = 0; - -ALTER TABLE `PREFIX_cms` ADD `indexation` tinyint(1) UNSIGNED NULL DEFAULT '1' AFTER `active`; - -/* PHP:update_order_messages(); */; - -ALTER TABLE `PREFIX_group_reduction` CHANGE `reduction` `reduction` DECIMAL( 4, 4 ) NOT NULL; \ No newline at end of file diff --git a/upgrade/sql/1.5.6.2.sql b/upgrade/sql/1.5.6.2.sql deleted file mode 100644 index 22c382dd4..000000000 --- a/upgrade/sql/1.5.6.2.sql +++ /dev/null @@ -1 +0,0 @@ -SET NAMES 'utf8'; \ No newline at end of file diff --git a/upgrade/sql/1.6.0.1.sql b/upgrade/sql/1.6.0.1.sql deleted file mode 100644 index dd1647b33..000000000 --- a/upgrade/sql/1.6.0.1.sql +++ /dev/null @@ -1,102 +0,0 @@ -SET NAMES 'utf8'; - -INSERT INTO `PREFIX_configuration` (`name`, `value`, `date_add`, `date_upd`) VALUES('PS_DASHBOARD_USE_PUSH', '0', NOW(), NOW()); -UPDATE `PREFIX_configuration` SET `value` = 'graphnvd3' WHERE `name` = 'PS_STATS_RENDER'; - -ALTER TABLE `PREFIX_employee` CHANGE `bo_show_screencast` `bo_menu` TINYINT(1) NOT NULL DEFAULT '1'; -UPDATE `PREFIX_employee` SET bo_menu = 1; - -CREATE TABLE `PREFIX_configuration_kpi` ( - `id_configuration_kpi` int(10) unsigned NOT NULL auto_increment, - `id_shop_group` INT(11) UNSIGNED DEFAULT NULL, - `id_shop` INT(11) UNSIGNED DEFAULT NULL, - `name` varchar(32) NOT NULL, - `value` text, - `date_add` datetime NOT NULL, - `date_upd` datetime NOT NULL, - PRIMARY KEY (`id_configuration_kpi`), - KEY `name` (`name`), - KEY `id_shop` (`id_shop`), - KEY `id_shop_group` (`id_shop_group`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; - -CREATE TABLE `PREFIX_configuration_kpi_lang` ( - `id_configuration_kpi` int(10) unsigned NOT NULL, - `id_lang` int(10) unsigned NOT NULL, - `value` text, - `date_upd` datetime default NULL, - PRIMARY KEY (`id_configuration_kpi`,`id_lang`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; - -/* PHP:ps1600_add_missing_index(); */; - -UPDATE `PREFIX_configuration` SET `value` = '-' WHERE `name` = 'PS_ATTRIBUTE_ANCHOR_SEPARATOR'; - -UPDATE `PREFIX_tab` SET class_name = 'AdminDashboard', id_parent = 0, active = 1, module = '' WHERE class_name = 'AdminHome'; -UPDATE `PREFIX_tab_lang` SET name = 'Dashboard' WHERE id_tab IN (SELECT id_tab FROM `PREFIX_tab` WHERE class_name = 'AdminDashboard') AND id_lang IN (SELECT id_lang FROM `PREFIX_lang` WHERE iso_code = 'en'); -UPDATE `PREFIX_tab_lang` SET name = 'Tableau de Bord' WHERE id_tab IN (SELECT id_tab FROM `PREFIX_tab` WHERE class_name = 'AdminDashboard') AND id_lang IN (SELECT id_lang FROM `PREFIX_lang` WHERE iso_code = 'fr'); - - -INSERT INTO `PREFIX_module` (`name`, `active`, `version`) -VALUES ('graphnvd3', '1', '1.0'),('dashactivity', '1', '0.1'),('dashtrends', '1', '0.1'),('dashgoals', '1', '0.1'),('dashproducts', '1', '0.1'); - -INSERT INTO `PREFIX_module_access` (`id_profile`, `id_module`, `view`, `configure`) ( - SELECT p.id_profile, m.id_module, 1, 1 FROM `PREFIX_module` m, `PREFIX_profile` p WHERE m.name IN ('graphnvd3', 'dashactivity', 'dashtrends', 'dashgoals', 'dashproducts') -); - -INSERT INTO `PREFIX_module_shop` (`id_module`, `id_shop`) ( - SELECT m.id_module, s.id_shop FROM `PREFIX_module` m, `PREFIX_shop` s WHERE m.name IN ('graphnvd3', 'dashactivity', 'dashtrends', 'dashgoals', 'dashproducts') -); - -INSERT INTO `PREFIX_hook` (`name`, `title`, `position`, `live_edit`) VALUES -('dashboardZoneOne', 'dashboardZoneOne', 1, 0), -('dashboardZoneTwo', 'dashboardZoneTwo', 1, 0), -('dashboardData', 'dashboardData', 0, 0); - -INSERT INTO `PREFIX_hook_module` (`id_module`, `id_shop`, `id_hook`, `position`) ( - SELECT m.id_module, s.id_shop, h.id_hook, 0 FROM `PREFIX_module` m, `PREFIX_shop` s, `PREFIX_hook` h WHERE m.name IN ('dashactivity', 'dashtrends', 'dashproducts') AND h.name IN ('dashboardData') -); -INSERT INTO `PREFIX_hook_module` (`id_module`, `id_shop`, `id_hook`, `position`) ( - SELECT m.id_module, s.id_shop, h.id_hook, 1 FROM `PREFIX_module` m, `PREFIX_shop` s, `PREFIX_hook` h WHERE m.name IN ('dashactivity') AND h.name IN ('dashboardZoneOne') -); -INSERT INTO `PREFIX_hook_module` (`id_module`, `id_shop`, `id_hook`, `position`) ( - SELECT m.id_module, s.id_shop, h.id_hook, 1 FROM `PREFIX_module` m, `PREFIX_shop` s, `PREFIX_hook` h WHERE m.name IN ('dashtrends') AND h.name IN ('dashboardZoneTwo') -); -INSERT INTO `PREFIX_hook_module` (`id_module`, `id_shop`, `id_hook`, `position`) ( - SELECT m.id_module, s.id_shop, h.id_hook, 2 FROM `PREFIX_module` m, `PREFIX_shop` s, `PREFIX_hook` h WHERE m.name IN ('dashgoals') AND h.name IN ('dashboardZoneTwo') -); -INSERT INTO `PREFIX_hook_module` (`id_module`, `id_shop`, `id_hook`, `position`) ( - SELECT m.id_module, s.id_shop, h.id_hook, 3 FROM `PREFIX_module` m, `PREFIX_shop` s, `PREFIX_hook` h WHERE m.name IN ('dashproducts') AND h.name IN ('dashboardZoneTwo') -); - -INSERT INTO `PREFIX_configuration` (`id_shop_group`, `id_shop`, `name`, `value`, `date_add`, `date_upd`) VALUES (NULL, NULL, 'CONF_AVERAGE_PRODUCT_MARGIN', '40', NOW(), NOW()); - -ALTER TABLE `PREFIX_employee` ADD `stats_compare_from` DATE NULL DEFAULT NULL AFTER `stats_date_to` , ADD `stats_compare_to` DATE NULL DEFAULT NULL AFTER `stats_compare_from`; - -INSERT INTO `PREFIX_hook` (`name` , `title` , `description` , `position` , `live_edit`) - VALUES ('displayHomeTab', 'Home Page Tabs', 'This hook displays new elements on the homepage tabs', '1', '1') - ON DUPLICATE KEY UPDATE `position` = 1, `live_edit` = 1; -INSERT INTO `PREFIX_hook` (`name` , `title` , `description` , `position` , `live_edit`) - VALUES ('displayHomeTabContent', 'Home Page Tabs Content', 'This hook displays new elements on the homepage tabs content', '1', '1') - ON DUPLICATE KEY UPDATE `position` = 1, `live_edit` = 1; -INSERT INTO `PREFIX_hook` (`name` , `title` , `description` , `position` , `live_edit`) - VALUES ('displayBackOfficeCategory', 'Display new elements in the Back Office, tab AdminCategories', 'This hook launches modules when the AdminCategories tab is displayed in the Back Office', '1', '1') - ON DUPLICATE KEY UPDATE `position` = 1, `live_edit` = 1; -INSERT INTO `PREFIX_hook` (`name` , `title` , `description` , `position` , `live_edit`) - VALUES ('actionBackOfficeCategory', 'Process new elements in the Back Office, tab AdminCategories', 'This hook process modules when the AdminCategories tab is displayed in the Back Office', '1', '1') - ON DUPLICATE KEY UPDATE `position` = 1, `live_edit` = 1; - -ALTER TABLE `PREFIX_employee` ADD `stats_compare_option` INT( 1 ) NOT NULL DEFAULT '1' AFTER `stats_compare_to`; - -INSERT INTO `PREFIX_configuration` (`name`, `value`, `date_add`, `date_upd`) VALUES('DASHACTIVITY_CART_ACTIVE', '30', NOW(), NOW()); -INSERT INTO `PREFIX_configuration` (`name`, `value`, `date_add`, `date_upd`) VALUES('DASHACTIVITY_CART_ABANDONED_MIN', '24', NOW(), NOW()); -INSERT INTO `PREFIX_configuration` (`name`, `value`, `date_add`, `date_upd`) VALUES('DASHACTIVITY_CART_ABANDONED_MAX', '48', NOW(), NOW()); -INSERT INTO `PREFIX_configuration` (`name`, `value`, `date_add`, `date_upd`) VALUES('DASHACTIVITY_VISITOR_ONLINE', '30', NOW(), NOW()); -INSERT INTO `PREFIX_configuration` (`name`, `value`, `date_add`, `date_upd`) VALUES('PS_DASHGOALS_CURRENT_YEAR', YEAR(NOW()), NOW(), NOW()); -INSERT INTO `PREFIX_configuration` (`name`, `value`, `date_add`, `date_upd`) VALUES('DASHPRODUCT_NBR_SHOW_LAST_ORDER', '10', NOW(), NOW()); -INSERT INTO `PREFIX_configuration` (`name`, `value`, `date_add`, `date_upd`) VALUES('DASHPRODUCT_NBR_SHOW_BEST_SELLER', '10', NOW(), NOW()); -INSERT INTO `PREFIX_configuration` (`name`, `value`, `date_add`, `date_upd`) VALUES('DASHPRODUCT_NBR_SHOW_MOST_VIEWED', '10', NOW(), NOW()); -INSERT INTO `PREFIX_configuration` (`name`, `value`, `date_add`, `date_upd`) VALUES('DASHPRODUCT_NBR_SHOW_TOP_SEARCH', '10', NOW(), NOW()); - -INSERT INTO `PREFIX_configuration` (name, value, date_add, date_upd) VALUES ('PS_RETURN_PREFIX', '#RE', NOW(), NOW()); -INSERT INTO `PREFIX_configuration_lang` (`id_configuration`, `id_lang`, `value`, `date_upd`) SELECT c.`id_configuration`, l.`id_lang`, c.`value`, NOW() FROM `PREFIX_configuration` c, `PREFIX_lang` l WHERE c.`name` = 'PS_RETURN_PREFIX'; diff --git a/upgrade/sql/1.6.0.10.sql b/upgrade/sql/1.6.0.10.sql deleted file mode 100644 index fd6dfd54c..000000000 --- a/upgrade/sql/1.6.0.10.sql +++ /dev/null @@ -1,65 +0,0 @@ -SET NAMES 'utf8'; - -CREATE TABLE `PREFIX_smarty_cache` ( - `id_smarty_cache` char(40) NOT NULL, - `name` char(40), - `cache_id` varchar(254) DEFAULT NULL, - `modified` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, - `content` longtext NOT NULL, - PRIMARY KEY (`id_smarty_cache`), - KEY `name` (`name`), - KEY `cache_id` (`cache_id`), - KEY `modified` (`modified`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; - -INSERT INTO `PREFIX_configuration` (`name` , `value` , `date_add` , `date_upd`) VALUES -('PS_SMARTY_CACHING_TYPE', 'filesystem', NOW(), NOW()), -('PS_SMARTY_CLEAR_CACHE', 'everytime', NOW(), NOW()), -('PS_DETECT_LANG', '1', NOW(), NOW()), -('PS_DETECT_COUNTRY', '1', NOW(), NOW()); - -ALTER TABLE `PREFIX_quick_access` CHANGE `link` `link` VARCHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL; - -ALTER TABLE `PREFIX_order_slip_detail` CHANGE `amount_tax_excl` `amount_tax_excl` DECIMAL(20, 6) NULL DEFAULT NULL; - -ALTER TABLE `PREFIX_order_slip_detail` CHANGE `amount_tax_incl` `amount_tax_incl` DECIMAL( 20, 6 ) NULL DEFAULT NULL; - -INSERT INTO `PREFIX_configuration` (`name`, `value`, `date_add`, `date_upd`) VALUES ('PS_ROUND_TYPE', 2, now(), now()); - -ALTER TABLE `PREFIX_order_slip` ADD `total_products_tax_excl` DECIMAL(20, 6) NULL AFTER `id_order`, ADD `total_products_tax_incl` DECIMAL(20, 6) NULL AFTER `total_products_tax_excl`,ADD `total_shipping_tax_excl` DECIMAL(20, 6) NULL AFTER `total_products_tax_incl`, ADD `total_shipping_tax_incl` DECIMAL(20, 6) NULL AFTER `total_shipping_tax_excl`; -ALTER TABLE `PREFIX_order_slip_detail` ADD `unit_price_tax_excl` DECIMAL(20, 6) NULL AFTER `product_quantity`, ADD `unit_price_tax_incl` DECIMAL(20, 6) NULL AFTER `unit_price_tax_excl`, ADD `total_price_tax_excl` DECIMAL(20, 6) NULL AFTER `unit_price_tax_incl`, ADD `total_price_tax_incl` DECIMAL(20, 6) NULL AFTER `total_price_tax_excl`; - -CREATE TABLE IF NOT EXISTS `PREFIX_order_slip_detail_tax` ( - `id_order_slip_detail` int(11) unsigned NOT NULL, - `id_tax` int(11) unsigned NOT NULL, - `unit_amount` decimal(16,6) NOT NULL DEFAULT '0.000000', - `total_amount` decimal(16,6) NOT NULL DEFAULT '0.000000', - KEY (`id_order_slip_detail`), - KEY `id_tax` (`id_tax`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; - -ALTER TABLE `PREFIX_tax_rules_group` ADD `deleted` TINYINT(1) UNSIGNED NOT NULL, ADD `date_add` DATETIME NOT NULL, ADD `date_upd` DATETIME NOT NULL; - -UPDATE `PREFIX_tax_rules_group` SET `date_add` = NOW(), `date_upd` = NOW(); - -ALTER TABLE `PREFIX_order_detail` ADD `id_tax_rules_group` INT(11) UNSIGNED DEFAULT '0' AFTER `product_weight`, ADD INDEX `id_tax_rules_group` (`id_tax_rules_group`); - -CREATE TABLE IF NOT EXISTS `PREFIX_mail` ( - `id_mail` int(11) unsigned NOT NULL AUTO_INCREMENT, - `recipient` varchar(126) NOT NULL, - `template` varchar(62) NOT NULL, - `subject` varchar(254) NOT NULL, - `id_lang` int(11) unsigned NOT NULL, - `date_add` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, - PRIMARY KEY (`id_mail`), - KEY `recipient` (`recipient`(10)) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; -INSERT INTO `PREFIX_configuration` (`name`, `value`, `date_add`, `date_upd`) VALUES ('PS_LOG_EMAILS', 1, now(), now()); - -ALTER TABLE `PREFIX_employee` ADD `last_connection_date` date NOT NULL DEFAULT '0000-00-00'; - -UPDATE `PREFIX_category` SET `is_root_category` = 0 WHERE `id_parent` != (SELECT `value` FROM `PREFIX_configuration` WHERE `name` = 'PS_ROOT_CATEGORY' LIMIT 1) AND `is_root_category` = 1; - -ALTER TABLE `PREFIX_orders` ADD INDEX (`reference`); - -UPDATE `PREFIX_meta` SET `page` = 'pagenotfound' WHERE `page` = '404'; diff --git a/upgrade/sql/1.6.0.11.sql b/upgrade/sql/1.6.0.11.sql deleted file mode 100644 index 865f343d3..000000000 --- a/upgrade/sql/1.6.0.11.sql +++ /dev/null @@ -1,54 +0,0 @@ -SET NAMES 'utf8'; - -INSERT INTO `PREFIX_order_state` (`invoice`, `send_email`, `module_name`, `color`, `unremovable`, `hidden`, `logable`, `delivery`, `shipped`, `paid`, `deleted`) VALUES ('0', '1', NULL, '#FF69B4', '1', '0', '0', '0', '0', '0', '0'); -SET @id_order_state = LAST_INSERT_ID(); -SET @id_order_state_oos = (SELECT `value` FROM `PREFIX_configuration` WHERE `name` = 'PS_OS_OUTOFSTOCK' LIMIT 1); -INSERT INTO `PREFIX_order_state_lang` (`id_order_state`, `id_lang`, `name`, `template`) (SELECT @id_order_state, id_lang, name, template FROM `PREFIX_order_state_lang` WHERE id_order_state = @id_order_state_oos); - -INSERT IGNORE INTO `PREFIX_configuration` (`name`, `value`, `date_add`, `date_upd`) VALUES -('PS_OS_OUTOFSTOCK_PAID', @id_order_state_oos, NOW(), NOW()), -('PS_OS_OUTOFSTOCK_UNPAID', @id_order_state, NOW(), NOW()); - -ALTER TABLE `PREFIX_module_access` ADD `uninstall` TINYINT( 1 ) NOT NULL AFTER `configure`; - -ALTER TABLE `PREFIX_specific_price` ADD `reduction_tax` TINYINT( 1 ) NOT NULL DEFAULT 1 AFTER `reduction`; -ALTER TABLE `PREFIX_specific_price_rule` ADD `reduction_tax` TINYINT( 1 ) NOT NULL DEFAULT 1 AFTER `reduction`; - -INSERT INTO `PREFIX_hook` (`id_hook` , `name` , `title` , `description` , `position` , `live_edit`) -VALUES (NULL , 'displayCustomerIdentityForm', 'Customer identity form displayed in Front Office', 'This hook displays new elements on the form to update a customer identity', '1', '0'); - -ALTER TABLE `PREFIX_orders` ADD `round_mode` TINYINT(1) NOT NULL DEFAULT '2' AFTER `total_wrapping_tax_excl`; - -ALTER TABLE `PREFIX_product_attribute` MODIFY `unit_price_impact` DECIMAL(20,6); -ALTER TABLE `PREFIX_product_attribute_shop` MODIFY `unit_price_impact` DECIMAL(20,6); - -/* PHP:p16011_media_server(); */; - -INSERT INTO `PREFIX_configuration` (`name`, `value`, `date_add`, `date_upd`) VALUES ('PS_PRICE_DISPLAY_PRECISION', 2, NOW(), NOW()); - -/* Precision used to be 2, now it can be set freely, so the DB must be ready to accept more decimals */ -ALTER TABLE `PREFIX_orders` -CHANGE COLUMN `total_discounts` `total_discounts` DECIMAL(20,6) NOT NULL DEFAULT '0.00' , -CHANGE COLUMN `total_discounts_tax_incl` `total_discounts_tax_incl` DECIMAL(20,6) NOT NULL DEFAULT '0.00' , -CHANGE COLUMN `total_discounts_tax_excl` `total_discounts_tax_excl` DECIMAL(20,6) NOT NULL DEFAULT '0.00' , -CHANGE COLUMN `total_paid` `total_paid` DECIMAL(20,6) NOT NULL DEFAULT '0.00' , -CHANGE COLUMN `total_paid_tax_incl` `total_paid_tax_incl` DECIMAL(20,6) NOT NULL DEFAULT '0.00' , -CHANGE COLUMN `total_paid_tax_excl` `total_paid_tax_excl` DECIMAL(20,6) NOT NULL DEFAULT '0.00' , -CHANGE COLUMN `total_paid_real` `total_paid_real` DECIMAL(20,6) NOT NULL DEFAULT '0.00' , -CHANGE COLUMN `total_products` `total_products` DECIMAL(20,6) NOT NULL DEFAULT '0.00' , -CHANGE COLUMN `total_products_wt` `total_products_wt` DECIMAL(20,6) NOT NULL DEFAULT '0.00' , -CHANGE COLUMN `total_shipping` `total_shipping` DECIMAL(20,6) NOT NULL DEFAULT '0.00' , -CHANGE COLUMN `total_shipping_tax_incl` `total_shipping_tax_incl` DECIMAL(20,6) NOT NULL DEFAULT '0.00' , -CHANGE COLUMN `total_shipping_tax_excl` `total_shipping_tax_excl` DECIMAL(20,6) NOT NULL DEFAULT '0.00' , -CHANGE COLUMN `total_wrapping` `total_wrapping` DECIMAL(20,6) NOT NULL DEFAULT '0.00' , -CHANGE COLUMN `total_wrapping_tax_incl` `total_wrapping_tax_incl` DECIMAL(20,6) NOT NULL DEFAULT '0.00' , -CHANGE COLUMN `total_wrapping_tax_excl` `total_wrapping_tax_excl` DECIMAL(20,6) NOT NULL DEFAULT '0.00'; -ALTER IGNORE TABLE `PREFIX_product` CHANGE `ean13` `ean13` BIGINT( 15 ) NULL DEFAULT NULL; - -ALTER TABLE `PREFIX_product` CHANGE `ean13` `ean13` VARCHAR( 13 ) NULL DEFAULT NULL; - -ALTER IGNORE TABLE `PREFIX_product_attribute` CHANGE `ean13` `ean13` BIGINT( 15 ) NULL DEFAULT NULL; - -ALTER TABLE `PREFIX_product_attribute` CHANGE `ean13` `ean13` VARCHAR( 13 ) NULL DEFAULT NULL; - -ALTER TABLE `PREFIX_order_slip` ADD `order_slip_type` TINYINT(1) NOT NULL DEFAULT 0 AFTER `partial`; diff --git a/upgrade/sql/1.6.0.12.sql b/upgrade/sql/1.6.0.12.sql deleted file mode 100644 index 49cb6d216..000000000 --- a/upgrade/sql/1.6.0.12.sql +++ /dev/null @@ -1,59 +0,0 @@ -SET NAMES 'utf8'; - -INSERT INTO `PREFIX_configuration` (`name`, `value`, `date_add`, `date_upd`) VALUES ('PS_CUSTOMER_NWSL', 1, NOW(), NOW()), ('PS_CUSTOMER_OPTIN', 1, NOW(), NOW()); - -INSERT INTO `PREFIX_order_state` (`invoice`, `send_email`, `module_name`, `color`, `unremovable`, `hidden`, `logable`, `delivery`, `shipped`, `paid`, `deleted`) VALUES ('0', '0', 'cashondelivery', '#4169E1', '1', '0', '0', '0', '0', '0', '0'); -SET @id_order_state = LAST_INSERT_ID(); -INSERT INTO `PREFIX_order_state_lang` (`id_order_state`, `id_lang`, `name`, `template`) (SELECT @id_order_state, id_lang, 'Waiting cod validation', '' FROM `PREFIX_lang`); - -INSERT IGNORE INTO `PREFIX_configuration` (`name`, `value`, `date_add`, `date_upd`) VALUES -('PS_OS_COD_VALIDATION', @id_order_state, NOW(), NOW()); - -UPDATE `PREFIX_hook` set `position` = 1 where `name` in ('displayBanner', 'displayNav', 'displayTopColumn'); - -ALTER TABLE `PREFIX_product` ADD `pack_stock_type` int(11) UNSIGNED DEFAULT '3'; -ALTER TABLE `PREFIX_product_shop` ADD `pack_stock_type` int(11) UNSIGNED DEFAULT '3'; -ALTER TABLE `PREFIX_pack` ADD `id_product_attribute_item` int(10) UNSIGNED NOT NULL AFTER `id_product_item`; -ALTER TABLE `PREFIX_pack` DROP PRIMARY KEY; - -/* PHP:p16012_pack_rework(); */; - -ALTER TABLE `PREFIX_pack` ADD PRIMARY KEY (`id_product_pack`, `id_product_item`, `id_product_attribute_item`); - -ALTER TABLE `PREFIX_order_state` ADD `pdf_delivery` TINYINT(1) UNSIGNED NOT NULL DEFAULT '0' AFTER `paid`; -ALTER TABLE `PREFIX_order_state` ADD `pdf_invoice` TINYINT(1) UNSIGNED NOT NULL DEFAULT '0' AFTER `pdf_delivery`; - -ALTER TABLE `PREFIX_orders` CHANGE `shipping_number` `shipping_number` VARCHAR( 64 ); - -/* PHP:ps16012_update_alias(); */; - -ALTER TABLE `PREFIX_store` CHANGE `hours` `hours` TEXT; - -ALTER TABLE `PREFIX_cms_lang` ADD `id_shop` INT(11) UNSIGNED NOT NULL DEFAULT '1' AFTER `id_lang`; -ALTER TABLE `PREFIX_cms_lang` DROP PRIMARY KEY, ADD PRIMARY KEY (`id_cms`, `id_shop`, `id_lang`); - -ALTER TABLE `PREFIX_cms_category_lang` ADD `id_shop` INT(11) UNSIGNED NOT NULL DEFAULT '1' AFTER `id_lang`; -ALTER TABLE `PREFIX_cms_category_lang` DROP PRIMARY KEY, ADD PRIMARY KEY (`id_cms_category`, `id_shop`, `id_lang`); - -CREATE TABLE `PREFIX_cms_category_shop` ( - `id_cms_category` int(10) unsigned NOT NULL AUTO_INCREMENT, - `id_shop` INT(11) UNSIGNED NOT NULL , - PRIMARY KEY (`id_cms_category`, `id_shop`), - KEY `id_shop` (`id_shop`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; - -/* PHP:cms_multishop(); */; - -ALTER TABLE `PREFIX_customization_field_lang` ADD `id_shop` INT(10) UNSIGNED NOT NULL DEFAULT '1' AFTER `id_lang`; -ALTER TABLE `PREFIX_customization_field_lang` DROP PRIMARY KEY, ADD PRIMARY KEY (`id_customization_field`, `id_shop`, `id_lang`); - -/* PHP:customization_field_multishop_lang(); */; - -ALTER TABLE `PREFIX_product` CHANGE `available_date` `available_date` DATE NOT NULL DEFAULT '0000-00-00'; -ALTER TABLE `PREFIX_product_shop` CHANGE `available_date` `available_date` DATE NOT NULL DEFAULT '0000-00-00'; -ALTER TABLE `PREFIX_product_attribute` CHANGE `available_date` `available_date` DATE NOT NULL DEFAULT '0000-00-00'; -ALTER TABLE `PREFIX_product_attribute_shop` CHANGE `available_date` `available_date` DATE NOT NULL DEFAULT '0000-00-00'; - -ALTER TABLE `PREFIX_module_access` CHANGE `view` `view` TINYINT( 1 ) NOT NULL DEFAULT '0', -CHANGE `configure` `configure` TINYINT( 1 ) NOT NULL DEFAULT '0', -CHANGE `uninstall` `uninstall` TINYINT( 1 ) NOT NULL DEFAULT '0'; \ No newline at end of file diff --git a/upgrade/sql/1.6.0.2.sql b/upgrade/sql/1.6.0.2.sql deleted file mode 100644 index d1f58eec3..000000000 --- a/upgrade/sql/1.6.0.2.sql +++ /dev/null @@ -1,35 +0,0 @@ -SET NAMES 'utf8'; - -INSERT INTO `PREFIX_hook` (`id_hook` , `name` , `title` , `description` , `position` , `live_edit`) -VALUES (NULL , 'actionAdminControllerSetMedia', 'Admin action setMedia', '', '0', '0'); - -INSERT INTO `PREFIX_hook_module` (`id_module`, `id_shop`, `id_hook`, `position`) ( - SELECT m.id_module, s.id_shop, h.id_hook, 0 FROM `PREFIX_module` m, `PREFIX_shop` s, `PREFIX_hook` h WHERE m.name IN ('graphnvd3') AND h.name IN ('GraphEngine', 'actionAdminControllerSetMedia') -); - -INSERT INTO `PREFIX_hook_module` (`id_module`, `id_shop`, `id_hook`, `position`) ( - SELECT m.id_module, s.id_shop, h.id_hook, 0 - FROM `PREFIX_module` m, `PREFIX_shop` s, `PREFIX_hook` h - WHERE m.name IN ('dashgoals', 'dashactivity', 'dashtrends', 'dashproducts') - AND h.name IN ('actionAdminControllerSetMedia') -); - -ALTER TABLE `PREFIX_configuration` CHANGE `name` `name` VARCHAR(254) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL; - -ALTER TABLE `PREFIX_module_shop` ADD `enable_device` TINYINT(1) NOT NULL DEFAULT '7' AFTER `id_shop`; - -ALTER TABLE `PREFIX_theme` ADD `responsive` TINYINT( 1 ) NOT NULL DEFAULT '0'; - -CREATE TABLE IF NOT EXISTS `PREFIX_theme_meta` ( - `id_theme_meta` int(11) NOT NULL AUTO_INCREMENT, - `id_theme` int(11) NOT NULL, - `id_meta` int(10) unsigned NOT NULL, - `left_column` tinyint(1) NOT NULL DEFAULT '0', - `right_column` tinyint(1) NOT NULL DEFAULT '0', - PRIMARY KEY (`id_theme_meta`), - UNIQUE KEY `id_theme_2` (`id_theme`,`id_meta`), - KEY `id_theme` (`id_theme`), - KEY `id_meta` (`id_meta`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; - -ALTER TABLE `PREFIX_meta` ADD `configurable` TINYINT(1) UNSIGNED NOT NULL DEFAULT '1' AFTER `page`; diff --git a/upgrade/sql/1.6.0.3.sql b/upgrade/sql/1.6.0.3.sql deleted file mode 100644 index 5c1cf21f0..000000000 --- a/upgrade/sql/1.6.0.3.sql +++ /dev/null @@ -1,30 +0,0 @@ -SET NAMES 'utf8'; - -ALTER TABLE `PREFIX_theme` ADD `default_left_column` TINYINT( 1 ) NOT NULL DEFAULT '1'; -ALTER TABLE `PREFIX_theme` ADD `default_right_column` TINYINT( 1 ) NOT NULL DEFAULT '1'; -ALTER TABLE `PREFIX_theme` ADD `product_per_page` INT UNSIGNED NOT NULL; - -ALTER TABLE `PREFIX_tab_lang` CHANGE `name` `name` VARCHAR(64) DEFAULT NULL; - -ALTER TABLE `PREFIX_attachment` ADD `file_size` bigint(10) unsigned NOT NULL DEFAULT 0 AFTER `file_name`; -/* PHP:p1603_add_attachment_size(); */; - -DROP TABLE IF EXISTS `PREFIX_help_access`; - -ALTER TABLE `PREFIX_theme_meta` CHANGE `left_column` `left_column` TINYINT( 1 ) NOT NULL DEFAULT '1', -CHANGE `right_column` `right_column` TINYINT( 1 ) NOT NULL DEFAULT '1'; - -ALTER TABLE `PREFIX_employee` ADD `bo_css` varchar(64) default 'admin-theme.css' AFTER `bo_theme`; - -INSERT INTO `PREFIX_web_browser` (name) VALUES ('IE 11'); - -DELETE FROM `PREFIX_theme` WHERE `directory` = 'default-bootstrap'; - -INSERT INTO `PREFIX_theme` (`name`, `directory`, `responsive`, `default_left_column`, `default_right_column`, `product_per_page`) -VALUES ('default-bootstrap', 'default-bootstrap', 1, 1, 0, 12); - -INSERT IGNORE INTO `PREFIX_theme_meta` ( `id_theme` , `id_meta` , `left_column` , `right_column` ) - SELECT `PREFIX_theme`.`id_theme` , `PREFIX_meta`.`id_meta` , `default_left_column` , `default_right_column` - FROM `PREFIX_theme` , `PREFIX_meta`; - -ALTER TABLE `PREFIX_import_match` ADD UNIQUE (`name` ( 32 )); \ No newline at end of file diff --git a/upgrade/sql/1.6.0.4.sql b/upgrade/sql/1.6.0.4.sql deleted file mode 100644 index d42871bb3..000000000 --- a/upgrade/sql/1.6.0.4.sql +++ /dev/null @@ -1,24 +0,0 @@ -SET NAMES 'utf8'; - -INSERT INTO `PREFIX_meta` (`page`, `configurable`) SELECT * FROM (SELECT 'product', '0') AS tmp WHERE NOT EXISTS (SELECT `page` FROM `PREFIX_meta` WHERE `page` = 'product'); -INSERT INTO `PREFIX_meta` (`page`, `configurable`) SELECT * FROM (SELECT 'index', '0') AS tmp WHERE NOT EXISTS (SELECT `page` FROM `PREFIX_meta` WHERE `page` = 'index'); -INSERT INTO `PREFIX_meta` (`page`, `configurable`) SELECT * FROM (SELECT 'category', '0') AS tmp WHERE NOT EXISTS (SELECT `page` FROM `PREFIX_meta` WHERE `page` = 'category'); -INSERT INTO `PREFIX_meta` (`page`, `configurable`) SELECT * FROM (SELECT 'cms', '0') AS tmp WHERE NOT EXISTS (SELECT `page` FROM `PREFIX_meta` WHERE `page` = 'cms'); - -ALTER TABLE `PREFIX_employee` ADD `optin` tinyint(1) unsigned NOT NULL default '1' AFTER `active`; - -ALTER IGNORE TABLE `PREFIX_meta` ADD UNIQUE (`page`); -ALTER TABLE `PREFIX_meta` DROP INDEX `meta_name`; - -UPDATE `PREFIX_orders` SET module = 'free_order' WHERE total_paid = 0 AND module LIKE ''; - -UPDATE `PREFIX_tab` SET `position` = '1' WHERE `id_tab` =48; -UPDATE `PREFIX_tab` SET `position` = '0' WHERE `id_tab` =49; - -ALTER TABLE `PREFIX_theme` CHANGE `product_per_page` `product_per_page` INT( 10 ) UNSIGNED NOT NULL DEFAULT '1'; - -ALTER TABLE `PREFIX_customer_message` ADD `date_upd` DATETIME NOT NULL AFTER `date_add`; - -ALTER TABLE `PREFIX_employee` ADD `preselect_date_range` VARCHAR( 32 ) NULL DEFAULT NULL AFTER `stats_compare_option`; - -/* PHP:ps1604_update_employee_date(); */; diff --git a/upgrade/sql/1.6.0.5.sql b/upgrade/sql/1.6.0.5.sql deleted file mode 100644 index 3a7bb25e6..000000000 --- a/upgrade/sql/1.6.0.5.sql +++ /dev/null @@ -1,11 +0,0 @@ -SET NAMES 'utf8'; - -ALTER TABLE `PREFIX_image_shop` CHANGE `cover` `cover` TINYINT( 1 ) UNSIGNED NOT NULL DEFAULT '0'; - -/* PHP:ps1605_change_index(); */; - -INSERT IGNORE INTO `PREFIX_hook_module` (`id_module`, `id_shop`, `id_hook`, `position`) ( - SELECT m.id_module, s.id_shop, h.id_hook, 0 FROM `PREFIX_module` m, `PREFIX_shop` s, `PREFIX_hook` h WHERE m.name IN ('dashgoals') AND h.name IN ('dashboardData') -); - -/* PHP:add_new_tab(AdminDashgoals, fr:Dashgoals|en:Dashgoals, -1, false, null, dashgoals); */; diff --git a/upgrade/sql/1.6.0.6.sql b/upgrade/sql/1.6.0.6.sql deleted file mode 100644 index d87068bac..000000000 --- a/upgrade/sql/1.6.0.6.sql +++ /dev/null @@ -1,30 +0,0 @@ -SET NAMES 'utf8'; - -ALTER TABLE `PREFIX_order_invoice_tax` ADD INDEX (`id_tax`); - -INSERT INTO `PREFIX_meta` (`page`, `configurable`) SELECT * FROM (SELECT 'product', '0') AS tmp WHERE NOT EXISTS (SELECT `page` FROM `PREFIX_meta` WHERE `page` = 'product'); -INSERT INTO `PREFIX_meta` (`page`, `configurable`) SELECT * FROM (SELECT 'category', '0') AS tmp WHERE NOT EXISTS (SELECT `page` FROM `PREFIX_meta` WHERE `page` = 'category'); -INSERT INTO `PREFIX_meta` (`page`, `configurable`) SELECT * FROM (SELECT 'cms', '0') AS tmp WHERE NOT EXISTS (SELECT `page` FROM `PREFIX_meta` WHERE `page` = 'cms'); -INSERT INTO `PREFIX_meta` (`page`, `configurable`) SELECT * FROM (SELECT 'products-comparison', '0') AS tmp WHERE NOT EXISTS (SELECT `page` FROM `PREFIX_meta` WHERE `page` = 'products-comparison'); -INSERT INTO `PREFIX_meta` (`page`, `configurable`) SELECT * FROM (SELECT 'module-bankwire-payment', '0') AS tmp WHERE NOT EXISTS (SELECT `page` FROM `PREFIX_meta` WHERE `page` = 'module-bankwire-payment'); -INSERT INTO `PREFIX_meta` (`page`, `configurable`) SELECT * FROM (SELECT 'module-bankwire-validation', '0') AS tmp WHERE NOT EXISTS (SELECT `page` FROM `PREFIX_meta` WHERE `page` = 'module-bankwire-validation'); -INSERT INTO `PREFIX_meta` (`page`, `configurable`) SELECT * FROM (SELECT 'module-cheque-validation', '0') AS tmp WHERE NOT EXISTS (SELECT `page` FROM `PREFIX_meta` WHERE `page` = 'module-cheque-validation'); -INSERT INTO `PREFIX_meta` (`page`, `configurable`) SELECT * FROM (SELECT 'module-cheque-payment', '0') AS tmp WHERE NOT EXISTS (SELECT `page` FROM `PREFIX_meta` WHERE `page` = 'module-cheque-payment'); - -INSERT IGNORE INTO `PREFIX_theme_meta` ( `id_theme` , `id_meta` , `left_column` , `right_column` ) - SELECT `PREFIX_theme`.`id_theme` , `PREFIX_meta`.`id_meta` , `default_left_column` , `default_right_column` - FROM `PREFIX_theme` , `PREFIX_meta`; - -ALTER TABLE `PREFIX_tab` ADD `hide_host_mode` tinyint(1) NOT NULL DEFAULT '0' AFTER `active`; - -UPDATE `PREFIX_employee` SET `bo_theme` = 'default'; - -DELETE FROM `PREFIX_image_type` WHERE `name` = 'cart_default'; - -INSERT INTO `PREFIX_image_type` (`id_image_type`,`name`,`width`,`height`,`products`,`categories`,`manufacturers`,`suppliers`,`scenes`,`stores`) -VALUES (NULL, 'cart_default', '80', '80', '1', '0', '0', '0', '0', '0'); - -ALTER TABLE `PREFIX_cart_rule_combination` ADD INDEX `id_cart_rule_1` (`id_cart_rule_1`); -ALTER TABLE `PREFIX_cart_rule_combination` ADD INDEX `id_cart_rule_2` (`id_cart_rule_2`); - -/* PHP:p1606module_exceptions(); */; diff --git a/upgrade/sql/1.6.0.7.sql b/upgrade/sql/1.6.0.7.sql deleted file mode 100644 index 81176da57..000000000 --- a/upgrade/sql/1.6.0.7.sql +++ /dev/null @@ -1,24 +0,0 @@ -SET NAMES 'utf8'; - -ALTER TABLE `PREFIX_customer_message` CHANGE `ip_address` `ip_address` VARCHAR( 16 ) NULL DEFAULT NULL; - -UPDATE `PREFIX_theme` SET product_per_page = '12' WHERE `product_per_page` = 0; - - -UPDATE `PREFIX_hook` SET live_edit = '1' WHERE `name` IN('displayTop','displayAttributeForm','displayAttributeGroupForm','displayBeforeCarrier', -'displayBeforePayment','displayCarrierList','displayCustomerAccount','displayCustomerAccountForm','displayCustomerAccountFormTop','displayFeatureForm', -'displayFeatureValueForm','displayFooter','displayLeftColumnProduct','displayMyAccountBlock','displayMyAccountBlockfooter','displayOrderConfirmation', -'displayOrderDetail','displayPaymentReturn','displayPaymentTop','displayProductButtons','displayProductComparison','displayProductListFunctionalButtons', -'displayProductTab','displayProductTabContent','displayRightColumnProduct','displayShoppingCart','displayShoppingCartFooter'); - -ALTER TABLE `PREFIX_order_detail_tax` ADD INDEX id_order_detail (`id_order_detail`); - -INSERT INTO `PREFIX_configuration` (`name`, `value`, `date_add`, `date_upd`) VALUES('PS_DISPLAY_BEST_SELLERS', '1', NOW(), NOW()); - -ALTER TABLE `PREFIX_orders` ADD INDEX (`current_state`); - -INSERT INTO `PREFIX_configuration` (`name`, `value`, `date_add`, `date_upd`) VALUES('PS_USE_HTMLPURIFIER', '1', NOW(), NOW()); - -/* PHP:ps1607_language_code_update(); */; -/* PHP:drop_module_non_unique_index(); */; -/* PHP:p1607_drop_primary_key_if_exists(); */; diff --git a/upgrade/sql/1.6.0.8.sql b/upgrade/sql/1.6.0.8.sql deleted file mode 100644 index 024114ebf..000000000 --- a/upgrade/sql/1.6.0.8.sql +++ /dev/null @@ -1,3 +0,0 @@ -SET NAMES 'utf8'; - -ALTER TABLE `PREFIX_image_shop` CHANGE `cover` `cover` TINYINT( 1 ) NOT NULL DEFAULT '0'; diff --git a/upgrade/sql/1.6.0.9.sql b/upgrade/sql/1.6.0.9.sql deleted file mode 100644 index 59e825688..000000000 --- a/upgrade/sql/1.6.0.9.sql +++ /dev/null @@ -1,12 +0,0 @@ -SET NAMES 'utf8'; - -INSERT INTO `PREFIX_hook` (`id_hook` , `name` , `title` , `description` , `position` , `live_edit`) -VALUES (NULL , 'displayAdminOrderTabOrder', 'Display new elements in Back Office on AdminOrder, panel Order', 'This hook launches modules when the AdminOrder tab is displayed in the Back Office and extends / override Order panel tabs', '1', '0'), -(NULL , 'displayAdminOrderContentOrder', 'Display new elements in Back Office on AdminOrder, panel Order', 'This hook launches modules when the AdminOrder tab is displayed in the Back Office and extends / override Order panel content', '1', '0'), -(NULL , 'displayAdminOrderTabShip', 'Display new elements in Back Office, AdminOrder, panel Shipping', 'This hook launches modules when the AdminOrder tab is displayed in the Back Office and extends / override Shipping panel tabs', '1', '0'), -(NULL , 'displayAdminOrderContentShip', 'Display new elements in Back Office, AdminOrder, panel Shipping', 'This hook launches modules when the AdminOrder tab is displayed in the Back Office and extends / override Shipping panel content', '1', '0'); - -INSERT INTO `PREFIX_configuration` (`name` , `value` , `date_add` , `date_upd`) -VALUES ('PS_SET_DISPLAY_SUBCATEGORIES', '1', NOW(), NOW()); - -UPDATE `PREFIX_hook` SET `live_edit` = 0 WHERE `name`='displayOverrideTemplate'; diff --git a/upgrade/sql/1.6.1.0.sql b/upgrade/sql/1.6.1.0.sql deleted file mode 100644 index 45eea88ef..000000000 --- a/upgrade/sql/1.6.1.0.sql +++ /dev/null @@ -1,226 +0,0 @@ -SET NAMES 'utf8'; - -UPDATE `PREFIX_configuration` SET `value` = CONCAT('#', `value`) WHERE `name` LIKE 'PS_%_PREFIX' AND `value` NOT LIKE '#%'; - -UPDATE `PREFIX_configuration_lang` SET `value` = CONCAT('#', `value`) WHERE `id_configuration` IN (SELECT `id_configuration` FROM `PREFIX_configuration` WHERE `name` LIKE 'PS_%_PREFIX') AND `value` NOT LIKE '#%'; - -ALTER TABLE `PREFIX_orders` CHANGE `invoice_number` `invoice_number` INT( 11 ) UNSIGNED NOT NULL DEFAULT '0', -CHANGE `delivery_number` `delivery_number` INT( 11 ) UNSIGNED NOT NULL DEFAULT '0'; - -/* taxes-patch */ - -ALTER TABLE `PREFIX_order_invoice` -CHANGE COLUMN `total_discount_tax_excl` `total_discount_tax_excl` DECIMAL(20,6) NOT NULL DEFAULT '0.00' , -CHANGE COLUMN `total_discount_tax_incl` `total_discount_tax_incl` DECIMAL(20,6) NOT NULL DEFAULT '0.00' , -CHANGE COLUMN `total_paid_tax_excl` `total_paid_tax_excl` DECIMAL(20,6) NOT NULL DEFAULT '0.00' , -CHANGE COLUMN `total_paid_tax_incl` `total_paid_tax_incl` DECIMAL(20,6) NOT NULL DEFAULT '0.00' , -CHANGE COLUMN `total_products` `total_products` DECIMAL(20,6) NOT NULL DEFAULT '0.00' , -CHANGE COLUMN `total_products_wt` `total_products_wt` DECIMAL(20,6) NOT NULL DEFAULT '0.00' , -CHANGE COLUMN `total_shipping_tax_excl` `total_shipping_tax_excl` DECIMAL(20,6) NOT NULL DEFAULT '0.00' , -CHANGE COLUMN `total_shipping_tax_incl` `total_shipping_tax_incl` DECIMAL(20,6) NOT NULL DEFAULT '0.00' , -CHANGE COLUMN `total_wrapping_tax_excl` `total_wrapping_tax_excl` DECIMAL(20,6) NOT NULL DEFAULT '0.00' , -CHANGE COLUMN `total_wrapping_tax_incl` `total_wrapping_tax_incl` DECIMAL(20,6) NOT NULL DEFAULT '0.00' ; - -ALTER TABLE `PREFIX_orders` ADD `round_type` TINYINT(1) NOT NULL DEFAULT '1' AFTER `round_mode`; - - -ALTER TABLE PREFIX_product_tag ADD `id_lang` int(10) unsigned NOT NULL, ADD KEY (id_lang, id_tag); -UPDATE PREFIX_product_tag, PREFIX_tag SET PREFIX_product_tag.id_lang=PREFIX_tag.id_lang WHERE PREFIX_tag.id_tag=PREFIX_product_tag.id_tag; - -DROP TABLE IF EXISTS `PREFIX_tag_count`; -CREATE TABLE `PREFIX_tag_count` ( - `id_group` int(10) unsigned NOT NULL DEFAULT 0, - `id_tag` int(10) unsigned NOT NULL DEFAULT 0, - `id_lang` int(10) unsigned NOT NULL DEFAULT 0, - `id_shop` int(11) unsigned NOT NULL DEFAULT 0, - `counter` int(10) unsigned NOT NULL DEFAULT 0, - PRIMARY KEY (`id_group`, `id_tag`), - KEY (`id_group`, `id_lang`, `id_shop`, `counter`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; -REPLACE INTO `PREFIX_tag_count` (id_group, id_tag, id_lang, id_shop, counter) -SELECT cg.id_group, t.id_tag, t.id_lang, ps.id_shop, COUNT(pt.id_tag) AS times - FROM `PREFIX_product_tag` pt - LEFT JOIN `PREFIX_tag` t ON (t.id_tag = pt.id_tag) - LEFT JOIN `PREFIX_product` p ON (p.id_product = pt.id_product) - INNER JOIN `PREFIX_product_shop` product_shop - ON (product_shop.id_product = p.id_product) - JOIN (SELECT DISTINCT id_group FROM `PREFIX_category_group`) cg - JOIN (SELECT DISTINCT id_shop FROM `PREFIX_shop`) ps - WHERE pt.`id_lang` = 1 AND product_shop.`active` = 1 - AND EXISTS(SELECT 1 FROM `PREFIX_category_product` cp - LEFT JOIN `PREFIX_category_group` cgo ON (cp.`id_category` = cgo.`id_category`) - WHERE cgo.`id_group` = cg.id_group AND p.`id_product` = cp.`id_product`) - AND product_shop.id_shop = ps.id_shop - GROUP BY pt.id_tag, cg.id_group; -REPLACE INTO `PREFIX_tag_count` (id_group, id_tag, id_lang, id_shop, counter) -SELECT 0, t.id_tag, t.id_lang, ps.id_shop, COUNT(pt.id_tag) AS times - FROM `PREFIX_product_tag` pt - LEFT JOIN `PREFIX_tag` t ON (t.id_tag = pt.id_tag) - LEFT JOIN `PREFIX_product` p ON (p.id_product = pt.id_product) - INNER JOIN `PREFIX_product_shop` product_shop - ON (product_shop.id_product = p.id_product) - JOIN (SELECT DISTINCT id_shop FROM `PREFIX_shop`) ps - WHERE pt.`id_lang` = 1 AND product_shop.`active` = 1 - AND product_shop.id_shop = ps.id_shop - GROUP BY pt.id_tag; - -/* PHP:alter_ignore_drop_key(shop, id_group_shop); */; -/* PHP:alter_ignore_drop_key(specific_price, id_product_2); */; -/* PHP:alter_ignore_drop_key(hook_module, position); */; -/* PHP:alter_ignore_drop_key(cart_product, PRIMARY); */; -/* PHP:alter_ignore_drop_key(cart_product, cart_product_index); */; - -ALTER TABLE `PREFIX_shop_group` ADD KEY `deleted` (`deleted`, `name`); -ALTER TABLE `PREFIX_shop` DROP KEY `id_shop_group`; -ALTER TABLE `PREFIX_shop` ADD KEY `id_shop_group` (`id_shop_group`, `deleted`); -ALTER TABLE `PREFIX_shop_url` DROP KEY `id_shop`; -ALTER TABLE `PREFIX_shop_url` ADD KEY `id_shop` (`id_shop`, `main`); -ALTER TABLE `PREFIX_customization` ADD KEY `id_cart` (`id_cart`); -ALTER TABLE `PREFIX_product_sale` ADD KEY `quantity` (`quantity`); -ALTER TABLE `PREFIX_cart_rule` ADD KEY `id_customer` (`id_customer`, `active`, `date_to`); -ALTER TABLE `PREFIX_cart_rule` ADD KEY `group_restriction` (`group_restriction`, `active`, `date_to`); -ALTER TABLE `PREFIX_hook_module` ADD KEY `position` (`id_shop`, `position`); -ALTER IGNORE TABLE `PREFIX_cart_product` ADD PRIMARY KEY (`id_cart`,`id_product`,`id_product_attribute`,`id_address_delivery`); -ALTER TABLE `PREFIX_cart_product` ADD KEY `id_cart_order` (`id_cart`, `date_add`, `id_product`, `id_product_attribute`); -ALTER TABLE `PREFIX_customization` DROP KEY id_cart; -ALTER IGNORE TABLE `PREFIX_customization` ADD KEY `id_cart_product` (`id_cart`, `id_product`, `id_product_attribute`); -ALTER TABLE `PREFIX_category` DROP KEY nleftright, DROP KEY nleft; -ALTER TABLE `PREFIX_category` ADD KEY `activenleft` (`active`,`nleft`), ADD KEY `activenright` (`active`,`nright`); -ALTER IGNORE TABLE `PREFIX_image_shop` DROP KEY `id_image`, ADD PRIMARY KEY (`id_image`, `id_shop`, `cover`); -ALTER TABLE PREFIX_product_attribute_shop ADD `id_product` int(10) unsigned NOT NULL, ADD KEY `id_product` (`id_product`, `id_shop`, `default_on`); -UPDATE PREFIX_product_attribute_shop, PREFIX_product_attribute - SET PREFIX_product_attribute_shop.id_product=PREFIX_product_attribute.id_product - WHERE PREFIX_product_attribute_shop.id_product_attribute=PREFIX_product_attribute.id_product_attribute; -ALTER TABLE PREFIX_image_shop ADD `id_product` int(10) unsigned NOT NULL, ADD KEY `id_product` (`id_product`, `id_shop`, `cover`); -UPDATE PREFIX_image_shop, PREFIX_image - SET PREFIX_image_shop.id_product=PREFIX_image.id_product - WHERE PREFIX_image_shop.id_image=PREFIX_image.id_image; -ALTER IGNORE TABLE `PREFIX_image_shop` DROP PRIMARY KEY, ADD PRIMARY KEY (`id_image`, `id_shop`); -ALTER TABLE `PREFIX_product_supplier` ADD KEY `id_supplier` (`id_supplier`,`id_product`); -ALTER TABLE `PREFIX_product` DROP KEY `product_manufacturer`; -ALTER TABLE `PREFIX_product` ADD KEY `product_manufacturer` (`id_manufacturer`, `id_product`); - -DROP TABLE IF EXISTS `PREFIX_smarty_lazy_cache`; -CREATE TABLE `PREFIX_smarty_lazy_cache` ( - `template_hash` varchar(32) NOT NULL DEFAULT '', - `cache_id` varchar(255) NOT NULL DEFAULT '', - `compile_id` varchar(32) NOT NULL DEFAULT '', - `filepath` varchar(255) NOT NULL DEFAULT '', - `last_update` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', - PRIMARY KEY (`template_hash`, `cache_id`, `compile_id`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; - -DROP TABLE IF EXISTS `PREFIX_smarty_last_flush`; -CREATE TABLE `PREFIX_smarty_last_flush` ( - `type` ENUM('compile', 'template'), - `last_flush` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', - PRIMARY KEY (`type`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; - -DROP TABLE IF EXISTS `PREFIX_modules_perfs`; -CREATE TABLE `PREFIX_modules_perfs` ( - `id_modules_perfs` int(11) unsigned NOT NULL AUTO_INCREMENT, - `session` int(11) unsigned NOT NULL, - `module` varchar(62) NOT NULL, - `method` varchar(126) NOT NULL, - `time_start` double unsigned NOT NULL, - `time_end` double unsigned NOT NULL, - `memory_start` int unsigned NOT NULL, - `memory_end` int unsigned NOT NULL, - PRIMARY KEY (`id_modules_perfs`), - KEY (`session`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; - -ALTER TABLE `PREFIX_image` CHANGE `cover` `cover` tinyint(1) unsigned NULL DEFAULT NULL; -UPDATE `PREFIX_image` SET `cover`=NULL WHERE `cover`=0; -CREATE TEMPORARY TABLE `image_transform` SELECT `id_product`, COUNT(*) c FROM `PREFIX_image` WHERE `cover`=1 GROUP BY `id_product` HAVING c>1; -UPDATE `image_transform` JOIN `PREFIX_image` USING (`id_product`) SET `PREFIX_image`.`cover`=NULL; -ALTER TABLE `PREFIX_image` DROP KEY `id_product_cover`; -ALTER IGNORE TABLE `PREFIX_image` ADD UNIQUE KEY `id_product_cover` (`id_product`,`cover`); - -ALTER TABLE `PREFIX_image_shop` CHANGE `cover` `cover` tinyint(1) unsigned NULL DEFAULT NULL; -UPDATE `PREFIX_image_shop` SET `cover`=NULL WHERE `cover`=0; -CREATE TEMPORARY TABLE `image_shop_transform` SELECT `id_product`, `id_shop`, COUNT(*) c FROM `PREFIX_image_shop` WHERE `cover`=1 GROUP BY `id_product`, `id_shop` HAVING c>1; -UPDATE `image_shop_transform` JOIN `PREFIX_image_shop` USING (`id_product`, `id_shop`) SET `PREFIX_image_shop`.`cover`=NULL; -ALTER TABLE `PREFIX_image_shop` DROP KEY `id_product`; -ALTER IGNORE TABLE `PREFIX_image_shop` ADD UNIQUE KEY `id_product` (`id_product`, `id_shop`, `cover`); - -ALTER TABLE `PREFIX_product_attribute` CHANGE `default_on` `default_on` tinyint(1) unsigned NULL DEFAULT NULL; -UPDATE `PREFIX_product_attribute` SET `default_on`=NULL WHERE `default_on`=0; -CREATE TEMPORARY TABLE `attribute_transform` SELECT `id_product`, COUNT(*) c FROM `PREFIX_product_attribute` WHERE `default_on`=1 GROUP BY `id_product` HAVING c>1; -UPDATE `attribute_transform` JOIN `PREFIX_product_attribute` USING (`id_product`) SET `PREFIX_product_attribute`.`default_on`=NULL; -ALTER TABLE `PREFIX_product_attribute` DROP KEY `product_default`; -ALTER IGNORE TABLE `PREFIX_product_attribute` ADD UNIQUE KEY `product_default` (`id_product`,`default_on`); - -ALTER TABLE `PREFIX_product_attribute_shop` CHANGE `default_on` `default_on` tinyint(1) unsigned NULL DEFAULT NULL; -UPDATE `PREFIX_product_attribute_shop` SET `default_on`=NULL WHERE `default_on`=0; -CREATE TEMPORARY TABLE `attribute_shop_transform` SELECT `id_product`, `id_shop`, COUNT(*) c FROM `PREFIX_product_attribute_shop` WHERE `default_on`=1 GROUP BY `id_product`, `id_shop` HAVING c>1; -UPDATE `attribute_shop_transform` JOIN `PREFIX_product_attribute_shop` USING (`id_product`, `id_shop`) SET `PREFIX_product_attribute_shop`.`default_on`=NULL; -ALTER TABLE `PREFIX_product_attribute_shop` DROP KEY `id_product`; -ALTER IGNORE TABLE `PREFIX_product_attribute_shop` ADD UNIQUE KEY `id_product` (`id_product`, `id_shop`, `default_on`); - -ALTER IGNORE TABLE `PREFIX_product_download` ADD UNIQUE KEY `id_product` (`id_product`); - -ALTER TABLE `PREFIX_customer` DROP KEY `id_shop`; -ALTER TABLE `PREFIX_customer` ADD KEY `id_shop` (`id_shop`, `date_add`); - -ALTER TABLE `PREFIX_cart` DROP KEY `id_shop`; -ALTER TABLE `PREFIX_cart` ADD KEY `id_shop_2` (`id_shop`,`date_upd`), ADD KEY `id_shop` (`id_shop`,`date_add`); -ALTER TABLE `PREFIX_product_shop` ADD KEY `indexed` (`indexed`, `active`, `id_product`); -UPDATE `PREFIX_product_shop` SET `date_add` = NOW() WHERE `date_add` = "0000-00-00 00:00:00"; - -INSERT IGNORE INTO `PREFIX_hook` (`id_hook`, `name`, `title`, `description`, `position`, `live_edit`) VALUES -(NULL, 'actionAdminLoginControllerSetMedia', 'Set media on admin login page header', 'This hook is called after adding media to admin login page header', '1', '0'), -(NULL, 'actionOrderEdited', 'Order edited', 'This hook is called when an order is edited.', '1', '0'), -(NULL, 'displayAdminNavBarBeforeEnd', 'Admin Nav-bar before end', 'Called before the end of the nav-bar.', '1', '0'), -(NULL, 'displayAdminAfterHeader', 'Admin after header', 'Hook called just after the header of the backoffice.', '1', '0'), -(NULL, 'displayAdminLogin', 'Admin login', 'Hook called just after login of the backoffice.', '1', '0'); - -ALTER TABLE `PREFIX_cart_rule` ADD KEY `id_customer_2` (`id_customer`,`active`,`highlight`,`date_to`); -ALTER TABLE `PREFIX_cart_rule` ADD KEY `group_restriction_2` (`group_restriction`,`active`,`highlight`,`date_to`); - -ALTER TABLE `PREFIX_configuration_kpi` CHANGE `name` `name` varchar(64); - -ALTER TABLE `PREFIX_smarty_lazy_cache` CHANGE `cache_id` `cache_id` varchar(255) NOT NULL DEFAULT ''; -TRUNCATE TABLE `PREFIX_smarty_lazy_cache`; - -/* Advanced EU Compliance tables */ -CREATE TABLE IF NOT EXISTS `PREFIX_cms_role` ( - `id_cms_role` int(11) unsigned NOT NULL AUTO_INCREMENT, - `name` varchar(50) NOT NULL, - `id_cms` int(11) unsigned NOT NULL, - PRIMARY KEY (`id_cms_role`, `id_cms`), - UNIQUE KEY `name` (`name`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; - -CREATE TABLE IF NOT EXISTS `PREFIX_cms_role_lang` ( - `id_cms_role` int(11) unsigned NOT NULL, - `id_lang` int(11) unsigned NOT NULL, - `id_shop` int(11) unsigned NOT NULL, - `name` varchar(128) DEFAULT NULL, - PRIMARY KEY (`id_cms_role`,`id_lang`, `id_shop`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; - -ALTER TABLE `PREFIX_order_invoice` ADD `company_address` TEXT DEFAULT NULL AFTER `total_wrapping_tax_incl`; - -ALTER TABLE `PREFIX_order_invoice` ADD `shop_address` TEXT DEFAULT NULL AFTER `total_wrapping_tax_incl`; -ALTER TABLE `PREFIX_order_invoice` ADD `invoice_address` TEXT DEFAULT NULL AFTER `shop_address`; -ALTER TABLE `PREFIX_order_invoice` ADD `delivery_address` TEXT DEFAULT NULL AFTER `invoice_address`; - - -INSERT IGNORE INTO `PREFIX_hook` (`name`, `title`, `description`) VALUES ('displayInvoiceLegalFreeText', 'PDF Invoice - Legal Free Text', 'This hook allows you to modify the legal free text on PDF invoices'); - -UPDATE `PREFIX_hook` SET position = 0 WHERE name LIKE 'action%'; - -ALTER IGNORE TABLE `PREFIX_specific_price` ADD UNIQUE KEY `id_product_2` (`id_cart`, `id_product`,`id_shop`,`id_shop_group`,`id_currency`,`id_country`,`id_group`,`id_customer`,`id_product_attribute`,`from_quantity`,`id_specific_price_rule`,`from`,`to`); - -INSERT INTO `PREFIX_configuration` (`name`, `value`, `date_add`, `date_upd`) - VALUES ('PS_INVCE_INVOICE_ADDR_RULES', '{"avoid":["vat_number","phone","phone_mobile"]}', NOW(), NOW()); -INSERT INTO `PREFIX_configuration` (`name`, `value`, `date_add`, `date_upd`) - VALUES ('PS_INVCE_DELIVERY_ADDR_RULES', '{"avoid":["vat_number","phone","phone_mobile"]}', NOW(), NOW()); - -ALTER TABLE `PREFIX_pack` ADD KEY `product_item` (`id_product_item`,`id_product_attribute_item`); - -ALTER TABLE `PREFIX_supply_order_detail` DROP KEY `id_supply_order`, DROP KEY `id_product`, ADD KEY `id_supply_order` (`id_supply_order`, `id_product`); - -ALTER TABLE `PREFIX_carrier` ADD KEY `reference` (`id_reference`, `deleted`, `active`); diff --git a/upgrade/sql/1.6.1.1.sql b/upgrade/sql/1.6.1.1.sql deleted file mode 100644 index fc1ead26c..000000000 --- a/upgrade/sql/1.6.1.1.sql +++ /dev/null @@ -1,10 +0,0 @@ -SET NAMES 'utf8'; - -ALTER TABLE `PREFIX_customer_message` CHANGE `message` `message` MEDIUMTEXT NOT NULL; -UPDATE `PREFIX_tax_rules_group` SET `date_add` = NOW(), `date_upd` = NOW() WHERE `date_add` = '0000-00-00 00:00:00'; - -ALTER TABLE `PREFIX_order_detail` ADD `original_wholesale_price` DECIMAL( 20, 6 ) NOT NULL DEFAULT '0.000000'; - -/* PHP:alter_ignore_drop_key(specific_price, id_product_2); */; - -ALTER TABLE `PREFIX_specific_price` ADD UNIQUE KEY `id_product_2` (`id_cart`, `id_product`,`id_shop`,`id_shop_group`,`id_currency`,`id_country`,`id_group`,`id_customer`,`id_product_attribute`,`from_quantity`,`id_specific_price_rule`,`from`,`to`); diff --git a/upgrade/sql/1.6.1.14.sql b/upgrade/sql/1.6.1.14.sql deleted file mode 100644 index 95b737931..000000000 --- a/upgrade/sql/1.6.1.14.sql +++ /dev/null @@ -1,3 +0,0 @@ -SET NAMES 'utf8'; - -ALTER TABLE `PREFIX_carrier_lang` CHANGE `delay` `delay` VARCHAR(512) NULL; diff --git a/upgrade/sql/1.6.1.2.sql b/upgrade/sql/1.6.1.2.sql deleted file mode 100644 index 111800431..000000000 --- a/upgrade/sql/1.6.1.2.sql +++ /dev/null @@ -1,37 +0,0 @@ -SET NAMES 'utf8'; - -UPDATE `PREFIX_image_shop` ish, `PREFIX_image` i SET ish.id_product = i.id_product WHERE i.id_image=ish.id_image; - -REPLACE INTO `PREFIX_tag_count` (id_group, id_tag, id_lang, id_shop, counter) - SELECT cg.id_group, pt.id_tag, pt.id_lang, id_shop, COUNT(pt.id_tag) AS times - FROM `PREFIX_product_tag` pt - INNER JOIN `PREFIX_product_shop` product_shop - USING (id_product) - JOIN (SELECT DISTINCT id_group FROM `PREFIX_category_group`) cg - WHERE product_shop.`active` = 1 - AND EXISTS(SELECT 1 FROM `PREFIX_category_product` cp - LEFT JOIN `PREFIX_category_group` cgo ON (cp.`id_category` = cgo.`id_category`) - WHERE cgo.`id_group` = cg.id_group AND product_shop.`id_product` = cp.`id_product`) - GROUP BY pt.id_tag, pt.id_lang, cg.id_group, id_shop ORDER BY NULL; -REPLACE INTO `PREFIX_tag_count` (id_group, id_tag, id_lang, id_shop, counter) - SELECT 0, pt.id_tag, pt.id_lang, id_shop, COUNT(pt.id_tag) AS times - FROM `PREFIX_product_tag` pt - INNER JOIN `PREFIX_product_shop` product_shop - USING (id_product) - WHERE product_shop.`active` = 1 - GROUP BY pt.id_tag, pt.id_lang, id_shop ORDER BY NULL; - -TRUNCATE TABLE `PREFIX_smarty_last_flush`; - -ALTER TABLE `PREFIX_search_index` ADD INDEX(`id_product`); -ALTER TABLE `PREFIX_specific_price` ADD INDEX(`id_product_attribute`); -ALTER TABLE `PREFIX_specific_price` ADD INDEX(`id_shop`); -ALTER TABLE `PREFIX_specific_price` ADD INDEX(`id_customer`); -ALTER TABLE `PREFIX_specific_price` ADD INDEX(`from`); -ALTER TABLE `PREFIX_specific_price` ADD INDEX(`to`); -ALTER TABLE `PREFIX_specific_price` DROP KEY `id_product_2`; -ALTER TABLE `PREFIX_specific_price` ADD UNIQUE KEY `id_product_2` (`id_product`,`id_product_attribute`,`id_customer`,`id_cart`,`from`,`to`,`id_shop`,`id_shop_group`,`id_currency`,`id_country`,`id_group`,`from_quantity`,`id_specific_price_rule`); -ALTER TABLE `PREFIX_category_product` ADD INDEX(`id_category`, `position`); - - -ALTER TABLE `PREFIX_address` CHANGE `company` `company` VARCHAR(64) NULL; diff --git a/upgrade/sql/1.6.1.5.sql b/upgrade/sql/1.6.1.5.sql deleted file mode 100644 index 474f64dff..000000000 --- a/upgrade/sql/1.6.1.5.sql +++ /dev/null @@ -1,3 +0,0 @@ -SET NAMES 'utf8'; - -UPDATE `PREFIX_configuration` c SET `value` = '{"avoid":[]}' WHERE `name` IN ('PS_INVCE_INVOICE_ADDR_RULES', 'PS_INVCE_DELIVERY_ADDR_RULES'); \ No newline at end of file diff --git a/upgrade/sql/1.6.1.6.sql b/upgrade/sql/1.6.1.6.sql deleted file mode 100644 index 19e1c32d4..000000000 --- a/upgrade/sql/1.6.1.6.sql +++ /dev/null @@ -1,3 +0,0 @@ -SET NAMES 'utf8'; - -ALTER TABLE `PREFIX_cart_product` CHANGE `id_product_attribute` `id_product_attribute` int(10) unsigned NOT NULL DEFAULT '0'; diff --git a/upgrade/sql/1.6.1.7.sql b/upgrade/sql/1.6.1.7.sql deleted file mode 100644 index 68fdd4450..000000000 --- a/upgrade/sql/1.6.1.7.sql +++ /dev/null @@ -1,3 +0,0 @@ -SET NAMES 'utf8'; - -INSERT IGNORE INTO `PREFIX_hook` (`name`, `title`, `description`, `position`) VALUES ('displayCartExtraProductActions', 'Extra buttons in shopping cart', 'This hook adds extra buttons to the product lines, in the shopping cart', 0); diff --git a/upgrade/sql/1.7.0.0.sql b/upgrade/sql/1.7.0.0.sql deleted file mode 100644 index a466e6731..000000000 --- a/upgrade/sql/1.7.0.0.sql +++ /dev/null @@ -1,242 +0,0 @@ -SET NAMES 'utf8'; - -INSERT INTO `PREFIX_configuration` (`name`, `value`, `date_add`, `date_upd`) VALUES - ('PS_SMARTY_LOCAL', '0', NOW(), NOW()), - ('PS_PASSWD_RESET_VALIDITY', '1440', NOW(), NOW()), - ('PS_CUSTOMER_BIRTHDATE', '1', NOW(), NOW()), - ('PS_ACTIVE_CRONJOB_EXCHANGE_RATE', '0', NOW(), NOW()), - ('PS_ORDER_RECALCULATE_SHIPPING', '1', NOW(), NOW()), - ('PS_MAINTENANCE_TEXT', 'We are currently updating our shop and will be back really soon.<br>Thanks for your patience.', NOW(), NOW()); - -/* PHP:ps_1700_short_description_config(); */; - -INSERT INTO `PREFIX_configuration_lang` (`id_configuration`, `id_lang`, `value`, `date_upd`) SELECT c.`id_configuration`, l.`id_lang`, c.`value`, NOW() FROM `PREFIX_configuration` c, `PREFIX_lang` l WHERE c.`name` = 'PS_MAINTENANCE_TEXT'; - -INSERT INTO `PREFIX_hook_alias` (`name`, `alias`) VALUES - ('actionCartUpdateQuantityBefore', 'actionBeforeCartUpdateQty'), - ('actionAjaxDieBefore', 'actionBeforeAjaxDie'), - ('actionAuthenticationBefore', 'actionBeforeAuthentication'), - ('actionSubmitAccountBefore', 'actionBeforeSubmitAccount'), - ('actionDeleteProductInCartAfter', 'actionAfterDeleteProductInCart'); - -ALTER TABLE `PREFIX_currency` DROP `iso_code_num` , DROP `sign` , DROP `blank` , DROP `format` , DROP `decimals` ; - -/* Password reset token for new "Forgot my password screen */ -ALTER TABLE `PREFIX_customer` ADD `reset_password_token` varchar(40) DEFAULT NULL; -ALTER TABLE `PREFIX_customer` ADD `reset_password_validity` datetime DEFAULT NULL; -ALTER TABLE `PREFIX_employee` CHANGE `last_connection_date` `last_connection_date` DATE NULL DEFAULT NULL; -ALTER TABLE `PREFIX_employee` ADD `reset_password_token` varchar(40) DEFAULT NULL; -ALTER TABLE `PREFIX_employee` ADD `reset_password_validity` datetime DEFAULT NULL; - -/* Need to set the date to null before manipulate the table if the strict mode is enabled on MySQL */ -UPDATE `PREFIX_customer` SET `newsletter_date_add` = NULL WHERE YEAR(newsletter_date_add) = "0000"; -ALTER TABLE `PREFIX_customer` CHANGE COLUMN `passwd` `passwd` varchar(60) NOT NULL; -ALTER TABLE `PREFIX_employee` CHANGE COLUMN `passwd` `passwd` varchar(60) NOT NULL; - -ALTER TABLE `PREFIX_customer` CHANGE COLUMN `firstname` `firstname` varchar(255) NOT NULL; -ALTER TABLE `PREFIX_customer` CHANGE COLUMN `lastname` `lastname` varchar(255) NOT NULL; - -/* Changes regarding modules */ -ALTER TABLE `PREFIX_module` ADD UNIQUE INDEX `name_UNIQUE` (`name` ASC); - -DROP TABLE IF EXISTS `PREFIX_modules_perfs`; - -CREATE TABLE `PREFIX_module_carrier` ( - `id_module`INT(10) unsigned NOT NULL, - `id_shop`INT(11) unsigned NOT NULL DEFAULT '1', - `id_reference` INT(11) NOT NULL, - PRIMARY KEY (`id_module`,`id_shop`, `id_reference`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; -/* PHP:select_current_payment_modules(); */; - - -/* Add Payment Preferences tab. SuperAdmin profile is the only one to access it. */ -/* PHP:ps_1700_add_payment_preferences_tab(); */; -UPDATE `PREFIX_access` SET `view` = '0', `add` = '0', `edit` = '0', `delete` = '0' WHERE `id_tab` = (SELECT `id_tab` FROM `PREFIX_tab` t WHERE t.`class_name` = 'AdminPaymentPreferences' LIMIT 1) AND `id_profile` > 1; - -UPDATE `PREFIX_quick_access` SET `link` = "index.php/product/new" WHERE `link` = "index.php?controller=AdminProducts&addproduct"; - -ALTER TABLE `PREFIX_product` CHANGE `available_date` `available_date` DATE NULL DEFAULT NULL; -ALTER TABLE `PREFIX_product` ADD `show_condition` TINYINT(1) NOT NULL DEFAULT '0' AFTER `available_date`; -ALTER TABLE `PREFIX_product` ADD `isbn` VARCHAR( 13 ) NULL DEFAULT NULL; -ALTER TABLE `PREFIX_product_shop` CHANGE `available_date` `available_date` DATE NULL DEFAULT NULL; -ALTER TABLE `PREFIX_product_shop` ADD `show_condition` TINYINT(1) NOT NULL DEFAULT '0' AFTER `available_date`; -ALTER TABLE `PREFIX_order_detail` ADD `product_isbn` VARCHAR( 13 ) NULL DEFAULT NULL; -ALTER TABLE `PREFIX_product_attribute` CHANGE `available_date` `available_date` DATE NULL DEFAULT NULL; -ALTER TABLE `PREFIX_product_attribute` ADD `isbn` VARCHAR( 13 ) NULL DEFAULT NULL; -ALTER TABLE `PREFIX_product_attribute_shop` CHANGE `available_date` `available_date` DATE NULL DEFAULT NULL; -ALTER TABLE `PREFIX_stock` ADD `isbn` VARCHAR( 13 ) NULL DEFAULT NULL; -ALTER TABLE `PREFIX_supply_order_detail` ADD `isbn` VARCHAR( 13 ) NULL DEFAULT NULL; - -ALTER TABLE `PREFIX_order_invoice` DROP COLUMN `invoice_address`, DROP COLUMN `delivery_address`; - -ALTER TABLE `PREFIX_cart_product` CHANGE `id_product_attribute` `id_product_attribute` int(10) unsigned DEFAULT '0'; - -ALTER TABLE `PREFIX_product_lang` ADD `social_sharing_title` VARCHAR( 255 ) NOT NULL; -ALTER TABLE `PREFIX_product_lang` ADD `social_sharing_description` VARCHAR( 255 ) NOT NULL; - -/* PHP:ps1700_stores(); */; - -ALTER TABLE `PREFIX_hook` DROP `live_edit`; - -/* Remove comparator feature */ -DELETE FROM `PREFIX_meta` WHERE `page` = 'products-comparison'; -DROP TABLE IF EXISTS `PREFIX_compare`; -DROP TABLE IF EXISTS `PREFIX_compare_product`; -DROP TABLE IF EXISTS `PREFIX_theme`; -DROP TABLE IF EXISTS `PREFIX_theme_meta`; -DROP TABLE IF EXISTS `PREFIX_theme_specific`; -DROP TABLE IF EXISTS `PREFIX_scene`; -DROP TABLE IF EXISTS `PREFIX_scene_category`; -DROP TABLE IF EXISTS `PREFIX_scene_lang`; -DROP TABLE IF EXISTS `PREFIX_scene_products`; -DROP TABLE IF EXISTS `PREFIX_scene_shop`; - -ALTER TABLE `PREFIX_shop` ADD COLUMN `theme_name` VARCHAR(255) AFTER `id_category`; -UPDATE `PREFIX_shop` SET `theme_name` = 'classic'; -UPDATE `PREFIX_configuration` SET value=0 WHERE name='PS_TAX_DISPLAY'; - -ALTER TABLE `PREFIX_image_type` DROP `scenes`; -ALTER TABLE `PREFIX_cart` ADD `checkout_session_data` MEDIUMTEXT NULL; -ALTER TABLE `PREFIX_shop` DROP COLUMN `id_theme`; -ALTER TABLE `PREFIX_cart_product` ADD `id_customization` INT(10) NOT NULL DEFAULT '0' AFTER `id_product_attribute`; -ALTER TABLE `PREFIX_cart_product` DROP PRIMARY KEY, ADD PRIMARY KEY (`id_cart`, `id_product`, `id_product_attribute`, `id_customization`, `id_address_delivery`); -ALTER TABLE `PREFIX_order_detail` ADD `id_customization` INT(10) NULL DEFAULT '0' AFTER `product_attribute_id`; -ALTER TABLE `PREFIX_customized_data` ADD `id_module` INT(10) NOT NULL DEFAULT '0', ADD `price` DECIMAL(20,6) NOT NULL DEFAULT '0', ADD `weight` DECIMAL(20,6) NOT NULL DEFAULT '0'; -ALTER TABLE `PREFIX_customization_field` ADD `is_module` TINYINT(1) NOT NULL DEFAULT '0' ; -ALTER TABLE `PREFIX_cart_rule` ADD `reduction_exclude_special` TINYINT(1) UNSIGNED NOT NULL DEFAULT '0' AFTER `reduction_percent`; -ALTER TABLE `PREFIX_product` ADD `state` INT UNSIGNED NOT NULL DEFAULT '1'; -ALTER TABLE `PREFIX_product` ADD KEY `state` (`state`, `date_upd`); - -ALTER TABLE `PREFIX_lang` ADD `locale` varchar(5) COLLATE utf8_unicode_ci NOT NULL; -/* PHP:ps_1700_add_locale(); */; - -/* Right management */ -CREATE TABLE `PREFIX_authorization_role` ( - `id_authorization_role` int(10) unsigned NOT NULL auto_increment, - `slug` VARCHAR(255) NOT NULL, - PRIMARY KEY (`id_authorization_role`), - UNIQUE KEY (`slug`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; - -/* Add missing access entries on certain installation */ -INSERT INTO `PREFIX_access` (`id_profile`, `id_tab`, `view`, `add`, `edit`, `delete`) - SELECT 1, `id_tab`, 0, 0 ,0 ,0 - FROM `PREFIX_tab` WHERE `id_tab` NOT IN (SELECT `id_tab` FROM `PREFIX_access` WHERE `id_profile` = 1); -INSERT INTO `PREFIX_module_access` (`id_profile`, `id_module`, `view`, `configure`, `uninstall`) - SELECT 1, `id_module`, 1, 0, 0 - FROM `PREFIX_module` WHERE `id_module` NOT IN (SELECT `id_module` FROM `PREFIX_module_access` WHERE `id_profile` = 1); - -/* Create a copy without indexes to make ID updates without conflict. */ -CREATE TABLE `PREFIX_access_old` AS SELECT * FROM `PREFIX_access`; -DROP TABLE `PREFIX_access`; -RENAME TABLE `PREFIX_module_access` TO `PREFIX_module_access_old`; - -CREATE TABLE `PREFIX_tab_transit` ( - `id_old_tab` int(11), - `id_new_tab` int(11), - `key` VARCHAR(128) /* class_name and module concatenation */ -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; -/* Save the old IDs */ -INSERT INTO `PREFIX_tab_transit` (`id_old_tab`, `key`) SELECT `id_tab`, CONCAT(`class_name`, COALESCE(`module`, '')) FROM `PREFIX_tab`; - -CREATE TABLE `PREFIX_access` ( - `id_profile` int(10) unsigned NOT NULL, - `id_authorization_role` int(10) unsigned NOT NULL, - PRIMARY KEY (`id_profile`,`id_authorization_role`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; - -CREATE TABLE `PREFIX_module_access` ( - `id_profile` int(10) unsigned NOT NULL, - `id_authorization_role` int(10) unsigned NOT NULL, - PRIMARY KEY (`id_profile`,`id_authorization_role`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; - -/* PHP:add_quick_access_tab(); */; - -INSERT IGNORE INTO `PREFIX_hook` (`name`, `title`, `description`, `position`) VALUES - ('actionValidateCustomerAddressForm', 'Customer address form validation', 'This hook is called when a customer submit its address form', '1'), - ('displayAfterCarrier', 'After carriers list', 'This hook is displayed after the carrier list in Front Office', '1'), - ('displayCarrierExtraContent', 'Display additional content for a carrier (e.g pickup points)', 'This hook calls only the module related to the carrier, in order to add options when needed.', '1'), - ('validateCustomerFormFields', 'Customer registration form validation', 'This hook is called to a module when it has sent additional fields with additionalCustomerFormFields', '1'), - ('displayProductExtraContent', 'Display extra content on the product page', 'This hook expects ProductExtraContent instances, which will be properly displayed by the template on the product page.', '1'), - ('displayNavFullWidth', 'Navigation', 'This hook displays full width navigation menu at the top of your pages', '1'), - ('displayAfterBodyOpeningTag', 'Very top of pages', 'Use this hook for advertisement or modals you want to load first.', '1'), - ('displayBeforeBodyClosingTag', 'Very bottom of pages', 'Use this hook for your modals or any content you want to load at the very end.', '1'); - -/* PHP:delete_hook(displayProductTab); */; -/* PHP:delete_hook(displayProductTabContent); */; -/* PHP:delete_hook(displayBeforePayment); */; -/* PHP:delete_hook(actionBeforeAuthentication); */; -/* PHP:delete_hook(actionOrderDetail); */; -/* PHP:delete_hook(actionProductListOverride); */; -/* PHP:delete_hook(actionSearch); */; -/* PHP:delete_hook(displayCustomerIdentityForm); */; -/* PHP:delete_hook(displayHomeTab); */; -/* PHP:delete_hook(displayHomeTabContent); */; -/* PHP:delete_hook(displayPayment); */; -/* PHP:delete_hook(displayProductComparison); */; - -DELETE FROM `PREFIX_hook_alias` WHERE `name` IN ( - 'beforeAuthentication', - 'displayProductTab', - 'displayProductTabContent', - 'displayBeforePayment', - 'orderDetail', - 'payment', - 'productListAssign', - 'search', - 'displayProductComparison'); - -DELETE FROM `PREFIX_configuration` WHERE `name` IN ( - '_MEDIA_SERVER_2_', - '_MEDIA_SERVER_3_', - 'PS_ORDER_PROCESS_TYPE', - 'PS_ADVANCED_PAYMENT_API', - 'PS_ONE_PHONE_AT_LEAST', - 'PS_SCENE_FEATURE_ACTIVE', - 'PS_ADMINREFRESH_NOTIFICATION', - 'PS_CUSTOMER_NWSL', - 'PS_CACHEFS_DIRECTORY_DEPTH', - 'PS_CART_REDIRECT', - 'PS_COMPARATOR_MAX_ITEM', - 'PS_STORES_DISPLAY_FOOTER', - 'PS_STORES_SIMPLIFIED', - 'PS_STORES_CENTER_LAT', - 'PS_STORES_CENTER_LONG', - 'PS_STORES_DISPLAY_SITEMAP', - 'PS_CIPHER_ALGORITHM', - 'PS_HTML_THEME_COMPRESSION', - 'PS_JS_HTML_THEME_COMPRESSION', - 'PS_LOGO_MOBILE', - 'SHOP_LOGO_MOBILE_HEIGHT', - 'SHOP_LOGO_MOBILE_WIDTH'); - -ALTER TABLE `PREFIX_tab` ADD `icon` varchar(32) DEFAULT ''; - -/* PHP:migrate_tabs_17(); */; - -/* Save the new IDs */ -UPDATE `PREFIX_tab_transit` tt SET `id_new_tab` = ( - SELECT `id_tab` FROM `PREFIX_tab` WHERE CONCAT(`class_name`, COALESCE(`module`, '')) = tt.`key` LIMIT 1 -); -/* Update default tab IDs for employees */ -UPDATE `PREFIX_employee` e SET `default_tab` = ( - SELECT IFNULL(`id_new_tab`, - /* If the tab does not exist anymore, fallback to the dashboard. */ - (SELECT `id_tab` FROM `PREFIX_tab` WHERE `class_name` = 'AdminDashboard' AND `module` IS NULL) - ) FROM `PREFIX_tab_transit` WHERE `id_old_tab` = e.`default_tab` -); - -/* Update access tab IDs */ -UPDATE `PREFIX_access_old` ao SET `id_tab` = ( - /* Update tab ID if possible, leave as is if the tab does not exist anymore */ - SELECT IFNULL(`id_new_tab`, ao.`id_tab`) FROM `PREFIX_tab_transit` WHERE `id_old_tab` = ao.`id_tab` -); - -/* Properly migrate the rights associated with each tabs */ -/* PHP:ps_1700_right_management(); */; - -DROP TABLE IF EXISTS `PREFIX_access_old`; -DROP TABLE IF EXISTS `PREFIX_module_access_old`; -DROP TABLE IF EXISTS `PREFIX_tab_transit`; diff --git a/upgrade/upgrade.php b/upgrade/upgrade.php index df6ab0be5..ca96b7f98 100644 --- a/upgrade/upgrade.php +++ b/upgrade/upgrade.php @@ -47,7 +47,6 @@ require_once __DIR__ . '/../../vendor/autoload.php'; require_once __DIR__ . '/../../config/defines.inc.php'; require_once __DIR__ . '/../../config/autoload.php'; -Upgrade::migrateSettingsFile(); require_once __DIR__ . '/../classes/datas.php'; require_once dirname(__FILE__) . '/../init.php'; require_once _PS_CONFIG_DIR_ . 'bootstrap.php'; From a8a7c58251ef52fb9d2345e52a2da977a04bfa15 Mon Sep 17 00:00:00 2001 From: Hlavtox Date: Wed, 13 Sep 2023 13:48:45 +0200 Subject: [PATCH 02/30] Fix upgrade inconsistencies --- upgrade/php/drop_column_if_exists.php | 33 +++++++++++++++++++++++++++ upgrade/sql/1.7.7.0.sql | 10 ++++---- upgrade/sql/1.7.8.0.sql | 6 ++--- upgrade/sql/8.0.0.sql | 4 ++++ upgrade/sql/8.1.0.sql | 6 ++--- upgrade/sql/8.1.2.sql | 15 ++++++++++++ 6 files changed, 63 insertions(+), 11 deletions(-) create mode 100644 upgrade/php/drop_column_if_exists.php diff --git a/upgrade/php/drop_column_if_exists.php b/upgrade/php/drop_column_if_exists.php new file mode 100644 index 000000000..59691ced6 --- /dev/null +++ b/upgrade/php/drop_column_if_exists.php @@ -0,0 +1,33 @@ + + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ +function drop_column_if_exists($table, $column) +{ + $column_exists = Db::getInstance()->executeS('SHOW COLUMNS FROM `' . _DB_PREFIX_ . $table . "` WHERE Field = '" . $column . "'"); + + if (!empty($column_exists)) { + Db::getInstance()->execute('ALTER TABLE `' . _DB_PREFIX_ . $table . '` DROP COLUMN `' . $column . '`'); + } +} diff --git a/upgrade/sql/1.7.7.0.sql b/upgrade/sql/1.7.7.0.sql index 5d7caa922..65626588d 100644 --- a/upgrade/sql/1.7.7.0.sql +++ b/upgrade/sql/1.7.7.0.sql @@ -53,7 +53,7 @@ UPDATE `PREFIX_tab_module_preference` SET `module` = SUBSTRING(`module`, 1, 191) ALTER TABLE `PREFIX_tab_module_preference` CHANGE `module` `module` VARCHAR(191) NOT NULL; UPDATE `PREFIX_smarty_lazy_cache` SET `cache_id` = SUBSTRING(`cache_id`, 1, 191); -ALTER TABLE `PREFIX_smarty_lazy_cache` CHANGE `cache_id` `cache_id` VARCHAR(191) NOT NULL; +ALTER TABLE `PREFIX_smarty_lazy_cache` CHANGE `cache_id` `cache_id` VARCHAR(191) NOT NULL DEFAULT ''; /* improve performance of lookup by product reference/product_supplier avoiding full table scan */ ALTER TABLE PREFIX_product @@ -357,11 +357,11 @@ INSERT IGNORE INTO `PREFIX_hook_alias` (`name`, `alias`) VALUES ALTER TABLE `PREFIX_order_detail` ADD `total_refunded_tax_excl` DECIMAL(20, 6) NOT NULL DEFAULT '0.000000' AFTER `original_wholesale_price`; ALTER TABLE `PREFIX_order_detail` ADD `total_refunded_tax_incl` DECIMAL(20, 6) NOT NULL DEFAULT '0.000000' AFTER `total_refunded_tax_excl`; -ALTER TABLE `PREFIX_group_reduction` CHANGE `reduction` `reduction` DECIMAL(5, 4) NOT NULL DEFAULT '0.0000'; -ALTER TABLE `PREFIX_product_group_reduction_cache` CHANGE `reduction` `reduction` DECIMAL(5, 4) NOT NULL DEFAULT '0.0000'; +ALTER TABLE `PREFIX_group_reduction` CHANGE `reduction` `reduction` DECIMAL(5, 4) NOT NULL; +ALTER TABLE `PREFIX_product_group_reduction_cache` CHANGE `reduction` `reduction` DECIMAL(5, 4) NOT NULL; ALTER TABLE `PREFIX_order_slip` CHANGE `amount` `amount` DECIMAL(20, 6) NOT NULL DEFAULT '0.000000'; ALTER TABLE `PREFIX_order_slip` CHANGE `shipping_cost_amount` `shipping_cost_amount` DECIMAL(20, 6) NOT NULL DEFAULT '0.000000'; -ALTER TABLE `PREFIX_order_payment` CHANGE `amount` `amount` DECIMAL(20, 6) NOT NULL DEFAULT '0.000000'; +ALTER TABLE `PREFIX_order_payment` CHANGE `amount` `amount` DECIMAL(20, 6) NOT NULL; /* attribute_impact price */ UPDATE `PREFIX_attribute_impact` SET `price` = RIGHT(`price`, 17) WHERE LENGTH(`price`) > 17; @@ -400,7 +400,7 @@ ALTER TABLE `PREFIX_order_cart_rule` CHANGE `value` `value` DECIMAL(20, 6) NOT N ALTER TABLE `PREFIX_order_cart_rule` CHANGE `value_tax_excl` `value_tax_excl` DECIMAL(20, 6) NOT NULL DEFAULT '0.000000'; /* add deleted field */ -ALTER TABLE `PREFIX_order_cart_rule` ADD `deleted` TINYINT(1) UNSIGNED NOT NULL; +ALTER TABLE `PREFIX_order_cart_rule` ADD `deleted` TINYINT(1) UNSIGNED NOT NULL DEFAULT '0'; UPDATE `PREFIX_order_detail` `od` diff --git a/upgrade/sql/1.7.8.0.sql b/upgrade/sql/1.7.8.0.sql index 8842ed2ec..989c96ff8 100644 --- a/upgrade/sql/1.7.8.0.sql +++ b/upgrade/sql/1.7.8.0.sql @@ -150,9 +150,9 @@ ALTER TABLE `PREFIX_currency` CHANGE `numeric_iso_code` `numeric_iso_code` varch UPDATE `PREFIX_configuration` SET `value` = '4' WHERE `name` = 'PS_LOGS_BY_EMAIL' AND `value` = '5'; ALTER TABLE `PREFIX_log` - ADD `id_shop` INT(10) NULL DEFAULT NULL after `object_id`, - ADD `id_shop_group` INT(10) NULL DEFAULT NULL after `id_shop`, - ADD `id_lang` INT(10) NULL DEFAULT NULL after `id_shop_group`, + ADD `id_shop` INT(10) unsigned DEFAULT NULL after `object_id`, + ADD `id_shop_group` INT(10) unsigned DEFAULT NULL after `id_shop`, + ADD `id_lang` INT(10) unsigned DEFAULT NULL after `id_shop_group`, ADD `in_all_shops` TINYINT(1) unsigned NOT NULL DEFAULT '0' ; diff --git a/upgrade/sql/8.0.0.sql b/upgrade/sql/8.0.0.sql index 489d09704..d01877d59 100644 --- a/upgrade/sql/8.0.0.sql +++ b/upgrade/sql/8.0.0.sql @@ -231,3 +231,7 @@ INSERT INTO `PREFIX_configuration` (`name`, `value`, `date_add`, `date_upd`) VAL UPDATE `PREFIX_carrier` SET `name` = 'Click and collect' WHERE `name` = '0'; /* PHP:install_ps_distributionapiclient(); */; + +/* Remove deprecated columns */ +/* PHP:drop_column_if_exists('product_attribute', 'location'); */; +/* PHP:drop_column_if_exists('product_attribute', 'quantity'); */; diff --git a/upgrade/sql/8.1.0.sql b/upgrade/sql/8.1.0.sql index 9ddeb356f..7220b13b5 100644 --- a/upgrade/sql/8.1.0.sql +++ b/upgrade/sql/8.1.0.sql @@ -26,8 +26,8 @@ INSERT INTO `PREFIX_configuration` (`name`, `value`, `date_add`, `date_upd`) VAL CREATE TABLE `PREFIX_product_attribute_lang` ( `id_product_attribute` int(10) unsigned NOT NULL, `id_lang` int(10) unsigned NOT NULL, - `available_now` varchar(255) COLLATE utf8mb4_general_ci NOT NULL DEFAULT '', - `available_later` varchar(255) COLLATE utf8mb4_general_ci NOT NULL DEFAULT '', + `available_now` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL, + `available_later` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL, PRIMARY KEY (`id_product_attribute`, `id_lang`) ) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; @@ -65,7 +65,7 @@ VALUES ('multiple_image_format', 0, 'Multiple image formats', 'Admin.Advparameters.Feature', 'Enable / Disable having more than one image format (jpg, webp, avif, png...)', 'Admin.Advparameters.Help', 'stable'); ALTER TABLE `PREFIX_stock_mvt` CHANGE `employee_lastname` `employee_lastname` VARCHAR(255) DEFAULT NULL, CHANGE `employee_firstname` `employee_firstname` VARCHAR(255) DEFAULT NULL; -ALTER TABLE `PREFIX_stock_mvt` CHANGE `physical_quantity` `physical_quantity` INT(11) UNSIGNED NOT NULL; +ALTER TABLE `PREFIX_stock_mvt` CHANGE `physical_quantity` `physical_quantity` INT(10) UNSIGNED NOT NULL; /* PHP:add_hook('actionAdminBreadcrumbModifier', 'Modify back office breadcrumb', 'This hook allows modifying back office breadcrumb'); */; diff --git a/upgrade/sql/8.1.2.sql b/upgrade/sql/8.1.2.sql index 4fc29d796..319ae3b08 100644 --- a/upgrade/sql/8.1.2.sql +++ b/upgrade/sql/8.1.2.sql @@ -13,3 +13,18 @@ UPDATE `PREFIX_tab` SET wording_domain = 'Admin.Navigation.Menu', wording = 'Cus INSERT IGNORE INTO `PREFIX_hook` (`id_hook`, `name`, `title`, `description`, `position`) VALUES (NULL, 'actionLanguageLinkParameters', 'Add parameters to language link', 'Allows modules to provide proper parameters for links in other languages.', '1'), (NULL, 'actionAfterLoadRoutes', 'Triggers after loading routes', 'Allow modules to modify routes in any way or add their own multilanguage routes.', '1'); + +/* We fixed some issues in older upgrade scripts. These are here to fix stores that have been upgraded in the meantime. */ +/* PHP:drop_column_if_exists('product_attribute', 'location'); */; +/* PHP:drop_column_if_exists('product_attribute', 'quantity'); */; +ALTER TABLE `PREFIX_smarty_lazy_cache` CHANGE `cache_id` `cache_id` VARCHAR(191) NOT NULL DEFAULT ''; +ALTER TABLE `PREFIX_log` CHANGE `id_shop` `id_shop` INT(10) unsigned DEFAULT NULL; +ALTER TABLE `PREFIX_log` CHANGE `id_shop_group` `id_shop_group` INT(10) unsigned DEFAULT NULL; +ALTER TABLE `PREFIX_log` CHANGE `id_lang` `id_lang` INT(10) unsigned DEFAULT NULL; +ALTER TABLE `PREFIX_product_attribute_lang` CHANGE `available_now` `available_now` VARCHAR(255) DEFAULT NULL; +ALTER TABLE `PREFIX_product_attribute_lang` CHANGE `available_later` `available_later` VARCHAR(255) DEFAULT NULL; +ALTER TABLE `PREFIX_order_cart_rule` CHANGE `deleted` `deleted` TINYINT(1) UNSIGNED NOT NULL DEFAULT '0'; +ALTER TABLE `PREFIX_product_group_reduction_cache` CHANGE `reduction` `reduction` DECIMAL(5, 4) NOT NULL; +ALTER TABLE `PREFIX_stock_mvt` CHANGE `physical_quantity` `physical_quantity` INT(10) UNSIGNED NOT NULL; +ALTER TABLE `PREFIX_group_reduction` CHANGE `reduction` `reduction` DECIMAL(5, 4) NOT NULL; +ALTER TABLE `PREFIX_order_payment` CHANGE `amount` `amount` DECIMAL(20, 6) NOT NULL; From b53a05311be48db960ef980a57444cb9c7300a86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Hlav=C3=A1=C4=8Dek?= Date: Tue, 19 Sep 2023 12:48:40 +0200 Subject: [PATCH 03/30] Update autoupgrade.php --- autoupgrade.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autoupgrade.php b/autoupgrade.php index d86da025b..1ceec462a 100644 --- a/autoupgrade.php +++ b/autoupgrade.php @@ -36,7 +36,7 @@ public function __construct() $this->name = 'autoupgrade'; $this->tab = 'administration'; $this->author = 'PrestaShop'; - $this->version = '4.16.4'; + $this->version = '4.16.5'; $this->need_instance = 1; $this->bootstrap = true; From df47e913131cb4f3d218e2b2dd4bc15d75675756 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Hlav=C3=A1=C4=8Dek?= Date: Tue, 19 Sep 2023 12:48:45 +0200 Subject: [PATCH 04/30] Update config.xml --- config.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config.xml b/config.xml index 8e12cfd89..7d954f494 100644 --- a/config.xml +++ b/config.xml @@ -2,7 +2,7 @@ autoupgrade - + From a29e0b5bf04a52897be78652f0e2cbe1d8bd4e89 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 27 Sep 2023 21:27:40 +0000 Subject: [PATCH 05/30] Bump get-func-name from 2.0.0 to 2.0.2 in /tests/e2e Bumps [get-func-name](https://github.com/chaijs/get-func-name) from 2.0.0 to 2.0.2. - [Release notes](https://github.com/chaijs/get-func-name/releases) - [Commits](https://github.com/chaijs/get-func-name/commits/v2.0.2) --- updated-dependencies: - dependency-name: get-func-name dependency-type: indirect ... Signed-off-by: dependabot[bot] --- tests/e2e/package-lock.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/e2e/package-lock.json b/tests/e2e/package-lock.json index 198612e27..62d26aece 100644 --- a/tests/e2e/package-lock.json +++ b/tests/e2e/package-lock.json @@ -1185,9 +1185,9 @@ "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==" }, "get-func-name": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.0.tgz", - "integrity": "sha1-6td0q+5y4gQJQzoGY2YCPdaIekE=" + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.2.tgz", + "integrity": "sha512-8vXOvuE167CtIc3OyItco7N/dpRtBbYOsPsXCz7X/PMnlGjYjSGuZJgM1Y7mmew7BKf9BqvLX2tnOVy1BBUsxQ==" }, "get-intrinsic": { "version": "1.1.1", From 4e586b9c06ec10b98377b84b225d2684d25919ad Mon Sep 17 00:00:00 2001 From: Alexandre Bak <138218784+alexandrebak42@users.noreply.github.com> Date: Wed, 11 Oct 2023 11:54:57 +0200 Subject: [PATCH 06/30] Create 8.1.3.sql --- upgrade/sql/8.1.3.sql | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 upgrade/sql/8.1.3.sql diff --git a/upgrade/sql/8.1.3.sql b/upgrade/sql/8.1.3.sql new file mode 100644 index 000000000..fff8c1fbf --- /dev/null +++ b/upgrade/sql/8.1.3.sql @@ -0,0 +1,5 @@ +SET SESSION sql_mode=''; +SET NAMES 'utf8mb4'; + +ALTER TABLE co_customer + CHANGE `ape` `ape` varchar(6) DEFAULT NULL; From bcf8963476a98712c8a96b346446fd7a07d71dd8 Mon Sep 17 00:00:00 2001 From: Alexandre Bak <138218784+alexandrebak42@users.noreply.github.com> Date: Wed, 11 Oct 2023 11:55:35 +0200 Subject: [PATCH 07/30] Update 8.1.3.sql --- upgrade/sql/8.1.3.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/upgrade/sql/8.1.3.sql b/upgrade/sql/8.1.3.sql index fff8c1fbf..58f490575 100644 --- a/upgrade/sql/8.1.3.sql +++ b/upgrade/sql/8.1.3.sql @@ -1,5 +1,5 @@ SET SESSION sql_mode=''; SET NAMES 'utf8mb4'; -ALTER TABLE co_customer +ALTER TABLE `PREFIX_customer` CHANGE `ape` `ape` varchar(6) DEFAULT NULL; From a6084f8a875dbe993be38cd998f6fcaddb3894fe Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 16 Oct 2023 23:19:59 +0000 Subject: [PATCH 08/30] Bump @babel/traverse from 7.12.13 to 7.23.2 in /tests/e2e Bumps [@babel/traverse](https://github.com/babel/babel/tree/HEAD/packages/babel-traverse) from 7.12.13 to 7.23.2. - [Release notes](https://github.com/babel/babel/releases) - [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md) - [Commits](https://github.com/babel/babel/commits/v7.23.2/packages/babel-traverse) --- updated-dependencies: - dependency-name: "@babel/traverse" dependency-type: indirect ... Signed-off-by: dependabot[bot] --- tests/e2e/package-lock.json | 295 ++++++++++++++++++++++++++++-------- 1 file changed, 231 insertions(+), 64 deletions(-) diff --git a/tests/e2e/package-lock.json b/tests/e2e/package-lock.json index 62d26aece..2edef27b9 100644 --- a/tests/e2e/package-lock.json +++ b/tests/e2e/package-lock.json @@ -13,45 +13,45 @@ "@babel/highlight": "^7.12.13" } }, - "@babel/generator": { - "version": "7.12.15", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.12.15.tgz", - "integrity": "sha512-6F2xHxBiFXWNSGb7vyCUTBF8RCLY66rS0zEPcP8t/nQyXjha5EuK4z7H5o7fWG8B4M7y6mqVWq1J+1PuwRhecQ==", - "dev": true, - "requires": { - "@babel/types": "^7.12.13", - "jsesc": "^2.5.1", - "source-map": "^0.5.0" - } - }, - "@babel/helper-function-name": { - "version": "7.12.13", - "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.12.13.tgz", - "integrity": "sha512-TZvmPn0UOqmvi5G4vvw0qZTpVptGkB1GL61R6lKvrSdIxGm5Pky7Q3fpKiIkQCAtRCBUwB0PaThlx9vebCDSwA==", - "dev": true, - "requires": { - "@babel/helper-get-function-arity": "^7.12.13", - "@babel/template": "^7.12.13", - "@babel/types": "^7.12.13" - } + "@babel/helper-environment-visitor": { + "version": "7.22.20", + "resolved": "https://registry.npmjs.org/@babel/helper-environment-visitor/-/helper-environment-visitor-7.22.20.tgz", + "integrity": "sha512-zfedSIzFhat/gFhWfHtgWvlec0nqB9YEIVrpuwjruLlXfUSnA8cJB0miHKwqDnQ7d32aKo2xt88/xZptwxbfhA==", + "dev": true }, - "@babel/helper-get-function-arity": { - "version": "7.12.13", - "resolved": "https://registry.npmjs.org/@babel/helper-get-function-arity/-/helper-get-function-arity-7.12.13.tgz", - "integrity": "sha512-DjEVzQNz5LICkzN0REdpD5prGoidvbdYk1BVgRUOINaWJP2t6avB27X1guXK1kXNrX0WMfsrm1A/ZBthYuIMQg==", + "@babel/helper-hoist-variables": { + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/helper-hoist-variables/-/helper-hoist-variables-7.22.5.tgz", + "integrity": "sha512-wGjk9QZVzvknA6yKIUURb8zY3grXCcOZt+/7Wcy8O2uctxhplmUPkOdlgoNhmdVee2c92JXbf1xpMtVNbfoxRw==", "dev": true, "requires": { - "@babel/types": "^7.12.13" + "@babel/types": "^7.22.5" + }, + "dependencies": { + "@babel/helper-validator-identifier": { + "version": "7.22.20", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.22.20.tgz", + "integrity": "sha512-Y4OZ+ytlatR8AI+8KZfKuL5urKp7qey08ha31L8b3BwewJAoJamTzyvxPR/5D+KkdJCGPq/+8TukHBlY10FX9A==", + "dev": true + }, + "@babel/types": { + "version": "7.23.0", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.23.0.tgz", + "integrity": "sha512-0oIyUfKoI3mSqMvsxBdclDwxXKXAUA8v/apZbc+iSyARYou1o8ZGDxbUYyLFoW2arqS2jDGqJuZvv1d/io1axg==", + "dev": true, + "requires": { + "@babel/helper-string-parser": "^7.22.5", + "@babel/helper-validator-identifier": "^7.22.20", + "to-fast-properties": "^2.0.0" + } + } } }, - "@babel/helper-split-export-declaration": { - "version": "7.12.13", - "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.12.13.tgz", - "integrity": "sha512-tCJDltF83htUtXx5NLcaDqRmknv652ZWCHyoTETf1CXYJdPC7nohZohjUgieXhv0hTJdRf2FjDueFehdNucpzg==", - "dev": true, - "requires": { - "@babel/types": "^7.12.13" - } + "@babel/helper-string-parser": { + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.22.5.tgz", + "integrity": "sha512-mM4COjgZox8U+JcXQwPijIZLElkgEpO5rsERVDJTc2qfCDfERyob6k5WegS14SX18IIjv+XD+GrqNumY5JRCDw==", + "dev": true }, "@babel/helper-validator-identifier": { "version": "7.12.11", @@ -134,32 +134,166 @@ "integrity": "sha512-AQBOU2Z9kWwSZMd6lNjCX0GUgFonL1wAM1db8L8PMk9UDaGsRCArBkU4Sc+UCM3AE4hjbXx+h58Lb3QT4oRmrA==", "dev": true }, - "@babel/template": { - "version": "7.12.13", - "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.12.13.tgz", - "integrity": "sha512-/7xxiGA57xMo/P2GVvdEumr8ONhFOhfgq2ihK3h1e6THqzTAkHbkXgB0xI9yeTfIUoH3+oAeHhqm/I43OTbbjA==", - "dev": true, - "requires": { - "@babel/code-frame": "^7.12.13", - "@babel/parser": "^7.12.13", - "@babel/types": "^7.12.13" - } - }, "@babel/traverse": { - "version": "7.12.13", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.12.13.tgz", - "integrity": "sha512-3Zb4w7eE/OslI0fTp8c7b286/cQps3+vdLW3UcwC8VSJC6GbKn55aeVVu2QJNuCDoeKyptLOFrPq8WqZZBodyA==", - "dev": true, - "requires": { - "@babel/code-frame": "^7.12.13", - "@babel/generator": "^7.12.13", - "@babel/helper-function-name": "^7.12.13", - "@babel/helper-split-export-declaration": "^7.12.13", - "@babel/parser": "^7.12.13", - "@babel/types": "^7.12.13", + "version": "7.23.2", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.23.2.tgz", + "integrity": "sha512-azpe59SQ48qG6nu2CzcMLbxUudtN+dOM9kDbUqGq3HXUJRlo7i8fvPoxQUzYgLZ4cMVmuZgm8vvBpNeRhd6XSw==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.22.13", + "@babel/generator": "^7.23.0", + "@babel/helper-environment-visitor": "^7.22.20", + "@babel/helper-function-name": "^7.23.0", + "@babel/helper-hoist-variables": "^7.22.5", + "@babel/helper-split-export-declaration": "^7.22.6", + "@babel/parser": "^7.23.0", + "@babel/types": "^7.23.0", "debug": "^4.1.0", - "globals": "^11.1.0", - "lodash": "^4.17.19" + "globals": "^11.1.0" + }, + "dependencies": { + "@babel/code-frame": { + "version": "7.22.13", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.22.13.tgz", + "integrity": "sha512-XktuhWlJ5g+3TJXc5upd9Ks1HutSArik6jf2eAjYFyIOf4ej3RN+184cZbzDvbPnuTJIUhPKKJE3cIsYTiAT3w==", + "dev": true, + "requires": { + "@babel/highlight": "^7.22.13", + "chalk": "^2.4.2" + } + }, + "@babel/generator": { + "version": "7.23.0", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.23.0.tgz", + "integrity": "sha512-lN85QRR+5IbYrMWM6Y4pE/noaQtg4pNiqeNGX60eqOfo6gtEj6uw/JagelB8vVztSd7R6M5n1+PQkDbHbBRU4g==", + "dev": true, + "requires": { + "@babel/types": "^7.23.0", + "@jridgewell/gen-mapping": "^0.3.2", + "@jridgewell/trace-mapping": "^0.3.17", + "jsesc": "^2.5.1" + } + }, + "@babel/helper-function-name": { + "version": "7.23.0", + "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.23.0.tgz", + "integrity": "sha512-OErEqsrxjZTJciZ4Oo+eoZqeW9UIiOcuYKRJA4ZAgV9myA+pOXhhmpfNCKjEH/auVfEYVFJ6y1Tc4r0eIApqiw==", + "dev": true, + "requires": { + "@babel/template": "^7.22.15", + "@babel/types": "^7.23.0" + } + }, + "@babel/helper-split-export-declaration": { + "version": "7.22.6", + "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.22.6.tgz", + "integrity": "sha512-AsUnxuLhRYsisFiaJwvp1QF+I3KjD5FOxut14q/GzovUe6orHLesW2C7d754kRm53h5gqrz6sFl6sxc4BVtE/g==", + "dev": true, + "requires": { + "@babel/types": "^7.22.5" + } + }, + "@babel/helper-validator-identifier": { + "version": "7.22.20", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.22.20.tgz", + "integrity": "sha512-Y4OZ+ytlatR8AI+8KZfKuL5urKp7qey08ha31L8b3BwewJAoJamTzyvxPR/5D+KkdJCGPq/+8TukHBlY10FX9A==", + "dev": true + }, + "@babel/highlight": { + "version": "7.22.20", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.22.20.tgz", + "integrity": "sha512-dkdMCN3py0+ksCgYmGG8jKeGA/8Tk+gJwSYYlFGxG5lmhfKNoAy004YpLxpS1W2J8m/EK2Ew+yOs9pVRwO89mg==", + "dev": true, + "requires": { + "@babel/helper-validator-identifier": "^7.22.20", + "chalk": "^2.4.2", + "js-tokens": "^4.0.0" + } + }, + "@babel/parser": { + "version": "7.23.0", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.23.0.tgz", + "integrity": "sha512-vvPKKdMemU85V9WE/l5wZEmImpCtLqbnTvqDS2U1fJ96KrxoW7KrXhNsNCblQlg8Ck4b85yxdTyelsMUgFUXiw==", + "dev": true + }, + "@babel/template": { + "version": "7.22.15", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.22.15.tgz", + "integrity": "sha512-QPErUVm4uyJa60rkI73qneDacvdvzxshT3kksGqlGWYdOTIUOwJ7RDUL8sGqslY1uXWSL6xMFKEXDS3ox2uF0w==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.22.13", + "@babel/parser": "^7.22.15", + "@babel/types": "^7.22.15" + } + }, + "@babel/types": { + "version": "7.23.0", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.23.0.tgz", + "integrity": "sha512-0oIyUfKoI3mSqMvsxBdclDwxXKXAUA8v/apZbc+iSyARYou1o8ZGDxbUYyLFoW2arqS2jDGqJuZvv1d/io1axg==", + "dev": true, + "requires": { + "@babel/helper-string-parser": "^7.22.5", + "@babel/helper-validator-identifier": "^7.22.20", + "to-fast-properties": "^2.0.0" + } + }, + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dev": true, + "requires": { + "color-name": "1.1.3" + } + }, + "color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", + "dev": true + }, + "escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", + "dev": true + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", + "dev": true + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } } }, "@babel/types": { @@ -173,6 +307,45 @@ "to-fast-properties": "^2.0.0" } }, + "@jridgewell/gen-mapping": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.3.tgz", + "integrity": "sha512-HLhSWOLRi875zjjMG/r+Nv0oCW8umGb0BgEhyX3dDX3egwZtB8PqLnjz3yedt8R5StBrzcg4aBpnh8UA9D1BoQ==", + "dev": true, + "requires": { + "@jridgewell/set-array": "^1.0.1", + "@jridgewell/sourcemap-codec": "^1.4.10", + "@jridgewell/trace-mapping": "^0.3.9" + } + }, + "@jridgewell/resolve-uri": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.1.tgz", + "integrity": "sha512-dSYZh7HhCDtCKm4QakX0xFpsRDqjjtZf/kjI/v3T3Nwt5r8/qz/M19F9ySyOqU94SXBmeG9ttTul+YnR4LOxFA==", + "dev": true + }, + "@jridgewell/set-array": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.1.2.tgz", + "integrity": "sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw==", + "dev": true + }, + "@jridgewell/sourcemap-codec": { + "version": "1.4.15", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz", + "integrity": "sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==", + "dev": true + }, + "@jridgewell/trace-mapping": { + "version": "0.3.19", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.19.tgz", + "integrity": "sha512-kf37QtfW+Hwx/buWGMPcR60iF9ziHa6r/CZJIHbmcm4+0qrXiVdxegAH0F6yddEVQ7zdkjcGCgCzUu+BcbhQxw==", + "dev": true, + "requires": { + "@jridgewell/resolve-uri": "^3.1.0", + "@jridgewell/sourcemap-codec": "^1.4.14" + } + }, "@types/json5": { "version": "0.0.29", "resolved": "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz", @@ -2772,12 +2945,6 @@ } } }, - "source-map": { - "version": "0.5.7", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", - "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", - "dev": true - }, "spdx-correct": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.1.1.tgz", From b2cea8a9ddec9da667e14b5f9ed80b0945a180c2 Mon Sep 17 00:00:00 2001 From: Ibrahima SOW Date: Tue, 17 Oct 2023 10:49:26 +0000 Subject: [PATCH 09/30] Avoid warning for passing null as 2nd parameter of ZipArchive::open --- classes/ZipAction.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/classes/ZipAction.php b/classes/ZipAction.php index cba276be3..b4b672bdc 100644 --- a/classes/ZipAction.php +++ b/classes/ZipAction.php @@ -247,7 +247,7 @@ private function isFileWithinFileSizeLimit($filepath) private function open($zipFile, $flags = null) { $zip = new \ZipArchive(); - if ($zip->open($zipFile, $flags) !== true || empty($zip->filename)) { + if ($zip->open($zipFile, $flags ?? 0) !== true || empty($zip->filename)) { $this->logger->error($this->translator->trans('Unable to open zipFile %s', [$zipFile], 'Modules.Autoupgrade.Admin')); return false; From edd411f204c0be429cfa27796f07732d29d3b162 Mon Sep 17 00:00:00 2001 From: Ibrahima SOW Date: Tue, 17 Oct 2023 11:24:33 +0000 Subject: [PATCH 10/30] PHP56 compliance --- classes/ZipAction.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/classes/ZipAction.php b/classes/ZipAction.php index b4b672bdc..60e469fd4 100644 --- a/classes/ZipAction.php +++ b/classes/ZipAction.php @@ -247,7 +247,10 @@ private function isFileWithinFileSizeLimit($filepath) private function open($zipFile, $flags = null) { $zip = new \ZipArchive(); - if ($zip->open($zipFile, $flags ?? 0) !== true || empty($zip->filename)) { + if (null === $flags) { + $flags = 0; + } + if ($zip->open($zipFile, $flags) !== true || empty($zip->filename)) { $this->logger->error($this->translator->trans('Unable to open zipFile %s', [$zipFile], 'Modules.Autoupgrade.Admin')); return false; From b85bea54dbb1b808f447fd10eee185ad4efe1f1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Hlav=C3=A1=C4=8Dek?= Date: Tue, 24 Oct 2023 09:20:33 +0200 Subject: [PATCH 11/30] Create 8.1.3.sql --- upgrade/sql/8.1.3.sql | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 upgrade/sql/8.1.3.sql diff --git a/upgrade/sql/8.1.3.sql b/upgrade/sql/8.1.3.sql new file mode 100644 index 000000000..d104d0670 --- /dev/null +++ b/upgrade/sql/8.1.3.sql @@ -0,0 +1,17 @@ +SET SESSION sql_mode=''; +SET NAMES 'utf8mb4'; + +/* We fixed some issues in older upgrade scripts. These are here to fix stores that have been upgraded in the meantime. */ +/* PHP:drop_column_if_exists('product_attribute', 'location'); */; +/* PHP:drop_column_if_exists('product_attribute', 'quantity'); */; +ALTER TABLE `PREFIX_smarty_lazy_cache` CHANGE `cache_id` `cache_id` VARCHAR(191) NOT NULL DEFAULT ''; +ALTER TABLE `PREFIX_log` CHANGE `id_shop` `id_shop` INT(10) unsigned DEFAULT NULL; +ALTER TABLE `PREFIX_log` CHANGE `id_shop_group` `id_shop_group` INT(10) unsigned DEFAULT NULL; +ALTER TABLE `PREFIX_log` CHANGE `id_lang` `id_lang` INT(10) unsigned DEFAULT NULL; +ALTER TABLE `PREFIX_product_attribute_lang` CHANGE `available_now` `available_now` VARCHAR(255) DEFAULT NULL; +ALTER TABLE `PREFIX_product_attribute_lang` CHANGE `available_later` `available_later` VARCHAR(255) DEFAULT NULL; +ALTER TABLE `PREFIX_order_cart_rule` CHANGE `deleted` `deleted` TINYINT(1) UNSIGNED NOT NULL DEFAULT '0'; +ALTER TABLE `PREFIX_product_group_reduction_cache` CHANGE `reduction` `reduction` DECIMAL(5, 4) NOT NULL; +ALTER TABLE `PREFIX_stock_mvt` CHANGE `physical_quantity` `physical_quantity` INT(10) UNSIGNED NOT NULL; +ALTER TABLE `PREFIX_group_reduction` CHANGE `reduction` `reduction` DECIMAL(5, 4) NOT NULL; +ALTER TABLE `PREFIX_order_payment` CHANGE `amount` `amount` DECIMAL(20, 6) NOT NULL; From 517c6bb0c2f73ac9b51ccb07a03a0d324105f257 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Hlav=C3=A1=C4=8Dek?= Date: Tue, 24 Oct 2023 09:20:41 +0200 Subject: [PATCH 12/30] Update 8.1.2.sql --- upgrade/sql/8.1.2.sql | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/upgrade/sql/8.1.2.sql b/upgrade/sql/8.1.2.sql index 319ae3b08..4fc29d796 100644 --- a/upgrade/sql/8.1.2.sql +++ b/upgrade/sql/8.1.2.sql @@ -13,18 +13,3 @@ UPDATE `PREFIX_tab` SET wording_domain = 'Admin.Navigation.Menu', wording = 'Cus INSERT IGNORE INTO `PREFIX_hook` (`id_hook`, `name`, `title`, `description`, `position`) VALUES (NULL, 'actionLanguageLinkParameters', 'Add parameters to language link', 'Allows modules to provide proper parameters for links in other languages.', '1'), (NULL, 'actionAfterLoadRoutes', 'Triggers after loading routes', 'Allow modules to modify routes in any way or add their own multilanguage routes.', '1'); - -/* We fixed some issues in older upgrade scripts. These are here to fix stores that have been upgraded in the meantime. */ -/* PHP:drop_column_if_exists('product_attribute', 'location'); */; -/* PHP:drop_column_if_exists('product_attribute', 'quantity'); */; -ALTER TABLE `PREFIX_smarty_lazy_cache` CHANGE `cache_id` `cache_id` VARCHAR(191) NOT NULL DEFAULT ''; -ALTER TABLE `PREFIX_log` CHANGE `id_shop` `id_shop` INT(10) unsigned DEFAULT NULL; -ALTER TABLE `PREFIX_log` CHANGE `id_shop_group` `id_shop_group` INT(10) unsigned DEFAULT NULL; -ALTER TABLE `PREFIX_log` CHANGE `id_lang` `id_lang` INT(10) unsigned DEFAULT NULL; -ALTER TABLE `PREFIX_product_attribute_lang` CHANGE `available_now` `available_now` VARCHAR(255) DEFAULT NULL; -ALTER TABLE `PREFIX_product_attribute_lang` CHANGE `available_later` `available_later` VARCHAR(255) DEFAULT NULL; -ALTER TABLE `PREFIX_order_cart_rule` CHANGE `deleted` `deleted` TINYINT(1) UNSIGNED NOT NULL DEFAULT '0'; -ALTER TABLE `PREFIX_product_group_reduction_cache` CHANGE `reduction` `reduction` DECIMAL(5, 4) NOT NULL; -ALTER TABLE `PREFIX_stock_mvt` CHANGE `physical_quantity` `physical_quantity` INT(10) UNSIGNED NOT NULL; -ALTER TABLE `PREFIX_group_reduction` CHANGE `reduction` `reduction` DECIMAL(5, 4) NOT NULL; -ALTER TABLE `PREFIX_order_payment` CHANGE `amount` `amount` DECIMAL(20, 6) NOT NULL; From 968e104437cab2c951571230f83e884157658e90 Mon Sep 17 00:00:00 2001 From: Tatu Wikman Date: Fri, 10 Nov 2023 14:31:47 +0200 Subject: [PATCH 13/30] Show which file was trying to be closed when error on close --- classes/ZipAction.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/classes/ZipAction.php b/classes/ZipAction.php index 60e469fd4..a11c29a5e 100644 --- a/classes/ZipAction.php +++ b/classes/ZipAction.php @@ -110,8 +110,8 @@ public function compress(&$filesList, $toFile) if (!$zip->close()) { $this->logger->error($this->translator->trans( - 'Could not close the Zip file properly. Check you are allowed to write on the disk and there is available space on it.', - [], + 'Could not close the Zip file: %toFile% properly. Check you are allowed to write on the disk and there is available space on it.', + ['%toFile%' => $toFile], 'Modules.Autoupgrade.Admin' )); From 96ab246eb6a4759b1ab7ede810ca62fbe0900b4e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 10 Nov 2023 16:03:54 +0000 Subject: [PATCH 14/30] Bump axios from 0.21.2 to 1.6.0 in /tests/e2e Bumps [axios](https://github.com/axios/axios) from 0.21.2 to 1.6.0. - [Release notes](https://github.com/axios/axios/releases) - [Changelog](https://github.com/axios/axios/blob/v1.x/CHANGELOG.md) - [Commits](https://github.com/axios/axios/compare/v0.21.2...v1.6.0) --- updated-dependencies: - dependency-name: axios dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- tests/e2e/package-lock.json | 57 ++++++++++++++++++++++++++++++++----- tests/e2e/package.json | 2 +- 2 files changed, 51 insertions(+), 8 deletions(-) diff --git a/tests/e2e/package-lock.json b/tests/e2e/package-lock.json index 2edef27b9..3c223b136 100644 --- a/tests/e2e/package-lock.json +++ b/tests/e2e/package-lock.json @@ -477,12 +477,19 @@ "integrity": "sha512-+Ryf6g3BKoRc7jfp7ad8tM4TtMiaWvbF/1/sQcZPkkS7ag3D5nMBCe2UfOTONtAkaG0tO0ij3C5Lwmf1EiyjHg==", "dev": true }, + "asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==" + }, "axios": { - "version": "0.21.2", - "resolved": "https://registry.npmjs.org/axios/-/axios-0.21.2.tgz", - "integrity": "sha512-87otirqUw3e8CzHTMO+/9kh/FSgXt/eVDvipijwDtEuwbkySWZ9SBm6VEubmJ/kLKEoLQV/POhxXFb66bfekfg==", + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.6.0.tgz", + "integrity": "sha512-EZ1DYihju9pwVB+jg67ogm+Tmqc6JmhamRN6I4Zt8DfZu5lbcQGw3ozH9lFejSJgs/ibaef3A9PMXPLeefFGJg==", "requires": { - "follow-redirects": "^1.14.0" + "follow-redirects": "^1.15.0", + "form-data": "^4.0.0", + "proxy-from-env": "^1.1.0" } }, "babel-eslint": { @@ -679,6 +686,14 @@ "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" }, + "combined-stream": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "requires": { + "delayed-stream": "~1.0.0" + } + }, "commander": { "version": "6.2.1", "resolved": "https://registry.npmjs.org/commander/-/commander-6.2.1.tgz", @@ -767,6 +782,11 @@ "object-keys": "^1.0.12" } }, + "delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==" + }, "diff": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/diff/-/diff-5.0.0.tgz", @@ -1309,9 +1329,19 @@ "dev": true }, "follow-redirects": { - "version": "1.14.8", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.8.tgz", - "integrity": "sha512-1x0S9UVJHsQprFcEC/qnNzBLcIxsjAV905f/UkQxbclCsoTWlacCNOpQa/anodLl2uaEKFhfWOvM2Qg77+15zA==" + "version": "1.15.3", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.3.tgz", + "integrity": "sha512-1VzOtuEM8pC9SFU1E+8KfTjZyMztRsgEfwQl44z8A25uy13jSzTj6dyK2Df52iV0vgHCfBwLhDWevLn95w5v6Q==" + }, + "form-data": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", + "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", + "requires": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "mime-types": "^2.1.12" + } }, "fs-extra": { "version": "7.0.1", @@ -1853,6 +1883,19 @@ "resolved": "https://registry.npmjs.org/mime/-/mime-2.5.2.tgz", "integrity": "sha512-tqkh47FzKeCPD2PUiPB6pkbMzsCasjxAfC62/Wap5qrUWcb+sFasXUC5I3gYM5iBM8v/Qpn4UK0x+j0iHyFPDg==" }, + "mime-db": { + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==" + }, + "mime-types": { + "version": "2.1.35", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "requires": { + "mime-db": "1.52.0" + } + }, "mimic-fn": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-1.2.0.tgz", diff --git a/tests/e2e/package.json b/tests/e2e/package.json index d77058ff3..847c9a0b1 100644 --- a/tests/e2e/package.json +++ b/tests/e2e/package.json @@ -21,7 +21,7 @@ "ui-tests" ], "dependencies": { - "axios": "^0.21.2", + "axios": "^1.6.0", "chai": "^4.2.0", "eslint-config-prestashop": "^0.1.0", "mocha": "^10.1.0", From e67975bf88f75f2696f7c24a3b5536bf44fcfb83 Mon Sep 17 00:00:00 2001 From: Dominik Ulrich Date: Sun, 12 Nov 2023 14:42:10 +0100 Subject: [PATCH 15/30] Update 8.1.3.sql --- upgrade/sql/8.1.3.sql | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/upgrade/sql/8.1.3.sql b/upgrade/sql/8.1.3.sql index 6cf78f0f9..bba33fcd5 100644 --- a/upgrade/sql/8.1.3.sql +++ b/upgrade/sql/8.1.3.sql @@ -18,3 +18,9 @@ ALTER TABLE `PREFIX_product_group_reduction_cache` CHANGE `reduction` `reduction ALTER TABLE `PREFIX_stock_mvt` CHANGE `physical_quantity` `physical_quantity` INT(10) UNSIGNED NOT NULL; ALTER TABLE `PREFIX_group_reduction` CHANGE `reduction` `reduction` DECIMAL(5, 4) NOT NULL; ALTER TABLE `PREFIX_order_payment` CHANGE `amount` `amount` DECIMAL(20, 6) NOT NULL; + +/* Minimal_quantity should be 1 at least, not 0 */ +UPDATE `PREFIX_product` SET `minimal_quantity` = 1 WHERE `minimal_quantity` = 0; +UPDATE `PREFIX_product_shop` SET `minimal_quantity` = 1 WHERE `minimal_quantity` = 0; +UPDATE `PREFIX_product_attribute` SET `minimal_quantity` = 1 WHERE `minimal_quantity` = 0; +UPDATE `PREFIX_product_attribute_shop` SET `minimal_quantity` = 1 WHERE `minimal_quantity` = 0; From f95346c682e0944a555dbe433fbf70aaa40dfbd2 Mon Sep 17 00:00:00 2001 From: leemyong pakvn <3759923+leemyongpakvn@users.noreply.github.com> Date: Mon, 13 Nov 2023 12:17:27 +0700 Subject: [PATCH 16/30] upgrade github actions to v3 --- .github/workflows/php.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index 983d1620a..fc1084453 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -7,7 +7,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v2.0.0 + uses: actions/checkout@v3.1.0 - name: PHP syntax checker 5.6 uses: prestashop/github-action-php-lint/5.6@master @@ -50,10 +50,10 @@ jobs: php-version: '5.6' - name: Checkout - uses: actions/checkout@v2.0.0 + uses: actions/checkout@v3.1.0 - name: Cache dependencies - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: vendor key: php-${{ hashFiles('composer.lock') }} @@ -76,7 +76,7 @@ jobs: with: php-version: ${{ matrix.php-versions }} extensions: mbstring, intl, gd, xml, dom, json, fileinfo, curl, zip, iconv, ext-zip - - uses: actions/checkout@v2 + - uses: actions/checkout@v3.1.0 with: fetch-depth: 0 @@ -92,18 +92,18 @@ jobs: presta-versions: ['1.6.1.18', '1.7.2.5', '1.7.3.4', '1.7.4.4', '1.7.5.1', '1.7.6', '1.7.7', '1.7.8', '8.0.0', 'latest'] steps: - name: Checkout - uses: actions/checkout@v2.0.0 + uses: actions/checkout@v3.1.0 # Add vendor folder in cache to make next builds faster - name: Cache vendor folder - uses: actions/cache@v1 + uses: actions/cache@v3 with: path: vendor key: php-${{ hashFiles('composer.lock') }} # Add composer local folder in cache to make next builds faster - name: Cache composer folder - uses: actions/cache@v1 + uses: actions/cache@v3 with: path: ~/.composer/cache key: php-composer-cache From ed8f5a576685b6ff641f42167f4771d962b7e772 Mon Sep 17 00:00:00 2001 From: leemyong pakvn <3759923+leemyongpakvn@users.noreply.github.com> Date: Mon, 13 Nov 2023 12:25:54 +0700 Subject: [PATCH 17/30] upgrade gh action to v3 for upgrade test --- .github/workflows/upgrade.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/upgrade.yml b/.github/workflows/upgrade.yml index bc5bf1adb..1e71ba313 100644 --- a/.github/workflows/upgrade.yml +++ b/.github/workflows/upgrade.yml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-latest name: Upgrade steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3.1.0 - name: Composer Install run: composer install - name: Upgrade & Rollback From 15b6642a8ff77d186f0a02d442615ed6219c1848 Mon Sep 17 00:00:00 2001 From: leemyong pakvn <3759923+leemyongpakvn@users.noreply.github.com> Date: Mon, 13 Nov 2023 12:33:03 +0700 Subject: [PATCH 18/30] upgrade gh actions e2e_nightly_upgrade --- .github/workflows/e2e_nightly_upgrade.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/e2e_nightly_upgrade.yml b/.github/workflows/e2e_nightly_upgrade.yml index 9b96f76b6..71b3abcfe 100755 --- a/.github/workflows/e2e_nightly_upgrade.yml +++ b/.github/workflows/e2e_nightly_upgrade.yml @@ -16,12 +16,12 @@ jobs: runs-on: ubuntu-18.04 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3.1.0 - name: Setup Node - uses: actions/setup-node@v2 + uses: actions/setup-node@v3 with: - node-version: 12 + node-version: 16 - name: Install dependencies shell: bash @@ -61,7 +61,7 @@ jobs: steps: # Setup PrestaShop and Install Autoupgrade module - - uses: actions/checkout@v2 + - uses: actions/checkout@v3.1.0 - run: | cp -r .github .github_dev @@ -94,9 +94,9 @@ jobs: # Install Module with user interface - name: Setup Node - uses: actions/setup-node@v2 + uses: actions/setup-node@v3 with: - node-version: 12 + node-version: 16 - name: Install dependencies run: npm install @@ -162,7 +162,7 @@ jobs: fail-fast: false steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3.1.0 - uses: actions/download-artifact@v2 name: Download reports @@ -173,7 +173,7 @@ jobs: - name: Setup Node uses: actions/setup-node@v2 with: - node-version: 12 + node-version: 16 - name: Install dependencies shell: bash @@ -206,7 +206,7 @@ jobs: fail-fast: false steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3.1.0 - uses: actions/download-artifact@v2 name: Download report From f8fb74faeedb327a561b6f03ea6415696755eea8 Mon Sep 17 00:00:00 2001 From: leemyong pakvn <3759923+leemyongpakvn@users.noreply.github.com> Date: Mon, 13 Nov 2023 14:08:06 +0700 Subject: [PATCH 19/30] upgrade gh actions nightly_upgrade --- .github/workflows/nightly_upgrade.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/nightly_upgrade.yml b/.github/workflows/nightly_upgrade.yml index 637b60dee..4e2d8143f 100644 --- a/.github/workflows/nightly_upgrade.yml +++ b/.github/workflows/nightly_upgrade.yml @@ -8,7 +8,7 @@ jobs: name: Set up matrix runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3.1.0 - uses: shivammathur/setup-php@v2 with: php-version: 7.4 @@ -39,7 +39,7 @@ jobs: outputs: result: ${{ steps.export-result.outputs.result }} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3.1.0 - if: ${{ matrix.branch != 'dev' }} run: | cp -r .github .github_dev @@ -76,7 +76,7 @@ jobs: matrix: ps-versions: ${{ fromJson(needs.get_matrix.outputs.matrix) }} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3.1.0 - uses: actions/download-artifact@v2 with: path: ./artifacts/ From 173d8480768b5723796449ff9ce5cc7557c32348 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Hlav=C3=A1=C4=8Dek?= Date: Thu, 16 Nov 2023 18:03:58 +0100 Subject: [PATCH 20/30] Remove non-needed condition --- classes/TaskRunner/Upgrade/UpgradeFiles.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/classes/TaskRunner/Upgrade/UpgradeFiles.php b/classes/TaskRunner/Upgrade/UpgradeFiles.php index f22251861..3ecc2ef5e 100644 --- a/classes/TaskRunner/Upgrade/UpgradeFiles.php +++ b/classes/TaskRunner/Upgrade/UpgradeFiles.php @@ -119,7 +119,7 @@ protected function listFilesToUpgrade($dir) continue; } $list[] = str_replace($this->container->getProperty(UpgradeContainer::LATEST_PATH), '', $fullPath); - if (is_dir($fullPath) && strpos($dir . DIRECTORY_SEPARATOR . $file, 'install') === false) { + if (is_dir($fullPath)) { $list = array_merge($list, $this->listFilesToUpgrade($fullPath)); } } From be65bf066f94276623af7366483d2e30595c7987 Mon Sep 17 00:00:00 2001 From: Hlavtox Date: Thu, 16 Nov 2023 19:30:40 +0100 Subject: [PATCH 21/30] Fix some files not being deleted --- .../Miscellaneous/CompareReleases.php | 4 +- classes/TaskRunner/Upgrade/UpgradeFiles.php | 45 +++++++++++++++---- 2 files changed, 39 insertions(+), 10 deletions(-) diff --git a/classes/TaskRunner/Miscellaneous/CompareReleases.php b/classes/TaskRunner/Miscellaneous/CompareReleases.php index d452b2b77..5b7719517 100644 --- a/classes/TaskRunner/Miscellaneous/CompareReleases.php +++ b/classes/TaskRunner/Miscellaneous/CompareReleases.php @@ -31,7 +31,7 @@ use PrestaShop\Module\AutoUpgrade\TaskRunner\AbstractTask; /** - * get the list of all modified and deleted files between current version + * This class gets the list of all modified and deleted files between current version * and target version (according to channel configuration). */ class CompareReleases extends AbstractTask @@ -61,6 +61,8 @@ public function run() $version = $upgrader->version_num; } + // Get list of differences between these two versions. The differences will be fetched from a local + // XML file if it exists, or from PrestaShop API. $diffFileList = $upgrader->getDiffFilesList(_PS_VERSION_, $version); if (!is_array($diffFileList)) { $this->nextParams['status'] = 'error'; diff --git a/classes/TaskRunner/Upgrade/UpgradeFiles.php b/classes/TaskRunner/Upgrade/UpgradeFiles.php index f22251861..802d0a7ca 100644 --- a/classes/TaskRunner/Upgrade/UpgradeFiles.php +++ b/classes/TaskRunner/Upgrade/UpgradeFiles.php @@ -38,7 +38,7 @@ class UpgradeFiles extends AbstractTask public function run() { - // The first call must init the list of files be upgraded + // The first call must init the list of files be upgraded. if (!$this->container->getFileConfigurationStorage()->exists(UpgradeFileNames::FILES_TO_UPGRADE_LIST)) { return $this->warmUp(); } @@ -47,6 +47,8 @@ public function run() $this->destUpgradePath = $this->container->getProperty(UpgradeContainer::PS_ROOT_PATH); $this->next = 'upgradeFiles'; + + // Now we load the list of files to be upgraded, prepared previously by warmUp method. $filesToUpgrade = $this->container->getFileConfigurationStorage()->load(UpgradeFileNames::FILES_TO_UPGRADE_LIST); if (!is_array($filesToUpgrade)) { $this->next = 'error'; @@ -68,6 +70,8 @@ public function run() } $file = array_pop($filesToUpgrade); + + // Note - upgrade this file means do whatever is needed for that file to be in the final state, delete included. if (!$this->upgradeThisFile($file)) { // put the file back to the begin of the list $this->next = 'error'; @@ -137,9 +141,15 @@ public function upgradeThisFile($file) // translations_custom and mails_custom list are currently not used // later, we could handle customization with some kind of diff functions // for now, just copy $file in str_replace($this->latestRootDir,_PS_ROOT_DIR_) + + // The path to the file from the upgrade archive $orig = $this->container->getProperty(UpgradeContainer::LATEST_PATH) . $file; + + // The path to the file in our prestashop directory $dest = $this->destUpgradePath . $file; + // Skip files that we want to avoid touching. They may be already excluded from the list from before, + // but again, as a safety precaution. if ($this->container->getFilesystemAdapter()->isFileSkipped($file, $dest, 'upgrade')) { $this->logger->debug($this->translator->trans('%s ignored', [$file], 'Modules.Autoupgrade.Admin')); @@ -221,6 +231,7 @@ public function upgradeThisFile($file) */ protected function warmUp() { + // Get path to the folder with release we will use to upgrade and check if it's valid $newReleasePath = $this->container->getProperty(UpgradeContainer::LATEST_PATH); if (!$this->container->getFilesystemAdapter()->isReleaseValid($newReleasePath)) { $this->logger->error($this->translator->trans('Could not assert the folder %s contains a valid PrestaShop release, exiting.', [$newReleasePath], 'Modules.Autoupgrade.Admin')); @@ -230,42 +241,57 @@ protected function warmUp() return false; } + // Replace the name of the admin folder inside the release to match our admin folder name $admin_dir = str_replace($this->container->getProperty(UpgradeContainer::PS_ROOT_PATH) . DIRECTORY_SEPARATOR, '', $this->container->getProperty(UpgradeContainer::PS_ADMIN_PATH)); if (file_exists($newReleasePath . DIRECTORY_SEPARATOR . 'admin')) { rename($newReleasePath . DIRECTORY_SEPARATOR . 'admin', $newReleasePath . DIRECTORY_SEPARATOR . $admin_dir); } elseif (file_exists($newReleasePath . DIRECTORY_SEPARATOR . 'admin-dev')) { rename($newReleasePath . DIRECTORY_SEPARATOR . 'admin-dev', $newReleasePath . DIRECTORY_SEPARATOR . $admin_dir); } + + // Rename develop installer directory, it would be ignored anyway because it's present in getFilesToIgnoreOnUpgrade() if (file_exists($newReleasePath . DIRECTORY_SEPARATOR . 'install-dev')) { rename($newReleasePath . DIRECTORY_SEPARATOR . 'install-dev', $newReleasePath . DIRECTORY_SEPARATOR . 'install'); } - // list saved in UpgradeFileNames::toUpgradeFileList - // get files differences (previously generated) - $admin_dir = trim(str_replace($this->container->getProperty(UpgradeContainer::PS_ROOT_PATH), '', $this->container->getProperty(UpgradeContainer::PS_ADMIN_PATH)), DIRECTORY_SEPARATOR); + // Now, we will get the list of changed and removed files between the versions. This was generated previously by + // CompareReleases task. $filepath_list_diff = $this->container->getProperty(UpgradeContainer::WORKSPACE_PATH) . DIRECTORY_SEPARATOR . UpgradeFileNames::FILES_DIFF_LIST; $list_files_diff = []; + + // We check if that file exists first and load it if (file_exists($filepath_list_diff)) { $list_files_diff = $this->container->getFileConfigurationStorage()->load(UpgradeFileNames::FILES_DIFF_LIST); - // only keep list of files to delete. The modified files will be listed with _listFilesToUpgrade + // $list_files_diff now contains an array with a list of changed and deleted files. + // We only keep list of files to delete. The modified files will be listed with listFilesToUpgrade below. $list_files_diff = $list_files_diff['deleted']; + + // Admin folder name in this deleted files list is standard /admin/. + // We will need to change it to our own admin folder name. + $admin_dir = trim(str_replace($this->container->getProperty(UpgradeContainer::PS_ROOT_PATH), '', $this->container->getProperty(UpgradeContainer::PS_ADMIN_PATH)), DIRECTORY_SEPARATOR); foreach ($list_files_diff as $k => $path) { if (preg_match('#autoupgrade#', $path)) { unset($list_files_diff[$k]); - } else { + } elseif (substr($path, 0, 6) === '/admin') { + // Please make sure that the condition to check if the string starts with /admin stays here, because it was replacing + // admin even in the middle of a path, not deleting some files as a result. + // Also, do not use DIRECTORY_SEPARATOR, keep forward slash, because the path come from the XML standardized. $list_files_diff[$k] = str_replace('/' . 'admin', '/' . $admin_dir, $path); } - } // do not replace by DIRECTORY_SEPARATOR + } } + // Now, we get the list of files that are either new or must be modified $list_files_to_upgrade = $this->listFilesToUpgrade($newReleasePath); if (false === $list_files_to_upgrade) { return false; } - // also add files to remove + // Add our previously created list of deleted files $list_files_to_upgrade = array_reverse(array_merge($list_files_diff, $list_files_to_upgrade)); + // Now, some files should be updated as an absolute last step, if they are present in the list, + // we will put them to the end of it. $filesToMoveToTheEnd = [ DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php', DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . 'composer' . DIRECTORY_SEPARATOR . 'ClassLoader.php', @@ -287,7 +313,8 @@ protected function warmUp() } } - // save in a serialized array in UpgradeFileNames::toUpgradeFileList + // Save in a serialized array in UpgradeFileNames::toUpgradeFileList, to be later used by the upgrade step itself above, + // after run() is called. $this->container->getFileConfigurationStorage()->save($list_files_to_upgrade, UpgradeFileNames::FILES_TO_UPGRADE_LIST); $total_files_to_upgrade = count($list_files_to_upgrade); From ed969eb13e3e442105c2dc3463ecdab2342c6a3b Mon Sep 17 00:00:00 2001 From: Hlavtox Date: Thu, 16 Nov 2023 19:37:35 +0100 Subject: [PATCH 22/30] Improve the logic --- classes/TaskRunner/Upgrade/UpgradeFiles.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/classes/TaskRunner/Upgrade/UpgradeFiles.php b/classes/TaskRunner/Upgrade/UpgradeFiles.php index 802d0a7ca..dd7524e78 100644 --- a/classes/TaskRunner/Upgrade/UpgradeFiles.php +++ b/classes/TaskRunner/Upgrade/UpgradeFiles.php @@ -276,7 +276,7 @@ protected function warmUp() // Please make sure that the condition to check if the string starts with /admin stays here, because it was replacing // admin even in the middle of a path, not deleting some files as a result. // Also, do not use DIRECTORY_SEPARATOR, keep forward slash, because the path come from the XML standardized. - $list_files_diff[$k] = str_replace('/' . 'admin', '/' . $admin_dir, $path); + $list_files_diff[$k] = '/' . $admin_dir . substr($path, 6); } } } From 260793aec26a0013ca4a51e64147f5fc3d3d1f28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Hlav=C3=A1=C4=8Dek?= Date: Thu, 23 Nov 2023 14:15:35 +0100 Subject: [PATCH 23/30] Update autoupgrade.php --- autoupgrade.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autoupgrade.php b/autoupgrade.php index 1ceec462a..e623a62c8 100644 --- a/autoupgrade.php +++ b/autoupgrade.php @@ -159,7 +159,7 @@ public function hookDashboardZoneOne($params) public function getContent() { global $cookie; - header('Location: index.php?tab=AdminSelfUpgrade&token=' . md5(pSQL(_COOKIE_KEY_ . 'AdminSelfUpgrade' . (int) Tab::getIdFromClassName('AdminSelfUpgrade') . (int) $cookie->id_employee))); + header('Location: index.php?controller=AdminSelfUpgrade&token=' . md5(pSQL(_COOKIE_KEY_ . 'AdminSelfUpgrade' . (int) Tab::getIdFromClassName('AdminSelfUpgrade') . (int) $cookie->id_employee))); exit; } From c13ba224e7d97d733b33271294cfda8dae038da3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Hlav=C3=A1=C4=8Dek?= Date: Thu, 23 Nov 2023 14:16:03 +0100 Subject: [PATCH 24/30] Update upgrade.js --- js/upgrade.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/upgrade.js b/js/upgrade.js index f2105cc15..49bdf37d7 100644 --- a/js/upgrade.js +++ b/js/upgrade.js @@ -201,7 +201,7 @@ $(document).ready(function(){ // show delete button if the value is not 0 if (val != 0) { $("span#buttonDeleteBackup").html( - "
{{ 'Refresh the page'|trans({}, 'Modules.Autoupgrade.Admin') }} - + {{ 'Refresh the page'|trans({}, 'Modules.Autoupgrade.Admin') }} - {% else %} - {{ 'Check if a new version is available'|trans({}, 'Modules.Autoupgrade.Admin') }} - + {{ 'Check if a new version is available'|trans({}, 'Modules.Autoupgrade.Admin') }} - {% endif %} {% if lastVersionCheck %} {{ 'Last check: %s'|trans([lastVersionCheck|date('Y-m-d H:i:s')], 'Modules.Autoupgrade.Admin') }} From 83aa1c8c65b939d83e219a3616aa62fffb43577b Mon Sep 17 00:00:00 2001 From: Hlavtox Date: Thu, 23 Nov 2023 17:07:41 +0100 Subject: [PATCH 26/30] Remove unused code --- AdminSelfUpgrade.php | 15 - ajax-upgradetabconfig.php | 1 - classes/Tools14.php | 2222 +-------------------------- functions.php | 300 ---- tests/phpstan/bootstrap.php | 2 - tests/phpstan/phpstan-1.6.1.18.neon | 24 - tests/phpstan/phpstan.neon | 1 - 7 files changed, 57 insertions(+), 2508 deletions(-) delete mode 100755 functions.php delete mode 100644 tests/phpstan/phpstan-1.6.1.18.neon diff --git a/AdminSelfUpgrade.php b/AdminSelfUpgrade.php index 045980143..a65355dee 100755 --- a/AdminSelfUpgrade.php +++ b/AdminSelfUpgrade.php @@ -522,21 +522,6 @@ public function display() parent::display(); } - /** - * @deprecated - * Method allowing errors on very old tabs to be displayed. - * On the next major of this module, use an admin controller and get rid of this. - * - * This method is called by functions.php available in the admin root folder. - */ - public function displayErrors() - { - if (empty($this->_errors)) { - return; - } - echo implode(' - ', $this->_errors); - } - /** * Adapter for trans calls, existing only on PS 1.7. * Making them available for PS 1.6 as well. diff --git a/ajax-upgradetabconfig.php b/ajax-upgradetabconfig.php index 35c4bbfab..139033ffd 100644 --- a/ajax-upgradetabconfig.php +++ b/ajax-upgradetabconfig.php @@ -63,7 +63,6 @@ function autoupgrade_init_container($callerFilePath) } define('AUTOUPGRADE_MODULE_DIR', _PS_MODULE_DIR_ . 'autoupgrade' . DIRECTORY_SEPARATOR); - require_once AUTOUPGRADE_MODULE_DIR . 'functions.php'; require_once AUTOUPGRADE_MODULE_DIR . 'vendor/autoload.php'; $dir = Tools14::safeOutput(Tools14::getValue('dir')); diff --git a/classes/Tools14.php b/classes/Tools14.php index 585808c65..de9b0fb15 100755 --- a/classes/Tools14.php +++ b/classes/Tools14.php @@ -29,84 +29,14 @@ use Tab; +/** + * Useful collection of utilities that are guaranteed to work on every PHP and PrestaShop version supported. + */ class Tools14 { - protected static $file_exists_cache = []; protected static $_forceCompile; protected static $_caching; - /** - * Random password generator. - * - * @param int $length Desired length (optional) - * - * @return string Password - */ - public static function passwdGen($length = 8) - { - $str = 'abcdefghijkmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'; - for ($i = 0, $passwd = ''; $i < $length; ++$i) { - $passwd .= self::substr($str, mt_rand(0, self::strlen($str) - 1), 1); - } - - return $passwd; - } - - /** - * Redirect user to another page. - * - * @param string $url Desired URL - * @param string $baseUri Base URI (optional) - */ - public static function redirect($url, $baseUri = __PS_BASE_URI__) - { - if (strpos($url, 'http://') === false && strpos($url, 'https://') === false) { - global $link; - if (strpos($url, $baseUri) !== false && strpos($url, $baseUri) == 0) { - $url = substr($url, strlen($baseUri)); - } - $explode = explode('?', $url, 2); - // don't use ssl if url is home page - // used when logout for example - $useSSL = !empty($url); - $url = $link->getPageLink($explode[0], $useSSL); - if (isset($explode[1])) { - $url .= '?' . $explode[1]; - } - $baseUri = ''; - } - - if (isset($_SERVER['HTTP_REFERER']) && ($url == $_SERVER['HTTP_REFERER'])) { - header('Location: ' . $_SERVER['HTTP_REFERER']); - } else { - header('Location: ' . $baseUri . $url); - } - exit; - } - - /** - * Redirect url wich allready PS_BASE_URI. - * - * @param string $url Desired URL - */ - public static function redirectLink($url) - { - if (!preg_match('@^https?://@i', $url)) { - global $link; - if (strpos($url, __PS_BASE_URI__) !== false && strpos($url, __PS_BASE_URI__) == 0) { - $url = substr($url, strlen(__PS_BASE_URI__)); - } - $explode = explode('?', $url, 2); - $url = $link->getPageLink($explode[0]); - if (isset($explode[1])) { - $url .= '?' . $explode[1]; - } - } - - header('Location: ' . $url); - exit; - } - /** * Redirect user to another admin page. * @@ -118,22 +48,9 @@ public static function redirectAdmin($url) exit; } - /** - * getProtocol return the set protocol according to configuration (http[s]). - * - * @param bool true if require ssl - * - * @return string (http|https) - */ - public static function getProtocol($use_ssl = null) - { - return null !== $use_ssl && $use_ssl ? 'https://' : 'http://'; - } - /** * getHttpHost return the current host used, with the protocol (http or https) if $http is true * This function should not be used to choose http or https domain name. - * Use Tools14::getShopDomain() or Tools14::getShopDomainSsl instead. * * @param bool $http * @param bool $entities @@ -153,135 +70,6 @@ public static function getHttpHost($http = false, $entities = false) return $host; } - /** - * getShopDomain returns domain name according to configuration and ignoring ssl. - * - * @param bool $http if true, return domain name with protocol - * @param bool $entities if true, - * - * @return string domain - */ - public static function getShopDomain($http = false, $entities = false) - { - if (!($domain = Configuration::get('PS_SHOP_DOMAIN'))) { - $domain = self::getHttpHost(); - } - if ($entities) { - $domain = htmlspecialchars($domain, ENT_COMPAT, 'UTF-8'); - } - if ($http) { - $domain = 'http://' . $domain; - } - - return $domain; - } - - /** - * getShopDomainSsl returns domain name according to configuration and depending on ssl activation. - * - * @param bool $http if true, return domain name with protocol - * @param bool $entities if true, - * - * @return string domain - */ - public static function getShopDomainSsl($http = false, $entities = false) - { - if (!($domain = Configuration::get('PS_SHOP_DOMAIN_SSL'))) { - $domain = self::getHttpHost(); - } - if ($entities) { - $domain = htmlspecialchars($domain, ENT_COMPAT, 'UTF-8'); - } - if ($http) { - $domain = (Configuration::get('PS_SSL_ENABLED') ? 'https://' : 'http://') . $domain; - } - - return $domain; - } - - /** - * Get the server variable SERVER_NAME. - * - * @return string server name - */ - public static function getServerName() - { - if (isset($_SERVER['HTTP_X_FORWARDED_SERVER']) && $_SERVER['HTTP_X_FORWARDED_SERVER']) { - return $_SERVER['HTTP_X_FORWARDED_SERVER']; - } - - return $_SERVER['SERVER_NAME']; - } - - /** - * Get the server variable REMOTE_ADDR, or the first ip of HTTP_X_FORWARDED_FOR (when using proxy). - * - * @return string $remote_addr ip of client - */ - public static function getRemoteAddr() - { - // This condition is necessary when using CDN, don't remove it. - if (isset($_SERVER['HTTP_X_FORWARDED_FOR']) && $_SERVER['HTTP_X_FORWARDED_FOR'] && (!isset($_SERVER['REMOTE_ADDR']) || preg_match('/^127\..*/i', trim($_SERVER['REMOTE_ADDR'])) || preg_match('/^172\.16.*/i', trim($_SERVER['REMOTE_ADDR'])) || preg_match('/^192\.168\.*/i', trim($_SERVER['REMOTE_ADDR'])) || preg_match('/^10\..*/i', trim($_SERVER['REMOTE_ADDR'])))) { - if (strpos($_SERVER['HTTP_X_FORWARDED_FOR'], ',')) { - $ips = explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']); - - return $ips[0]; - } else { - return $_SERVER['HTTP_X_FORWARDED_FOR']; - } - } - - return $_SERVER['REMOTE_ADDR']; - } - - /** - * Check if the current page use SSL connection on not. - * - * @return bool uses SSL - */ - public static function usingSecureMode() - { - if (isset($_SERVER['HTTPS'])) { - return $_SERVER['HTTPS'] == 1 || strtolower($_SERVER['HTTPS']) == 'on'; - } - // $_SERVER['SSL'] exists only in some specific configuration - if (isset($_SERVER['SSL'])) { - return $_SERVER['SSL'] == 1 || strtolower($_SERVER['SSL']) == 'on'; - } - - return false; - } - - /** - * Get the current url prefix protocol (https/http). - * - * @return string protocol - */ - public static function getCurrentUrlProtocolPrefix() - { - if (self::usingSecureMode()) { - return 'https://'; - } else { - return 'http://'; - } - } - - /** - * Secure an URL referrer. - * - * @param string $referrer URL referrer - * - * @return secured referrer - */ - public static function secureReferrer($referrer) - { - if (preg_match('/^http[s]?:\/\/' . self::getServerName() . '(:' . _PS_SSL_PORT_ . ')?\/.*$/Ui', $referrer)) { - return $referrer; - } - - return __PS_BASE_URI__; - } - /** * Get a value from $_POST / $_GET * if unavailable, take a default value. @@ -305,236 +93,6 @@ public static function getValue($key, $defaultValue = false) return !is_string($ret) ? $ret : stripslashes($ret); } - public static function getIsset($key) - { - if (!isset($key) || empty($key) || !is_string($key)) { - return false; - } - - return isset($_POST[$key]) ? true : (isset($_GET[$key]) ? true : false); - } - - /** - * Change language in cookie while clicking on a flag. - * - * @return string iso code - */ - public static function setCookieLanguage() - { - global $cookie; - - /* If language does not exist or is disabled, erase it */ - if ($cookie->id_lang) { - $lang = new Language((int) $cookie->id_lang); - if (!Validate::isLoadedObject($lang) || !$lang->active) { - $cookie->id_lang = null; - } - } - - /* Automatically detect language if not already defined */ - if (!$cookie->id_lang && isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) { - $array = explode(',', self::strtolower($_SERVER['HTTP_ACCEPT_LANGUAGE'])); - if (self::strlen($array[0]) > 2) { - $tab = explode('-', $array[0]); - $string = $tab[0]; - } else { - $string = $array[0]; - } - if (Validate::isLanguageIsoCode($string)) { - $lang = new Language((int) (Language::getIdByIso($string))); - if (Validate::isLoadedObject($lang) && $lang->active) { - $cookie->id_lang = (int) ($lang->id); - } - } - } - - /* If language file not present, you must use default language file */ - if (!$cookie->id_lang || !Validate::isUnsignedId($cookie->id_lang)) { - $cookie->id_lang = (int) (Configuration::get('PS_LANG_DEFAULT')); - } - - $iso = Language::getIsoById((int) $cookie->id_lang); - @include_once _PS_THEME_DIR_ . 'lang/' . $iso . '.php'; - - return $iso; - } - - /** - * Set cookie id_lang. - */ - public static function switchLanguage() - { - global $cookie; - - if ($id_lang = (int) (self::getValue('id_lang')) && Validate::isUnsignedId($id_lang)) { - $cookie->id_lang = $id_lang; - } - } - - /** - * Set cookie currency from POST or default currency. - * - * @return Currency object - */ - public static function setCurrency() - { - global $cookie; - - if (self::isSubmit('SubmitCurrency')) { - if (isset($_POST['id_currency']) && is_numeric($_POST['id_currency'])) { - $currency = Currency::getCurrencyInstance((int) ($_POST['id_currency'])); - if (is_object($currency) && $currency->id && !$currency->deleted) { - $cookie->id_currency = (int) ($currency->id); - } - } - } - - if ((int) $cookie->id_currency) { - $currency = Currency::getCurrencyInstance((int) $cookie->id_currency); - if (is_object($currency) && (int) $currency->id && (int) $currency->deleted != 1 && $currency->active) { - return $currency; - } - } - $currency = Currency::getCurrencyInstance((int) (Configuration::get('PS_CURRENCY_DEFAULT'))); - if (is_object($currency) && $currency->id) { - $cookie->id_currency = (int) ($currency->id); - } - - return $currency; - } - - /** - * Return price with currency sign for a given product. - * - * @param float $price Product price - * @param object $currency Current currency (object, id_currency, NULL => getCurrent()) - * - * @return string Price correctly formated (sign, decimal separator...) - */ - public static function displayPrice($price, $currency = null, $no_utf8 = false) - { - if ($currency === null) { - $currency = Currency::getCurrent(); - } - /* if you modified this function, don't forget to modify the Javascript function formatCurrency (in tools.js) */ - if (is_int($currency)) { - $currency = Currency::getCurrencyInstance((int) ($currency)); - } - $c_char = (is_array($currency) ? $currency['sign'] : $currency->sign); - $c_format = (is_array($currency) ? $currency['format'] : $currency->format); - $c_decimals = (is_array($currency) ? (int) ($currency['decimals']) : (int) ($currency->decimals)) * _PS_PRICE_DISPLAY_PRECISION_; - $c_blank = (is_array($currency) ? $currency['blank'] : $currency->blank); - $blank = ($c_blank ? ' ' : ''); - $ret = 0; - if (($isNegative = ($price < 0))) { - $price *= -1; - } - $price = self::ps_round($price, $c_decimals); - switch ($c_format) { - /* X 0,000.00 */ - case 1: - $ret = $c_char . $blank . number_format($price, $c_decimals, '.', ','); - break; - /* 0 000,00 X*/ - case 2: - $ret = number_format($price, $c_decimals, ',', ' ') . $blank . $c_char; - break; - /* X 0.000,00 */ - case 3: - $ret = $c_char . $blank . number_format($price, $c_decimals, ',', '.'); - break; - /* 0,000.00 X */ - case 4: - $ret = number_format($price, $c_decimals, '.', ',') . $blank . $c_char; - break; - } - if ($isNegative) { - $ret = '-' . $ret; - } - if ($no_utf8) { - return str_replace('€', chr(128), $ret); - } - - return $ret; - } - - public static function displayPriceSmarty($params, &$smarty) - { - if (array_key_exists('currency', $params)) { - $currency = Currency::getCurrencyInstance((int) ($params['currency'])); - if (Validate::isLoadedObject($currency)) { - return self::displayPrice($params['price'], $currency, false); - } - } - - return self::displayPrice($params['price']); - } - - /** - * Return price converted. - * - * @param float $price Product price - * @param object $currency Current currency object - * @param bool $to_currency convert to currency or from currency to default currency - */ - public static function convertPrice($price, $currency = null, $to_currency = true) - { - if ($currency === null) { - $currency = Currency::getCurrent(); - } elseif (is_numeric($currency)) { - $currency = Currency::getCurrencyInstance($currency); - } - - $c_id = (is_array($currency) ? $currency['id_currency'] : $currency->id); - $c_rate = (is_array($currency) ? $currency['conversion_rate'] : $currency->conversion_rate); - - if ($c_id != (int) (Configuration::get('PS_CURRENCY_DEFAULT'))) { - if ($to_currency) { - $price *= $c_rate; - } else { - $price /= $c_rate; - } - } - - return $price; - } - - /** - * Display date regarding to language preferences. - * - * @param array $params Date, format... - * @param object $smarty Smarty object for language preferences - * - * @return string Date - */ - public static function dateFormat($params, &$smarty) - { - return self::displayDate($params['date'], $smarty->ps_language->id, (isset($params['full']) ? $params['full'] : false)); - } - - /** - * Display date regarding to language preferences. - * - * @param string $date Date to display format UNIX - * @param int $id_lang Language id - * @param bool $full With time or not (optional) - * - * @return string Date - */ - public static function displayDate($date, $id_lang, $full = false, $separator = '-') - { - if (!$date || !($time = strtotime($date))) { - return $date; - } - if (!Validate::isDate($date) || !Validate::isBool($full)) { - exit(self::displayError('Invalid date')); - } - - $language = Language::getLanguage((int) $id_lang); - - return date($full ? $language['date_format_full'] : $language['date_format_lite'], $time); - } - /** * Sanitize a string. * @@ -561,20 +119,6 @@ public static function htmlentitiesUTF8($string, $type = ENT_QUOTES) return htmlentities($string, $type, 'utf-8'); } - public static function htmlentitiesDecodeUTF8($string) - { - if (is_array($string)) { - return array_map(['Tools', 'htmlentitiesDecodeUTF8'], $string); - } - - return html_entity_decode($string, ENT_QUOTES, 'utf-8'); - } - - public static function safePostVars() - { - $_POST = array_map(['Tools', 'htmlentitiesUTF8'], $_POST); - } - /** * Delete directory and subdirectories. * @@ -634,1755 +178,103 @@ public static function displayError($string = 'Fatal error', $htmlentities = tru } /** - * Display an error with detailed object. - * - * @param mixed $object - * @param bool $kill + * Check if submit has been posted. * - * @return $object if $kill = false; + * @param string $submit submit name */ - public static function dieObject($object, $kill = true) + public static function isSubmit($submit) { - echo '
';
-        print_r($object);
-        echo '

'; - if ($kill) { - exit('END'); - } - - return $object; + return + isset($_POST[$submit]) || isset($_POST[$submit . '_x']) || isset($_POST[$submit . '_y']) + || isset($_GET[$submit]) || isset($_GET[$submit . '_x']) || isset($_GET[$submit . '_y']) + ; } /** - * ALIAS OF dieObject() - Display an error with detailed object. + * Encrypt password. * * @param object $object Object to display */ - public static function d($object, $kill = true) + public static function encrypt($passwd) { - return self::dieObject($object, $kill = true); + return md5(pSQL(_COOKIE_KEY_ . $passwd)); } /** - * ALIAS OF dieObject() - Display an error with detailed object but don't stop the execution. + * Encrypt password. * * @param object $object Object to display */ - public static function p($object) + public static function getAdminToken($string) { - return self::dieObject($object, false); + return !empty($string) ? self::encrypt($string) : false; } - /** - * Check if submit has been posted. - * - * @param string $submit submit name - */ - public static function isSubmit($submit) + public static function getAdminTokenLite($tab) { - return - isset($_POST[$submit]) || isset($_POST[$submit . '_x']) || isset($_POST[$submit . '_y']) - || isset($_GET[$submit]) || isset($_GET[$submit . '_x']) || isset($_GET[$submit . '_y']) - ; + global $cookie; + + return self::getAdminToken($tab . (int) Tab::getIdFromClassName($tab) . (int) $cookie->id_employee); } - /** - * Get meta tages for a given page. - * - * @param int $id_lang Language id - * - * @return array Meta tags - */ - public static function getMetaTags($id_lang, $page_name) - { - global $maintenance; - - if (!(isset($maintenance) && (!in_array(self::getRemoteAddr(), explode(',', Configuration::get('PS_MAINTENANCE_IP')))))) { - /* Products specifics meta tags */ - if ($id_product = self::getValue('id_product')) { - $row = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow(' - SELECT `name`, `meta_title`, `meta_description`, `meta_keywords`, `description_short` - FROM `' . _DB_PREFIX_ . 'product` p - LEFT JOIN `' . _DB_PREFIX_ . 'product_lang` pl ON (pl.`id_product` = p.`id_product`) - WHERE pl.id_lang = ' . (int) ($id_lang) . ' AND pl.id_product = ' . (int) ($id_product) . ' AND p.active = 1'); - if ($row) { - if (empty($row['meta_description'])) { - $row['meta_description'] = strip_tags($row['description_short']); - } - - return self::completeMetaTags($row, $row['name']); - } - } - - /* Categories specifics meta tags */ - elseif ($id_category = self::getValue('id_category')) { - $page_number = (int) self::getValue('p'); - $row = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow(' - SELECT `name`, `meta_title`, `meta_description`, `meta_keywords`, `description` - FROM `' . _DB_PREFIX_ . 'category_lang` - WHERE id_lang = ' . (int) ($id_lang) . ' AND id_category = ' . (int) ($id_category)); - if ($row) { - if (empty($row['meta_description'])) { - $row['meta_description'] = strip_tags($row['description']); - } - - // Paginate title - if (!empty($row['meta_title'])) { - $row['meta_title'] = $row['meta_title'] . (!empty($page_number) ? ' (' . $page_number . ')' : '') . ' - ' . Configuration::get('PS_SHOP_NAME'); - } else { - $row['meta_title'] = $row['name'] . (!empty($page_number) ? ' (' . $page_number . ')' : '') . ' - ' . Configuration::get('PS_SHOP_NAME'); - } - - return self::completeMetaTags($row, $row['name']); - } - } - - /* Manufacturers specifics meta tags */ - elseif ($id_manufacturer = self::getValue('id_manufacturer')) { - $page_number = (int) self::getValue('p'); - $row = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow(' - SELECT `name`, `meta_title`, `meta_description`, `meta_keywords` - FROM `' . _DB_PREFIX_ . 'manufacturer_lang` ml - LEFT JOIN `' . _DB_PREFIX_ . 'manufacturer` m ON (ml.`id_manufacturer` = m.`id_manufacturer`) - WHERE ml.id_lang = ' . (int) ($id_lang) . ' AND ml.id_manufacturer = ' . (int) ($id_manufacturer)); - if ($row) { - if (empty($row['meta_description'])) { - $row['meta_description'] = strip_tags($row['meta_description']); - } - $row['meta_title'] .= $row['name'] . (!empty($page_number) ? ' (' . $page_number . ')' : ''); - $row['meta_title'] .= ' - ' . Configuration::get('PS_SHOP_NAME'); - - return self::completeMetaTags($row, $row['meta_title']); - } - } - - /* Suppliers specifics meta tags */ - elseif ($id_supplier = self::getValue('id_supplier')) { - $row = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow(' - SELECT `name`, `meta_title`, `meta_description`, `meta_keywords` - FROM `' . _DB_PREFIX_ . 'supplier_lang` sl - LEFT JOIN `' . _DB_PREFIX_ . 'supplier` s ON (sl.`id_supplier` = s.`id_supplier`) - WHERE sl.id_lang = ' . (int) ($id_lang) . ' AND sl.id_supplier = ' . (int) ($id_supplier)); - - if ($row) { - if (empty($row['meta_description'])) { - $row['meta_description'] = strip_tags($row['meta_description']); - } - if (!empty($row['meta_title'])) { - $row['meta_title'] = $row['meta_title'] . ' - ' . Configuration::get('PS_SHOP_NAME'); - } - - return self::completeMetaTags($row, $row['name']); - } - } - - /* CMS specifics meta tags */ - elseif ($id_cms = self::getValue('id_cms')) { - $row = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow(' - SELECT `meta_title`, `meta_description`, `meta_keywords` - FROM `' . _DB_PREFIX_ . 'cms_lang` - WHERE id_lang = ' . (int) ($id_lang) . ' AND id_cms = ' . (int) ($id_cms)); - if ($row) { - $row['meta_title'] = $row['meta_title'] . ' - ' . Configuration::get('PS_SHOP_NAME'); - - return self::completeMetaTags($row, $row['meta_title']); - } - } - - /* CMS category specifics meta tags */ - elseif ($id_cms = self::getValue('id_cms_category')) { - $row = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow(' - SELECT `meta_title`, `meta_description`, `meta_keywords` - FROM `' . _DB_PREFIX_ . 'cms_category_lang` - WHERE id_lang = ' . (int) ($id_lang) . ' AND id_cms_category = ' . (int) ($id_cms)); - if ($row) { - $row['meta_title'] = $row['meta_title'] . ' - ' . Configuration::get('PS_SHOP_NAME'); - - return self::completeMetaTags($row, $row['meta_title']); - } - } - } - - /* Default meta tags */ - return self::getHomeMetaTags($id_lang, $page_name); - } - - /** - * Get meta tags for a given page. - * - * @param int $id_lang Language id - * - * @return array Meta tags - */ - public static function getHomeMetaTags($id_lang, $page_name) - { - /* Metas-tags */ - $metas = Meta::getMetaByPage($page_name, $id_lang); - $ret['meta_title'] = (isset($metas['title']) && $metas['title']) ? $metas['title'] . ' - ' . Configuration::get('PS_SHOP_NAME') : Configuration::get('PS_SHOP_NAME'); - $ret['meta_description'] = (isset($metas['description']) && $metas['description']) ? $metas['description'] : ''; - $ret['meta_keywords'] = (isset($metas['keywords']) && $metas['keywords']) ? $metas['keywords'] : ''; - - return $ret; - } - - public static function completeMetaTags($metaTags, $defaultValue) - { - global $cookie; - - if (empty($metaTags['meta_title'])) { - $metaTags['meta_title'] = $defaultValue . ' - ' . Configuration::get('PS_SHOP_NAME'); - } - if (empty($metaTags['meta_description'])) { - $metaTags['meta_description'] = Configuration::get('PS_META_DESCRIPTION', (int) ($cookie->id_lang)) ? Configuration::get('PS_META_DESCRIPTION', (int) ($cookie->id_lang)) : ''; - } - if (empty($metaTags['meta_keywords'])) { - $metaTags['meta_keywords'] = Configuration::get('PS_META_KEYWORDS', (int) ($cookie->id_lang)) ? Configuration::get('PS_META_KEYWORDS', (int) ($cookie->id_lang)) : ''; - } - - return $metaTags; - } - - /** - * Encrypt password. - * - * @param object $object Object to display - */ - public static function encrypt($passwd) - { - return md5(pSQL(_COOKIE_KEY_ . $passwd)); - } - - /** - * Get token to prevent CSRF. - * - * @param string $token token to encrypt - */ - public static function getToken($page = true) - { - global $cookie; - if ($page === true) { - return self::encrypt($cookie->id_customer . $cookie->passwd . $_SERVER['SCRIPT_NAME']); - } else { - return self::encrypt($cookie->id_customer . $cookie->passwd . $page); - } - } - - /** - * Encrypt password. - * - * @param object $object Object to display - */ - public static function getAdminToken($string) - { - return !empty($string) ? self::encrypt($string) : false; - } - - public static function getAdminTokenLite($tab) - { - global $cookie; - - return self::getAdminToken($tab . (int) Tab::getIdFromClassName($tab) . (int) $cookie->id_employee); - } - - /** - * Get the user's journey. - * - * @param int $id_category Category ID - * @param string $path Path end - * @param bool $linkOntheLastItem Put or not a link on the current category - * @param string [optionnal] $categoryType defined what type of categories is used (products or cms) - */ - public static function getPath($id_category, $path = '', $linkOntheLastItem = false, $categoryType = 'products') - { - global $link, $cookie; - - if ($id_category == 1) { - return '' . $path . ''; - } - - $pipe = Configuration::get('PS_NAVIGATION_PIPE'); - if (empty($pipe)) { - $pipe = '>'; - } - - $fullPath = ''; - - if ($categoryType === 'products') { - $category = Db::getInstance()->getRow(' - SELECT id_category, level_depth, nleft, nright - FROM ' . _DB_PREFIX_ . 'category - WHERE id_category = ' . (int) $id_category); - - if (isset($category['id_category'])) { - $categories = Db::getInstance()->ExecuteS(' - SELECT c.id_category, cl.name, cl.link_rewrite - FROM ' . _DB_PREFIX_ . 'category c - LEFT JOIN ' . _DB_PREFIX_ . 'category_lang cl ON (cl.id_category = c.id_category) - WHERE c.nleft <= ' . (int) $category['nleft'] . ' AND c.nright >= ' . (int) $category['nright'] . ' AND cl.id_lang = ' . (int) ($cookie->id_lang) . ' AND c.id_category != 1 - ORDER BY c.level_depth ASC - LIMIT ' . (int) $category['level_depth']); - - $n = 1; - $nCategories = (int) sizeof($categories); - foreach ($categories as $category) { - $fullPath .= - (($n < $nCategories || $linkOntheLastItem) ? '' : '') . - htmlentities($category['name'], ENT_NOQUOTES, 'UTF-8') . - (($n < $nCategories || $linkOntheLastItem) ? '' : '') . - (($n++ != $nCategories || !empty($path)) ? '' . $pipe . '' : ''); - } - - return $fullPath . $path; - } - } elseif ($categoryType === 'CMS') { - $category = new CMSCategory((int) ($id_category), (int) ($cookie->id_lang)); - if (!Validate::isLoadedObject($category)) { - exit(self::displayError()); - } - $categoryLink = $link->getCMSCategoryLink($category); - - if ($path != $category->name) { - $fullPath .= '' . htmlentities($category->name, ENT_NOQUOTES, 'UTF-8') . '' . $pipe . '' . $path; - } else { - $fullPath = ($linkOntheLastItem ? '' : '') . htmlentities($path, ENT_NOQUOTES, 'UTF-8') . ($linkOntheLastItem ? '' : ''); - } - - return self::getPath((int) ($category->id_parent), $fullPath, $linkOntheLastItem, $categoryType); - } - } - - /** - * @param string [optionnal] $type_cat defined what type of categories is used (products or cms) - */ - public static function getFullPath($id_category, $end, $type_cat = 'products') - { - global $cookie; - - $pipe = (Configuration::get('PS_NAVIGATION_PIPE') ? Configuration::get('PS_NAVIGATION_PIPE') : '>'); - - if ($type_cat === 'products') { - $category = new Category((int) ($id_category), (int) ($cookie->id_lang)); - } elseif ($type_cat === 'CMS') { - $category = new CMSCategory((int) ($id_category), (int) ($cookie->id_lang)); - } - - if (!Validate::isLoadedObject($category)) { - $id_category = 1; - } - if ($id_category == 1) { - return htmlentities($end, ENT_NOQUOTES, 'UTF-8'); - } - - return self::getPath($id_category, $category->name, true, $type_cat) . '' . $pipe . ' ' . htmlentities($end, ENT_NOQUOTES, 'UTF-8') . ''; - } - - /** - * @deprecated - */ - public static function getCategoriesTotal() - { - $row = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow('SELECT COUNT(`id_category`) AS total FROM `' . _DB_PREFIX_ . 'category`'); - - return (int) ($row['total']); - } - - /** - * @deprecated - */ - public static function getProductsTotal() - { - $row = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow('SELECT COUNT(`id_product`) AS total FROM `' . _DB_PREFIX_ . 'product`'); - - return (int) ($row['total']); - } - - /** - * @deprecated - */ - public static function getCustomersTotal() - { - $row = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow('SELECT COUNT(`id_customer`) AS total FROM `' . _DB_PREFIX_ . 'customer`'); - - return (int) ($row['total']); - } - - /** - * @deprecated - */ - public static function getOrdersTotal() - { - $row = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow('SELECT COUNT(`id_order`) AS total FROM `' . _DB_PREFIX_ . 'orders`'); - - return (int) ($row['total']); - } - - /* - ** Historyc translation function kept for compatibility - ** Removing soon - */ - public static function historyc_l($key, $translations) - { - global $cookie; - if (!$translations || !is_array($translations)) { - exit(self::displayError()); - } - $iso = strtoupper(Language::getIsoById($cookie->id_lang)); - $lang = key_exists($iso, $translations) ? $translations[$iso] : false; - - return ($lang && is_array($lang) && key_exists($key, $lang)) ? stripslashes($lang[$key]) : $key; - } - - /** - * Return the friendly url from the provided string. - * - * @param string $str - * @param bool $utf8_decode => needs to be marked as deprecated - * - * @return string - */ - public static function link_rewrite($str, $utf8_decode = false) - { - return self::str2url($str); - } - - /** - * Return a friendly url made from the provided string - * If the mbstring library is available, the output is the same as the js function of the same name. - * - * @param string $str - * - * @return string - */ - public static function str2url($str) - { - if (function_exists('mb_strtolower')) { - $str = mb_strtolower($str, 'utf-8'); - } - - $str = trim($str); - $str = self::replaceAccentedChars($str); - - // Remove all non-whitelist chars. - $str = preg_replace('/[^a-zA-Z0-9\s\'\:\/\[\]-]/', '', $str); - $str = preg_replace('/[\s\'\:\/\[\]-]+/', ' ', $str); - $str = preg_replace('/[ ]/', '-', $str); - $str = preg_replace('/[\/]/', '-', $str); - - // If it was not possible to lowercase the string with mb_strtolower, we do it after the transformations. - // This way we lose fewer special chars. - if (!function_exists('mb_strtolower')) { - $str = strtolower($str); - } - - return $str; - } - - /** - * Replace all accented chars by their equivalent non accented chars. - * - * @param string $str - * - * @return string - */ - public static function replaceAccentedChars($str) - { - $str = preg_replace('/[\x{0105}\x{0104}\x{00E0}\x{00E1}\x{00E2}\x{00E3}\x{00E4}\x{00E5}]/u', 'a', $str); - $str = preg_replace('/[\x{00E7}\x{010D}\x{0107}\x{0106}]/u', 'c', $str); - $str = preg_replace('/[\x{010F}]/u', 'd', $str); - $str = preg_replace('/[\x{00E8}\x{00E9}\x{00EA}\x{00EB}\x{011B}\x{0119}\x{0118}]/u', 'e', $str); - $str = preg_replace('/[\x{00EC}\x{00ED}\x{00EE}\x{00EF}]/u', 'i', $str); - $str = preg_replace('/[\x{0142}\x{0141}\x{013E}\x{013A}]/u', 'l', $str); - $str = preg_replace('/[\x{00F1}\x{0148}]/u', 'n', $str); - $str = preg_replace('/[\x{00F2}\x{00F3}\x{00F4}\x{00F5}\x{00F6}\x{00F8}\x{00D3}]/u', 'o', $str); - $str = preg_replace('/[\x{0159}\x{0155}]/u', 'r', $str); - $str = preg_replace('/[\x{015B}\x{015A}\x{0161}]/u', 's', $str); - $str = preg_replace('/[\x{00DF}]/u', 'ss', $str); - $str = preg_replace('/[\x{0165}]/u', 't', $str); - $str = preg_replace('/[\x{00F9}\x{00FA}\x{00FB}\x{00FC}\x{016F}]/u', 'u', $str); - $str = preg_replace('/[\x{00FD}\x{00FF}]/u', 'y', $str); - $str = preg_replace('/[\x{017C}\x{017A}\x{017B}\x{0179}\x{017E}]/u', 'z', $str); - $str = preg_replace('/[\x{00E6}]/u', 'ae', $str); - $str = preg_replace('/[\x{0153}]/u', 'oe', $str); - - return $str; - } - - /** - * Truncate strings. - * - * @param string $str - * @param int $maxLen Max length - * @param string $suffix Suffix optional - * - * @return string $str truncated - */ - /* CAUTION : Use it only on module hookEvents. - ** For other purposes use the smarty function instead */ - public static function truncate($str, $maxLen, $suffix = '...') - { - if (self::strlen($str) <= $maxLen) { - return $str; - } - $str = utf8_decode($str); - - return utf8_encode(substr($str, 0, $maxLen - self::strlen($suffix)) . $suffix); - } - - /** - * Generate date form. - * - * @param int $year Year to select - * @param int $month Month to select - * @param int $day Day to select - * - * @return array $tab html data with 3 cells :['days'], ['months'], ['years'] - */ - public static function dateYears() - { - $tab = []; - for ($i = date('Y'); $i >= 1900; --$i) { - $tab[] = $i; - } - - return $tab; - } - - public static function dateDays() - { - for ($i = 1; $i != 32; ++$i) { - $tab[] = $i; - } - - return $tab; - } - - public static function dateMonths() - { - for ($i = 1; $i != 13; ++$i) { - $tab[$i] = date('F', mktime(0, 0, 0, $i, date('m'), date('Y'))); - } - - return $tab; - } - - public static function hourGenerate($hours, $minutes, $seconds) - { - return implode(':', [$hours, $minutes, $seconds]); - } - - public static function dateFrom($date) - { - $tab = explode(' ', $date); - if (!isset($tab[1])) { - $date .= ' ' . self::hourGenerate(0, 0, 0); - } - - return $date; - } - - public static function dateTo($date) - { - $tab = explode(' ', $date); - if (!isset($tab[1])) { - $date .= ' ' . self::hourGenerate(23, 59, 59); - } - - return $date; - } - - /** - * @deprecated - */ - public static function getExactTime() - { - return time() + microtime(); - } - - public static function strtolower($str) - { - if (is_array($str)) { - return false; - } - if (function_exists('mb_strtolower')) { - return mb_strtolower($str, 'utf-8'); - } - - return strtolower($str); - } - - public static function strlen($str, $encoding = 'UTF-8') - { - if (is_array($str)) { - return false; - } - $str = html_entity_decode($str, ENT_COMPAT, 'UTF-8'); - if (function_exists('mb_strlen')) { - return mb_strlen($str, $encoding); - } - - return strlen($str); - } - - public static function stripslashes($string) - { - if (_PS_MAGIC_QUOTES_GPC_) { - $string = stripslashes($string); - } - - return $string; - } - - public static function strtoupper($str) - { - if (is_array($str)) { - return false; - } - if (function_exists('mb_strtoupper')) { - return mb_strtoupper($str, 'utf-8'); - } - - return strtoupper($str); - } - - public static function substr($str, $start, $length = false, $encoding = 'utf-8') - { - if (is_array($str)) { - return false; - } - if (function_exists('mb_substr')) { - return mb_substr($str, (int) ($start), ($length === false ? self::strlen($str) : (int) ($length)), $encoding); - } - - return substr($str, $start, ($length === false ? self::strlen($str) : (int) ($length))); - } - - public static function ucfirst($str) - { - return self::strtoupper(self::substr($str, 0, 1)) . self::substr($str, 1); - } - - public static function orderbyPrice(&$array, $orderWay) - { - foreach ($array as &$row) { - $row['price_tmp'] = Product::getPriceStatic($row['id_product'], true, ((isset($row['id_product_attribute']) && !empty($row['id_product_attribute'])) ? (int) ($row['id_product_attribute']) : null), 2); - } - if (strtolower($orderWay) == 'desc') { - uasort($array, 'cmpPriceDesc'); - } else { - uasort($array, 'cmpPriceAsc'); - } - foreach ($array as &$row) { - unset($row['price_tmp']); - } - } - - public static function iconv($from, $to, $string) - { - if (function_exists('iconv')) { - return iconv($from, $to . '//TRANSLIT', str_replace('¥', '¥', str_replace('£', '£', str_replace('€', '€', $string)))); - } - - return html_entity_decode(htmlentities($string, ENT_NOQUOTES, $from), ENT_NOQUOTES, $to); - } - - public static function isEmpty($field) - { - return $field === '' || $field === null; - } - - /** - * @deprecated - **/ - public static function getTimezones($select = false) - { - static $_cache = 0; - - // One select - if ($select) { - // No cache - if (!$_cache) { - $tmz = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow('SELECT `name` FROM ' . _DB_PREFIX_ . 'timezone WHERE id_timezone = ' . (int) ($select)); - $_cache = $tmz['name']; - } - - return $_cache; - } - - // Multiple select - $tmz = Db::getInstance(_PS_USE_SQL_SLAVE_)->s('SELECT * FROM ' . _DB_PREFIX_ . 'timezone'); - $tab = []; - foreach ($tmz as $timezone) { - $tab[$timezone['id_timezone']] = str_replace('_', ' ', $timezone['name']); - } - - return $tab; - } - - /** - * @deprecated - **/ - public static function ps_set_magic_quotes_runtime($var) - { - if (function_exists('set_magic_quotes_runtime')) { - set_magic_quotes_runtime($var); - } - } - - public static function ps_round($value, $precision = 0) - { - $method = (int) (Configuration::get('PS_PRICE_ROUND_MODE')); - if ($method == PS_ROUND_UP) { - return self::ceilf($value, $precision); - } elseif ($method == PS_ROUND_DOWN) { - return self::floorf($value, $precision); - } - - return round($value, $precision); - } - - public static function ceilf($value, $precision = 0) - { - $precisionFactor = $precision == 0 ? 1 : pow(10, $precision); - $tmp = $value * $precisionFactor; - $tmp2 = (string) $tmp; - // If the current value has already the desired precision - if (strpos($tmp2, '.') === false) { - return $value; - } - if ($tmp2[strlen($tmp2) - 1] == 0) { - return $value; - } - - return ceil($tmp) / $precisionFactor; - } - - public static function floorf($value, $precision = 0) - { - $precisionFactor = $precision == 0 ? 1 : pow(10, $precision); - $tmp = $value * $precisionFactor; - $tmp2 = (string) $tmp; - // If the current value has already the desired precision - if (strpos($tmp2, '.') === false) { - return $value; - } - if ($tmp2[strlen($tmp2) - 1] == 0) { - return $value; - } - - return floor($tmp) / $precisionFactor; - } - - /** - * file_exists() wrapper with cache to speedup performance. - * - * @param string $filename File name - * - * @return bool Cached result of file_exists($filename) - */ - public static function file_exists_cache($filename) - { - if (!isset(self::$file_exists_cache[$filename])) { - self::$file_exists_cache[$filename] = file_exists($filename); - } - - return self::$file_exists_cache[$filename]; - } - - /** - * Check config & source file to settle which dl method to use - */ - public static function shouldUseFopen($url) - { - return in_array(ini_get('allow_url_fopen'), ['On', 'on', '1']) || !preg_match('/^https?:\/\//', $url); - } - - public static function file_get_contents($url, $use_include_path = false, $stream_context = null, $curl_timeout = 5) - { - if (!extension_loaded('openssl') && strpos('https://', $url) === true) { - $url = str_replace('https', 'http', $url); - } - if ($stream_context == null && preg_match('/^https?:\/\//', $url)) { - $stream_context = @stream_context_create(['http' => ['timeout' => $curl_timeout, 'header' => "User-Agent:MyAgent/1.0\r\n"]]); - } - if (self::shouldUseFopen($url)) { - $var = @file_get_contents($url, $use_include_path, $stream_context); - - /* PSCSX-3205 buffer output ? */ - if (self::getValue('ajaxMode') && ob_get_level() && ob_get_length() > 0) { - ob_clean(); - } - - if ($var) { - return $var; - } - } elseif (function_exists('curl_init')) { - $curl = curl_init(); - curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); - curl_setopt($curl, CURLOPT_URL, $url); - curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 5); - curl_setopt($curl, CURLOPT_TIMEOUT, $curl_timeout); - curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0); - $opts = stream_context_get_options($stream_context); - if (isset($opts['http']['method']) && self::strtolower($opts['http']['method']) == 'post') { - curl_setopt($curl, CURLOPT_POST, true); - if (isset($opts['http']['content'])) { - parse_str($opts['http']['content'], $datas); - curl_setopt($curl, CURLOPT_POSTFIELDS, $datas); - } - } - $content = curl_exec($curl); - curl_close($curl); - - return $content; - } - - return false; - } - - public static function simplexml_load_file($url, $class_name = null) - { - return @simplexml_load_string(self::file_get_contents($url), $class_name); - } - - public static function minifyHTML($html_content) - { - if (strlen($html_content) > 0) { - //set an alphabetical order for args - $html_content = preg_replace_callback( - '/(<[a-zA-Z0-9]+)((\s?[a-zA-Z0-9]+=[\"\\\'][^\"\\\']*[\"\\\']\s?)*)>/', ['Tools', 'minifyHTMLpregCallback'], $html_content); - - require_once _PS_TOOL_DIR_ . 'minify_html/minify_html.class.php'; - $html_content = str_replace(chr(194) . chr(160), ' ', $html_content); - $html_content = Minify_HTML::minify($html_content, ['xhtml', 'cssMinifier', 'jsMinifier']); - - if (Configuration::get('PS_HIGH_HTML_THEME_COMPRESSION')) { - //$html_content = preg_replace('/"([^\>\s"]*)"/i', '$1', $html_content);//FIXME create a js bug - $html_content = preg_replace('/]*dtd\">/is', '', $html_content); - $html_content = preg_replace('/\s\>/is', '>', $html_content); - $html_content = str_replace('', '', $html_content); - $html_content = str_replace('', '', $html_content); - $html_content = str_replace('', '', $html_content); - $html_content = str_replace('', '', $html_content); - $html_content = str_replace('', '', $html_content); - $html_content = str_replace('', '', $html_content); - $html_content = str_replace('', '', $html_content); - //$html_content = str_replace('

', '', $html_content);//FIXME doesnt work... - $html_content = str_replace("\n", '', $html_content); //TODO with bellow - $html_content = str_replace('', '', $html_content); - $html_content = str_replace('