From 2b405eed03b0c88b3eeedaa6929cfc8d1711fe88 Mon Sep 17 00:00:00 2001 From: Abhishek Kumar Date: Wed, 13 Sep 2023 15:19:15 +0530 Subject: [PATCH 1/7] Move Support contact settings to Settings page --- .../default/sass/partials/_commons.sass | 7 +- .../themes/default/sass/vendor/_animate.sass | 26 +++- .../admin/AdminPPreferencesController.php | 9 ++ .../AdminHotelGeneralSettingsController.php | 117 +++++++++--------- modules/qloblockcontact/qloblockcontact.php | 103 ++++++--------- 5 files changed, 140 insertions(+), 122 deletions(-) diff --git a/admin/themes/default/sass/partials/_commons.sass b/admin/themes/default/sass/partials/_commons.sass index 588ef7d53..82fb046af 100644 --- a/admin/themes/default/sass/partials/_commons.sass +++ b/admin/themes/default/sass/partials/_commons.sass @@ -215,4 +215,9 @@ padding: 8px 12px text-transform: none label - font-weight: 400 \ No newline at end of file + font-weight: 400 + +.panel:target, +.panel:target .panel-footer + scroll-margin-top: 180px + animation: flashBgYellow 1.5s \ No newline at end of file diff --git a/admin/themes/default/sass/vendor/_animate.sass b/admin/themes/default/sass/vendor/_animate.sass index 025948818..54798c10d 100644 --- a/admin/themes/default/sass/vendor/_animate.sass +++ b/admin/themes/default/sass/vendor/_animate.sass @@ -434,6 +434,12 @@ 100% -webkit-transform: scale(1) rotate(0) +@-webkit-keyframes flashBgYellow + 0% + background: #fbe986 + 100% + background: #ffffff + @-moz-keyframes fadeIn 0% opacity: 0 @@ -862,6 +868,12 @@ 100% -moz-transform: scale(1) rotate(0) +@-moz-keyframes flashBgYellow + 0% + background: #fbe986 + 100% + background: #ffffff + @-ms-keyframes fadeIn 0% opacity: 0 @@ -1290,6 +1302,12 @@ 100% -ms-transform: scale(1) rotate(0) +@-ms-keyframes flashBgYellow + 0% + background: #fbe986 + 100% + background: #ffffff + @keyframes fadeIn 0% opacity: 0 @@ -1716,4 +1734,10 @@ 90% transform: scale(1.1) rotate(3deg) 100% - transform: scale(1) rotate(0) \ No newline at end of file + transform: scale(1) rotate(0) + +@keyframes flashBgYellow + 0% + background: #fbe986 + 100% + background: #ffffff \ No newline at end of file diff --git a/controllers/admin/AdminPPreferencesController.php b/controllers/admin/AdminPPreferencesController.php index 1ea8b3f50..117b95cfa 100644 --- a/controllers/admin/AdminPPreferencesController.php +++ b/controllers/admin/AdminPPreferencesController.php @@ -194,6 +194,15 @@ class AdminPPreferencesControllerCore extends AdminController 'required' => false, 'type' => 'bool' ), + 'WK_ROOM_LEFT_WARNING_NUMBER' => array( + 'title' => $this->l('Display remaining Number of rooms when the rooms are lower than or equal to'), + 'hint' => $this->l('Mention the minimum quantity of rooms after which alert message of remaining rooms will get displayed to users.'), + 'validation' => 'isInt', + 'cast' => 'intval', + 'type' => 'text', + 'class' => 'fixed-width-xxl', + 'visibility' => Shop::CONTEXT_ALL, + ), ), 'submit' => array('title' => $this->l('Save')) ), diff --git a/modules/hotelreservationsystem/controllers/admin/AdminHotelGeneralSettingsController.php b/modules/hotelreservationsystem/controllers/admin/AdminHotelGeneralSettingsController.php index 74e120141..fb90b7d54 100644 --- a/modules/hotelreservationsystem/controllers/admin/AdminHotelGeneralSettingsController.php +++ b/modules/hotelreservationsystem/controllers/admin/AdminHotelGeneralSettingsController.php @@ -43,7 +43,7 @@ class AdminHotelGeneralSettingsController extends ModuleAdminController $this->fields_options = array( 'hotelsearchpanel' => array( 'icon' => 'icon-search', - 'title' => $this->l('Hotel Search Setting'), + 'title' => $this->l('Search Panel Setting'), 'fields' => array( 'WK_HOTEL_LOCATION_ENABLE' => array( 'title' => $this->l('Enable Hotel Location'), @@ -86,65 +86,9 @@ class AdminHotelGeneralSettingsController extends ModuleAdminController 'title' => $this->l('Save'), ), ), - 'occupancypanel' => array( - 'icon' => 'icon-users', - 'title' => $this->l('Occupancy Setting'), - 'fields' => array( - // max age of child - 'WK_GLOBAL_CHILD_MAX_AGE' => array( - 'title' => $this->l('Consider guest as child below age'), - 'type' => 'text', - 'required' => true, - 'validation' => 'isUnsignedInt', - 'hint' => $this->l('Enter the age of the guest, which that guest will be considered as child.'), - ), - 'WK_GLOBAL_MAX_CHILD_IN_ROOM' => array( - 'title' => $this->l('Maximum children allowed in a room'), - 'type' => 'text', - 'required' => true, - 'validation' => 'isUnsignedInt', - 'hint' => $this->l('Enter number of the child allowed in a room.'), - 'desc' => $this->l('Set as 0 if you do not want to limit children in a room.') - ), - ), - 'submit' => array( - 'title' => $this->l('Save'), - ), - ), 'generalsetting' => array( - 'title' => $this->l('Configuration'), + 'title' => $this->l('Website Configuration'), 'fields' => array( - 'WK_ROOM_LEFT_WARNING_NUMBER' => array( - 'title' => $this->l('Display remaining Number of rooms when the rooms are lower than or equal to'), - 'hint' => $this->l('Mention the minimum quantity of rooms after which alert message of remaining rooms will get displayed to users.'), - 'validation' => 'isInt', - 'cast' => 'intval', - 'type' => 'text', - 'visibility' => Shop::CONTEXT_ALL, - ), - '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.'), - 'type' => 'text', - 'isCleanHtml' => true, - ), - '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', - ), - '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.'), - 'type' => 'text', - 'validation' => 'isPhoneNumber', - ), - 'WK_HTL_ESTABLISHMENT_YEAR' => array( - 'title' => $this->l('Website Launch Year'), - 'hint' => $this->l('The year when your hotel site was launched.'), - 'type' => 'text', - ), 'WK_PRIMARY_HOTEL' => array( 'title' => $this->l('Primary hotel'), 'hint' => $this->l('Primary hotel is used to default address for your business. The hotel address will be considered as your registered business address.'), @@ -178,6 +122,11 @@ class AdminHotelGeneralSettingsController extends ModuleAdminController 'validation' => 'isGenericName', 'hint' => $this->l('This will display hotel short description in footer. Note: number of letters must be less than 220.'), ), + 'WK_HTL_ESTABLISHMENT_YEAR' => array( + 'title' => $this->l('Website Launch Year'), + 'hint' => $this->l('The year when your hotel site was launched.'), + 'type' => 'text', + ), 'WK_HTL_HEADER_IMAGE' => array( 'title' => $this->l('Header Background Image'), 'type' => 'file', @@ -189,6 +138,33 @@ class AdminHotelGeneralSettingsController extends ModuleAdminController ), 'submit' => array('title' => $this->l('Save')), ), + 'contactdetail' => array( + 'icon' => 'icon-phone', + '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.'), + 'type' => 'text', + 'isCleanHtml' => true, + ), + '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', + ), + '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.'), + 'type' => 'text', + 'validation' => 'isPhoneNumber', + ), + ), + 'submit' => array( + 'title' => $this->l('Save'), + ), + ), 'advancedPayment' => array( 'title' => $this->l('Advance Payment Global Setting'), 'fields' => array( @@ -236,6 +212,31 @@ class AdminHotelGeneralSettingsController extends ModuleAdminController ), 'submit' => array('title' => $this->l('Save')), ), + 'occupancypanel' => array( + 'icon' => 'icon-users', + 'title' => $this->l('Occupancy Settings'), + 'fields' => array( + // max age of child + 'WK_GLOBAL_CHILD_MAX_AGE' => array( + 'title' => $this->l('Consider guest as child below age'), + 'type' => 'text', + 'required' => true, + 'validation' => 'isUnsignedInt', + 'hint' => $this->l('Enter the age of the guest, which that guest will be considered as child.'), + ), + 'WK_GLOBAL_MAX_CHILD_IN_ROOM' => array( + 'title' => $this->l('Maximum children allowed in a room'), + 'type' => 'text', + 'required' => true, + 'validation' => 'isUnsignedInt', + 'hint' => $this->l('Enter number of the child allowed in a room.'), + 'desc' => $this->l('Set as 0 if you do not want to limit children in a room.') + ), + ), + 'submit' => array( + 'title' => $this->l('Save'), + ), + ), 'googleMap' => array( 'title' => $this->l('Google Maps Settings'), 'fields' => array( diff --git a/modules/qloblockcontact/qloblockcontact.php b/modules/qloblockcontact/qloblockcontact.php index a12c23973..e65620a08 100644 --- a/modules/qloblockcontact/qloblockcontact.php +++ b/modules/qloblockcontact/qloblockcontact.php @@ -46,6 +46,8 @@ class QloBlockContact extends Module || !$this->registerHook('actionFrontControllerSetMedia') || !$this->registerHook('displayNav') || !$this->registerHook('displayExternalNavigationHook') + || !$this->registerHook('actionAdminHotelGeneralSettingsOptionsModifier') + || !$this->registerHook('actionAdminHotelGeneralSettingsControllerUpdate_optionsBefore') ) { return false; } @@ -54,14 +56,9 @@ class QloBlockContact extends Module public function getContent() { - if (Tools::isSubmit('submitModuleConfig')) { - Configuration::updateValue('QBC_PHONE', Tools::getValue('QBC_PHONE')); - Configuration::updateValue('QBC_EMAIL', Tools::getValue('QBC_EMAIL')); - Tools::redirectAdmin( - $this->context->link->getAdminLink('AdminModules').'&configure='.$this->name.'&conf=6' - ); - } - return $this->renderForm(); + Tools::redirectAdmin( + $this->context->link->getAdminLink('AdminHotelGeneralSettings').'#configuration_fieldset_contactdetail' + ); } public function hookActionFrontControllerSetMedia() @@ -78,56 +75,6 @@ class QloBlockContact extends Module return $this->display(__FILE__, 'display-nav.tpl'); } - public function renderForm() - { - $fields_form = array( - 'form' => array( - 'legend' => array( - 'title' => $this->l('Configuration'), - 'icon' => 'icon-cogs', - ), - 'input' => array( - array( - 'type' => 'text', - 'label' => $this->l('Phone'), - 'hint' => $this->l('The phone number used for customer service.'), - 'name' => 'QBC_PHONE', - 'class' => 'fixed-width-xxl', - ), - array( - 'type' => 'text', - 'label' => $this->l('Email'), - 'hint' => $this->l('The email used for customer service.'), - 'name' => 'QBC_EMAIL', - 'class' => 'fixed-width-xxl', - ), - ), - 'submit' => array( - 'title' => $this->l('Save'), - ) - ), - ); - - $helper = new HelperForm(); - $helper->show_toolbar = false; - $helper->table = $this->table; - $lang = new Language((int)Configuration::get('PS_LANG_DEFAULT')); - $helper->default_form_language = $lang->id; - $helper->allow_employee_form_lang = Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') ? Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') : 0; - $this->fields_form = array(); - - $helper->identifier = $this->identifier; - $helper->submit_action = 'submitModuleConfig'; - $helper->currentIndex = $this->context->link->getAdminLink('AdminModules', false).'&configure='.$this->name.'&tab_module='.$this->tab.'&module_name='.$this->name; - $helper->token = Tools::getAdminTokenLite('AdminModules'); - $helper->tpl_vars = array( - 'fields_value' => $this->getConfigFieldsValues(), - 'languages' => $this->context->controller->getLanguages(), - 'id_language' => $this->context->language->id - ); - return $helper->generateForm(array($fields_form)); - } - public function hookDisplayExternalNavigationHook() { $this->smarty->assign(array( @@ -137,14 +84,46 @@ class QloBlockContact extends Module return $this->display(__FILE__, 'external-navigation-hook.tpl'); } - public function getConfigFieldsValues() + public function hookActionAdminHotelGeneralSettingsOptionsModifier($params) { - return array( - 'QBC_PHONE' => Tools::getValue('QBC_PHONE', Configuration::get('QBC_PHONE')), - 'QBC_EMAIL' => Tools::getValue('QBC_EMAIL', Configuration::get('QBC_EMAIL')), + $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() From 70573a6dd603e09434a017c95affa5d3ed111200 Mon Sep 17 00:00:00 2001 From: Abhishek Kumar Date: Fri, 22 Sep 2023 17:11:08 +0530 Subject: [PATCH 2/7] Update AdminHotelGeneralSettingsController.php --- .../default/sass/partials/_commons.sass | 6 ++--- .../themes/default/sass/vendor/_animate.sass | 26 +------------------ .../AdminHotelGeneralSettingsController.php | 23 ++++++++++------ 3 files changed, 18 insertions(+), 37 deletions(-) diff --git a/admin/themes/default/sass/partials/_commons.sass b/admin/themes/default/sass/partials/_commons.sass index 82fb046af..c1fc46376 100644 --- a/admin/themes/default/sass/partials/_commons.sass +++ b/admin/themes/default/sass/partials/_commons.sass @@ -217,7 +217,5 @@ label font-weight: 400 -.panel:target, -.panel:target .panel-footer - scroll-margin-top: 180px - animation: flashBgYellow 1.5s \ No newline at end of file +.panel:target + scroll-margin-top: 180px \ No newline at end of file diff --git a/admin/themes/default/sass/vendor/_animate.sass b/admin/themes/default/sass/vendor/_animate.sass index 54798c10d..025948818 100644 --- a/admin/themes/default/sass/vendor/_animate.sass +++ b/admin/themes/default/sass/vendor/_animate.sass @@ -434,12 +434,6 @@ 100% -webkit-transform: scale(1) rotate(0) -@-webkit-keyframes flashBgYellow - 0% - background: #fbe986 - 100% - background: #ffffff - @-moz-keyframes fadeIn 0% opacity: 0 @@ -868,12 +862,6 @@ 100% -moz-transform: scale(1) rotate(0) -@-moz-keyframes flashBgYellow - 0% - background: #fbe986 - 100% - background: #ffffff - @-ms-keyframes fadeIn 0% opacity: 0 @@ -1302,12 +1290,6 @@ 100% -ms-transform: scale(1) rotate(0) -@-ms-keyframes flashBgYellow - 0% - background: #fbe986 - 100% - background: #ffffff - @keyframes fadeIn 0% opacity: 0 @@ -1734,10 +1716,4 @@ 90% transform: scale(1.1) rotate(3deg) 100% - transform: scale(1) rotate(0) - -@keyframes flashBgYellow - 0% - background: #fbe986 - 100% - background: #ffffff \ No newline at end of file + transform: scale(1) rotate(0) \ No newline at end of file diff --git a/modules/hotelreservationsystem/controllers/admin/AdminHotelGeneralSettingsController.php b/modules/hotelreservationsystem/controllers/admin/AdminHotelGeneralSettingsController.php index fb90b7d54..bce96de53 100644 --- a/modules/hotelreservationsystem/controllers/admin/AdminHotelGeneralSettingsController.php +++ b/modules/hotelreservationsystem/controllers/admin/AdminHotelGeneralSettingsController.php @@ -89,13 +89,6 @@ class AdminHotelGeneralSettingsController extends ModuleAdminController 'generalsetting' => array( 'title' => $this->l('Website Configuration'), 'fields' => array( - 'WK_PRIMARY_HOTEL' => array( - 'title' => $this->l('Primary hotel'), - 'hint' => $this->l('Primary hotel is used to default address for your business. The hotel address will be considered as your registered business address.'), - 'type' => 'select', - 'identifier' => 'id', - 'list' => $hotelsInfo, - ), 'WK_HTL_CHAIN_NAME' => array( 'title' => $this->l('Hotel Name'), 'type' => 'textLang', @@ -122,10 +115,18 @@ class AdminHotelGeneralSettingsController extends ModuleAdminController 'validation' => 'isGenericName', 'hint' => $this->l('This will display hotel short description in footer. Note: number of letters must be less than 220.'), ), + 'WK_PRIMARY_HOTEL' => array( + 'title' => $this->l('Primary hotel'), + 'hint' => $this->l('Primary hotel is used to default address for your business. The hotel address will be considered as your registered business address.'), + 'type' => 'select', + 'identifier' => 'id', + 'list' => $hotelsInfo, + ), 'WK_HTL_ESTABLISHMENT_YEAR' => array( 'title' => $this->l('Website Launch Year'), 'hint' => $this->l('The year when your hotel site was launched.'), 'type' => 'text', + 'class' => 'fixed-width-xxl', ), 'WK_HTL_HEADER_IMAGE' => array( 'title' => $this->l('Header Background Image'), @@ -148,17 +149,20 @@ class AdminHotelGeneralSettingsController extends ModuleAdminController shown at 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.'), 'type' => 'text', 'validation' => 'isPhoneNumber', + 'class' => 'fixed-width-xxl', ), ), 'submit' => array( @@ -191,6 +195,7 @@ class AdminHotelGeneralSettingsController extends ModuleAdminController 'type' => 'text', 'validation' => 'isUnsignedFloat', 'suffix' => $this->l('%'), + 'class' => 'fixed-width-xxl', ), 'WK_ADVANCED_PAYMENT_INC_TAX' => array( 'title' => $this->l('Global Booking Amount Include Tax'), @@ -223,6 +228,7 @@ class AdminHotelGeneralSettingsController extends ModuleAdminController 'required' => true, 'validation' => 'isUnsignedInt', 'hint' => $this->l('Enter the age of the guest, which that guest will be considered as child.'), + 'class' => 'fixed-width-xxl', ), 'WK_GLOBAL_MAX_CHILD_IN_ROOM' => array( 'title' => $this->l('Maximum children allowed in a room'), @@ -230,7 +236,8 @@ class AdminHotelGeneralSettingsController extends ModuleAdminController 'required' => true, 'validation' => 'isUnsignedInt', 'hint' => $this->l('Enter number of the child allowed in a room.'), - 'desc' => $this->l('Set as 0 if you do not want to limit children in a room.') + 'desc' => $this->l('Set as 0 if you do not want to limit children in a room.'), + 'class' => 'fixed-width-xxl', ), ), 'submit' => array( From a4403135e6b735fea2b9d1f997b4f02827801745 Mon Sep 17 00:00:00 2001 From: Abhishek Kumar Date: Tue, 19 Dec 2023 12:47:59 +0530 Subject: [PATCH 3/7] Display customer service details using module hotelreservationsystem instead of qloblockcontact --- controllers/admin/AdminThemesController.php | 1 - install/models/install.php | 1 - .../classes/HotelHelper.php | 2 + .../AdminHotelGeneralSettingsController.php | 21 +- .../hotelreservationsystem.php | 74 +++++- .../views/css/hook/display-nav.css | 4 +- .../views/css}/hook/index.php | 58 ++--- .../views/templates/hook/display-nav.tpl | 0 .../hook/external-navigation-hook.tpl | 0 modules/qloblockcontact/CHANGELOG.txt | 4 - modules/qloblockcontact/LICENSE.md | 223 ------------------ modules/qloblockcontact/README.md | 1 - modules/qloblockcontact/index.php | 29 --- modules/qloblockcontact/logo.gif | Bin 3276 -> 0 bytes modules/qloblockcontact/logo.png | Bin 1086 -> 0 bytes modules/qloblockcontact/qloblockcontact.php | 137 ----------- .../qloblockcontact/views/css/hook/index.php | 29 --- modules/qloblockcontact/views/css/index.php | 29 --- modules/qloblockcontact/views/index.php | 29 --- .../qloblockcontact/views/templates/index.php | 29 --- 20 files changed, 116 insertions(+), 555 deletions(-) rename modules/{qloblockcontact => hotelreservationsystem}/views/css/hook/display-nav.css (93%) rename modules/{qloblockcontact/views/templates => hotelreservationsystem/views/css}/hook/index.php (92%) rename modules/{qloblockcontact => hotelreservationsystem}/views/templates/hook/display-nav.tpl (100%) rename modules/{qloblockcontact => hotelreservationsystem}/views/templates/hook/external-navigation-hook.tpl (100%) delete mode 100644 modules/qloblockcontact/CHANGELOG.txt delete mode 100644 modules/qloblockcontact/LICENSE.md delete mode 100644 modules/qloblockcontact/README.md delete mode 100644 modules/qloblockcontact/index.php delete mode 100644 modules/qloblockcontact/logo.gif delete mode 100644 modules/qloblockcontact/logo.png delete mode 100644 modules/qloblockcontact/qloblockcontact.php delete mode 100644 modules/qloblockcontact/views/css/hook/index.php delete mode 100644 modules/qloblockcontact/views/css/index.php delete mode 100644 modules/qloblockcontact/views/index.php delete mode 100644 modules/qloblockcontact/views/templates/index.php 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 @@ -_6- zE>{ZMGZlbM$o{6c6sVPV@!Z$#{ zC9xzCNZZ&~6eK2Rr(XryOorVccuC?(A*$i)q61dwN|o>5X#V5P5LUS6(OZmgGIl&)`RX=$l% zV5DzkqzhD`TU?n}l31aeSF8*)flC2whD&O3a#3bMNoIbY0?5q7r2NtnTXl6V1*p*_ znP~{K^NRJrPSs1!&(#OX=o{)8=mSktP_O}Ut^A8JQ-PL%jI%Se0V_cf1KO$&vIfao zpl85BK;M9v@X!GnN_#MB2}xl*8eF5nMN$ZmqTqK16Ns5P2 z>O!<@Q}ck0*>Yg3mGS?-zkh!J`uXGgx36D5fBN|0{kyksUcY+z;`y_uPaZ#d_~8D% zyLWEix_RUJwX0VyU%GhV{JFDdPMZ`!zF z{kpYlR+RDK7P)&*h|#nc72gRLi3ejMH#KTB(P;EwOw^kf6FnHwvnTc7 zD=|@gKLQ%6K;)sk9}T3Xuyo7ry0hqpx&?L%C7We`>1L+ieB17SXJ_V{nWfepYv-YJ z7GNG=h|~*)NWEZ))C-14yCPydjYO~ zH~=l9NaVqy8XOXi3~Nxbjf4ilglX(v^%+lEN>JOk8d^os<9g2XGD;wUV_7L*;jV_3 ziMvg*Ttv!yvV5>4(a$of8q zlqYSG36IEpEXg#ynLcO{MIt|UW=Z)`IykAHS)=Vzk;q2BQ%p$>#;Qd^RoxCeX)S>k zQ8Z3A_#Ft)f-4=6l?^dVaHFOik6SiEt0)pV6kded-^nO)ME9s6LE!NhN6<9rf|gO- zyWaV>U1lSljWuZ$T1T-+61H`R(q#4%8y-OGs2V4$d}T6Qp1li|h0ma6REZ>kc&ys2 zEPRgj&Sq#8)e+BR)2eIUyI5f!gceaPlC;hHjb53ZbV4__-JDV=DLYa8P@JC4B~(27 zlcJ!lH^uh&KRv@~IA47jKL;~pW%qVnN3Ok7@~i1xjk`h+(LHQOB3bAxJ$(r(Vb~;m z>|O&;=66_=qeD4z1IqK>i}~8VT**#)Vb6rvmiUpIL}oAPLJfzQ#iH;;K+R;QIo&)U z)aWg&unfd3Cl_5+S0?)HbiEiiax6H81{-1iUI8T>3xp4aul;UZ{c>p1|1+g5Lp)G3 z-AdPXcuc}sc+-a+0~29 z#ThtrvS&xlxYc8mEWHBd@50|xa<30lK!5?y zj)`qEI6}qr@1~dI)32pqSw>dIbK@(6CbJ{Tp5n-dHOGtTpc4Ha4+-~nxL%>i{vGKl z{z?7b^c3Ubmy<{Ys#ehBfka6E7M^oc+fbC&Ac*ZpuB}a2#vFmgG``aCw8Mi$k#La{ zX$oYE$6RCVYUu?-q+T#Y>IFljUNA)J1w*7>FhuHwKlsdC*@ud!lmGw#07*qoM6N<$ Eg8!EG!vFvP diff --git a/modules/qloblockcontact/qloblockcontact.php b/modules/qloblockcontact/qloblockcontact.php deleted file mode 100644 index e65620a08..000000000 --- a/modules/qloblockcontact/qloblockcontact.php +++ /dev/null @@ -1,137 +0,0 @@ -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 @@ - Date: Tue, 19 Dec 2023 13:05:59 +0530 Subject: [PATCH 4/7] Undo _commons.sass --- admin/themes/default/sass/partials/_commons.sass | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/admin/themes/default/sass/partials/_commons.sass b/admin/themes/default/sass/partials/_commons.sass index c1fc46376..588ef7d53 100644 --- a/admin/themes/default/sass/partials/_commons.sass +++ b/admin/themes/default/sass/partials/_commons.sass @@ -215,7 +215,4 @@ padding: 8px 12px text-transform: none label - font-weight: 400 - -.panel:target - scroll-margin-top: 180px \ No newline at end of file + font-weight: 400 \ No newline at end of file From c2a147176308ff3937930f7822e3fc5b038e43f4 Mon Sep 17 00:00:00 2001 From: Abhishek Kumar Date: Tue, 6 Feb 2024 18:42:31 +0530 Subject: [PATCH 5/7] Config key update --- .../classes/HotelHelper.php | 4 ++-- .../hotelreservationsystem.php | 24 +++++++++---------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/modules/hotelreservationsystem/classes/HotelHelper.php b/modules/hotelreservationsystem/classes/HotelHelper.php index d87f15b52..129e590ec 100644 --- a/modules/hotelreservationsystem/classes/HotelHelper.php +++ b/modules/hotelreservationsystem/classes/HotelHelper.php @@ -208,8 +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_CUSTOMER_SUPPORT_PHONE_NUMBER', '0987654321'); + Configuration::updateValue('WK_CUSTOMER_SUPPORT_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/hotelreservationsystem.php b/modules/hotelreservationsystem/hotelreservationsystem.php index c29eb3a84..f41c073c8 100644 --- a/modules/hotelreservationsystem/hotelreservationsystem.php +++ b/modules/hotelreservationsystem/hotelreservationsystem.php @@ -109,8 +109,8 @@ class HotelReservationSystem extends Module public function hookDisplayNav() { $this->smarty->assign(array( - 'phone' => Configuration::get('QBC_PHONE'), - 'email' => Configuration::get('QBC_EMAIL'), + 'phone' => Configuration::get('WK_CUSTOMER_SUPPORT_PHONE_NUMBER'), + 'email' => Configuration::get('WK_CUSTOMER_SUPPORT_EMAIL'), )); return $this->display(__FILE__, 'display-nav.tpl'); @@ -119,8 +119,8 @@ class HotelReservationSystem extends Module public function hookDisplayExternalNavigationHook() { $this->smarty->assign(array( - 'phone' => Configuration::get('QBC_PHONE'), - 'email' => Configuration::get('QBC_EMAIL'), + 'phone' => Configuration::get('WK_CUSTOMER_SUPPORT_PHONE_NUMBER'), + 'email' => Configuration::get('WK_CUSTOMER_SUPPORT_EMAIL'), )); return $this->display(__FILE__, 'external-navigation-hook.tpl'); @@ -131,13 +131,13 @@ class HotelReservationSystem extends Module $params['options']['contactdetail']['fields'] = array_merge( $params['options']['contactdetail']['fields'], array( - 'QBC_PHONE' => array( + 'WK_CUSTOMER_SUPPORT_PHONE_NUMBER' => 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( + 'WK_CUSTOMER_SUPPORT_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.'), @@ -149,8 +149,8 @@ class HotelReservationSystem extends Module public function hookActionAdminHotelGeneralSettingsControllerUpdate_optionsBefore() { - $phone = Tools::getValue('QBC_PHONE'); - $email = Tools::getValue('QBC_EMAIL'); + $phone = Tools::getValue('WK_CUSTOMER_SUPPORT_PHONE_NUMBER'); + $email = Tools::getValue('WK_CUSTOMER_SUPPORT_EMAIL'); if ($phone != '' && !Validate::isPhoneNumber($phone)) { $this->context->controller->errors[] = $this->l('Support Phone Number is invalid.'); @@ -161,8 +161,8 @@ class HotelReservationSystem extends Module } if (!count($this->context->controller->errors)) { - Configuration::updateValue('QBC_PHONE', $phone); - Configuration::updateValue('QBC_EMAIL', $email); + Configuration::updateValue('WK_CUSTOMER_SUPPORT_PHONE_NUMBER', $phone); + Configuration::updateValue('WK_CUSTOMER_SUPPORT_EMAIL', $email); } } @@ -740,8 +740,8 @@ class HotelReservationSystem extends Module 'WK_GOOGLE_ACTIVE_MAP', 'WK_MAP_HOTEL_ACTIVE_ONLY', 'WK_HOTEL_NAME_ENABLE', - 'QBC_PHONE', - 'QBC_EMAIL', + 'WK_CUSTOMER_SUPPORT_PHONE_NUMBER', + 'WK_CUSTOMER_SUPPORT_EMAIL', ); foreach ($configKeys as $key) { if (!Configuration::deleteByName($key)) { From e02e45b8e253491e06c81df69ea6c90e3563d143 Mon Sep 17 00:00:00 2001 From: Abhishek Kumar Date: Fri, 9 Feb 2024 15:01:01 +0530 Subject: [PATCH 6/7] Move customer support options --- .../AdminHotelGeneralSettingsController.php | 25 ++++++++++ .../hotelreservationsystem.php | 49 +++---------------- .../views/templates/hook/display-nav.tpl | 4 +- .../hook/external-navigation-hook.tpl | 6 +-- 4 files changed, 36 insertions(+), 48 deletions(-) diff --git a/modules/hotelreservationsystem/controllers/admin/AdminHotelGeneralSettingsController.php b/modules/hotelreservationsystem/controllers/admin/AdminHotelGeneralSettingsController.php index b1cd6cfb7..30b34ea38 100644 --- a/modules/hotelreservationsystem/controllers/admin/AdminHotelGeneralSettingsController.php +++ b/modules/hotelreservationsystem/controllers/admin/AdminHotelGeneralSettingsController.php @@ -149,6 +149,7 @@ class AdminHotelGeneralSettingsController extends ModuleAdminController 'type' => 'text', 'isCleanHtml' => true, 'class' => 'fixed-width-xxl', + 'required' => true, ), 'WK_HOTEL_GLOBAL_CONTACT_NUMBER' => array( 'title' => $this->l('Main Branch Phone Number'), @@ -156,12 +157,26 @@ class AdminHotelGeneralSettingsController extends ModuleAdminController 'type' => 'text', 'validation' => 'isPhoneNumber', 'class' => 'fixed-width-xxl', + 'required' => true, ), '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', + 'required' => true, + ), + 'WK_CUSTOMER_SUPPORT_PHONE_NUMBER' => 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', + ), + 'WK_CUSTOMER_SUPPORT_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', ), ), 'submit' => array( @@ -384,6 +399,16 @@ class AdminHotelGeneralSettingsController extends ModuleAdminController } elseif (!Validate::isEmail(Tools::getValue('WK_HOTEL_GLOBAL_CONTACT_EMAIL'))) { $this->errors[] = $this->l('Hotel global contact email field is invalid'); } + if (trim(Tools::getValue('WK_CUSTOMER_SUPPORT_PHONE_NUMBER')) != '') { + if (!Validate::isPhoneNumber(trim(Tools::getValue('WK_CUSTOMER_SUPPORT_PHONE_NUMBER')))) { + $this->errors[] = $this->l('Support Phone Number is invalid.'); + } + } + if (trim(Tools::getValue('WK_CUSTOMER_SUPPORT_EMAIL')) != '') { + if (!Validate::isEmail(trim(Tools::getValue('WK_CUSTOMER_SUPPORT_EMAIL')))) { + $this->errors[] = $this->l('Support Email is invalid.'); + } + } if (!count($this->errors)) { $objHotelInfo = new HotelBranchInformation(); diff --git a/modules/hotelreservationsystem/hotelreservationsystem.php b/modules/hotelreservationsystem/hotelreservationsystem.php index f41c073c8..8975e6faf 100644 --- a/modules/hotelreservationsystem/hotelreservationsystem.php +++ b/modules/hotelreservationsystem/hotelreservationsystem.php @@ -103,7 +103,12 @@ class HotelReservationSystem extends Module public function hookActionFrontControllerSetMedia() { - $this->context->controller->addCSS($this->getPathUri().'views/css/hook/display-nav.css'); + if (Configuration::get('WK_CUSTOMER_SUPPORT_PHONE_NUMBER') != '' + || Configuration::get('WK_CUSTOMER_SUPPORT_EMAIL') != '' + ) { + $this->context->controller->addCSS($this->getPathUri().'views/css/hook/display-nav.css'); + } + } public function hookDisplayNav() @@ -126,46 +131,6 @@ class HotelReservationSystem extends Module return $this->display(__FILE__, 'external-navigation-hook.tpl'); } - public function hookActionAdminHotelGeneralSettingsOptionsModifier($params) - { - $params['options']['contactdetail']['fields'] = array_merge( - $params['options']['contactdetail']['fields'], - array( - 'WK_CUSTOMER_SUPPORT_PHONE_NUMBER' => 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', - ), - 'WK_CUSTOMER_SUPPORT_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('WK_CUSTOMER_SUPPORT_PHONE_NUMBER'); - $email = Tools::getValue('WK_CUSTOMER_SUPPORT_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('WK_CUSTOMER_SUPPORT_PHONE_NUMBER', $phone); - Configuration::updateValue('WK_CUSTOMER_SUPPORT_EMAIL', $email); - } - } - public function cartBookingDataForMail($order) { $result = array(); @@ -703,8 +668,6 @@ class HotelReservationSystem extends Module 'actionFrontControllerSetMedia', 'displayNav', 'displayExternalNavigationHook', - 'actionAdminHotelGeneralSettingsOptionsModifier', - 'actionAdminHotelGeneralSettingsControllerUpdate_optionsBefore', ) ); } diff --git a/modules/hotelreservationsystem/views/templates/hook/display-nav.tpl b/modules/hotelreservationsystem/views/templates/hook/display-nav.tpl index de3a1a783..a18db23ab 100644 --- a/modules/hotelreservationsystem/views/templates/hook/display-nav.tpl +++ b/modules/hotelreservationsystem/views/templates/hook/display-nav.tpl @@ -17,13 +17,13 @@ * @license LICENSE.txt *} -{if $email} +{if $email != ''} {/if} -{if $phone} +{if $phone != ''}
{$phone} diff --git a/modules/hotelreservationsystem/views/templates/hook/external-navigation-hook.tpl b/modules/hotelreservationsystem/views/templates/hook/external-navigation-hook.tpl index 4c20672cb..d7b3f27be 100644 --- a/modules/hotelreservationsystem/views/templates/hook/external-navigation-hook.tpl +++ b/modules/hotelreservationsystem/views/templates/hook/external-navigation-hook.tpl @@ -17,9 +17,9 @@ * @license LICENSE.txt *} -{if $email || $phone} +{if ($email != '') || ($phone != '')}