From 7707a9e5e449f21b2a6b1f1c9151473b028cce69 Mon Sep 17 00:00:00 2001 From: "lakshya.chauhan193" Date: Mon, 27 Feb 2023 17:26:29 +0530 Subject: [PATCH 1/2] resolved impact way issue on advance price --- .../controllers/admin/AdminHotelFeaturePricesSettings.php | 4 ++++ .../hotel_feature_prices_settings/helpers/form/form.tpl | 5 ++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/modules/hotelreservationsystem/controllers/admin/AdminHotelFeaturePricesSettings.php b/modules/hotelreservationsystem/controllers/admin/AdminHotelFeaturePricesSettings.php index 3d4e7aae8..7b80a8ec3 100644 --- a/modules/hotelreservationsystem/controllers/admin/AdminHotelFeaturePricesSettings.php +++ b/modules/hotelreservationsystem/controllers/admin/AdminHotelFeaturePricesSettings.php @@ -257,6 +257,10 @@ class AdminHotelFeaturePricesSettingsController extends ModuleAdminController $objFeaturePricing = new HotelRoomTypeFeaturePricing(); + if ($priceImpactWay == HotelRoomTypeFeaturePricing::IMPACT_WAY_FIX_PRICE) { + $priceImpactType = HotelRoomTypeFeaturePricing::IMPACT_TYPE_FIXED_PRICE; + } + $languages = Language::getLanguages(false); $objDefaultLang = new language($defaultLangId); $isPlanTypeExists = 0; diff --git a/modules/hotelreservationsystem/views/templates/admin/hotel_feature_prices_settings/helpers/form/form.tpl b/modules/hotelreservationsystem/views/templates/admin/hotel_feature_prices_settings/helpers/form/form.tpl index 9587d2bf5..517a23438 100644 --- a/modules/hotelreservationsystem/views/templates/admin/hotel_feature_prices_settings/helpers/form/form.tpl +++ b/modules/hotelreservationsystem/views/templates/admin/hotel_feature_prices_settings/helpers/form/form.tpl @@ -207,7 +207,7 @@ {l s='Increase Price' mod='hotelreservationsystem'} @@ -223,10 +223,9 @@ {l s='Percentage' mod='hotelreservationsystem'} - From ca527d841733b5fb3ab546184fef779ec8e233c3 Mon Sep 17 00:00:00 2001 From: "lakshya.chauhan193" Date: Thu, 23 Mar 2023 13:02:22 +0530 Subject: [PATCH 2/2] added group access column in render list --- .../admin/AdminHotelFeaturePricesSettings.php | 25 +++++++++++++++-- .../group_access_label.tpl | 28 +++++++++++++++++++ .../helpers/form/form.tpl | 12 ++++++-- 3 files changed, 60 insertions(+), 5 deletions(-) create mode 100644 modules/hotelreservationsystem/views/templates/admin/hotel_feature_prices_settings/group_access_label.tpl diff --git a/modules/hotelreservationsystem/controllers/admin/AdminHotelFeaturePricesSettings.php b/modules/hotelreservationsystem/controllers/admin/AdminHotelFeaturePricesSettings.php index 7b80a8ec3..3e6435433 100644 --- a/modules/hotelreservationsystem/controllers/admin/AdminHotelFeaturePricesSettings.php +++ b/modules/hotelreservationsystem/controllers/admin/AdminHotelFeaturePricesSettings.php @@ -41,16 +41,20 @@ class AdminHotelFeaturePricesSettingsController extends ModuleAdminController $this->_join .= ' LEFT JOIN `'._DB_PREFIX_.'htl_room_type_feature_pricing_lang` fpl ON (a.id_feature_price = fpl.id_feature_price AND fpl.`id_lang` = '.(int) $this->context->language->id.')'; $this->_join .= ' LEFT JOIN `'._DB_PREFIX_.'htl_room_type` hrt ON (hrt.`id_product` = a.`id_product`)'; $this->_join .= ' LEFT JOIN `'._DB_PREFIX_.'htl_branch_info_lang` hbl ON (hbl.`id` = hrt.`id_hotel` AND hbl.`id_lang`='.(int) $this->context->language->id.')'; + $this->_join .= ' LEFT JOIN `'._DB_PREFIX_.'htl_room_type_feature_pricing_group` hrtfpg ON (hrtfpg.`id_feature_price` = a.`id_feature_price`)'; + $this->_join .= ' LEFT JOIN `'._DB_PREFIX_.'group_lang` gl ON (gl.`id_group` = hrtfpg.`id_group` AND gl.`id_lang` = '.(int) $this->context->language->id.')'; $this->_select .= ' fpl.`feature_price_name` as ftr_price_name, CONCAT(pl.`name`, " (#", a.`id_product`, ")") as product_name, hbl.`hotel_name`, IF(a.impact_type='.(int) HotelRoomTypeFeaturePricing::IMPACT_TYPE_PERCENTAGE.', CONCAT(round(a.impact_value, 2), " ", "%"), a.impact_value) AS impact_value'; $this->_select .= ' ,IF(a.impact_type='.(int) HotelRoomTypeFeaturePricing::IMPACT_TYPE_PERCENTAGE.', \''.$this->l('Percentage').'\', \''.$this->l('Fixed Amount').'\') - AS impact_type'; + AS impact_type, count(hrtfpg.`id_feature_price`) AS group_access_count, group_concat(gl.`name` separator ", ") as group_names'; $this->_select .= ', CASE WHEN a.`impact_way` = '.(int) HotelRoomTypeFeaturePricing::IMPACT_WAY_DECREASE.' THEN \''.$this->l('Decrease').'\' WHEN a.`impact_way` = '.(int) HotelRoomTypeFeaturePricing::IMPACT_WAY_INCREASE.' THEN \''.$this->l('Increase').'\' WHEN a.`impact_way` = '.(int) HotelRoomTypeFeaturePricing::IMPACT_WAY_FIX_PRICE.' THEN \''.$this->l('Fix').'\' END AS `impact_way`'; + $this->_group = 'GROUP BY a.`id_feature_price`'; + $this->_where = ' AND a.`id_cart` = 0 AND a.`id_guest` = 0 AND a.`id_room` = 0'; $impactWays = array(1 => $this->l('Decrease'), 2 => $this->l('Increase'), 3 => $this->l('Fix')); @@ -100,6 +104,13 @@ class AdminHotelFeaturePricesSettingsController extends ModuleAdminController 'currency' => true, 'callback' => 'setOrderCurrency', ), + 'group_access_count' => array( + 'align' => 'center', + 'title' => $this->l('Group Access'), + 'type' => 'bool', + 'callback' => 'setGroupAccessLabel', + 'search' => false, + ), 'date_from' => array( 'title' => $this->l('Date From'), 'align' => 'center', @@ -149,12 +160,19 @@ class AdminHotelFeaturePricesSettingsController extends ModuleAdminController } //A callback function for setting currency sign with amount - public static function setOrderCurrency($echo, $tr) + public static function setOrderCurrency($echo, $row) { $currency_default = Configuration::get('PS_CURRENCY_DEFAULT'); return Tools::displayPrice($echo, (int)$currency_default); } + public function setGroupAccessLabel($echo, $row) + { + $this->context->smarty->assign('row' ,$row); + $tpl_path = 'hotelreservationsystem/views/templates/admin/hotel_feature_prices_settings/group_access_label.tpl'; + return $this->context->smarty->fetch(_PS_MODULE_DIR_.$tpl_path); + } + public function initToolbar() { parent::initToolbar(); @@ -370,6 +388,9 @@ class AdminHotelFeaturePricesSettingsController extends ModuleAdminController } } + if (!(bool)Tools::getValue('groupBox')) { + $this->errors[] = $this->l('Please select at least one group for the group access'); + } if (!count($this->errors)) { if ($idFeaturePrice) { diff --git a/modules/hotelreservationsystem/views/templates/admin/hotel_feature_prices_settings/group_access_label.tpl b/modules/hotelreservationsystem/views/templates/admin/hotel_feature_prices_settings/group_access_label.tpl new file mode 100644 index 000000000..83864f832 --- /dev/null +++ b/modules/hotelreservationsystem/views/templates/admin/hotel_feature_prices_settings/group_access_label.tpl @@ -0,0 +1,28 @@ +{* +* 2010-2023 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-2023 Webkul IN +* @license https://store.webkul.com/license.html +*} + + + {$row['group_access_count']}  + {if $row['group_access_count'] > 1} + {l s='Groups' mod='hotelreservationsystem'} + {else} + {l s='Group' mod='hotelreservationsystem'} + {/if} + \ No newline at end of file diff --git a/modules/hotelreservationsystem/views/templates/admin/hotel_feature_prices_settings/helpers/form/form.tpl b/modules/hotelreservationsystem/views/templates/admin/hotel_feature_prices_settings/helpers/form/form.tpl index 517a23438..24072a43b 100644 --- a/modules/hotelreservationsystem/views/templates/admin/hotel_feature_prices_settings/helpers/form/form.tpl +++ b/modules/hotelreservationsystem/views/templates/admin/hotel_feature_prices_settings/helpers/form/form.tpl @@ -261,8 +261,8 @@ {* select group accesses *}
-