From 00a741414d98325fc6f21705f64d763a313d0e1c Mon Sep 17 00:00:00 2001 From: Abhishek Kumar Date: Wed, 9 Mar 2022 15:34:35 +0530 Subject: [PATCH] Remove install.sql file from modules --- modules/blockwishlist/CHANGELOG.txt | 8 + modules/blockwishlist/blockwishlist.php | 28 +- .../blockwishlist/classes/BlockWishlistDb.php | 89 ++++ modules/blockwishlist/classes/index.php | 35 ++ modules/blockwishlist/install.sql | 36 -- modules/hotelreservationsystem/CHANGELOG.txt | 8 + .../classes/HotelReservationSystemDb.php | 423 ++++++++++++++++++ modules/hotelreservationsystem/define.php | 1 + .../hotelreservationsystem.php | 60 +-- modules/hotelreservationsystem/install.sql | 363 --------------- modules/productcomments/CHANGELOG.txt | 8 + .../classes/ProductCommentsDb.php | 131 ++++++ modules/productcomments/classes/index.php | 35 ++ modules/productcomments/install.sql | 75 ---- modules/productcomments/productcomments.php | 40 +- modules/wkabouthotelblock/CHANGELOG.txt | 8 + .../classes/WkAboutHotelBlockDb.php | 60 +++ modules/wkabouthotelblock/define.php | 1 + modules/wkabouthotelblock/install.sql | 29 -- .../wkabouthotelblock/wkabouthotelblock.php | 31 +- modules/wkfooterpaymentblock/CHANGELOG.txt | 8 + .../classes/WkFooterPaymentBlockDb.php | 59 +++ modules/wkfooterpaymentblock/install.sql | 28 -- .../wkfooterpaymentblock.php | 32 +- modules/wkhotelfeaturesblock/CHANGELOG.txt | 8 + .../classes/WkHotelFeaturesBlockDb.php | 67 +++ modules/wkhotelfeaturesblock/install.sql | 35 -- .../wkhotelfeaturesblock.php | 35 +- modules/wkhotelroom/CHANGELOG.txt | 10 +- modules/wkhotelroom/classes/WkHotelRoomDb.php | 59 +++ modules/wkhotelroom/define.php | 1 + modules/wkhotelroom/install.sql | 28 -- modules/wkhotelroom/wkhotelroom.php | 36 +- modules/wktestimonialblock/CHANGELOG.txt | 7 + .../classes/WkTestimonialBlockDb.php | 68 +++ modules/wktestimonialblock/install.sql | 36 -- .../wktestimonialblock/wktestimonialblock.php | 30 +- 37 files changed, 1153 insertions(+), 863 deletions(-) create mode 100644 modules/blockwishlist/classes/BlockWishlistDb.php create mode 100644 modules/blockwishlist/classes/index.php delete mode 100644 modules/blockwishlist/install.sql create mode 100644 modules/hotelreservationsystem/classes/HotelReservationSystemDb.php delete mode 100644 modules/hotelreservationsystem/install.sql create mode 100644 modules/productcomments/classes/ProductCommentsDb.php create mode 100644 modules/productcomments/classes/index.php delete mode 100644 modules/productcomments/install.sql create mode 100644 modules/wkabouthotelblock/classes/WkAboutHotelBlockDb.php delete mode 100644 modules/wkabouthotelblock/install.sql create mode 100644 modules/wkfooterpaymentblock/classes/WkFooterPaymentBlockDb.php delete mode 100644 modules/wkfooterpaymentblock/install.sql create mode 100644 modules/wkhotelfeaturesblock/classes/WkHotelFeaturesBlockDb.php delete mode 100644 modules/wkhotelfeaturesblock/install.sql create mode 100644 modules/wkhotelroom/classes/WkHotelRoomDb.php delete mode 100644 modules/wkhotelroom/install.sql create mode 100644 modules/wktestimonialblock/classes/WkTestimonialBlockDb.php delete mode 100644 modules/wktestimonialblock/install.sql diff --git a/modules/blockwishlist/CHANGELOG.txt b/modules/blockwishlist/CHANGELOG.txt index 66c403bcf..471b0a0ff 100644 --- a/modules/blockwishlist/CHANGELOG.txt +++ b/modules/blockwishlist/CHANGELOG.txt @@ -1,3 +1,11 @@ +----------------------------- +# V1.3.2 to V1.3.3 +----------------------------- + +## Improved/Changed Features: + +* [CO] : Removed install.sql + ----------------------------- # V1.3.1 to V1.3.2 ----------------------------- diff --git a/modules/blockwishlist/blockwishlist.php b/modules/blockwishlist/blockwishlist.php index 5f77967b8..2b520b42d 100644 --- a/modules/blockwishlist/blockwishlist.php +++ b/modules/blockwishlist/blockwishlist.php @@ -27,19 +27,18 @@ if (!defined('_PS_VERSION_')) exit; -include_once(dirname(__FILE__).'/WishList.php'); +include_once (dirname(__FILE__).'/classes/BlockWishlistDb.php'); +include_once (dirname(__FILE__).'/WishList.php'); class BlockWishList extends Module { - const INSTALL_SQL_FILE = 'install.sql'; - private $html = ''; public function __construct() { $this->name = 'blockwishlist'; $this->tab = 'front_office_features'; - $this->version = '1.3.2'; + $this->version = '1.3.3'; $this->author = 'PrestaShop'; $this->need_instance = 0; @@ -57,18 +56,11 @@ class BlockWishList extends Module public function install($delete_params = true) { - if ($delete_params) - { - if (!file_exists(dirname(__FILE__).'/'.self::INSTALL_SQL_FILE)) - return (false); - else if (!$sql = file_get_contents(dirname(__FILE__).'/'.self::INSTALL_SQL_FILE)) - return (false); - $sql = str_replace(array('PREFIX_', 'ENGINE_TYPE'), array(_DB_PREFIX_, _MYSQL_ENGINE_), $sql); - $sql = preg_split("/;\s*[\r\n]+/", $sql); - foreach ($sql as $query) - if ($query) - if (!Db::getInstance()->execute(trim($query))) - return false; + if ($delete_params) { + $objBlockWishListDb = new BlockWishlistDb(); + if (!$objBlockWishListDb->createTables()) { + return false; + } } if (!parent::install() || @@ -89,8 +81,10 @@ class BlockWishList extends Module public function uninstall($delete_params = true) { - if (($delete_params && !$this->deleteTables()) || !parent::uninstall()) + $objBlockWishListDb = new BlockWishlistDb(); + if (($delete_params && !$objBlockWishListDb->dropTables()) || !parent::uninstall()) { return false; + } return true; } diff --git a/modules/blockwishlist/classes/BlockWishlistDb.php b/modules/blockwishlist/classes/BlockWishlistDb.php new file mode 100644 index 000000000..fe5a650bd --- /dev/null +++ b/modules/blockwishlist/classes/BlockWishlistDb.php @@ -0,0 +1,89 @@ +getModuleSql()) { + foreach ($sql as $query) { + if ($query) { + if (!Db::getInstance()->execute(trim($query))) { + return false; + } + } + } + } + return true; + } + + public function dropTables() + { + return Db::getInstance()->execute( + 'DROP TABLE IF EXISTS + `'._DB_PREFIX_.'wishlist`, + `'._DB_PREFIX_.'wishlist_email`, + `'._DB_PREFIX_.'wishlist_product`, + `'._DB_PREFIX_.'wishlist_product_cart`' + ); + } +} diff --git a/modules/blockwishlist/classes/index.php b/modules/blockwishlist/classes/index.php new file mode 100644 index 000000000..044cb85ee --- /dev/null +++ b/modules/blockwishlist/classes/index.php @@ -0,0 +1,35 @@ + +* @copyright 2007-2015 PrestaShop SA +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +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; \ No newline at end of file diff --git a/modules/blockwishlist/install.sql b/modules/blockwishlist/install.sql deleted file mode 100644 index 8658ff4d6..000000000 --- a/modules/blockwishlist/install.sql +++ /dev/null @@ -1,36 +0,0 @@ -CREATE TABLE IF NOT EXISTS `PREFIX_wishlist` ( - `id_wishlist` int(10) unsigned NOT NULL auto_increment, - `id_customer` int(10) unsigned NOT NULL, - `token` varchar(64) character set utf8 NOT NULL, - `name` varchar(64) character set utf8 NOT NULL, - `counter` int(10) unsigned NULL, - `id_shop` int(10) unsigned default 1, - `id_shop_group` int(10) unsigned default 1, - `date_add` datetime NOT NULL, - `date_upd` datetime NOT NULL, - `default` int(10) unsigned default 0, - PRIMARY KEY (`id_wishlist`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; - -CREATE TABLE IF NOT EXISTS `PREFIX_wishlist_email` ( - `id_wishlist` int(10) unsigned NOT NULL, - `email` varchar(128) character set utf8 NOT NULL, - `date_add` datetime NOT NULL -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; - -CREATE TABLE IF NOT EXISTS `PREFIX_wishlist_product` ( - `id_wishlist_product` int(10) NOT NULL auto_increment, - `id_wishlist` int(10) unsigned NOT NULL, - `id_product` int(10) unsigned NOT NULL, - `id_product_attribute` int(10) unsigned NOT NULL, - `quantity` int(10) unsigned NOT NULL, - `priority` int(10) unsigned NOT NULL, - PRIMARY KEY (`id_wishlist_product`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; - -CREATE TABLE IF NOT EXISTS `PREFIX_wishlist_product_cart` ( - `id_wishlist_product` int(10) unsigned NOT NULL, - `id_cart` int(10) unsigned NOT NULL, - `quantity` int(10) unsigned NOT NULL, - `date_add` datetime NOT NULL -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; diff --git a/modules/hotelreservationsystem/CHANGELOG.txt b/modules/hotelreservationsystem/CHANGELOG.txt index d41a48a25..574e67e0d 100644 --- a/modules/hotelreservationsystem/CHANGELOG.txt +++ b/modules/hotelreservationsystem/CHANGELOG.txt @@ -1,3 +1,11 @@ +------------------------- +# V1.4.3 to V1.4.4 +------------------------- + +## Improved/changed features: + +[*] CO : Removed install.sql + ------------------------- # V1.4.2 to V1.4.3 ------------------------- diff --git a/modules/hotelreservationsystem/classes/HotelReservationSystemDb.php b/modules/hotelreservationsystem/classes/HotelReservationSystemDb.php new file mode 100644 index 000000000..5bad7f2ce --- /dev/null +++ b/modules/hotelreservationsystem/classes/HotelReservationSystemDb.php @@ -0,0 +1,423 @@ +getModuleSql()) { + foreach ($sql as $query) { + if ($query) { + if (!Db::getInstance()->execute(trim($query))) { + return false; + } + } + } + } + return true; + } + + public function dropTables() + { + return Db::getInstance()->execute( + 'DROP TABLE IF EXISTS + `'._DB_PREFIX_.'htl_room_type`, + `'._DB_PREFIX_.'htl_room_information`, + `'._DB_PREFIX_.'htl_branch_info`, + `'._DB_PREFIX_.'htl_branch_info_lang`, + `'._DB_PREFIX_.'htl_image`, + `'._DB_PREFIX_.'htl_branch_features`, + `'._DB_PREFIX_.'htl_features`, + `'._DB_PREFIX_.'htl_features_lang`, + `'._DB_PREFIX_.'htl_cart_booking_data`, + `'._DB_PREFIX_.'htl_booking_detail`, + `'._DB_PREFIX_.'htl_booking_demands`, + `'._DB_PREFIX_.'htl_booking_demands_tax`, + `'._DB_PREFIX_.'htl_room_status`, + `'._DB_PREFIX_.'htl_room_allotment_type`, + `'._DB_PREFIX_.'htl_advance_payment`, + `'._DB_PREFIX_.'htl_order_refund_rules`, + `'._DB_PREFIX_.'htl_order_refund_rules_lang`, + `'._DB_PREFIX_.'htl_branch_refund_rules`, + `'._DB_PREFIX_.'htl_order_restrict_date`, + `'._DB_PREFIX_.'htl_room_type_feature_pricing`, + `'._DB_PREFIX_.'htl_room_type_feature_pricing_lang`, + `'._DB_PREFIX_.'htl_room_type_feature_pricing_group`, + `'._DB_PREFIX_.'htl_room_type_global_demand`, + `'._DB_PREFIX_.'htl_room_type_global_demand_lang`, + `'._DB_PREFIX_.'htl_room_type_global_demand_advance_option`, + `'._DB_PREFIX_.'htl_room_type_global_demand_advance_option_lang`, + `'._DB_PREFIX_.'htl_room_type_demand_price`, + `'._DB_PREFIX_.'htl_room_type_demand`, + `'._DB_PREFIX_.'htl_room_disable_dates`, + `'._DB_PREFIX_.'htl_access`' + ); + } +} diff --git a/modules/hotelreservationsystem/define.php b/modules/hotelreservationsystem/define.php index 1e90ad144..ad5b54880 100644 --- a/modules/hotelreservationsystem/define.php +++ b/modules/hotelreservationsystem/define.php @@ -18,6 +18,7 @@ * @license https://store.webkul.com/license.html */ +require_once 'classes/HotelReservationSystemDb.php'; require_once 'classes/HotelRoomType.php'; require_once 'classes/HotelRoomInformation.php'; require_once 'classes/HotelBranchInformation.php'; diff --git a/modules/hotelreservationsystem/hotelreservationsystem.php b/modules/hotelreservationsystem/hotelreservationsystem.php index f726e6d4e..5af970fd7 100644 --- a/modules/hotelreservationsystem/hotelreservationsystem.php +++ b/modules/hotelreservationsystem/hotelreservationsystem.php @@ -25,11 +25,10 @@ include_once 'define.php'; class hotelreservationsystem extends Module { - const INSTALL_SQL_FILE = 'install.sql'; public function __construct() { $this->name = 'hotelreservationsystem'; - $this->version = '1.4.3'; + $this->version = '1.4.4'; $this->author = 'Webkul'; $this->need_instance = 0; $this->bootstrap = true; @@ -636,21 +635,9 @@ class hotelreservationsystem extends Module public function install() { - if (!file_exists(dirname(__FILE__).'/'.self::INSTALL_SQL_FILE)) { + $objModuleDb = new HotelReservationSystemDb(); + if (!$objModuleDb->createTables()) { return false; - } elseif (!$sql = Tools::file_get_contents(dirname(__FILE__).'/'.self::INSTALL_SQL_FILE)) { - return false; - } - - $sql = str_replace(array('PREFIX_', 'ENGINE_TYPE'), array(_DB_PREFIX_, _MYSQL_ENGINE_), $sql); - $sql = preg_split("/;\s*[\r\n]+/", $sql); - - foreach ($sql as $query) { - if ($query) { - if (!Db::getInstance()->execute(trim($query))) { - return false; - } - } } // if module should be populated while installation @@ -673,7 +660,6 @@ class hotelreservationsystem extends Module return false; } - return true; } @@ -704,43 +690,6 @@ class hotelreservationsystem extends Module ); } - public function deleteTables() - { - return Db::getInstance()->execute( - 'DROP TABLE IF EXISTS - `'._DB_PREFIX_.'htl_room_type`, - `'._DB_PREFIX_.'htl_room_information`, - `'._DB_PREFIX_.'htl_branch_info`, - `'._DB_PREFIX_.'htl_branch_info_lang`, - `'._DB_PREFIX_.'htl_image`, - `'._DB_PREFIX_.'htl_branch_features`, - `'._DB_PREFIX_.'htl_features`, - `'._DB_PREFIX_.'htl_features_lang`, - `'._DB_PREFIX_.'htl_cart_booking_data`, - `'._DB_PREFIX_.'htl_booking_detail`, - `'._DB_PREFIX_.'htl_booking_demands`, - `'._DB_PREFIX_.'htl_booking_demands_tax`, - `'._DB_PREFIX_.'htl_room_status`, - `'._DB_PREFIX_.'htl_room_allotment_type`, - `'._DB_PREFIX_.'htl_advance_payment`, - `'._DB_PREFIX_.'htl_order_refund_rules`, - `'._DB_PREFIX_.'htl_order_refund_rules_lang`, - `'._DB_PREFIX_.'htl_branch_refund_rules`, - `'._DB_PREFIX_.'htl_order_restrict_date`, - `'._DB_PREFIX_.'htl_room_type_feature_pricing`, - `'._DB_PREFIX_.'htl_room_type_feature_pricing_lang`, - `'._DB_PREFIX_.'htl_room_type_feature_pricing_group`, - `'._DB_PREFIX_.'htl_room_type_global_demand`, - `'._DB_PREFIX_.'htl_room_type_global_demand_lang`, - `'._DB_PREFIX_.'htl_room_type_global_demand_advance_option`, - `'._DB_PREFIX_.'htl_room_type_global_demand_advance_option_lang`, - `'._DB_PREFIX_.'htl_room_type_demand_price`, - `'._DB_PREFIX_.'htl_room_type_demand`, - `'._DB_PREFIX_.'htl_room_disable_dates`, - `'._DB_PREFIX_.'htl_access`' - ); - } - public function uninstallTab() { $moduleTabs = Tab::getCollectionFromModule($this->name); @@ -783,9 +732,10 @@ class hotelreservationsystem extends Module public function uninstall() { + $objModuleDb = new HotelReservationSystemDb(); if (!parent::uninstall() || !$this->deleteConfigVars() - || !$this->deleteTables() + || !$objModuleDb->dropTables() || !$this->uninstallTab() ) { return false; diff --git a/modules/hotelreservationsystem/install.sql b/modules/hotelreservationsystem/install.sql deleted file mode 100644 index 2f5e6ac07..000000000 --- a/modules/hotelreservationsystem/install.sql +++ /dev/null @@ -1,363 +0,0 @@ -/** -* 2010-2020 Webkul. -* -* NOTICE OF LICENSE -* -* All right is reserved, -* Please go through this link for complete license : https://store.webkul.com/license.html -* -* DISCLAIMER -* -* Do not edit or add to this file if you wish to upgrade this module to newer -* versions in the future. If you wish to customize this module for your -* needs please refer to https://store.webkul.com/customisation-guidelines/ for more information. -* -* @author Webkul IN -* @copyright 2010-2020 Webkul IN -* @license https://store.webkul.com/license.html -*/ - -CREATE TABLE IF NOT EXISTS `PREFIX_htl_room_type` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `id_product` int(11) NOT NULL, - `id_hotel` int(11) NOT NULL, - `adult` smallint(6) NOT NULL, - `children` smallint(6) NOT NULL, - `date_add` datetime NOT NULL, - `date_upd` datetime NOT NULL, - PRIMARY KEY (`id`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; - -CREATE TABLE IF NOT EXISTS `PREFIX_htl_room_information` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `id_product` int(11) NOT NULL, - `id_hotel` int(11) NOT NULL, - `room_num` varchar(225) NOT NULL, - `id_status` int(11) NOT NULL, - `floor` text NOT NULL, - `comment` text NOT NULL, - `date_add` datetime NOT NULL, - `date_upd` datetime NOT NULL, - PRIMARY KEY (`id`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; - -CREATE TABLE IF NOT EXISTS `PREFIX_htl_branch_info` ( - `id` int(10) unsigned NOT NULL auto_increment, - `id_category` int(10) unsigned NOT NULL, - `phone` varchar(32) DEFAULT NULL, - `email` varchar(128) NOT NULL, - `check_in` varchar(255) DEFAULT NULL, - `check_out` varchar(255) DEFAULT NULL, - `rating` int(2) unsigned NOT NULL, - `city` varchar(64) NOT NULL, - `state_id` int(10) unsigned NOT NULL, - `country_id` int(10) unsigned NOT NULL, - `zipcode` varchar(12) NOT NULL, - `address` text DEFAULT NULL, - `active` tinyint(1) unsigned NOT NULL DEFAULT '0', - `latitude` decimal(10,8) NOT NULL, - `longitude` decimal(11,8) NOT NULL, - `map_formated_address` text NOT NULL, - `map_input_text` text NOT NULL, - `active_refund` tinyint(1) unsigned NOT NULL DEFAULT '0', - `date_add` datetime NOT NULL, - `date_upd` datetime NOT NULL, - PRIMARY KEY (`id`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; - -CREATE TABLE IF NOT EXISTS `PREFIX_htl_branch_info_lang` ( - `id` int(10) unsigned NOT NULL, - `id_lang` int(10) unsigned NOT NULL, - `hotel_name` varchar(255) DEFAULT NULL, - `short_description` text, - `description` text, - `policies` text, - PRIMARY KEY (`id`, `id_lang`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; - -CREATE TABLE IF NOT EXISTS `PREFIX_htl_image` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `id_hotel` int(10) unsigned NOT NULL, - `hotel_image_id` varchar(32) NOT NULL, - `cover` tinyint(1) NOT NULL DEFAULT '0', - PRIMARY KEY (`id`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; - -CREATE TABLE IF NOT EXISTS `PREFIX_htl_branch_features` ( - `id` int(10) unsigned NOT NULL auto_increment, - `id_hotel` int(10) unsigned NOT NULL, - `feature_id` varchar(255) DEFAULT NULL, - `date_add` datetime NOT NULL, - `date_upd` datetime NOT NULL, - PRIMARY KEY (`id`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; - -CREATE TABLE IF NOT EXISTS `PREFIX_htl_features` ( - `id` int(10) unsigned NOT NULL auto_increment, - `parent_feature_id` int(10) unsigned NOT NULL, - `position` int(10) unsigned NOT NULL, - `active` int(2) NOT NULL DEFAULT '0', - `date_add` datetime NOT NULL, - `date_upd` datetime NOT NULL, - PRIMARY KEY (`id`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; - -CREATE TABLE IF NOT EXISTS `PREFIX_htl_features_lang` ( - `id` int(10) unsigned NOT NULL, - `id_lang` int(10) unsigned NOT NULL, - `name` varchar(255) NOT NULL, - PRIMARY KEY (`id`, `id_lang`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; - -CREATE TABLE IF NOT EXISTS `PREFIX_htl_cart_booking_data` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `id_cart` int(11) NOT NULL, - `id_guest` int(11) NOT NULL, - `id_order` int(11) NOT NULL, - `id_customer` int(11) NOT NULL, - `id_currency` int(11) NOT NULL, - `id_product` int(11) NOT NULL, - `id_room` int(11) NOT NULL, - `id_hotel` int(11) NOT NULL, - `quantity` int(11) NOT NULL, - `booking_type` tinyint(4) NOT NULL, - `comment` text NOT NULL, - `is_back_order` tinyint(4) NOT NULL, - `extra_demands` text NOT NULL, - `date_from` datetime NOT NULL, - `date_to` datetime NOT NULL, - `is_refunded` tinyint(1) NOT NULL DEFAULT '0', - `date_add` datetime NOT NULL, - `date_upd` datetime NOT NULL, - PRIMARY KEY (`id`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; - -CREATE TABLE IF NOT EXISTS `PREFIX_htl_booking_detail` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `id_product` int(11) NOT NULL, - `id_order` int(11) NOT NULL, - `id_order_detail` int(11) NOT NULL, - `id_cart` int(11) NOT NULL, - `id_room` int(11) NOT NULL, - `id_hotel` int(11) NOT NULL, - `id_customer` int(11) NOT NULL, - `booking_type` tinyint(4) NOT NULL, - `id_status` int(11) NOT NULL, - `comment` text NOT NULL, - `check_in` datetime NOT NULL, - `check_out` datetime NOT NULL, - `date_from` datetime NOT NULL, - `date_to` datetime NOT NULL, - `total_price_tax_excl` decimal(20,6) NOT NULL, - `total_price_tax_incl` decimal(20,6) NOT NULL, - `total_paid_amount` decimal(20,6) NOT NULL DEFAULT '0.000000', - `is_back_order` tinyint(4) NOT NULL, - `hotel_name` varchar(255) DEFAULT NULL, - `room_type_name` varchar(255) DEFAULT NULL, - `city` varchar(255) NOT NULL, - `state` varchar(255) DEFAULT NULL, - `country` varchar(255) DEFAULT NULL, - `zipcode` varchar(12) DEFAULT NULL, - `phone` varchar(32) DEFAULT NULL, - `email` varchar(128) DEFAULT NULL, - `check_in_time` varchar(32) DEFAULT NULL, - `check_out_time` varchar(32) DEFAULT NULL, - `room_num` varchar(225) DEFAULT NULL, - `adult` smallint(6) NOT NULL DEFAULT '0', - `children` smallint(6) NOT NULL DEFAULT '0', - `is_refunded` tinyint(1) NOT NULL DEFAULT '0', - -- `available_for_order` tinyint(1) NOT NULL DEFAULT '0', - `date_add` datetime NOT NULL, - `date_upd` datetime NOT NULL, - PRIMARY KEY (`id`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; - -CREATE TABLE IF NOT EXISTS `PREFIX_htl_booking_demands` ( - `id_booking_demand` int(11) NOT NULL AUTO_INCREMENT, - `id_htl_booking` int(11) NOT NULL, - `name` varchar(255) character set utf8 NOT NULL, - `unit_price_tax_excl` decimal(20,6) NOT NULL DEFAULT '0.000000', - `unit_price_tax_incl` decimal(20,6) NOT NULL DEFAULT '0.000000', - `total_price_tax_excl` decimal(20,6) NOT NULL DEFAULT '0.000000', - `total_price_tax_incl` decimal(20,6) NOT NULL DEFAULT '0.000000', - `price_calc_method` int(11) unsigned DEFAULT '0', - `id_tax_rules_group` int(11) unsigned DEFAULT '0', - `tax_computation_method` tinyint(1) unsigned NOT NULL DEFAULT '0', - `date_add` datetime NOT NULL, - `date_upd` datetime NOT NULL, - PRIMARY KEY (`id_booking_demand`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; - -CREATE TABLE IF NOT EXISTS `PREFIX_htl_booking_demands_tax` ( - `id_booking_demand` int(11) NOT NULL AUTO_INCREMENT, - `id_tax` int(11) NOT NULL, - `unit_amount` DECIMAL(16, 6) NOT NULL DEFAULT '0.00', - `total_amount` DECIMAL(16, 6) NOT NULL DEFAULT '0.00', - PRIMARY KEY (`id_booking_demand`, `id_tax`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; - -CREATE TABLE IF NOT EXISTS `PREFIX_htl_room_status` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `status` text NOT NULL, - PRIMARY KEY (`id`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; - -CREATE TABLE IF NOT EXISTS `PREFIX_htl_room_allotment_type` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `type` text NOT NULL, - PRIMARY KEY (`id`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; - -CREATE TABLE IF NOT EXISTS `PREFIX_htl_advance_payment` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `id_product` int(11) NOT NULL, - `payment_type` tinyint(4) NOT NULL, - `value` decimal(20,6) NOT NULL, - `id_currency` int(11) NOT NULL, - `tax_include` tinyint(4) NOT NULL, - `calculate_from` tinyint(4) NOT NULL, - `active` tinyint(4) NOT NULL, - `date_add` datetime NOT NULL, - `date_upd` datetime NOT NULL, - PRIMARY KEY (`id`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; - -CREATE TABLE IF NOT EXISTS `PREFIX_htl_order_refund_rules` ( - `id_refund_rule` int(11) NOT NULL AUTO_INCREMENT, - `payment_type` int(2) unsigned NOT NULL, - `deduction_value_full_pay` decimal(20,6) NOT NULL, - `deduction_value_adv_pay` decimal(20,6) NOT NULL, - `days` decimal(35,0) NOT NULL, - `date_add` datetime NOT NULL, - `date_upd` datetime NOT NULL, - PRIMARY KEY (`id_refund_rule`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; - -CREATE TABLE IF NOT EXISTS `PREFIX_htl_order_refund_rules_lang` ( - `id_refund_rule` int(10) unsigned NOT NULL, - `id_lang` int(10) unsigned NOT NULL, - `name` varchar(255) DEFAULT NULL, - `description` text, - PRIMARY KEY (`id_refund_rule`, `id_lang`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; - -CREATE TABLE IF NOT EXISTS `PREFIX_htl_branch_refund_rules` ( - `id_hotel_refund_rule` int(11) NOT NULL AUTO_INCREMENT, - `id_refund_rule` int(10) unsigned NOT NULL, - `id_hotel` int(10) unsigned NOT NULL, - `position` int(10) unsigned NOT NULL DEFAULT '0', - `date_add` datetime NOT NULL, - `date_upd` datetime NOT NULL, - PRIMARY KEY (`id_hotel_refund_rule`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; - -CREATE TABLE IF NOT EXISTS `PREFIX_htl_order_restrict_date` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `id_hotel` int(11) NOT NULL, - `max_order_date` datetime NOT NULL, - `date_add` datetime NOT NULL, - `date_upd` datetime NOT NULL, - PRIMARY KEY (`id`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; - -CREATE TABLE IF NOT EXISTS `PREFIX_htl_room_type_feature_pricing` ( - `id_feature_price` int(11) NOT NULL AUTO_INCREMENT, - `id_product` int(11) NOT NULL, - `date_from` date NOT NULL, - `date_to` date NOT NULL, - `is_special_days_exists` tinyint(1) NOT NULL, - `date_selection_type` tinyint(1) NOT NULL, - `special_days` text, - `impact_way` tinyint(1) NOT NULL, - `impact_type` tinyint(1) NOT NULL, - `impact_value` decimal(20,6) NOT NULL DEFAULT '0.000000', - `active` tinyint(1) unsigned NOT NULL DEFAULT '0', - `date_add` datetime NOT NULL, - `date_upd` datetime NOT NULL, - PRIMARY KEY (`id_feature_price`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; - -CREATE TABLE IF NOT EXISTS `PREFIX_htl_room_type_feature_pricing_lang` ( - `id_feature_price` int(10) unsigned NOT NULL, - `id_lang` int(10) unsigned NOT NULL, - `feature_price_name` varchar(255) character set utf8 NOT NULL, - PRIMARY KEY (`id_feature_price`, `id_lang`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; - -CREATE TABLE `PREFIX_htl_room_type_feature_pricing_group` ( - `id_feature_price` int(10) unsigned NOT NULL, - `id_group` int(10) unsigned NOT NULL, - PRIMARY KEY (`id_feature_price`,`id_group`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; - -CREATE TABLE IF NOT EXISTS `PREFIX_htl_room_type_global_demand` ( - `id_global_demand` int(11) NOT NULL AUTO_INCREMENT, - `price` decimal(20,6) NOT NULL DEFAULT '0.000000', - `id_tax_rules_group` int(10) unsigned NOT NULL DEFAULT '0', - `price_calc_method` tinyint(1) NOT NULL, - `date_add` datetime NOT NULL, - `date_upd` datetime NOT NULL, - PRIMARY KEY (`id_global_demand`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; - -CREATE TABLE IF NOT EXISTS `PREFIX_htl_room_type_global_demand_lang` ( - `id_global_demand` int(10) unsigned NOT NULL, - `id_lang` int(10) unsigned NOT NULL, - `name` varchar(255) character set utf8 NOT NULL, - PRIMARY KEY (`id_global_demand`, `id_lang`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; - -CREATE TABLE IF NOT EXISTS `PREFIX_htl_room_type_global_demand_advance_option` ( - `id_option` int(11) NOT NULL AUTO_INCREMENT, - `id_global_demand` int(11) NOT NULL, - `price` decimal(20,6) NOT NULL DEFAULT '0.000000', - `date_add` datetime NOT NULL, - `date_upd` datetime NOT NULL, - PRIMARY KEY (`id_option`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; - -CREATE TABLE IF NOT EXISTS `PREFIX_htl_room_type_global_demand_advance_option_lang` ( - `id_option` int(10) unsigned NOT NULL, - `id_lang` int(10) unsigned NOT NULL, - `name` varchar(255) character set utf8 NOT NULL, - PRIMARY KEY (`id_option`, `id_lang`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; - -CREATE TABLE IF NOT EXISTS `PREFIX_htl_room_type_demand_price` ( - `id_room_type_demand_price` int(11) NOT NULL AUTO_INCREMENT, - `id_product` int(10) unsigned NOT NULL, - `id_global_demand` int(10) unsigned NOT NULL, - `id_option` int(10) unsigned NOT NULL, - `price` decimal(20,6) NOT NULL DEFAULT '0.000000', - `date_add` datetime NOT NULL, - `date_upd` datetime NOT NULL, - PRIMARY KEY (`id_room_type_demand_price`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; - -CREATE TABLE IF NOT EXISTS `PREFIX_htl_room_type_demand` ( - `id_room_type_demand` int(11) NOT NULL AUTO_INCREMENT, - `id_product` int(10) unsigned NOT NULL, - `id_global_demand` int(10) unsigned NOT NULL, - `date_add` datetime NOT NULL, - `date_upd` datetime NOT NULL, - PRIMARY KEY (`id_room_type_demand`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; - -CREATE TABLE IF NOT EXISTS `PREFIX_htl_room_disable_dates` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `id_room_type` int(11) NOT NULL, - `id_room` int(11) NOT NULL, - `date_from` date NOT NULL, - `date_to` date NOT NULL, - `reason` text, - `date_add` datetime NOT NULL, - `date_upd` datetime NOT NULL, - PRIMARY KEY (`id`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; - -CREATE TABLE IF NOT EXISTS `PREFIX_htl_access` ( - `id_profile` int(10) unsigned NOT NULL, - `id_hotel` int(10) unsigned NOT NULL, - `access` int(11) NOT NULL, - PRIMARY KEY (`id_profile`, `id_hotel`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; diff --git a/modules/productcomments/CHANGELOG.txt b/modules/productcomments/CHANGELOG.txt index 650ea1596..c7724d39c 100644 --- a/modules/productcomments/CHANGELOG.txt +++ b/modules/productcomments/CHANGELOG.txt @@ -1,3 +1,11 @@ +------------------------- +# V3.6.1 to V3.6.2 +------------------------- + +## Improved/changed features: + +* [CO] : Removed install.sql + ------------------------- # V3.6.0 to V3.6.1 ------------------------- diff --git a/modules/productcomments/classes/ProductCommentsDb.php b/modules/productcomments/classes/ProductCommentsDb.php new file mode 100644 index 000000000..8958f0336 --- /dev/null +++ b/modules/productcomments/classes/ProductCommentsDb.php @@ -0,0 +1,131 @@ +getModuleSql()) { + foreach ($sql as $query) { + if ($query) { + if (!Db::getInstance()->execute(trim($query))) { + return false; + } + } + } + } + return true; + } + + public function dropTables() + { + return Db::getInstance()->execute( + 'DROP TABLE IF EXISTS + `'._DB_PREFIX_.'product_comment`, + `'._DB_PREFIX_.'product_comment_criterion`, + `'._DB_PREFIX_.'product_comment_criterion_product`, + `'._DB_PREFIX_.'product_comment_criterion_lang`, + `'._DB_PREFIX_.'product_comment_criterion_category`, + `'._DB_PREFIX_.'product_comment_grade`, + `'._DB_PREFIX_.'product_comment_usefulness`, + `'._DB_PREFIX_.'product_comment_report`' + ); + } +} diff --git a/modules/productcomments/classes/index.php b/modules/productcomments/classes/index.php new file mode 100644 index 000000000..044cb85ee --- /dev/null +++ b/modules/productcomments/classes/index.php @@ -0,0 +1,35 @@ + +* @copyright 2007-2015 PrestaShop SA +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +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; \ No newline at end of file diff --git a/modules/productcomments/install.sql b/modules/productcomments/install.sql deleted file mode 100644 index 53ee6cb6d..000000000 --- a/modules/productcomments/install.sql +++ /dev/null @@ -1,75 +0,0 @@ -CREATE TABLE IF NOT EXISTS `PREFIX_product_comment` ( - `id_product_comment` int(10) unsigned NOT NULL auto_increment, - `id_product` int(10) unsigned NOT NULL, - `id_customer` int(10) unsigned NOT NULL, - `id_guest` int(10) unsigned NULL, - `title` varchar(64) NULL, - `content` text NOT NULL, - `customer_name` varchar(64) NULL, - `grade` float unsigned NOT NULL, - `validate` tinyint(1) NOT NULL, - `deleted` tinyint(1) NOT NULL, - `date_add` datetime NOT NULL, - PRIMARY KEY (`id_product_comment`), - KEY `id_product` (`id_product`), - KEY `id_customer` (`id_customer`), - KEY `id_guest` (`id_guest`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; - -CREATE TABLE IF NOT EXISTS `PREFIX_product_comment_criterion` ( - `id_product_comment_criterion` int(10) unsigned NOT NULL auto_increment, - `id_product_comment_criterion_type` tinyint(1) NOT NULL, - `active` tinyint(1) NOT NULL, - PRIMARY KEY (`id_product_comment_criterion`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; - -CREATE TABLE IF NOT EXISTS `PREFIX_product_comment_criterion_product` ( - `id_product` int(10) unsigned NOT NULL, - `id_product_comment_criterion` int(10) unsigned NOT NULL, - PRIMARY KEY(`id_product`, `id_product_comment_criterion`), - KEY `id_product_comment_criterion` (`id_product_comment_criterion`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; - -CREATE TABLE IF NOT EXISTS `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=ENGINE_TYPE DEFAULT CHARSET=utf8; - -CREATE TABLE IF NOT EXISTS `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=ENGINE_TYPE DEFAULT CHARSET=utf8; - -CREATE TABLE IF NOT EXISTS `PREFIX_product_comment_grade` ( - `id_product_comment` int(10) unsigned NOT NULL, - `id_product_comment_criterion` int(10) unsigned NOT NULL, - `grade` int(10) unsigned NOT NULL, - PRIMARY KEY (`id_product_comment`, `id_product_comment_criterion`), - KEY `id_product_comment_criterion` (`id_product_comment_criterion`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; - -CREATE TABLE IF NOT EXISTS `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=ENGINE_TYPE DEFAULT CHARSET=utf8; - -CREATE TABLE IF NOT EXISTS `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=ENGINE_TYPE DEFAULT CHARSET=utf8; - -INSERT IGNORE INTO `PREFIX_product_comment_criterion` VALUES ('1', '1', '1'); - -INSERT IGNORE INTO `PREFIX_product_comment_criterion_lang` (`id_product_comment_criterion`, `id_lang`, `name`) - ( - SELECT '1', l.`id_lang`, 'Quality' - FROM `PREFIX_lang` l - ); - diff --git a/modules/productcomments/productcomments.php b/modules/productcomments/productcomments.php index 89155d488..23e186ad8 100644 --- a/modules/productcomments/productcomments.php +++ b/modules/productcomments/productcomments.php @@ -27,10 +27,10 @@ if (!defined('_PS_VERSION_')) exit; +include_once (dirname(__FILE__).'/classes/ProductCommentsDb.php'); + class ProductComments extends Module { - const INSTALL_SQL_FILE = 'install.sql'; - private $_html = ''; private $_postErrors = array(); private $_filters = array(); @@ -42,7 +42,7 @@ class ProductComments extends Module { $this->name = 'productcomments'; $this->tab = 'front_office_features'; - $this->version = '3.6.1'; + $this->version = '3.6.2'; $this->author = 'PrestaShop'; $this->need_instance = 0; $this->bootstrap = true; @@ -59,19 +59,11 @@ class ProductComments extends Module public function install($keep = true) { - if ($keep) - { - if (!file_exists(dirname(__FILE__).'/'.self::INSTALL_SQL_FILE)) + if ($keep) { + $objProductCommentsDb = new ProductCommentsDb(); + if (!$objProductCommentsDb->createTables()) { return false; - else if (!$sql = file_get_contents(dirname(__FILE__).'/'.self::INSTALL_SQL_FILE)) - return false; - $sql = str_replace(array('PREFIX_', 'ENGINE_TYPE'), array(_DB_PREFIX_, _MYSQL_ENGINE_), $sql); - $sql = preg_split("/;\s*[\r\n]+/", trim($sql)); - - foreach ($sql as $query) - if (!Db::getInstance()->execute(trim($query))) - return false; - + } } if (parent::install() == false || @@ -90,7 +82,8 @@ class ProductComments extends Module public function uninstall($keep = true) { - if (!parent::uninstall() || ($keep && !$this->deleteTables()) || + $objProductCommentsDb = new ProductCommentsDb(); + if (!parent::uninstall() || ($keep && !$objProductCommentsDb->dropTables()) || !Configuration::deleteByName('PRODUCT_COMMENTS_MODERATE') || !Configuration::deleteByName('PRODUCT_COMMENTS_ALLOW_GUESTS') || !Configuration::deleteByName('PRODUCT_COMMENTS_MINIMAL_TIME') || @@ -114,20 +107,6 @@ class ProductComments extends Module return true; } - public function deleteTables() - { - return Db::getInstance()->execute(' - DROP TABLE IF EXISTS - `'._DB_PREFIX_.'product_comment`, - `'._DB_PREFIX_.'product_comment_criterion`, - `'._DB_PREFIX_.'product_comment_criterion_product`, - `'._DB_PREFIX_.'product_comment_criterion_lang`, - `'._DB_PREFIX_.'product_comment_criterion_category`, - `'._DB_PREFIX_.'product_comment_grade`, - `'._DB_PREFIX_.'product_comment_usefulness`, - `'._DB_PREFIX_.'product_comment_report`'); - } - public function getCacheId($id_product = null) { return parent::getCacheId().'|'.(int)$id_product; @@ -496,7 +475,6 @@ class ProductComments extends Module return $helper->generateList($comments, $fields_list); } - public function getConfigFieldsValues() { return array( diff --git a/modules/wkabouthotelblock/CHANGELOG.txt b/modules/wkabouthotelblock/CHANGELOG.txt index a411dc1ab..5fc3470f7 100644 --- a/modules/wkabouthotelblock/CHANGELOG.txt +++ b/modules/wkabouthotelblock/CHANGELOG.txt @@ -1,3 +1,11 @@ +------------------------------ +# V1.1.7 to V1.1.8 +------------------------------ + +## Improved/Changed Features: + +[*] CO : Removed install.sql + ------------------------------ # V1.1.6 to V1.1.7 ------------------------------ diff --git a/modules/wkabouthotelblock/classes/WkAboutHotelBlockDb.php b/modules/wkabouthotelblock/classes/WkAboutHotelBlockDb.php new file mode 100644 index 000000000..745200fc4 --- /dev/null +++ b/modules/wkabouthotelblock/classes/WkAboutHotelBlockDb.php @@ -0,0 +1,60 @@ +getModuleSqls()) { + foreach ($sqls as $query) { + if ($query) { + if (!DB::getInstance()->execute(trim($query))) { + return false; + } + } + } + } + return true; + } + + public function getModuleSqls() + { + return array( + "CREATE TABLE IF NOT EXISTS `"._DB_PREFIX_."htl_interior_image` ( + `id_interior_image` int(11) NOT NULL AUTO_INCREMENT, + `name` text NOT NULL, + `display_name` text NOT NULL, + `active` tinyint(1) NOT NULL, + `position` int(11) NOT NULL, + `date_add` datetime NOT NULL, + `date_upd` datetime NOT NULL, + PRIMARY KEY (`id_interior_image`) + ) ENGINE="._MYSQL_ENGINE_." DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;", + ); + } + + public function dropTables() + { + return DB::getInstance()->execute(' + DROP TABLE IF EXISTS + `'._DB_PREFIX_.'htl_interior_image`; + '); + } +} diff --git a/modules/wkabouthotelblock/define.php b/modules/wkabouthotelblock/define.php index 5f063f18b..b010a43e9 100644 --- a/modules/wkabouthotelblock/define.php +++ b/modules/wkabouthotelblock/define.php @@ -18,4 +18,5 @@ * @license https://store.webkul.com/license.html */ +require_once 'classes/WkAboutHotelBlockDb.php'; require_once 'classes/WkHotelInteriorImage.php'; diff --git a/modules/wkabouthotelblock/install.sql b/modules/wkabouthotelblock/install.sql deleted file mode 100644 index 35c2aec12..000000000 --- a/modules/wkabouthotelblock/install.sql +++ /dev/null @@ -1,29 +0,0 @@ -/** -* 2010-2020 Webkul. -* -* NOTICE OF LICENSE -* -* All right is reserved, -* Please go through this link for complete license : https://store.webkul.com/license.html -* -* DISCLAIMER -* -* Do not edit or add to this file if you wish to upgrade this module to newer -* versions in the future. If you wish to customize this module for your -* needs please refer to https://store.webkul.com/customisation-guidelines/ for more information. -* -* @author Webkul IN -* @copyright 2010-2020 Webkul IN -* @license https://store.webkul.com/license.html -*/ - -CREATE TABLE IF NOT EXISTS `PREFIX_htl_interior_image` ( - `id_interior_image` int(11) NOT NULL AUTO_INCREMENT, - `name` text NOT NULL, - `display_name` text NOT NULL, - `active` tinyint(1) NOT NULL, - `position` int(11) NOT NULL, - `date_add` datetime NOT NULL, - `date_upd` datetime NOT NULL, - PRIMARY KEY (`id_interior_image`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; \ No newline at end of file diff --git a/modules/wkabouthotelblock/wkabouthotelblock.php b/modules/wkabouthotelblock/wkabouthotelblock.php index 9877b85df..8b8517db7 100644 --- a/modules/wkabouthotelblock/wkabouthotelblock.php +++ b/modules/wkabouthotelblock/wkabouthotelblock.php @@ -26,13 +26,12 @@ require_once dirname(__FILE__).'/define.php'; class WkAboutHotelBlock extends Module { - const INSTALL_SQL_FILE = 'install.sql'; public function __construct() { $this->name = 'wkabouthotelblock'; $this->tab = 'front_office_features'; - $this->version = '1.1.7'; - $this->author = 'webkul'; + $this->version = '1.1.8'; + $this->author = 'Webkul'; $this->need_instance = 0; $this->bootstrap = true; @@ -90,22 +89,11 @@ class WkAboutHotelBlock extends Module public function install() { - if (!file_exists(dirname(__FILE__).'/'.self::INSTALL_SQL_FILE)) { - return false; - } elseif (!$sql = Tools::file_get_contents(dirname(__FILE__).'/'.self::INSTALL_SQL_FILE)) { + $objAboutHotelBlockDb = new WkAboutHotelBlockDb(); + if (!$objAboutHotelBlockDb->createTables()) { return false; } - $sql = str_replace(array('PREFIX_', 'ENGINE_TYPE'), array(_DB_PREFIX_, _MYSQL_ENGINE_), $sql); - $sql = preg_split("/;\s*[\r\n]+/", $sql); - - foreach ($sql as $query) { - if ($query) { - if (!Db::getInstance()->execute(trim($query))) { - return false; - } - } - } $objHtlInteriorImg = new WkHotelInteriorImage(); if (!parent::install() || !$this->registerModuleHooks() @@ -161,9 +149,10 @@ class WkAboutHotelBlock extends Module public function uninstall() { + $objAboutHotelBlockDb = new WkAboutHotelBlockDb(); if (!parent::uninstall() || !$this->deleteHotelInterierImg() - || !$this->deleteTables() + || !$objAboutHotelBlockDb->dropTables() || !$this->deleteConfigKeys() || !$this->uninstallTab() ) { @@ -207,12 +196,4 @@ class WkAboutHotelBlock extends Module } return true; } - - public function deleteTables() - { - return Db::getInstance()->execute( - 'DROP TABLE IF EXISTS - `'._DB_PREFIX_.'htl_interior_image`' - ); - } } diff --git a/modules/wkfooterpaymentblock/CHANGELOG.txt b/modules/wkfooterpaymentblock/CHANGELOG.txt index 70e44f870..9d268d610 100644 --- a/modules/wkfooterpaymentblock/CHANGELOG.txt +++ b/modules/wkfooterpaymentblock/CHANGELOG.txt @@ -1,3 +1,11 @@ +------------------------------ +# V1.1.4 to V1.1.5 +------------------------------ + +## Improved/Changed Features: + +[*] FO : Removed install.sql + ------------------------------ # V1.1.3 to V1.1.4 ------------------------------ diff --git a/modules/wkfooterpaymentblock/classes/WkFooterPaymentBlockDb.php b/modules/wkfooterpaymentblock/classes/WkFooterPaymentBlockDb.php new file mode 100644 index 000000000..2c13d9e3b --- /dev/null +++ b/modules/wkfooterpaymentblock/classes/WkFooterPaymentBlockDb.php @@ -0,0 +1,59 @@ +getModuleSqls()) { + foreach ($sqls as $query) { + if ($query) { + if (!DB::getInstance()->execute(trim($query))) { + return false; + } + } + } + } + return true; + } + + public function getModuleSqls() + { + return array( + "CREATE TABLE IF NOT EXISTS `"._DB_PREFIX_."htl_footer_payment_block_info` ( + `id_payment_block` int(11) NOT NULL AUTO_INCREMENT, + `name` varchar(255) NOT NULL, + `active` tinyint(1) NOT NULL, + `position` int(10) unsigned NOT NULL DEFAULT '0', + `date_add` datetime NOT NULL, + `date_upd` datetime NOT NULL, + PRIMARY KEY (`id_payment_block`) + ) ENGINE="._MYSQL_ENGINE_." DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;", + ); + } + + public function dropTables() + { + return DB::getInstance()->execute(' + DROP TABLE IF EXISTS + `'._DB_PREFIX_.'htl_footer_payment_block_info`; + '); + } +} diff --git a/modules/wkfooterpaymentblock/install.sql b/modules/wkfooterpaymentblock/install.sql deleted file mode 100644 index a116fbe80..000000000 --- a/modules/wkfooterpaymentblock/install.sql +++ /dev/null @@ -1,28 +0,0 @@ -/** -* 2010-2018 Webkul. -* -* NOTICE OF LICENSE -* -* All right is reserved, -* Please go through this link for complete license : https://store.webkul.com/license.html -* -* DISCLAIMER -* -* Do not edit or add to this file if you wish to upgrade this module to newer -* versions in the future. If you wish to customize this module for your -* needs please refer to https://store.webkul.com/customisation-guidelines/ for more information. -* -* @author Webkul IN -* @copyright 2010-2018 Webkul IN -* @license https://store.webkul.com/license.html -*/ - -CREATE TABLE IF NOT EXISTS `PREFIX_htl_footer_payment_block_info` ( - `id_payment_block` int(11) NOT NULL AUTO_INCREMENT, - `name` varchar(255) NOT NULL, - `active` tinyint(1) NOT NULL, - `position` int(10) unsigned NOT NULL DEFAULT '0', - `date_add` datetime NOT NULL, - `date_upd` datetime NOT NULL, - PRIMARY KEY (`id_payment_block`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; \ No newline at end of file diff --git a/modules/wkfooterpaymentblock/wkfooterpaymentblock.php b/modules/wkfooterpaymentblock/wkfooterpaymentblock.php index 1ea861932..3453a1377 100644 --- a/modules/wkfooterpaymentblock/wkfooterpaymentblock.php +++ b/modules/wkfooterpaymentblock/wkfooterpaymentblock.php @@ -22,18 +22,17 @@ if (!defined('_PS_VERSION_')) { exit; } +require_once dirname(__FILE__).'/classes/WkFooterPaymentBlockDb.php'; require_once dirname(__FILE__).'/classes/WkFooterPaymentBlockInfo.php'; class WkFooterPaymentBlock extends Module { - const INSTALL_SQL_FILE = 'install.sql'; - public function __construct() { $this->name = 'wkfooterpaymentblock'; $this->tab = 'front_office_features'; - $this->version = '1.1.4'; - $this->author = 'webkul'; + $this->version = '1.1.5'; + $this->author = 'Webkul'; $this->need_instance = 0; $this->bootstrap = true; @@ -99,22 +98,11 @@ class WkFooterPaymentBlock extends Module public function install() { - if (!file_exists(dirname(__FILE__).'/'.self::INSTALL_SQL_FILE)) { - return false; - } elseif (!$sql = Tools::file_get_contents(dirname(__FILE__).'/'.self::INSTALL_SQL_FILE)) { + $objFooterPaymentBlockDb = new WkFooterPaymentBlockDb(); + if (!$objFooterPaymentBlockDb->createTables()) { return false; } - $sql = str_replace(array('PREFIX_', 'ENGINE_TYPE'), array(_DB_PREFIX_, _MYSQL_ENGINE_), $sql); - $sql = preg_split("/;\s*[\r\n]+/", $sql); - - foreach ($sql as $query) { - if ($query) { - if (!Db::getInstance()->execute(trim($query))) { - return false; - } - } - } if (!parent::install() ||!$this->registerHook('displayFooterPaymentInfo') ||!$this->registerHook('displayAddModuleSettingLink') @@ -128,9 +116,10 @@ class WkFooterPaymentBlock extends Module public function uninstall() { + $objFooterPaymentBlockDb = new WkFooterPaymentBlockDb(); if (!parent::uninstall() || !$this->uninstallTab() - || !$this->dropTables() + || !$objFooterPaymentBlockDb->dropTables() ) { return false; } @@ -150,13 +139,6 @@ class WkFooterPaymentBlock extends Module return true; } - private function dropTables() - { - return Db::getInstance()->execute( - 'DROP TABLE IF EXISTS `'._DB_PREFIX_.'htl_footer_payment_block_info`' - ); - } - public function insertDefaultModuleData() { $paymentNames = array( diff --git a/modules/wkhotelfeaturesblock/CHANGELOG.txt b/modules/wkhotelfeaturesblock/CHANGELOG.txt index 4f9aa0009..ad8fd6e63 100644 --- a/modules/wkhotelfeaturesblock/CHANGELOG.txt +++ b/modules/wkhotelfeaturesblock/CHANGELOG.txt @@ -1,3 +1,11 @@ +------------------------------ +# V2.0.5 to V2.0.6 +------------------------------ + +## Improved/Changed Features: + +[*] CO : Removed install.sql + ------------------------------ # V2.0.4 to V2.0.5 ------------------------------ diff --git a/modules/wkhotelfeaturesblock/classes/WkHotelFeaturesBlockDb.php b/modules/wkhotelfeaturesblock/classes/WkHotelFeaturesBlockDb.php new file mode 100644 index 000000000..26d9c6946 --- /dev/null +++ b/modules/wkhotelfeaturesblock/classes/WkHotelFeaturesBlockDb.php @@ -0,0 +1,67 @@ +getModuleSqls()) { + foreach ($sqls as $query) { + if ($query) { + if (!DB::getInstance()->execute(trim($query))) { + return false; + } + } + } + } + return true; + } + + public function getModuleSqls() + { + return array( + "CREATE TABLE IF NOT EXISTS `"._DB_PREFIX_."htl_features_block_data` ( + `id_features_block` int(11) NOT NULL AUTO_INCREMENT, + `active` tinyint(1) NOT NULL, + `position` int(11) NOT NULL, + `date_add` datetime NOT NULL, + `date_upd` datetime NOT NULL, + PRIMARY KEY (`id_features_block`) + ) ENGINE="._MYSQL_ENGINE_." DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;", + + "CREATE TABLE IF NOT EXISTS `"._DB_PREFIX_."htl_features_block_data_lang` ( + `id_features_block` int(11) NOT NULL, + `id_lang` int(11) NOT NULL, + `feature_title` text NOT NULL, + `feature_description` text NOT NULL, + PRIMARY KEY (`id_features_block`, `id_lang`) + ) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;" + ); + } + + public function dropTables() + { + return DB::getInstance()->execute( + 'DROP TABLE IF EXISTS + `'._DB_PREFIX_.'htl_features_block_data`, + `'._DB_PREFIX_.'htl_features_block_data_lang`; + '); + } +} diff --git a/modules/wkhotelfeaturesblock/install.sql b/modules/wkhotelfeaturesblock/install.sql deleted file mode 100644 index 659abcf60..000000000 --- a/modules/wkhotelfeaturesblock/install.sql +++ /dev/null @@ -1,35 +0,0 @@ -/** -* 2010-2020 Webkul. -* -* NOTICE OF LICENSE -* -* All right is reserved, -* Please go through this link for complete license : https://store.webkul.com/license.html -* -* DISCLAIMER -* -* Do not edit or add to this file if you wish to upgrade this module to newer -* versions in the future. If you wish to customize this module for your -* needs please refer to https://store.webkul.com/customisation-guidelines/ for more information. -* -* @author Webkul IN -* @copyright 2010-2020 Webkul IN -* @license https://store.webkul.com/license.html -*/ - -CREATE TABLE IF NOT EXISTS `PREFIX_htl_features_block_data` ( - `id_features_block` int(11) NOT NULL AUTO_INCREMENT, - `active` tinyint(1) NOT NULL, - `position` int(11) NOT NULL, - `date_add` datetime NOT NULL, - `date_upd` datetime NOT NULL, - PRIMARY KEY (`id_features_block`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; - -CREATE TABLE IF NOT EXISTS `PREFIX_htl_features_block_data_lang` ( - `id_features_block` int(11) NOT NULL, - `id_lang` int(11) NOT NULL, - `feature_title` text NOT NULL, - `feature_description` text NOT NULL, - PRIMARY KEY (`id_features_block`, `id_lang`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8 ; diff --git a/modules/wkhotelfeaturesblock/wkhotelfeaturesblock.php b/modules/wkhotelfeaturesblock/wkhotelfeaturesblock.php index e671a17d5..c19cb6701 100644 --- a/modules/wkhotelfeaturesblock/wkhotelfeaturesblock.php +++ b/modules/wkhotelfeaturesblock/wkhotelfeaturesblock.php @@ -23,17 +23,17 @@ if (!defined('_PS_VERSION_')) { } require_once _PS_MODULE_DIR_.'hotelreservationsystem/define.php'; +require_once dirname(__FILE__).'/../wkhotelfeaturesblock/classes/WkHotelFeaturesBlockDb.php'; require_once dirname(__FILE__).'/../wkhotelfeaturesblock/classes/WkHotelFeaturesData.php'; class WkHotelFeaturesBlock extends Module { - const INSTALL_SQL_FILE = 'install.sql'; public function __construct() { $this->name = 'wkhotelfeaturesblock'; $this->tab = 'front_office_features'; - $this->version = '2.0.5'; - $this->author = 'webkul'; + $this->version = '2.0.6'; + $this->author = 'Webkul'; $this->bootstrap = true; parent::__construct(); @@ -121,22 +121,11 @@ class WkHotelFeaturesBlock extends Module public function install() { - if (!file_exists(dirname(__FILE__).'/'.self::INSTALL_SQL_FILE)) { - return false; - } elseif (!$sql = Tools::file_get_contents(dirname(__FILE__).'/'.self::INSTALL_SQL_FILE)) { + $objHotelFeaturesBlockDb = new WkHotelFeaturesBlockDb(); + if (!$objHotelFeaturesBlockDb->createTables()) { return false; } - $sql = str_replace(array('PREFIX_', 'ENGINE_TYPE'), array(_DB_PREFIX_, _MYSQL_ENGINE_), $sql); - $sql = preg_split("/;\s*[\r\n]+/", $sql); - - foreach ($sql as $query) { - if ($query) { - if (!Db::getInstance()->execute(trim($query))) { - return false; - } - } - } $objFeaturesData = new WkHotelFeaturesData(); if (!parent::install() || !$this->registerModuleHooks() @@ -162,10 +151,11 @@ class WkHotelFeaturesBlock extends Module public function uninstall() { + $objHotelFeaturesBlockDb = new WkHotelFeaturesBlockDb(); if (!parent::uninstall() || !$this->deleteHotelAmenityImg() || !$this->uninstallTab() - || !$this->deleteTables() + || !$objHotelFeaturesBlockDb->dropTables() || !$this->deleteConfigKeys() ) { return false; @@ -200,16 +190,7 @@ class WkHotelFeaturesBlock extends Module } return true; } - - public function deleteTables() - { - return Db::getInstance()->execute( - 'DROP TABLE IF EXISTS - `'._DB_PREFIX_.'htl_features_block_data`, - `'._DB_PREFIX_.'htl_features_block_data_lang`' - ); - } - + public function uninstallTab() { $moduleTabs = Tab::getCollectionFromModule($this->name); diff --git a/modules/wkhotelroom/CHANGELOG.txt b/modules/wkhotelroom/CHANGELOG.txt index 488e05936..adb50074d 100644 --- a/modules/wkhotelroom/CHANGELOG.txt +++ b/modules/wkhotelroom/CHANGELOG.txt @@ -1,5 +1,13 @@ ------------------------------ -# V1.1.7 to V1.1.7 +# V1.1.7 to V1.1.8 +------------------------------ + +## Improved/Changed Features: + +[*] CO : Removed install.sql + +------------------------------ +# V1.1.6 to V1.1.7 ------------------------------ ## Improved/Changed Features: diff --git a/modules/wkhotelroom/classes/WkHotelRoomDb.php b/modules/wkhotelroom/classes/WkHotelRoomDb.php new file mode 100644 index 000000000..a21f82dae --- /dev/null +++ b/modules/wkhotelroom/classes/WkHotelRoomDb.php @@ -0,0 +1,59 @@ +getModuleSqls()) { + foreach ($sqls as $query) { + if ($query) { + if (!DB::getInstance()->execute(trim($query))) { + return false; + } + } + } + } + return true; + } + + public function getModuleSqls() + { + return array( + "CREATE TABLE IF NOT EXISTS `"._DB_PREFIX_."htl_room_block_data` ( + `id_room_block` int(11) NOT NULL AUTO_INCREMENT, + `id_product` int(11) NOT NULL, + `active` tinyint(4) NOT NULL, + `position` int(11) NOT NULL, + `date_add` datetime NOT NULL, + `date_upd` datetime NOT NULL, + PRIMARY KEY (`id_room_block`) + ) ENGINE="._MYSQL_ENGINE_." DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;" + ); + } + + public function dropTables() + { + return DB::getInstance()->execute( + 'DROP TABLE IF EXISTS + `'._DB_PREFIX_.'htl_room_block_data`; + '); + } +} diff --git a/modules/wkhotelroom/define.php b/modules/wkhotelroom/define.php index c100cb59c..2ca63f9d7 100644 --- a/modules/wkhotelroom/define.php +++ b/modules/wkhotelroom/define.php @@ -19,4 +19,5 @@ */ require_once _PS_MODULE_DIR_.'/hotelreservationsystem/define.php'; +require_once 'classes/WkHotelRoomDb.php'; require_once 'classes/WkHotelRoomDisplay.php'; diff --git a/modules/wkhotelroom/install.sql b/modules/wkhotelroom/install.sql deleted file mode 100644 index 975d3c2e6..000000000 --- a/modules/wkhotelroom/install.sql +++ /dev/null @@ -1,28 +0,0 @@ -/** -* 2010-2020 Webkul. -* -* NOTICE OF LICENSE -* -* All right is reserved, -* Please go through this link for complete license : https://store.webkul.com/license.html -* -* DISCLAIMER -* -* Do not edit or add to this file if you wish to upgrade this module to newer -* versions in the future. If you wish to customize this module for your -* needs please refer to https://store.webkul.com/customisation-guidelines/ for more information. -* -* @author Webkul IN -* @copyright 2010-2020 Webkul IN -* @license https://store.webkul.com/license.html -*/ - -CREATE TABLE IF NOT EXISTS `PREFIX_htl_room_block_data` ( - `id_room_block` int(11) NOT NULL AUTO_INCREMENT, - `id_product` int(11) NOT NULL, - `active` tinyint(4) NOT NULL, - `position` int(11) NOT NULL, - `date_add` datetime NOT NULL, - `date_upd` datetime NOT NULL, - PRIMARY KEY (`id_room_block`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; \ No newline at end of file diff --git a/modules/wkhotelroom/wkhotelroom.php b/modules/wkhotelroom/wkhotelroom.php index c088c6350..caa0fb177 100644 --- a/modules/wkhotelroom/wkhotelroom.php +++ b/modules/wkhotelroom/wkhotelroom.php @@ -21,18 +21,17 @@ if (!defined('_PS_VERSION_')) { exit; } + require_once dirname(__FILE__).'/define.php'; class WkHotelRoom extends Module { - const INSTALL_SQL_FILE = 'install.sql'; - public function __construct() { $this->name = 'wkhotelroom'; $this->tab = 'front_office_features'; - $this->version = '1.1.7'; - $this->author = 'webkul'; + $this->version = '1.1.8'; + $this->author = 'Webkul'; $this->bootstrap = true; parent::__construct(); @@ -179,21 +178,9 @@ class WkHotelRoom extends Module public function install() { - if (!file_exists(dirname(__FILE__).'/'.self::INSTALL_SQL_FILE)) { + $objHotelRoomDb = new WkHotelRoomDb(); + if (!$objHotelRoomDb->createTables()) { return false; - } elseif (!$sql = Tools::file_get_contents(dirname(__FILE__).'/'.self::INSTALL_SQL_FILE)) { - return false; - } - - $sql = str_replace(array('PREFIX_', 'ENGINE_TYPE'), array(_DB_PREFIX_, _MYSQL_ENGINE_), $sql); - $sql = preg_split("/;\s*[\r\n]+/", $sql); - - foreach ($sql as $query) { - if ($query) { - if (!Db::getInstance()->execute(trim($query))) { - return false; - } - } } if (!parent::install() @@ -230,24 +217,17 @@ class WkHotelRoom extends Module public function uninstall() { + $objHotelRoomDb = new WkHotelRoomDb(); if (!parent::uninstall() || !$this->uninstallTab() - || !$this->deleteTables() + || !$objHotelRoomDb->dropTables() || !$this->deleteConfigKeys() ) { return false; } return true; } - - public function deleteTables() - { - return Db::getInstance()->execute( - 'DROP TABLE IF EXISTS - `'._DB_PREFIX_.'htl_room_block_data`' - ); - } - + public function deleteConfigKeys() { $configVars = array( diff --git a/modules/wktestimonialblock/CHANGELOG.txt b/modules/wktestimonialblock/CHANGELOG.txt index 93d324eb9..e9097f51e 100644 --- a/modules/wktestimonialblock/CHANGELOG.txt +++ b/modules/wktestimonialblock/CHANGELOG.txt @@ -1,3 +1,10 @@ +# V1.1.5 to V1.1.6 +------------------------------ + +## Improved/Changed Features: + +[*] CO : Removed install.sql + # V1.1.4 to V1.1.5 ------------------------------ diff --git a/modules/wktestimonialblock/classes/WkTestimonialBlockDb.php b/modules/wktestimonialblock/classes/WkTestimonialBlockDb.php new file mode 100644 index 000000000..5c3b1a17e --- /dev/null +++ b/modules/wktestimonialblock/classes/WkTestimonialBlockDb.php @@ -0,0 +1,68 @@ +getModuleSqls()) { + foreach ($sqls as $query) { + if ($query) { + if (!DB::getInstance()->execute(trim($query))) { + return false; + } + } + } + } + return true; + } + + public function getModuleSqls() + { + return array( + "CREATE TABLE IF NOT EXISTS `"._DB_PREFIX_."htl_testimonials_block_data` ( + `id_testimonial_block` int(11) NOT NULL AUTO_INCREMENT, + `name` varchar(255) NOT NULL, + `designation` text NOT NULL, + `active` tinyint(1) NOT NULL, + `position` int(10) unsigned NOT NULL DEFAULT '0', + `date_add` datetime NOT NULL, + `date_upd` datetime NOT NULL, + PRIMARY KEY (`id_testimonial_block`) + ) ENGINE="._MYSQL_ENGINE_." DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;", + + "CREATE TABLE IF NOT EXISTS `"._DB_PREFIX_."htl_testimonials_block_data_lang` ( + `id_testimonial_block` int(11) NOT NULL, + `id_lang` int(11) NOT NULL, + `testimonial_content` text NOT NULL, + PRIMARY KEY (`id_testimonial_block`, `id_lang`) + ) ENGINE="._MYSQL_ENGINE_." DEFAULT CHARSET=utf8;" + ); + } + + public function dropTables() + { + return DB::getInstance()->execute( + 'DROP TABLE IF EXISTS + `'._DB_PREFIX_.'htl_testimonials_block_data`, + `'._DB_PREFIX_.'htl_testimonials_block_data_lang` + '); + } +} diff --git a/modules/wktestimonialblock/install.sql b/modules/wktestimonialblock/install.sql deleted file mode 100644 index 9f5d011aa..000000000 --- a/modules/wktestimonialblock/install.sql +++ /dev/null @@ -1,36 +0,0 @@ -/** -* 2010-2020 Webkul. -* -* NOTICE OF LICENSE -* -* All right is reserved, -* Please go through this link for complete license : https://store.webkul.com/license.html -* -* DISCLAIMER -* -* Do not edit or add to this file if you wish to upgrade this module to newer -* versions in the future. If you wish to customize this module for your -* needs please refer to https://store.webkul.com/customisation-guidelines/ for more information. -* -* @author Webkul IN -* @copyright 2010-2020 Webkul IN -* @license https://store.webkul.com/license.html -*/ - -CREATE TABLE IF NOT EXISTS `PREFIX_htl_testimonials_block_data` ( - `id_testimonial_block` int(11) NOT NULL AUTO_INCREMENT, - `name` varchar(255) NOT NULL, - `designation` text NOT NULL, - `active` tinyint(1) NOT NULL, - `position` int(10) unsigned NOT NULL DEFAULT '0', - `date_add` datetime NOT NULL, - `date_upd` datetime NOT NULL, - PRIMARY KEY (`id_testimonial_block`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; - -CREATE TABLE IF NOT EXISTS `PREFIX_htl_testimonials_block_data_lang` ( - `id_testimonial_block` int(11) NOT NULL, - `id_lang` int(11) NOT NULL, - `testimonial_content` text NOT NULL, - PRIMARY KEY (`id_testimonial_block`, `id_lang`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8 ; diff --git a/modules/wktestimonialblock/wktestimonialblock.php b/modules/wktestimonialblock/wktestimonialblock.php index 1edd4993c..f4947ae8b 100644 --- a/modules/wktestimonialblock/wktestimonialblock.php +++ b/modules/wktestimonialblock/wktestimonialblock.php @@ -22,17 +22,17 @@ if (!defined('_PS_VERSION_')) { exit; } +require_once dirname(__FILE__).'/../wktestimonialblock/classes/WkTestimonialBlockDb.php'; require_once dirname(__FILE__).'/../wktestimonialblock/classes/WkHotelTestimonialData.php'; require_once _PS_MODULE_DIR_.'hotelreservationsystem/define.php'; class WkTestimonialBlock extends Module { - const INSTALL_SQL_FILE = 'install.sql'; public function __construct() { $this->name = 'wktestimonialblock'; $this->tab = 'front_office_features'; - $this->version = '1.1.5'; + $this->version = '1.1.6'; $this->author = 'webkul'; $this->need_instance = 0; @@ -113,21 +113,11 @@ class WkTestimonialBlock extends Module public function install() { - if (!file_exists(dirname(__FILE__).'/'.self::INSTALL_SQL_FILE)) { - return false; - } elseif (!$sql = Tools::file_get_contents(dirname(__FILE__).'/'.self::INSTALL_SQL_FILE)) { + $objTestimonialBlockDb = new WkTestimonialBlockDb(); + if (!$objTestimonialBlockDb->createTables()) { return false; } - $sql = str_replace(array('PREFIX_', 'ENGINE_TYPE'), array(_DB_PREFIX_, _MYSQL_ENGINE_), $sql); - $sql = preg_split("/;\s*[\r\n]+/", $sql); - foreach ($sql as $query) { - if ($query) { - if (!Db::getInstance()->execute(trim($query))) { - return false; - } - } - } $objTestimonialData = new WkHotelTestimonialData(); if (!parent::install() || !$this->registerModuleHooks() @@ -192,15 +182,6 @@ class WkTestimonialBlock extends Module return true; } - public function deleteTables() - { - return Db::getInstance()->execute( - 'DROP TABLE IF EXISTS - `'._DB_PREFIX_.'htl_testimonials_block_data`, - `'._DB_PREFIX_.'htl_testimonials_block_data_lang`' - ); - } - public function uninstallTab() { $moduleTabs = Tab::getCollectionFromModule($this->name); @@ -215,9 +196,10 @@ class WkTestimonialBlock extends Module public function uninstall() { + $objTestimonialBlockDb = new WkTestimonialBlockDb(); if (!parent::uninstall() || !$this->deleteTestimonialUserImage() - || !$this->deleteTables() + || !$objTestimonialBlockDb->dropTables() || !$this->uninstallTab() || !$this->deleteConfigKeys() ) {