diff --git a/controllers/admin/AdminThemesController.php b/controllers/admin/AdminThemesController.php index 4a3a306c7..165362763 100644 --- a/controllers/admin/AdminThemesController.php +++ b/controllers/admin/AdminThemesController.php @@ -2097,7 +2097,6 @@ class AdminThemesControllerCore extends AdminController 'blockcart', 'blockcurrencies', 'blocklanguages', - 'qloblockcontact', 'blockmyaccount', 'blocknewsletter', 'blocksocial', diff --git a/install/models/install.php b/install/models/install.php index 3e166f2ee..533bfd233 100644 --- a/install/models/install.php +++ b/install/models/install.php @@ -659,7 +659,6 @@ class InstallModelInstall extends InstallAbstractModel 'bankwire', 'cheque', 'blockmyaccount', - 'qloblockcontact', 'blockcurrencies', 'blocklanguages', 'qlohotelreview', diff --git a/modules/hotelreservationsystem/classes/HotelHelper.php b/modules/hotelreservationsystem/classes/HotelHelper.php index 447e95354..d87f15b52 100644 --- a/modules/hotelreservationsystem/classes/HotelHelper.php +++ b/modules/hotelreservationsystem/classes/HotelHelper.php @@ -208,6 +208,8 @@ class HotelHelper ); Configuration::updateValue('WK_HOTEL_GLOBAL_CONTACT_NUMBER', '0987654321'); Configuration::updateValue('WK_HOTEL_GLOBAL_CONTACT_EMAIL', 'hotelprime@htl.com'); + Configuration::updateValue('QBC_PHONE', '0987654321'); + Configuration::updateValue('QBC_EMAIL', 'hotelprime@htl.com'); Configuration::updateValue('WK_TITLE_HEADER_BLOCK', $home_banner_default_title); Configuration::updateValue('WK_CONTENT_HEADER_BLOCK', $home_banner_default_content); diff --git a/modules/hotelreservationsystem/controllers/admin/AdminHotelGeneralSettingsController.php b/modules/hotelreservationsystem/controllers/admin/AdminHotelGeneralSettingsController.php index bce96de53..b1cd6cfb7 100644 --- a/modules/hotelreservationsystem/controllers/admin/AdminHotelGeneralSettingsController.php +++ b/modules/hotelreservationsystem/controllers/admin/AdminHotelGeneralSettingsController.php @@ -144,26 +144,25 @@ class AdminHotelGeneralSettingsController extends ModuleAdminController 'title' => $this->l('Website Contact Details'), 'fields' => array( 'WK_HOTEL_GLOBAL_ADDRESS' => array( - 'title' => $this->l('Global Address'), - 'hint' => $this->l('Hotel global address which you want to show to your customers. It will be - shown at contact us page.'), + 'title' => $this->l('Main Branch Address'), + 'hint' => $this->l('The address of the main branch. It will be shown on Contact Us page.'), 'type' => 'text', 'isCleanHtml' => true, 'class' => 'fixed-width-xxl', ), - 'WK_HOTEL_GLOBAL_CONTACT_EMAIL' => array( - 'title' => $this->l('Global Email'), - 'hint' => $this->l('Email which you want to show a customer to email you.'), - 'type' => 'text', - 'class' => 'fixed-width-xxl', - ), 'WK_HOTEL_GLOBAL_CONTACT_NUMBER' => array( - 'title' => $this->l('Global Contact Number'), - 'hint' => $this->l('Phone Number which you want to show a customer to contact you.'), + 'title' => $this->l('Main Branch Phone Number'), + 'hint' => $this->l('The phone number of the main branch. It will be shown on Contact Us page.'), 'type' => 'text', 'validation' => 'isPhoneNumber', 'class' => 'fixed-width-xxl', ), + 'WK_HOTEL_GLOBAL_CONTACT_EMAIL' => array( + 'title' => $this->l('Main Branch Email'), + 'hint' => $this->l('The email address of the main branch. It will be shown on Contact Us page.'), + 'type' => 'text', + 'class' => 'fixed-width-xxl', + ), ), 'submit' => array( 'title' => $this->l('Save'), diff --git a/modules/hotelreservationsystem/hotelreservationsystem.php b/modules/hotelreservationsystem/hotelreservationsystem.php index e1240de49..c29eb3a84 100644 --- a/modules/hotelreservationsystem/hotelreservationsystem.php +++ b/modules/hotelreservationsystem/hotelreservationsystem.php @@ -101,6 +101,71 @@ class HotelReservationSystem extends Module $this->context->controller->addJS($this->_path.'/views/js/HotelReservationFront.js'); } + public function hookActionFrontControllerSetMedia() + { + $this->context->controller->addCSS($this->getPathUri().'views/css/hook/display-nav.css'); + } + + public function hookDisplayNav() + { + $this->smarty->assign(array( + 'phone' => Configuration::get('QBC_PHONE'), + 'email' => Configuration::get('QBC_EMAIL'), + )); + + return $this->display(__FILE__, 'display-nav.tpl'); + } + + public function hookDisplayExternalNavigationHook() + { + $this->smarty->assign(array( + 'phone' => Configuration::get('QBC_PHONE'), + 'email' => Configuration::get('QBC_EMAIL'), + )); + + return $this->display(__FILE__, 'external-navigation-hook.tpl'); + } + + public function hookActionAdminHotelGeneralSettingsOptionsModifier($params) + { + $params['options']['contactdetail']['fields'] = array_merge( + $params['options']['contactdetail']['fields'], + array( + 'QBC_PHONE' => array( + 'title' => $this->l('Support Phone Number'), + 'type' => 'text', + 'hint' => $this->l('The phone number used for customer service. It will be shown on navigation bar.'), + 'class' => 'fixed-width-xxl', + ), + 'QBC_EMAIL' => array( + 'title' => $this->l('Support Email'), + 'type' => 'text', + 'hint' => $this->l('The email used for customer service. It will be shown on navigation bar.'), + 'class' => 'fixed-width-xxl', + ), + ) + ); + } + + public function hookActionAdminHotelGeneralSettingsControllerUpdate_optionsBefore() + { + $phone = Tools::getValue('QBC_PHONE'); + $email = Tools::getValue('QBC_EMAIL'); + + if ($phone != '' && !Validate::isPhoneNumber($phone)) { + $this->context->controller->errors[] = $this->l('Support Phone Number is invalid.'); + } + + if ($email != '' && !Validate::isEmail($email)) { + $this->context->controller->errors[] = $this->l('Support Email is invalid.'); + } + + if (!count($this->context->controller->errors)) { + Configuration::updateValue('QBC_PHONE', $phone); + Configuration::updateValue('QBC_EMAIL', $email); + } + } + public function cartBookingDataForMail($order) { $result = array(); @@ -635,6 +700,11 @@ class HotelReservationSystem extends Module 'actionOrderStatusPostUpdate', 'displayLeftColumn', 'actionCartSummary', + 'actionFrontControllerSetMedia', + 'displayNav', + 'displayExternalNavigationHook', + 'actionAdminHotelGeneralSettingsOptionsModifier', + 'actionAdminHotelGeneralSettingsControllerUpdate_optionsBefore', ) ); } @@ -669,7 +739,9 @@ class HotelReservationSystem extends Module 'WK_ADVANCED_PAYMENT_INC_TAX', 'WK_GOOGLE_ACTIVE_MAP', 'WK_MAP_HOTEL_ACTIVE_ONLY', - 'WK_HOTEL_NAME_ENABLE' + 'WK_HOTEL_NAME_ENABLE', + 'QBC_PHONE', + 'QBC_EMAIL', ); foreach ($configKeys as $key) { if (!Configuration::deleteByName($key)) { diff --git a/modules/qloblockcontact/views/css/hook/display-nav.css b/modules/hotelreservationsystem/views/css/hook/display-nav.css similarity index 93% rename from modules/qloblockcontact/views/css/hook/display-nav.css rename to modules/hotelreservationsystem/views/css/hook/display-nav.css index 80d7c3d24..5bfc24ef0 100644 --- a/modules/qloblockcontact/views/css/hook/display-nav.css +++ b/modules/hotelreservationsystem/views/css/hook/display-nav.css @@ -1,5 +1,5 @@ /** -* 2010-2022 Webkul. +* 2010-2023 Webkul. * * NOTICE OF LICENSE * @@ -13,7 +13,7 @@ * needs please refer to CustomizationPolicy.txt file inside our module for more information. * * @author Webkul IN -* @copyright 2010-2022 Webkul IN +* @copyright 2010-2023 Webkul IN * @license LICENSE.txt */ diff --git a/modules/qloblockcontact/views/templates/hook/index.php b/modules/hotelreservationsystem/views/css/hook/index.php similarity index 92% rename from modules/qloblockcontact/views/templates/hook/index.php rename to modules/hotelreservationsystem/views/css/hook/index.php index 499810d54..5d9e49caf 100644 --- a/modules/qloblockcontact/views/templates/hook/index.php +++ b/modules/hotelreservationsystem/views/css/hook/index.php @@ -1,29 +1,29 @@ -name = 'qloblockcontact'; - $this->tab = 'front_office_features'; - $this->version = '1.0.0'; - $this->ps_versions_compliancy = array('min' => '1.6', 'max' => '1.6'); - $this->author = 'Webkul'; - $this->bootstrap = true; - parent::__construct(); - $this->displayName = $this->l('QloApps Contact Block'); - $this->description = $this->l('Allows admin to add customer service information to website navigation bar.'); - $this->confirmUnsinstall = $this->l('Are you sure you want to uninstall?'); - } - - public function install() - { - if (!parent::install() - || !Configuration::updateValue('QBC_PHONE', Configuration::get('WK_HOTEL_GLOBAL_CONTACT_NUMBER')) - || !Configuration::updateValue('QBC_EMAIL', Configuration::get('WK_HOTEL_GLOBAL_CONTACT_EMAIL')) - || !$this->registerHook('actionFrontControllerSetMedia') - || !$this->registerHook('displayNav') - || !$this->registerHook('displayExternalNavigationHook') - || !$this->registerHook('actionAdminHotelGeneralSettingsOptionsModifier') - || !$this->registerHook('actionAdminHotelGeneralSettingsControllerUpdate_optionsBefore') - ) { - return false; - } - return true; - } - - public function getContent() - { - Tools::redirectAdmin( - $this->context->link->getAdminLink('AdminHotelGeneralSettings').'#configuration_fieldset_contactdetail' - ); - } - - public function hookActionFrontControllerSetMedia() - { - $this->context->controller->addCSS($this->getPathUri().'views/css/hook/display-nav.css'); - } - - public function hookDisplayNav() - { - $this->smarty->assign(array( - 'phone' => Configuration::get('QBC_PHONE'), - 'email' => Configuration::get('QBC_EMAIL'), - )); - return $this->display(__FILE__, 'display-nav.tpl'); - } - - public function hookDisplayExternalNavigationHook() - { - $this->smarty->assign(array( - 'phone' => Configuration::get('QBC_PHONE'), - 'email' => Configuration::get('QBC_EMAIL'), - )); - return $this->display(__FILE__, 'external-navigation-hook.tpl'); - } - - public function hookActionAdminHotelGeneralSettingsOptionsModifier($params) - { - $params['options']['contactdetail']['fields'] = array_merge( - $params['options']['contactdetail']['fields'], - array( - 'QBC_PHONE' => array( - 'title' => $this->l('Support Contact Number'), - 'type' => 'text', - 'hint' => $this->l('The phone number used for customer service.'), - 'class' => 'fixed-width-xxl', - ), - 'QBC_EMAIL' => array( - 'title' => $this->l('Support Email'), - 'type' => 'text', - 'hint' => $this->l('The email used for customer service.'), - 'class' => 'fixed-width-xxl', - ), - ) - ); - } - - public function hookActionAdminHotelGeneralSettingsControllerUpdate_optionsBefore() - { - $phone = Tools::getValue('QBC_PHONE'); - $email = Tools::getValue('QBC_EMAIL'); - - if ($phone != '' && !Validate::isPhoneNumber($phone)) { - $this->context->controller->errors[] = $this->l('Support Contact Number is invalid.'); - } - - if ($email != '' && !Validate::isEmail($email)) { - $this->context->controller->errors[] = $this->l('Support Email is invalid.'); - } - - if (!count($this->context->controller->errors)) { - Configuration::updateValue('QBC_PHONE', $phone); - Configuration::updateValue('QBC_EMAIL', $email); - } - } - - public function uninstall() - { - if (!parent::uninstall() - || !Configuration::deleteByName('QBC_PHONE') - || !Configuration::deleteByName('QBC_EMAIL') - ) { - return false; - } - return true; - } -} diff --git a/modules/qloblockcontact/views/css/hook/index.php b/modules/qloblockcontact/views/css/hook/index.php deleted file mode 100644 index 0a4a63f52..000000000 --- a/modules/qloblockcontact/views/css/hook/index.php +++ /dev/null @@ -1,29 +0,0 @@ -