From 55cf83563a2fe25ad09920aaeecfae4f1d960e76 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Wed, 3 Apr 2024 18:53:21 +0530 Subject: [PATCH 01/82] Fixed: Room type duplication was not creating a perfect copy of existing the room type --- modules/hotelreservationsystem/classes/HotelRoomType.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/modules/hotelreservationsystem/classes/HotelRoomType.php b/modules/hotelreservationsystem/classes/HotelRoomType.php index a5445ec18..6c0a80fd4 100644 --- a/modules/hotelreservationsystem/classes/HotelRoomType.php +++ b/modules/hotelreservationsystem/classes/HotelRoomType.php @@ -107,6 +107,11 @@ class HotelRoomType extends ObjectModel $objHotelRoomType->id_hotel = $idHotelNew; $objHotelRoomType->adults = $roomType['adults']; $objHotelRoomType->children = $roomType['children']; + $objHotelRoomType->max_adults = $roomType['max_adults']; + $objHotelRoomType->max_children = $roomType['max_children']; + $objHotelRoomType->max_guests = $roomType['max_guests']; + $objHotelRoomType->min_los = $roomType['min_los']; + $objHotelRoomType->max_los = $roomType['max_los']; if ($objHotelRoomType->save()) { $objHotelRoomType->updateCategories(); return $returnId ? $objHotelRoomType->id : true; From 52b6e3f87edaa744e9c6ed099a1fcba40dc05425 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Fri, 5 Apr 2024 11:32:07 +0530 Subject: [PATCH 02/82] Fixed: Defaul dates in the booking form, search block, if prepration time is applied to the hotel --- controllers/front/ProductController.php | 8 +++++--- .../controllers/front/autocompletesearch.php | 3 ++- .../views/js/wk-room-search-block.js | 13 +++++++++++++ 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/controllers/front/ProductController.php b/controllers/front/ProductController.php index ec77ebd09..d44e46489 100644 --- a/controllers/front/ProductController.php +++ b/controllers/front/ProductController.php @@ -341,8 +341,13 @@ class ProductControllerCore extends FrontController $date_from = Tools::getValue('date_from'); $date_to = Tools::getValue('date_to'); + $preparationTime = (int) HotelOrderRestrictDate::getPreparationTime($hotel_id); if (!($date_from = Tools::getValue('date_from'))) { $date_from = date('Y-m-d'); + if ($preparationTime) { + $date_from = date('Y-m-d', strtotime('+ '.$preparationTime.' day')); + } + // set date to according to los $objHotelRoomTypeRestrictionDateRange = new HotelRoomTypeRestrictionDateRange(); $los = $objHotelRoomTypeRestrictionDateRange->getRoomTypeLengthOfStay($this->product->id, $date_from); @@ -368,9 +373,6 @@ class ProductControllerCore extends FrontController } } /*End*/ - // booking preparation time - $preparationTime = (int) HotelOrderRestrictDate::getPreparationTime($hotel_id); - $objHotelImage = new HotelImage(); $hotelImageLink = null; if ($coverImage = HotelImage::getCover($hotel_id)) { diff --git a/modules/wkroomsearchblock/controllers/front/autocompletesearch.php b/modules/wkroomsearchblock/controllers/front/autocompletesearch.php index 4a051c103..4d5eec20a 100644 --- a/modules/wkroomsearchblock/controllers/front/autocompletesearch.php +++ b/modules/wkroomsearchblock/controllers/front/autocompletesearch.php @@ -46,9 +46,10 @@ class WkRoomSearchBlockAutoCompleteSearchModuleFrontController extends ModuleFro foreach ($cat_ids as $value) { if ($hotel_info = $obj_htl_info->hotelBranchInfoByCategoryId($value['id_category'])) { $maxOrderDate = HotelOrderRestrictDate::getMaxOrderDate($hotel_info['id']); + $preparationTime = (int) HotelOrderRestrictDate::getPreparationTime($hotel_info['id']); $maxOrderDate = date('Y-m-d', strtotime($maxOrderDate)); $html .= '
  • '. + $hotel_info['id_category'].'" data-max_order_date="'.$maxOrderDate.'" data-preparation_time="'.$preparationTime.'">'. $hotel_info['hotel_name'].'
  • '; } } diff --git a/modules/wkroomsearchblock/views/js/wk-room-search-block.js b/modules/wkroomsearchblock/views/js/wk-room-search-block.js index f5d180d16..d85c25e5b 100644 --- a/modules/wkroomsearchblock/views/js/wk-room-search-block.js +++ b/modules/wkroomsearchblock/views/js/wk-room-search-block.js @@ -62,6 +62,14 @@ $(document).ready(function() { if (preparation_time) { start_date.setDate(start_date.getDate() + parseInt(preparation_time)); start_date.setHours(0, 0, 0, 0); + let selecteDateFrom = new Date(Date.parse(dateFrom)); + let selecteDateTo = new Date(Date.parse(dateTo)); + if (selecteDateFrom < start_date + || selecteDateTo < start_date + ) { + $('#check_in_time').val(''); + $('#check_out_time').val(''); + } } if (max_order_date) { @@ -203,6 +211,11 @@ $(document).ready(function() { $('#hotel_cat_name').html('Select Hotel'); $('.hotel_dropdown_ul').empty(); $('.hotel_dropdown_ul').html(result.data); + // Resetting the data from previously selected hotel + $('#preparation_time').val(0); + var max_order_date = $('#max_order_date').val(); + var preparation_time = 0; + createDateRangePicker(max_order_date, preparation_time, $('#check_in_time').val(), $('#check_out_time').val()); } else { alert(no_results_found_cond); } From cd58f81cbcab68f7f7d291b5342fe76464971192 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Wed, 17 Apr 2024 13:31:20 +0530 Subject: [PATCH 03/82] Added:Admin is show global max order date and global preparation time in AdminAddHotel while editing hotel --- .../controllers/admin/AdminAddHotelController.php | 2 ++ .../views/templates/admin/add_hotel/helpers/form/form.tpl | 2 ++ 2 files changed, 4 insertions(+) diff --git a/modules/hotelreservationsystem/controllers/admin/AdminAddHotelController.php b/modules/hotelreservationsystem/controllers/admin/AdminAddHotelController.php index 1d0e738b3..9b6f35bbf 100644 --- a/modules/hotelreservationsystem/controllers/admin/AdminAddHotelController.php +++ b/modules/hotelreservationsystem/controllers/admin/AdminAddHotelController.php @@ -183,6 +183,8 @@ class AdminAddHotelController extends ModuleAdminController $smartyVars['state_var'] = $stateOptions; $smartyVars['enabledDisplayMap'] = Configuration::get('PS_API_KEY') && Configuration::get('WK_GOOGLE_ACTIVE_MAP'); $smartyVars['ps_img_dir'] = _PS_IMG_.'l/'; + $smartyVars['MAX_GLOBAL_BOOKING_DATE'] = date('Y-m-d', strtotime(Configuration::get('MAX_GLOBAL_BOOKING_DATE'))); + $smartyVars['GLOBAL_PREPARATION_TIME'] = Configuration::get('GLOBAL_PREPARATION_TIME'); $this->context->smarty->assign($smartyVars); diff --git a/modules/hotelreservationsystem/views/templates/admin/add_hotel/helpers/form/form.tpl b/modules/hotelreservationsystem/views/templates/admin/add_hotel/helpers/form/form.tpl index 4ef90c7d8..53a919257 100644 --- a/modules/hotelreservationsystem/views/templates/admin/add_hotel/helpers/form/form.tpl +++ b/modules/hotelreservationsystem/views/templates/admin/add_hotel/helpers/form/form.tpl @@ -357,6 +357,7 @@ +
    {l s='Global max order date:' mod='hotelreservationsystem'} {dateFormat date=$MAX_GLOBAL_BOOKING_DATE}
    {* Feilds of cms page *}
    +
    +
    + +
    + +
    +
    +
    {*Display CMS Pages*} {if isset($cmsPages)}
    @@ -62,7 +80,7 @@
    - +
    '; html += ''; html += ''; From 4c10e15ab926cb7d74eddd6135034a55ce6951a4 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Fri, 28 Jun 2024 12:11:25 +0530 Subject: [PATCH 45/82] removed non required code for advanced payment status in Admin Products controller --- controllers/admin/AdminProductsController.php | 23 ++++++++----------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/controllers/admin/AdminProductsController.php b/controllers/admin/AdminProductsController.php index 690c3f054..a5cf027ab 100644 --- a/controllers/admin/AdminProductsController.php +++ b/controllers/admin/AdminProductsController.php @@ -332,7 +332,7 @@ class AdminProductsControllerCore extends AdminController if (Configuration::get('WK_ALLOW_ADVANCED_PAYMENT')) { $this->fields_list['advance_payment'] = array( 'title' => $this->l('Advance Payment'), - 'callback' => 'getAdvancePaymentBadge', + 'callback' => 'getAdvancePaymentStatus', 'align' => 'text-center', 'type' => 'bool', 'optional' => true, @@ -342,17 +342,6 @@ class AdminProductsControllerCore extends AdminController ); } - $this->statusBadge = array( - 0 => array( - 'badge' => 'badge-danger', - 'text' => $this->l('No') - ), - 1 => array( - 'badge' => 'badge-success', - 'text' => $this->l('Yes') - ) - ); - $taxRulesGroups = array(); foreach (TaxRulesGroup::getTaxRulesGroups(true) as $taxRulesGroup) { $taxRulesGroups[$taxRulesGroup['id_tax_rules_group']] = $taxRulesGroup['name']; @@ -452,9 +441,15 @@ class AdminProductsControllerCore extends AdminController } } - public function getAdvancePaymentBadge($val, $row) + public function getAdvancePaymentStatus($val, $row) { - return ''.$this->statusBadge[(int)$val]['text'].''; + if ($val) { + $str_return = ''.$this->l('Yes').''; + } else { + $str_return = ''.$this->l('No').''; + } + + return $str_return; } From fc4d66f6925ccbe3fecd69ca89da4ae3f99ccdbb Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Fri, 28 Jun 2024 12:59:49 +0530 Subject: [PATCH 46/82] Udpated: Text of column 'tax' to 'Tax rule' in both 'Additional Facilities' & 'Service Products' tab of room type detail page --- .../template/controllers/products/additionalfacilities.tpl | 2 +- .../default/template/controllers/products/serviceproduct.tpl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/admin/themes/default/template/controllers/products/additionalfacilities.tpl b/admin/themes/default/template/controllers/products/additionalfacilities.tpl index c3a58eb34..eb40e083e 100644 --- a/admin/themes/default/template/controllers/products/additionalfacilities.tpl +++ b/admin/themes/default/template/controllers/products/additionalfacilities.tpl @@ -43,7 +43,7 @@ {l s='Price'} From 620c7a2f495ed0c1ed4099a0389310d0dd2a3d1d Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Fri, 28 Jun 2024 13:20:46 +0530 Subject: [PATCH 47/82] Fixed the variable name for view on map on order detail page --- controllers/front/OrderDetailController.php | 2 +- themes/hotel-reservation-theme/order-detail.tpl | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/controllers/front/OrderDetailController.php b/controllers/front/OrderDetailController.php index bc6ae5620..381a1410e 100644 --- a/controllers/front/OrderDetailController.php +++ b/controllers/front/OrderDetailController.php @@ -407,7 +407,7 @@ class OrderDetailControllerCore extends FrontController 'obj_hotel_branch_information' => $objHotelBranchInformation, 'hotel_address_info' => $hotelAddressInfo, 'hotel_refund_rules' => $hotelRefundRules, - 'view_on_google_map' => Configuration::get('WK_GOOGLE_ACTIVE_MAP'), + 'view_on_map' => Configuration::get('WK_GOOGLE_ACTIVE_MAP'), ) ); // } diff --git a/themes/hotel-reservation-theme/order-detail.tpl b/themes/hotel-reservation-theme/order-detail.tpl index 4d4dc120c..730247dad 100644 --- a/themes/hotel-reservation-theme/order-detail.tpl +++ b/themes/hotel-reservation-theme/order-detail.tpl @@ -155,7 +155,7 @@
    {l s='Hotel location not available.'}
    {/if} - {if ($obj_hotel_branch_information->latitude|floatval != 0 && $obj_hotel_branch_information->longitude|floatval != 0) && $view_on_google_map} + {if ($obj_hotel_branch_information->latitude|floatval != 0 && $obj_hotel_branch_information->longitude|floatval != 0) && $view_on_map}
    @@ -542,7 +542,7 @@
    {l s='Hotel location not available.'}
    {/if} - {if ($obj_hotel_branch_information->latitude|floatval != 0 && $obj_hotel_branch_information->longitude|floatval != 0) && $view_google_map} + {if ($obj_hotel_branch_information->latitude|floatval != 0 && $obj_hotel_branch_information->longitude|floatval != 0) && $view_on_map}
    From 09c883a7fe3027feb7b9d36fb4f06009467df3ac Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Fri, 28 Jun 2024 17:00:30 +0530 Subject: [PATCH 48/82] Updated: Prepration time to minimum booking offset and its defination in the admin order preferences controller --- controllers/admin/AdminOrderPreferencesController.php | 8 ++++---- .../classes/HotelBranchInformation.php | 4 ++-- .../controllers/admin/AdminAddHotelController.php | 4 ++-- .../views/templates/admin/add_hotel/helpers/form/form.tpl | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/controllers/admin/AdminOrderPreferencesController.php b/controllers/admin/AdminOrderPreferencesController.php index 4068a6f09..4125603b6 100644 --- a/controllers/admin/AdminOrderPreferencesController.php +++ b/controllers/admin/AdminOrderPreferencesController.php @@ -95,8 +95,8 @@ class AdminOrderPreferencesControllerCore extends AdminController 'class' => 'fixed-width-xxl readonly', ), 'GLOBAL_PREPARATION_TIME' => array( - 'title' => $this->l('Preparation time'), - 'hint' => $this->l('Number of days required to prepare a room for a guest\'s stay. For example, if you set this value to 3 and someone is booking on 2nd of March he can only book rooms for dates from and after 3 days, i.e, 5th of March.'), + 'title' => $this->l('Minimum booking offset'), + 'hint' => $this->l('The minimum booking offset refers to the furthest future date from which a guest can book a room relative to their desired check-in date. For example, if you set this value to 3 and someone is booking on 2nd of March he can only book rooms for dates from and after 3 days, i.e, 5th of March.'), 'desc' => $this->l('Set to 0 to disable this feature.'), 'type' => 'text', 'class' => 'fixed-width-xl', @@ -342,9 +342,9 @@ class AdminOrderPreferencesControllerCore extends AdminController } if ($globalPreparationTime === '') { - $this->errors[] = Tools::displayError('Field \'Preparation time\' can not be empty.'); + $this->errors[] = Tools::displayError('Field \'Minimum booking offset\' can not be empty.'); } elseif ($globalPreparationTime !== '0' && !Validate::isUnsignedInt($globalPreparationTime)) { - $this->errors[] = Tools::displayError('Field \'Preparation time\' is invalid.'); + $this->errors[] = Tools::displayError('Field \'Minimum booking offset\' is invalid.'); } } diff --git a/modules/hotelreservationsystem/classes/HotelBranchInformation.php b/modules/hotelreservationsystem/classes/HotelBranchInformation.php index 05af3c72b..9463c8cd0 100644 --- a/modules/hotelreservationsystem/classes/HotelBranchInformation.php +++ b/modules/hotelreservationsystem/classes/HotelBranchInformation.php @@ -1228,13 +1228,13 @@ class HotelBranchInformation extends ObjectModel if (!$this->use_global_preparation_time) { if ($this->preparation_time === '') { - $message = Tools::displayError('Preparation time is a required.'); + $message = Tools::displayError('Minimum booking offset is a required.'); if ($die) { throw new PrestaShopException($message); } return $error_return ? $message : false; } elseif ($this->preparation_time !== '0' && !Validate::isUnsignedInt($this->preparation_time)) { - $message = Tools::displayError('Preparation time is invalid.'); + $message = Tools::displayError('Minimum booking offset is invalid.'); if ($die) { throw new PrestaShopException($message); } diff --git a/modules/hotelreservationsystem/controllers/admin/AdminAddHotelController.php b/modules/hotelreservationsystem/controllers/admin/AdminAddHotelController.php index 1d0e738b3..4998ad868 100644 --- a/modules/hotelreservationsystem/controllers/admin/AdminAddHotelController.php +++ b/modules/hotelreservationsystem/controllers/admin/AdminAddHotelController.php @@ -343,9 +343,9 @@ class AdminAddHotelController extends ModuleAdminController if (!$enableUseGlobalPreparationTime) { if ($preparationTime === '') { - $this->errors[] = $this->l('Preparation time is a required field.'); + $this->errors[] = $this->l('Minimum booking offset is a required field.'); } elseif ($preparationTime !== '0' && !Validate::isUnsignedInt($preparationTime)) { - $this->errors[] = $this->l('Preparation time is invalid.'); + $this->errors[] = $this->l('Minimum booking offset is invalid.'); } } } diff --git a/modules/hotelreservationsystem/views/templates/admin/add_hotel/helpers/form/form.tpl b/modules/hotelreservationsystem/views/templates/admin/add_hotel/helpers/form/form.tpl index 4ef90c7d8..2321054af 100644 --- a/modules/hotelreservationsystem/views/templates/admin/add_hotel/helpers/form/form.tpl +++ b/modules/hotelreservationsystem/views/templates/admin/add_hotel/helpers/form/form.tpl @@ -367,7 +367,7 @@
    @@ -380,7 +380,7 @@
    From 960808ce364b9644561cbeb957a6dbe993a065dc Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Thu, 2 May 2024 11:21:51 +0530 Subject: [PATCH 06/82] Updated: Format of global and hotel max order date while it is saved in the database --- controllers/admin/AdminOrderPreferencesController.php | 9 ++++++++- .../controllers/admin/AdminAddHotelController.php | 4 ++-- .../views/js/HotelReservationAdmin.js | 10 +++++++--- .../templates/admin/add_hotel/helpers/form/form.tpl | 3 ++- 4 files changed, 19 insertions(+), 7 deletions(-) diff --git a/controllers/admin/AdminOrderPreferencesController.php b/controllers/admin/AdminOrderPreferencesController.php index 4068a6f09..ccfc972ad 100644 --- a/controllers/admin/AdminOrderPreferencesController.php +++ b/controllers/admin/AdminOrderPreferencesController.php @@ -82,18 +82,23 @@ class AdminOrderPreferencesControllerCore extends AdminController ) ); + $maxOrderDate = (Tools::getValue('MAX_GLOBAL_BOOKING_DATE'))? Tools::getValue('MAX_GLOBAL_BOOKING_DATE') : Configuration::get('MAX_GLOBAL_BOOKING_DATE'); $this->fields_options = array( 'order_restrict' => array( 'title' => $this->l('Order Restrict'), 'icon' => 'icon-cogs', 'fields' => array( - 'MAX_GLOBAL_BOOKING_DATE' => array( + 'max_global_booking_date_formatted' => array( 'title' => $this->l('Maximum Global Check-out Date to book a room'), 'hint' => $this->l('Maximum date of check-out for which rooms of your hotels can be booked.'), + 'defaultValue' => date('d-m-Y', strtotime($maxOrderDate)), 'type' => 'text', 'id' => 'max_global_book_date', 'class' => 'fixed-width-xxl readonly', ), + 'MAX_GLOBAL_BOOKING_DATE' => array( + 'type' => 'hidden', + ), 'GLOBAL_PREPARATION_TIME' => array( 'title' => $this->l('Preparation time'), 'hint' => $this->l('Number of days required to prepare a room for a guest\'s stay. For example, if you set this value to 3 and someone is booking on 2nd of March he can only book rooms for dates from and after 3 days, i.e, 5th of March.'), @@ -329,6 +334,8 @@ class AdminOrderPreferencesControllerCore extends AdminController $this->errors[] = Tools::displayError('Please assign a valid CMS page for Terms and Conditions.'); } + // To prevent this from saving in the configuration table + unset($_POST['max_global_booking_date_formatted']); $maxGlobalBookingDate = Tools::getValue('MAX_GLOBAL_BOOKING_DATE'); $globalPreparationTime = Tools::getValue('GLOBAL_PREPARATION_TIME'); $maxGlobalBookingDateFormatted = date('Y-m-d', strtotime($maxGlobalBookingDate)); diff --git a/modules/hotelreservationsystem/controllers/admin/AdminAddHotelController.php b/modules/hotelreservationsystem/controllers/admin/AdminAddHotelController.php index 9b6f35bbf..15196c989 100644 --- a/modules/hotelreservationsystem/controllers/admin/AdminAddHotelController.php +++ b/modules/hotelreservationsystem/controllers/admin/AdminAddHotelController.php @@ -183,7 +183,7 @@ class AdminAddHotelController extends ModuleAdminController $smartyVars['state_var'] = $stateOptions; $smartyVars['enabledDisplayMap'] = Configuration::get('PS_API_KEY') && Configuration::get('WK_GOOGLE_ACTIVE_MAP'); $smartyVars['ps_img_dir'] = _PS_IMG_.'l/'; - $smartyVars['MAX_GLOBAL_BOOKING_DATE'] = date('Y-m-d', strtotime(Configuration::get('MAX_GLOBAL_BOOKING_DATE'))); + $smartyVars['MAX_GLOBAL_BOOKING_DATE'] = (Configuration::get('MAX_GLOBAL_BOOKING_DATE')); $smartyVars['GLOBAL_PREPARATION_TIME'] = Configuration::get('GLOBAL_PREPARATION_TIME'); $this->context->smarty->assign($smartyVars); @@ -471,7 +471,7 @@ class AdminAddHotelController extends ModuleAdminController } // getHotel address if ($idHotelAddress = $objHotelBranch->getHotelIdAddress()) { - $objAddress = new Address($idHotelAddress); + $objAddress = new Address($idHotelAddress); } else { $objAddress = new Address(); } diff --git a/modules/hotelreservationsystem/views/js/HotelReservationAdmin.js b/modules/hotelreservationsystem/views/js/HotelReservationAdmin.js index be204a2e3..57ae7e7b1 100644 --- a/modules/hotelreservationsystem/views/js/HotelReservationAdmin.js +++ b/modules/hotelreservationsystem/views/js/HotelReservationAdmin.js @@ -555,6 +555,8 @@ $(document).ready(function() { $("#max_global_book_date").datepicker({ defaultDate: new Date(), dateFormat: 'dd-mm-yy', + altFormat: 'yy-mm-dd', + altField: 'input[name="MAX_GLOBAL_BOOKING_DATE"]', minDate: 0, }); @@ -800,17 +802,19 @@ $(document).ready(function() { } // manage hotel page - $('#maximum_booking_date').datepicker({ + $('#maximum_booking_date_formatted').datepicker({ defaultDate: new Date(), dateFormat: 'dd-mm-yy', + altFormat: 'yy-mm-dd', + altField: 'input[name="maximum_booking_date"]', minDate: 0, }); $('input[name="enable_use_global_max_order_date"]').on('change', function () { if (parseInt($(this).val())) { - $('input[name="maximum_booking_date"]').closest('.form-group').hide(200); + $('input[name="maximum_booking_date_formatted"]').closest('.form-group').hide(200); } else { - $('input[name="maximum_booking_date"]').closest('.form-group').show(200); + $('input[name="maximum_booking_date_formatted"]').closest('.form-group').show(200); } }); diff --git a/modules/hotelreservationsystem/views/templates/admin/add_hotel/helpers/form/form.tpl b/modules/hotelreservationsystem/views/templates/admin/add_hotel/helpers/form/form.tpl index 53a919257..3e44b0e0c 100644 --- a/modules/hotelreservationsystem/views/templates/admin/add_hotel/helpers/form/form.tpl +++ b/modules/hotelreservationsystem/views/templates/admin/add_hotel/helpers/form/form.tpl @@ -363,7 +363,8 @@
    From 1822bc76f27b30e7eb6401486ef970fdb196eeaa Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Thu, 2 May 2024 11:29:12 +0530 Subject: [PATCH 07/82] Fixed: The display format for max order date in case admin does not update the max order date for the hotel --- .../controllers/admin/AdminAddHotelController.php | 4 ++-- .../views/templates/admin/add_hotel/helpers/form/form.tpl | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/hotelreservationsystem/controllers/admin/AdminAddHotelController.php b/modules/hotelreservationsystem/controllers/admin/AdminAddHotelController.php index 15196c989..4ec3f3dbc 100644 --- a/modules/hotelreservationsystem/controllers/admin/AdminAddHotelController.php +++ b/modules/hotelreservationsystem/controllers/admin/AdminAddHotelController.php @@ -162,9 +162,9 @@ class AdminAddHotelController extends ModuleAdminController $restrictDateInfo = HotelOrderRestrictDate::getDataByHotelId($idHotel); if ($restrictDateInfo) { if ($restrictDateInfo['max_order_date'] == '0000-00-00') { - $restrictDateInfo['max_order_date'] = date('d-m-Y', strtotime('1 year')); + $restrictDateInfo['max_order_date'] = date('Y-m-d', strtotime('1 year')); } else { - $restrictDateInfo['max_order_date'] = date('d-m-Y', strtotime($restrictDateInfo['max_order_date'])); + $restrictDateInfo['max_order_date'] = date('Y-m-d', strtotime($restrictDateInfo['max_order_date'])); } } $smartyVars['order_restrict_date_info'] = $restrictDateInfo; diff --git a/modules/hotelreservationsystem/views/templates/admin/add_hotel/helpers/form/form.tpl b/modules/hotelreservationsystem/views/templates/admin/add_hotel/helpers/form/form.tpl index 3e44b0e0c..196df0efd 100644 --- a/modules/hotelreservationsystem/views/templates/admin/add_hotel/helpers/form/form.tpl +++ b/modules/hotelreservationsystem/views/templates/admin/add_hotel/helpers/form/form.tpl @@ -364,7 +364,7 @@
    - +
    From f6b0be8e1a588d7d99118ee1b458ddd2e83df929 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Tue, 7 May 2024 09:58:31 +0530 Subject: [PATCH 08/82] Fixed: The display of the fields. The price values displayed in the catalog price rules on edit --- controllers/admin/AdminSpecificPriceRuleController.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/controllers/admin/AdminSpecificPriceRuleController.php b/controllers/admin/AdminSpecificPriceRuleController.php index 4694f46e3..edaefc127 100644 --- a/controllers/admin/AdminSpecificPriceRuleController.php +++ b/controllers/admin/AdminSpecificPriceRuleController.php @@ -171,6 +171,7 @@ class AdminSpecificPriceRuleControllerCore extends AdminController 'label' => $this->l('Name'), 'name' => 'name', 'maxlength' => 32, + 'col' => 3, 'required' => true, 'hint' => $this->l('Forbidden characters').' <>;=#{}' ), @@ -222,8 +223,8 @@ class AdminSpecificPriceRuleControllerCore extends AdminController 'name' => 'price', 'disabled' => ($this->object->price == -1 ? 1 : 0), 'maxlength' => 10, - 'suffix' => $this->context->currency->getSign('right'), - + 'suffix' => $this->context->currency->sign, + 'col' => 3, ), array( 'type' => 'checkbox', @@ -279,6 +280,7 @@ class AdminSpecificPriceRuleControllerCore extends AdminController 'type' => 'text', 'label' => $this->l('Reduction'), 'name' => 'reduction', + 'col' => 3, 'required' => true, ), ), @@ -298,14 +300,14 @@ class AdminSpecificPriceRuleControllerCore extends AdminController $price = $this->getFieldValue($this->object, 'price'); if ($price != -1 && Validate::isPrice($price)) { - $price = number_format($price, 6); + $price = number_format($price, 6, '.', ''); } else { $price = ''; } $reduction = $this->getFieldValue($this->object, 'reduction'); if (Validate::isPrice($reduction)) { - $reduction = number_format($reduction, 6); + $reduction = number_format($reduction, 6, '.', ''); } else { $reduction = 0; } From 1f18100fc5a2b84222cc5da904f211e389cebbfa Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Fri, 10 May 2024 16:22:02 +0530 Subject: [PATCH 09/82] Fixed: View on map button was displayed even if the option to display google maps for hotel location was disabled --- controllers/front/ContactController.php | 1 + themes/hotel-reservation-theme/contact-form.tpl | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/controllers/front/ContactController.php b/controllers/front/ContactController.php index ba68dd08c..901506388 100644 --- a/controllers/front/ContactController.php +++ b/controllers/front/ContactController.php @@ -295,6 +295,7 @@ class ContactControllerCore extends FrontController $this->context->smarty->assign( array( 'hotelsInfo' => $hotelsInfo, + 'viewOnMap' => Configuration::get('WK_GOOGLE_ACTIVE_MAP'), 'gblHtlPhone' => $gblHtlPhone, 'gblHtlEmail' => $gblHtlEmail, 'gblHtlAddress' => $gblHtlAddress, diff --git a/themes/hotel-reservation-theme/contact-form.tpl b/themes/hotel-reservation-theme/contact-form.tpl index 6e7cbdc7e..4ebf927bd 100644 --- a/themes/hotel-reservation-theme/contact-form.tpl +++ b/themes/hotel-reservation-theme/contact-form.tpl @@ -184,7 +184,7 @@

    {$hotel['hotel_name']}

    {$hotel['address']}, {$hotel['city']}, {if {$hotel['state_name']}}{$hotel['state_name']},{/if} {$hotel['country_name']}, {$hotel['postcode']}

    - {if $hotel['latitude'] != 0 || $hotel['longitude'] != 0} + {if ($hotel['latitude'] != 0 || $hotel['longitude'] != 0) && $viewOnMap}

    {l s='View on map'} From 084b3c34ed5e65f9e71eaff08fe99324e9032d1c Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Tue, 14 May 2024 11:30:19 +0530 Subject: [PATCH 10/82] Fixed: The admin was unable to change the customer after any error is displayed while creating new address for the customer, also fixed the back button --- .../template/controllers/addresses/helpers/form/form.tpl | 2 +- controllers/admin/AdminAddressesController.php | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/admin/themes/default/template/controllers/addresses/helpers/form/form.tpl b/admin/themes/default/template/controllers/addresses/helpers/form/form.tpl index ec102910d..e46200e15 100644 --- a/admin/themes/default/template/controllers/addresses/helpers/form/form.tpl +++ b/admin/themes/default/template/controllers/addresses/helpers/form/form.tpl @@ -88,7 +88,7 @@

    {/if} {else} diff --git a/controllers/admin/AdminAddressesController.php b/controllers/admin/AdminAddressesController.php index 83a646cb6..6e052f39b 100644 --- a/controllers/admin/AdminAddressesController.php +++ b/controllers/admin/AdminAddressesController.php @@ -190,10 +190,10 @@ class AdminAddressesControllerCore extends AdminController $token_customer = Tools::getAdminToken('AdminCustomers'.(int)(Tab::getIdFromClassName('AdminCustomers')).(int)$this->context->employee->id); } + $this->fields_value['email'] = Tools::getValue('email'); $this->tpl_form_vars = array( - 'customer' => isset($customer) ? $customer : null, - 'tokenCustomer' => isset($token_customer) ? $token_customer : null, - 'back_url' => urldecode(Tools::getValue('back')) + 'customer' => (isset($customer) && $this->object->id) ? $customer : null, + 'tokenCustomer' => isset($token_customer) ? $token_customer : null ); // Order address fields depending on country format From e299b4bd41a036f36e4fa19b6c611fec19e06217 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Tue, 14 May 2024 15:10:40 +0530 Subject: [PATCH 11/82] Fixed: The incorrect information on the KPIs in the AdminProductController --- controllers/admin/AdminProductsController.php | 12 ++++---- controllers/admin/AdminStatsController.php | 29 +++++++++++++++---- 2 files changed, 30 insertions(+), 11 deletions(-) diff --git a/controllers/admin/AdminProductsController.php b/controllers/admin/AdminProductsController.php index 7123dbbf4..089d56c9c 100644 --- a/controllers/admin/AdminProductsController.php +++ b/controllers/admin/AdminProductsController.php @@ -2458,7 +2458,7 @@ class AdminProductsControllerCore extends AdminController $helper->title = $this->l('Occupied Rooms', null, null, false); $helper->subtitle = $this->l('Today', null, null, false); $helper->source = $this->context->link->getAdminLink('AdminStats').'&ajax=1&action=getKpi&kpi=occupied_rooms'; - $helper->tooltip = $this->l('The current count of rooms that are currently occupied by guests.', null, null, false); + $helper->tooltip = $this->l('The count of rooms that are currently occupied by guests.', null, null, false); $kpis[] = $helper; $helper = new HelperKpi(); @@ -2468,7 +2468,7 @@ class AdminProductsControllerCore extends AdminController $helper->title = $this->l('Vacant Rooms', null, null, false); $helper->subtitle = $this->l('Today', null, null, false); $helper->source = $this->context->link->getAdminLink('AdminStats').'&ajax=1&action=getKpi&kpi=vacant_rooms'; - $helper->tooltip = $this->l('The count of rooms that are currently unoccupied and available for booking.', null, null, false); + $helper->tooltip = $this->l('The count of rooms that are either booked but currently unoccupied or available for booking', null, null, false); $kpis[] = $helper; $helper = new HelperKpi(); @@ -2478,7 +2478,7 @@ class AdminProductsControllerCore extends AdminController $helper->title = $this->l('Booked Rooms', null, null, false); $helper->subtitle = $this->l('Today', null, null, false); $helper->source = $this->context->link->getAdminLink('AdminStats').'&ajax=1&action=getKpi&kpi=booked_rooms'; - $helper->tooltip = $this->l('The number of rooms that are currently booked but not yet occupied.', null, null, false); + $helper->tooltip = $this->l('The total number of rooms that are currently booked and unoccupied.', null, null, false); $kpis[] = $helper; $helper = new HelperKpi(); @@ -2488,7 +2488,7 @@ class AdminProductsControllerCore extends AdminController $helper->title = $this->l('Disabled Rooms', null, null, false); $helper->subtitle = $this->l('Today', null, null, false); $helper->source = $this->context->link->getAdminLink('AdminStats').'&ajax=1&action=getKpi&kpi=disabled_rooms'; - $helper->tooltip = $this->l('The number of rooms that are currently disabled.', null, null, false); + $helper->tooltip = $this->l('The total number of rooms that are currently disabled.', null, null, false); $kpis[] = $helper; $helper = new HelperKpi(); @@ -2498,7 +2498,7 @@ class AdminProductsControllerCore extends AdminController $helper->title = $this->l('Online Bookable Rooms', null, null, false); $helper->subtitle = $this->l('Today', null, null, false); $helper->source = $this->context->link->getAdminLink('AdminStats').'&ajax=1&action=getKpi&kpi=online_bookable_rooms'; - $helper->tooltip = $this->l('The total number of rooms that can be booked only using website.', null, null, false); + $helper->tooltip = $this->l('The total number of rooms that can be booked directly from the front office.', null, null, false); $kpis[] = $helper; $helper = new HelperKpi(); @@ -2508,7 +2508,7 @@ class AdminProductsControllerCore extends AdminController $helper->title = $this->l('Offline Bookable Rooms', null, null, false); $helper->subtitle = $this->l('Today', null, null, false); $helper->source = $this->context->link->getAdminLink('AdminStats').'&ajax=1&action=getKpi&kpi=offline_bookable_rooms'; - $helper->tooltip = $this->l('The number of rooms that can be booked either through website or offline channels (e.g., phone or in-person).', null, null, false); + $helper->tooltip = $this->l('The total number of rooms available for booking through the back office.', null, null, false); $kpis[] = $helper; $helper = new HelperKpi(); diff --git a/controllers/admin/AdminStatsController.php b/controllers/admin/AdminStatsController.php index 2de11a362..1d3e4a721 100644 --- a/controllers/admin/AdminStatsController.php +++ b/controllers/admin/AdminStatsController.php @@ -850,15 +850,16 @@ class AdminStatsControllerCore extends AdminStatsTabController break; case 'occupied_rooms': - $value = AdminStatsController::getOccupiedRooms(0); + $value = AdminStatsController::getCurrentlyOccupiedRooms(0); break; case 'vacant_rooms': - $totalAvailableRooms = AdminStatsController::getAvailableRoomsForDiscreteDates(date('Y-m-d'), null, 0); - $totalAvailableRooms = $totalAvailableRooms[strtotime(date('Y-m-d'))]; - $totalOccupiedRooms = AdminStatsController::getOccupiedRooms(0); - $value = $totalAvailableRooms - $totalOccupiedRooms; + $totalUnAvailRooms = AdminStatsController::getDisabledRoomsForDiscreteDates(date('Y-m-d'), null, 0); + $totalUnAvailRooms = $totalUnAvailRooms[strtotime(date('Y-m-d'))]; + $totalRooms = AdminStatsController::getTotalRooms(0); + $totalOccupiedRooms = AdminStatsController::getCurrentlyOccupiedRooms(0); + $value = $totalRooms - ($totalUnAvailRooms + $totalOccupiedRooms); break; @@ -1810,6 +1811,24 @@ class AdminStatsControllerCore extends AdminStatsTabController return $result; } + public static function getCurrentlyOccupiedRooms($idHotel = null) + { + $sql = 'SELECT COUNT(DISTINCT hbd.`id_room`) + FROM `'._DB_PREFIX_.'htl_booking_detail` hbd + LEFT JOIN `'._DB_PREFIX_.'htl_room_information` hri + ON (hri.`id` = hbd.`id_room`) + LEFT JOIN `'._DB_PREFIX_.'product` p + ON (p.`id_product` = hri.`id_product`) + WHERE p.`active` = 1 + AND hbd.`is_refunded` = 0 + AND hbd.`is_cancelled` = 0 + AND ("'.pSQL(date('Y-m-d')).'" BETWEEN hbd.`date_from` AND hbd.`date_to`) + AND hbd.`id_status` = '.(int) HotelBookingDetail::STATUS_CHECKED_IN. + (!is_null($idHotel) ? HotelBranchInformation::addHotelRestriction($idHotel, 'hbd') : ''); + + return Db::getInstance()->getValue($sql); + } + /** * Returns the number of rooms that have been booked but not checked-in yet. */ From ba921726b6694a3840abaef2b3b41b41f49c448a Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Tue, 14 May 2024 19:41:31 +0530 Subject: [PATCH 12/82] Updated: The user will now be redirected to page not found incase there is direct manupulation of the dates in the url in category page and product page and the dates are invalid --- controllers/front/CategoryController.php | 4 ++++ controllers/front/ProductController.php | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/controllers/front/CategoryController.php b/controllers/front/CategoryController.php index 3823504ab..b60c6f101 100644 --- a/controllers/front/CategoryController.php +++ b/controllers/front/CategoryController.php @@ -114,6 +114,10 @@ class CategoryControllerCore extends FrontController Tools::redirect($this->context->link->getPageLink('pagenotfound')); } + if ($dateTo != '' && $dateFrom != '' && $dateFromTimestamp >= $dateToTimestamp) { + Tools::redirect($this->context->link->getPageLink('pagenotfound')); + } + // Instantiate category $this->category = new Category($id_category, $this->context->language->id); diff --git a/controllers/front/ProductController.php b/controllers/front/ProductController.php index ec77ebd09..237a85cac 100644 --- a/controllers/front/ProductController.php +++ b/controllers/front/ProductController.php @@ -122,6 +122,10 @@ class ProductControllerCore extends FrontController Tools::redirect($this->context->link->getPageLink('pagenotfound')); } + if ($dateTo != '' && $dateFrom != '' && $dateFromTimestamp >= $dateToTimestamp) { + Tools::redirect($this->context->link->getPageLink('pagenotfound')); + } + parent::init(); if ($id_product = (int) Tools::getValue('id_product')) { From 04bbe71c66d5d597bf1867c7486424d74b169906 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Thu, 16 May 2024 11:50:50 +0530 Subject: [PATCH 13/82] Added show at front in the room type list, updated the advanced payment in the room type list --- controllers/admin/AdminProductsController.php | 77 +++++++++++-------- 1 file changed, 44 insertions(+), 33 deletions(-) diff --git a/controllers/admin/AdminProductsController.php b/controllers/admin/AdminProductsController.php index 21bba9ce7..503dabfc7 100644 --- a/controllers/admin/AdminProductsController.php +++ b/controllers/admin/AdminProductsController.php @@ -318,10 +318,21 @@ class AdminProductsControllerCore extends AdminController 'optional' => true, ); + $this->fields_list['show_at_front'] = array( + 'title' => $this->l('Show at front'), + 'align' => 'text-center', + 'type' => 'bool', + 'active' => 'show_at_front', + 'optional' => true, + 'havingFilter' => true, + 'visible_default' => true, + 'orderby' => false, + ); + if (Configuration::get('WK_ALLOW_ADVANCED_PAYMENT')) { $this->fields_list['advance_payment'] = array( 'title' => $this->l('Advance Payment'), - 'active' => 'advance_payment', + 'callback' => 'getAdvancePaymentBadge', 'align' => 'text-center', 'type' => 'bool', 'optional' => true, @@ -331,6 +342,17 @@ class AdminProductsControllerCore extends AdminController ); } + $this->statusBadge = array( + 0 => array( + 'badge' => 'badge-danger', + 'text' => $this->l('No') + ), + 1 => array( + 'badge' => 'badge-success', + 'text' => $this->l('Yes') + ) + ); + $taxRulesGroups = array(); foreach (TaxRulesGroup::getTaxRulesGroups(true) as $taxRulesGroup) { $taxRulesGroups[$taxRulesGroup['id_tax_rules_group']] = $taxRulesGroup['name']; @@ -430,6 +452,12 @@ class AdminProductsControllerCore extends AdminController } } + public function getAdvancePaymentBadge($val, $row) + { + return ''.$this->statusBadge[(int)$val]['text'].''; + } + + private function buildCategoryOptions($category) { $space = str_repeat(' ', 5 * (($category['level_depth'] - $this->objLocationsCategory->level_depth) - 1)); @@ -1335,10 +1363,10 @@ class AdminProductsControllerCore extends AdminController $this->errors[] = Tools::displayError('You do not have permission to add this.'); } } - // Toggle Advance Payment - elseif (Tools::getIsset('advance_payment'.$this->table)) { + // Toggle Show at front + elseif (Tools::getIsset('show_at_front'.$this->table)) { if ($this->tabAccess['edit'] === '1') { - $this->action = 'toggleAdvancePayment'; + $this->action = 'toggleShowAtFront'; } else { $this->errors[] = Tools::displayError('You do not have permission to edit this.'); } @@ -1895,38 +1923,21 @@ class AdminProductsControllerCore extends AdminController return $res; } - public function processToggleAdvancePayment() + public function processToggleShowAtFront() { - if (Configuration::get('WK_ALLOW_ADVANCED_PAYMENT')) { - $this->loadObject(true); - if (!Validate::isLoadedObject($this->object)) { - return false; - } + if (!$this->loadObject()) { + return false; + } - if (!Product::isBookingProduct($this->object->id)) { - return false; - } + if (!Product::isBookingProduct($this->object->id)) { + return false; + } - $objHotelAdvancedPayment = new HotelAdvancedPayment(); - $roomTypeAdvancePaymentInfo = $objHotelAdvancedPayment->getIdAdvPaymentByIdProduct($this->object->id); - if ($roomTypeAdvancePaymentInfo) { - $objHotelAdvancedPayment = new HotelAdvancedPayment($roomTypeAdvancePaymentInfo['id']); - $objHotelAdvancedPayment->active = !$objHotelAdvancedPayment->active; - } else { - $objHotelAdvancedPayment->id_product = $this->object->id; - $objHotelAdvancedPayment->payment_type = ''; - $objHotelAdvancedPayment->value = ''; - $objHotelAdvancedPayment->id_currency = ''; - $objHotelAdvancedPayment->tax_include = ''; - $objHotelAdvancedPayment->calculate_from = 0; - $objHotelAdvancedPayment->active = 1; - } - - if ($objHotelAdvancedPayment->save()) { - Tools::redirectAdmin(self::$currentIndex.'&token='.$this->token.'&conf=4'); - } else { - $this->errors[] = $this->l('Something went wrong while updating Advance payment status.'); - } + $this->object->show_at_front = !$this->object->show_at_front; + if ($this->object->save()) { + Tools::redirectAdmin(self::$currentIndex.'&token='.$this->token.'&conf=4'); + } else { + $this->errors[] = $this->l('Something error occurred.'); } } From d9af2bee2b1ef3ff067603ca31a3885ba3eb4657 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Fri, 17 May 2024 10:11:49 +0530 Subject: [PATCH 14/82] Added: show_at_front in the select to remove ambiguity --- controllers/admin/AdminProductsController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/controllers/admin/AdminProductsController.php b/controllers/admin/AdminProductsController.php index 503dabfc7..2786381b6 100644 --- a/controllers/admin/AdminProductsController.php +++ b/controllers/admin/AdminProductsController.php @@ -203,7 +203,7 @@ class AdminProductsControllerCore extends AdminController LEFT JOIN `'._DB_PREFIX_.'htl_room_type_demand` hrtd ON (hrtd.`id_product` = a.`id_product`) LEFT JOIN `'._DB_PREFIX_.'htl_room_type_service_product` hrtsp ON ((hrtsp.`element_type` = '.(int) RoomTypeServiceProduct::WK_ELEMENT_TYPE_HOTEL.' AND hrtsp.`id_element` = hrt.`id_hotel`) OR (hrtsp.`element_type` = '.(int) RoomTypeServiceProduct::WK_ELEMENT_TYPE_ROOM_TYPE.' AND hrtsp.`id_element` = a.`id_product`))'; - $this->_select .= ' (SELECT COUNT(hri.`id`) FROM `'._DB_PREFIX_.'htl_room_information` hri WHERE hri.`id_product` = a.`id_product`) as num_rooms, '; + $this->_select .= ' a.`show_at_front`, (SELECT COUNT(hri.`id`) FROM `'._DB_PREFIX_.'htl_room_information` hri WHERE hri.`id_product` = a.`id_product`) as num_rooms, '; $this->_select .= 'hrt.`adults`, hrt.`children`, hrt.`max_guests`, hb.`id` as id_hotel, aa.`city`, hbl.`hotel_name`, '; $this->_select .= 'shop.`name` AS `shopname`, a.`id_shop_default`, '; $this->_select .= $alias_image.'.`id_image` AS `id_image`, cl.`name` AS `name_category`, '.$alias.'.`price`, 0 AS `price_final`, a.`is_virtual`, pd.`nb_downloadable`, sav.`quantity` AS `sav_quantity`, '.$alias.'.`active`, IF(sav.`quantity`<=0, 1, 0) AS `badge_danger`'; From 1d1fd511f9956fe90fa66550ce9159c7ac2308c7 Mon Sep 17 00:00:00 2001 From: Shreesh Arora Date: Mon, 20 May 2024 16:24:43 +0530 Subject: [PATCH 15/82] Updated: htaccess file comptible with apache 2.2 and 2.4 --- .gitignore | 1 + admin/backups/.htaccess | 12 +++++++++-- admin/export/.htaccess | 12 +++++++++-- admin/import/.htaccess | 12 +++++++++-- admin/tabs/.htaccess | 12 +++++++++-- classes/.htaccess | 12 +++++++++-- config/.htaccess | 12 +++++++++-- config/xml/.htaccess | 12 +++++++++-- docs/.htaccess | 11 +++++++++- docs/csv_import/.htaccess | 11 +++++++++- download/.htaccess | 12 +++++++++-- img/.htaccess | 16 ++++++++++++++ img/cms/.htaccess | 8 ------- log/.htaccess | 13 ++++++++++-- mails/.htaccess | 21 ++++++++++++++----- modules/.htaccess | 13 ++++++++++-- .../documents/.htaccess | 11 +++++++++- override/.htaccess | 12 +++++++++-- pdf/.htaccess | 17 ++++++++++++--- themes/.htaccess | 17 ++++++++++++--- tools/geoip/.htaccess | 12 +++++++++-- tools/htmlpurifier/.htaccess | 12 +++++++++-- tools/http_build_url/.htaccess | 12 +++++++++-- tools/js_minify/.htaccess | 12 +++++++++-- tools/minify_html/.htaccess | 12 +++++++++-- tools/mobile_Detect/.htaccess | 12 +++++++++-- tools/parser_sql/.htaccess | 12 +++++++++-- tools/pear/.htaccess | 12 +++++++++-- tools/profiling/.htaccess | 12 +++++++++-- tools/smarty/.htaccess | 12 +++++++++-- tools/swift/.htaccess | 12 +++++++++-- tools/tar/.htaccess | 12 +++++++++-- tools/tcpdf/.htaccess | 12 +++++++++-- tools/tcpdf/tools/.htaccess | 11 +++++++++- upload/.htaccess | 19 ++++++++++++----- 35 files changed, 357 insertions(+), 76 deletions(-) create mode 100644 img/.htaccess delete mode 100644 img/cms/.htaccess diff --git a/.gitignore b/.gitignore index ae0a05c8f..9ce95681a 100644 --- a/.gitignore +++ b/.gitignore @@ -53,6 +53,7 @@ composer.lock img/** !/img/404.gif +!/img/.htaccess !/img/admin/ !/img/admin/*.gif !/img/admin/*.png diff --git a/admin/backups/.htaccess b/admin/backups/.htaccess index 93169e4eb..3de9e4008 100644 --- a/admin/backups/.htaccess +++ b/admin/backups/.htaccess @@ -1,2 +1,10 @@ -Order deny,allow -Deny from all +# Apache 2.2 + + Order deny,allow + Deny from all + + +# Apache 2.4 + + Require all denied + diff --git a/admin/export/.htaccess b/admin/export/.htaccess index 93169e4eb..3de9e4008 100644 --- a/admin/export/.htaccess +++ b/admin/export/.htaccess @@ -1,2 +1,10 @@ -Order deny,allow -Deny from all +# Apache 2.2 + + Order deny,allow + Deny from all + + +# Apache 2.4 + + Require all denied + diff --git a/admin/import/.htaccess b/admin/import/.htaccess index 93169e4eb..3de9e4008 100644 --- a/admin/import/.htaccess +++ b/admin/import/.htaccess @@ -1,2 +1,10 @@ -Order deny,allow -Deny from all +# Apache 2.2 + + Order deny,allow + Deny from all + + +# Apache 2.4 + + Require all denied + diff --git a/admin/tabs/.htaccess b/admin/tabs/.htaccess index 93169e4eb..3de9e4008 100644 --- a/admin/tabs/.htaccess +++ b/admin/tabs/.htaccess @@ -1,2 +1,10 @@ -Order deny,allow -Deny from all +# Apache 2.2 + + Order deny,allow + Deny from all + + +# Apache 2.4 + + Require all denied + diff --git a/classes/.htaccess b/classes/.htaccess index 93169e4eb..3de9e4008 100644 --- a/classes/.htaccess +++ b/classes/.htaccess @@ -1,2 +1,10 @@ -Order deny,allow -Deny from all +# Apache 2.2 + + Order deny,allow + Deny from all + + +# Apache 2.4 + + Require all denied + diff --git a/config/.htaccess b/config/.htaccess index 93169e4eb..3de9e4008 100644 --- a/config/.htaccess +++ b/config/.htaccess @@ -1,2 +1,10 @@ -Order deny,allow -Deny from all +# Apache 2.2 + + Order deny,allow + Deny from all + + +# Apache 2.4 + + Require all denied + diff --git a/config/xml/.htaccess b/config/xml/.htaccess index 93169e4eb..3de9e4008 100644 --- a/config/xml/.htaccess +++ b/config/xml/.htaccess @@ -1,2 +1,10 @@ -Order deny,allow -Deny from all +# Apache 2.2 + + Order deny,allow + Deny from all + + +# Apache 2.4 + + Require all denied + diff --git a/docs/.htaccess b/docs/.htaccess index 8703119f9..3de9e4008 100644 --- a/docs/.htaccess +++ b/docs/.htaccess @@ -1 +1,10 @@ -Deny from ALL +# Apache 2.2 + + Order deny,allow + Deny from all + + +# Apache 2.4 + + Require all denied + diff --git a/docs/csv_import/.htaccess b/docs/csv_import/.htaccess index 18aba5838..041b7e558 100644 --- a/docs/csv_import/.htaccess +++ b/docs/csv_import/.htaccess @@ -1 +1,10 @@ -Allow from ALL \ No newline at end of file +# Apache 2.2 + + Order allow,deny + Allow from ALL + + +# Apache 2.4 + + Require all granted + diff --git a/download/.htaccess b/download/.htaccess index 93169e4eb..3de9e4008 100644 --- a/download/.htaccess +++ b/download/.htaccess @@ -1,2 +1,10 @@ -Order deny,allow -Deny from all +# Apache 2.2 + + Order deny,allow + Deny from all + + +# Apache 2.4 + + Require all denied + diff --git a/img/.htaccess b/img/.htaccess new file mode 100644 index 000000000..b892de715 --- /dev/null +++ b/img/.htaccess @@ -0,0 +1,16 @@ +# Apache 2.2 + + Order deny,allow + Deny from all + + Allow from all + + + +# Apache 2.4 + + Require all denied + + Require all granted + + \ No newline at end of file diff --git a/img/cms/.htaccess b/img/cms/.htaccess deleted file mode 100644 index 91920ed0a..000000000 --- a/img/cms/.htaccess +++ /dev/null @@ -1,8 +0,0 @@ - - php_flag engine off - -deny from all - - order deny,allow - allow from all - diff --git a/log/.htaccess b/log/.htaccess index 93169e4eb..7c2f481d2 100644 --- a/log/.htaccess +++ b/log/.htaccess @@ -1,2 +1,11 @@ -Order deny,allow -Deny from all +# Apache 2.2 + + Order deny,allow + Deny from all + + +# Apache 2.4 + + Require all denied + + diff --git a/mails/.htaccess b/mails/.htaccess index 45feba9cf..1bb323e41 100644 --- a/mails/.htaccess +++ b/mails/.htaccess @@ -1,5 +1,16 @@ -Order deny,allow -Deny from all - -Allow from all - +# Apache 2.2 + + Order deny,allow + Deny from all + + Allow from all + + + +# Apache 2.4 + + Require all denied + + Require all granted + + diff --git a/modules/.htaccess b/modules/.htaccess index d6fd8d12b..cd6d6b97f 100644 --- a/modules/.htaccess +++ b/modules/.htaccess @@ -1,3 +1,12 @@ - -Deny from all + + # Apache 2.2 + + Order deny,allow + Deny from all + + + # Apache 2.4 + + Require all denied + diff --git a/modules/hotelreservationsystem/documents/.htaccess b/modules/hotelreservationsystem/documents/.htaccess index 14249c50b..3de9e4008 100644 --- a/modules/hotelreservationsystem/documents/.htaccess +++ b/modules/hotelreservationsystem/documents/.htaccess @@ -1 +1,10 @@ -Deny from all \ No newline at end of file +# Apache 2.2 + + Order deny,allow + Deny from all + + +# Apache 2.4 + + Require all denied + diff --git a/override/.htaccess b/override/.htaccess index 896fbc5a3..3de9e4008 100644 --- a/override/.htaccess +++ b/override/.htaccess @@ -1,2 +1,10 @@ -Order deny,allow -Deny from all \ No newline at end of file +# Apache 2.2 + + Order deny,allow + Deny from all + + +# Apache 2.4 + + Require all denied + diff --git a/pdf/.htaccess b/pdf/.htaccess index 3caa91589..edaca433a 100644 --- a/pdf/.htaccess +++ b/pdf/.htaccess @@ -1,3 +1,14 @@ - -Deny from all - \ No newline at end of file +# Apache 2.2 + + Order deny,allow + + Deny from all + + + +# Apache 2.4 + + + Require all denied + + diff --git a/themes/.htaccess b/themes/.htaccess index 3caa91589..edaca433a 100644 --- a/themes/.htaccess +++ b/themes/.htaccess @@ -1,3 +1,14 @@ - -Deny from all - \ No newline at end of file +# Apache 2.2 + + Order deny,allow + + Deny from all + + + +# Apache 2.4 + + + Require all denied + + diff --git a/tools/geoip/.htaccess b/tools/geoip/.htaccess index 93169e4eb..3de9e4008 100644 --- a/tools/geoip/.htaccess +++ b/tools/geoip/.htaccess @@ -1,2 +1,10 @@ -Order deny,allow -Deny from all +# Apache 2.2 + + Order deny,allow + Deny from all + + +# Apache 2.4 + + Require all denied + diff --git a/tools/htmlpurifier/.htaccess b/tools/htmlpurifier/.htaccess index 93169e4eb..3de9e4008 100644 --- a/tools/htmlpurifier/.htaccess +++ b/tools/htmlpurifier/.htaccess @@ -1,2 +1,10 @@ -Order deny,allow -Deny from all +# Apache 2.2 + + Order deny,allow + Deny from all + + +# Apache 2.4 + + Require all denied + diff --git a/tools/http_build_url/.htaccess b/tools/http_build_url/.htaccess index 93169e4eb..3de9e4008 100644 --- a/tools/http_build_url/.htaccess +++ b/tools/http_build_url/.htaccess @@ -1,2 +1,10 @@ -Order deny,allow -Deny from all +# Apache 2.2 + + Order deny,allow + Deny from all + + +# Apache 2.4 + + Require all denied + diff --git a/tools/js_minify/.htaccess b/tools/js_minify/.htaccess index 93169e4eb..3de9e4008 100644 --- a/tools/js_minify/.htaccess +++ b/tools/js_minify/.htaccess @@ -1,2 +1,10 @@ -Order deny,allow -Deny from all +# Apache 2.2 + + Order deny,allow + Deny from all + + +# Apache 2.4 + + Require all denied + diff --git a/tools/minify_html/.htaccess b/tools/minify_html/.htaccess index 93169e4eb..3de9e4008 100644 --- a/tools/minify_html/.htaccess +++ b/tools/minify_html/.htaccess @@ -1,2 +1,10 @@ -Order deny,allow -Deny from all +# Apache 2.2 + + Order deny,allow + Deny from all + + +# Apache 2.4 + + Require all denied + diff --git a/tools/mobile_Detect/.htaccess b/tools/mobile_Detect/.htaccess index 93169e4eb..3de9e4008 100644 --- a/tools/mobile_Detect/.htaccess +++ b/tools/mobile_Detect/.htaccess @@ -1,2 +1,10 @@ -Order deny,allow -Deny from all +# Apache 2.2 + + Order deny,allow + Deny from all + + +# Apache 2.4 + + Require all denied + diff --git a/tools/parser_sql/.htaccess b/tools/parser_sql/.htaccess index 93169e4eb..3de9e4008 100644 --- a/tools/parser_sql/.htaccess +++ b/tools/parser_sql/.htaccess @@ -1,2 +1,10 @@ -Order deny,allow -Deny from all +# Apache 2.2 + + Order deny,allow + Deny from all + + +# Apache 2.4 + + Require all denied + diff --git a/tools/pear/.htaccess b/tools/pear/.htaccess index 93169e4eb..3de9e4008 100644 --- a/tools/pear/.htaccess +++ b/tools/pear/.htaccess @@ -1,2 +1,10 @@ -Order deny,allow -Deny from all +# Apache 2.2 + + Order deny,allow + Deny from all + + +# Apache 2.4 + + Require all denied + diff --git a/tools/profiling/.htaccess b/tools/profiling/.htaccess index 93169e4eb..3de9e4008 100644 --- a/tools/profiling/.htaccess +++ b/tools/profiling/.htaccess @@ -1,2 +1,10 @@ -Order deny,allow -Deny from all +# Apache 2.2 + + Order deny,allow + Deny from all + + +# Apache 2.4 + + Require all denied + diff --git a/tools/smarty/.htaccess b/tools/smarty/.htaccess index 93169e4eb..3de9e4008 100644 --- a/tools/smarty/.htaccess +++ b/tools/smarty/.htaccess @@ -1,2 +1,10 @@ -Order deny,allow -Deny from all +# Apache 2.2 + + Order deny,allow + Deny from all + + +# Apache 2.4 + + Require all denied + diff --git a/tools/swift/.htaccess b/tools/swift/.htaccess index 93169e4eb..3de9e4008 100644 --- a/tools/swift/.htaccess +++ b/tools/swift/.htaccess @@ -1,2 +1,10 @@ -Order deny,allow -Deny from all +# Apache 2.2 + + Order deny,allow + Deny from all + + +# Apache 2.4 + + Require all denied + diff --git a/tools/tar/.htaccess b/tools/tar/.htaccess index 93169e4eb..3de9e4008 100644 --- a/tools/tar/.htaccess +++ b/tools/tar/.htaccess @@ -1,2 +1,10 @@ -Order deny,allow -Deny from all +# Apache 2.2 + + Order deny,allow + Deny from all + + +# Apache 2.4 + + Require all denied + diff --git a/tools/tcpdf/.htaccess b/tools/tcpdf/.htaccess index 93169e4eb..3de9e4008 100644 --- a/tools/tcpdf/.htaccess +++ b/tools/tcpdf/.htaccess @@ -1,2 +1,10 @@ -Order deny,allow -Deny from all +# Apache 2.2 + + Order deny,allow + Deny from all + + +# Apache 2.4 + + Require all denied + diff --git a/tools/tcpdf/tools/.htaccess b/tools/tcpdf/tools/.htaccess index 8d2f25636..224784069 100644 --- a/tools/tcpdf/tools/.htaccess +++ b/tools/tcpdf/tools/.htaccess @@ -1 +1,10 @@ -deny from all +# Apache 2.2 + + Order deny,allow + Deny from all + + +# Apache 2.4 + + Require all denied + \ No newline at end of file diff --git a/upload/.htaccess b/upload/.htaccess index 33b4fbec0..37095a359 100644 --- a/upload/.htaccess +++ b/upload/.htaccess @@ -1,7 +1,16 @@ - RemoveHandler .php .phtml .php3 .php4 .php5 - RemoveType .php .phtml .php3 .php4 .php5 - - - php_flag engine off + RemoveHandler .php .phtml .php3 .php4 .php5 .php7 .php8 + RemoveType .php .phtml .php3 .php4 .php5 .php7 .php8 + + # Apache 2.2 + + Order deny,allow + Deny from all + + + # Apache 2.4 + + Require all denied + + \ No newline at end of file From 0d64da3315e29b0095cec6742f71df529b3f2e44 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Tue, 21 May 2024 10:48:42 +0530 Subject: [PATCH 16/82] Removed: Non required email templates from the order status email template dropdrown --- controllers/admin/AdminStatusesController.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/controllers/admin/AdminStatusesController.php b/controllers/admin/AdminStatusesController.php index e10140b77..01a1d9c0d 100644 --- a/controllers/admin/AdminStatusesController.php +++ b/controllers/admin/AdminStatusesController.php @@ -707,6 +707,14 @@ class AdminStatusesControllerCore extends AdminController $theme = new Theme($this->context->shop->id_theme); $default_path = '../mails/'; $theme_path = '../themes/'.$theme->directory.'/mails/'; // Mail templates can also be found in the theme folder + $templatesToIgnore = array( + 'footer.html', + 'header.html', + 'shipped.html', + 'in_transit.html', + 'download_products.html', + 'test.html' + ); $array = array(); foreach (Language::getLanguages(false) as $language) { @@ -722,7 +730,9 @@ class AdminStatusesControllerCore extends AdminController // We merge all available emails in one array $templates = array_unique(array_merge(scandir(_PS_ADMIN_DIR_.'/'.$default_path.$iso_code), $theme_templates)); foreach ($templates as $key => $template) { - if (!strncmp(strrev($template), 'lmth.', 5)) { + if (!strncmp(strrev($template), 'lmth.', 5) + && !in_array($template, $templatesToIgnore) + ) { $search_result = array_search($template, $theme_templates); $array[$iso_code][] = array( 'id' => substr($template, 0, -5), From 677a3d7492d65123d63dd25a8eb73f88a2def2a0 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Tue, 21 May 2024 12:51:50 +0530 Subject: [PATCH 17/82] Removed non required function and updated getOccupupiedRooms function --- controllers/admin/AdminStatsController.php | 25 ++++------------------ 1 file changed, 4 insertions(+), 21 deletions(-) diff --git a/controllers/admin/AdminStatsController.php b/controllers/admin/AdminStatsController.php index 1d3e4a721..5530ea491 100644 --- a/controllers/admin/AdminStatsController.php +++ b/controllers/admin/AdminStatsController.php @@ -850,7 +850,7 @@ class AdminStatsControllerCore extends AdminStatsTabController break; case 'occupied_rooms': - $value = AdminStatsController::getCurrentlyOccupiedRooms(0); + $value = AdminStatsController::getOccupiedRooms(0, date('Y-m-d')); break; @@ -858,7 +858,7 @@ class AdminStatsControllerCore extends AdminStatsTabController $totalUnAvailRooms = AdminStatsController::getDisabledRoomsForDiscreteDates(date('Y-m-d'), null, 0); $totalUnAvailRooms = $totalUnAvailRooms[strtotime(date('Y-m-d'))]; $totalRooms = AdminStatsController::getTotalRooms(0); - $totalOccupiedRooms = AdminStatsController::getCurrentlyOccupiedRooms(0); + $totalOccupiedRooms = AdminStatsController::getOccupiedRooms(0, date('Y-m-d')); $value = $totalRooms - ($totalUnAvailRooms + $totalOccupiedRooms); break; @@ -1793,7 +1793,7 @@ class AdminStatsControllerCore extends AdminStatsTabController /** * Returns the number of rooms that have been checked-in. */ - public static function getOccupiedRooms($idHotel = null) + public static function getOccupiedRooms($idHotel = null, $date = false) { $sql = 'SELECT COUNT(DISTINCT hbd.`id_room`) FROM `'._DB_PREFIX_.'htl_booking_detail` hbd @@ -1805,30 +1805,13 @@ class AdminStatsControllerCore extends AdminStatsTabController AND hbd.`is_refunded` = 0 AND hbd.`is_cancelled` = 0 AND hbd.`id_status` = '.(int) HotelBookingDetail::STATUS_CHECKED_IN. + (($date) ? ' AND ("'.pSQL($date).'" BETWEEN hbd.`date_from` AND hbd.`date_to`) ' : ''); (!is_null($idHotel) ? HotelBranchInformation::addHotelRestriction($idHotel, 'hbd') : ''); $result = Db::getInstance()->getValue($sql); return $result; } - public static function getCurrentlyOccupiedRooms($idHotel = null) - { - $sql = 'SELECT COUNT(DISTINCT hbd.`id_room`) - FROM `'._DB_PREFIX_.'htl_booking_detail` hbd - LEFT JOIN `'._DB_PREFIX_.'htl_room_information` hri - ON (hri.`id` = hbd.`id_room`) - LEFT JOIN `'._DB_PREFIX_.'product` p - ON (p.`id_product` = hri.`id_product`) - WHERE p.`active` = 1 - AND hbd.`is_refunded` = 0 - AND hbd.`is_cancelled` = 0 - AND ("'.pSQL(date('Y-m-d')).'" BETWEEN hbd.`date_from` AND hbd.`date_to`) - AND hbd.`id_status` = '.(int) HotelBookingDetail::STATUS_CHECKED_IN. - (!is_null($idHotel) ? HotelBranchInformation::addHotelRestriction($idHotel, 'hbd') : ''); - - return Db::getInstance()->getValue($sql); - } - /** * Returns the number of rooms that have been booked but not checked-in yet. */ From 906ed2b693fcbb6a1819e7d71c98ad7ce6c9bffb Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Wed, 22 May 2024 10:16:55 +0530 Subject: [PATCH 18/82] Updated: the tooltip for the booked rooms KPI --- controllers/admin/AdminProductsController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/controllers/admin/AdminProductsController.php b/controllers/admin/AdminProductsController.php index ee8a33dfb..2ede2a539 100644 --- a/controllers/admin/AdminProductsController.php +++ b/controllers/admin/AdminProductsController.php @@ -2478,7 +2478,7 @@ class AdminProductsControllerCore extends AdminController $helper->title = $this->l('Booked Rooms', null, null, false); $helper->subtitle = $this->l('Today', null, null, false); $helper->source = $this->context->link->getAdminLink('AdminStats').'&ajax=1&action=getKpi&kpi=booked_rooms'; - $helper->tooltip = $this->l('The total number of rooms that are currently booked and unoccupied.', null, null, false); + $helper->tooltip = $this->l('The total number of rooms that are currently booked and and awaiting guest check-in', null, null, false); $kpis[] = $helper; $helper = new HelperKpi(); From 8407a4ba5191582246c65e5a6613ca7e547b1855 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Wed, 22 May 2024 13:29:59 +0530 Subject: [PATCH 19/82] Updated: The searched date valdiation process for the category and product controller in the front --- controllers/front/CategoryController.php | 14 +------------- controllers/front/ProductController.php | 14 +------------- .../classes/HotelHelper.php | 17 +++++++++++++++++ 3 files changed, 19 insertions(+), 26 deletions(-) diff --git a/controllers/front/CategoryController.php b/controllers/front/CategoryController.php index b60c6f101..8d3eac6a5 100644 --- a/controllers/front/CategoryController.php +++ b/controllers/front/CategoryController.php @@ -102,19 +102,7 @@ class CategoryControllerCore extends FrontController $dateFrom = Tools::getValue('date_from'); $dateTo = Tools::getValue('date_to'); - $currentTimestamp = strtotime(date('Y-m-d')); - $dateFromTimestamp = strtotime($dateFrom); - $dateToTimestamp = strtotime($dateTo); - - if ($dateFrom != '' && ($dateFromTimestamp === false || ($dateFromTimestamp < $currentTimestamp))) { - Tools::redirect($this->context->link->getPageLink('pagenotfound')); - } - - if ($dateTo != '' && ($dateToTimestamp === false || ($dateToTimestamp < $currentTimestamp))) { - Tools::redirect($this->context->link->getPageLink('pagenotfound')); - } - - if ($dateTo != '' && $dateFrom != '' && $dateFromTimestamp >= $dateToTimestamp) { + if (!HotelHelper::validateDateRange($dateFrom, $dateTo)) { Tools::redirect($this->context->link->getPageLink('pagenotfound')); } diff --git a/controllers/front/ProductController.php b/controllers/front/ProductController.php index 237a85cac..3a458e656 100644 --- a/controllers/front/ProductController.php +++ b/controllers/front/ProductController.php @@ -110,19 +110,7 @@ class ProductControllerCore extends FrontController $dateFrom = Tools::getValue('date_from'); $dateTo = Tools::getValue('date_to'); - $currentTimestamp = strtotime(date('Y-m-d')); - $dateFromTimestamp = strtotime($dateFrom); - $dateToTimestamp = strtotime($dateTo); - - if ($dateFrom != '' && ($dateFromTimestamp === false || ($dateFromTimestamp < $currentTimestamp))) { - Tools::redirect($this->context->link->getPageLink('pagenotfound')); - } - - if ($dateTo != '' && ($dateToTimestamp === false || ($dateToTimestamp < $currentTimestamp))) { - Tools::redirect($this->context->link->getPageLink('pagenotfound')); - } - - if ($dateTo != '' && $dateFrom != '' && $dateFromTimestamp >= $dateToTimestamp) { + if (!HotelHelper::validateDateRange($dateFrom, $dateTo)) { Tools::redirect($this->context->link->getPageLink('pagenotfound')); } diff --git a/modules/hotelreservationsystem/classes/HotelHelper.php b/modules/hotelreservationsystem/classes/HotelHelper.php index 8aee39b6f..3f8c647e7 100644 --- a/modules/hotelreservationsystem/classes/HotelHelper.php +++ b/modules/hotelreservationsystem/classes/HotelHelper.php @@ -929,4 +929,21 @@ class HotelHelper return $daysDifference; } + + public static function validateDateRange($dateFrom, $dateTo) + { + $currentTimestamp = strtotime(date('Y-m-d')); + $dateFromTimestamp = strtotime($dateFrom); + $dateToTimestamp = strtotime($dateTo); + $isValid = true; + if ($dateFrom != '' && ($dateFromTimestamp === false || ($dateFromTimestamp < $currentTimestamp))) { + $isValid = false; + } else if ($dateTo != '' && ($dateToTimestamp === false || ($dateToTimestamp < $currentTimestamp))) { + $isValid = false; + } else if ($dateTo != '' && $dateFrom != '' && $dateFromTimestamp >= $dateToTimestamp) { + $isValid = false; + } + + return $isValid; + } } From d47362e483ff44f82d93aa9c69e8d3d16431ccd9 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Mon, 27 May 2024 12:52:09 +0530 Subject: [PATCH 20/82] Fixed: The max order date getting saved in the wrong required format --- controllers/admin/AdminOrderPreferencesController.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/controllers/admin/AdminOrderPreferencesController.php b/controllers/admin/AdminOrderPreferencesController.php index ccfc972ad..cd5329be0 100644 --- a/controllers/admin/AdminOrderPreferencesController.php +++ b/controllers/admin/AdminOrderPreferencesController.php @@ -336,6 +336,8 @@ class AdminOrderPreferencesControllerCore extends AdminController // To prevent this from saving in the configuration table unset($_POST['max_global_booking_date_formatted']); + // To prevent the saving of the wrong + $_POST['MAX_GLOBAL_BOOKING_DATE'] = date('Y-m-d', strtotime(Tools::getValue('MAX_GLOBAL_BOOKING_DATE'))); $maxGlobalBookingDate = Tools::getValue('MAX_GLOBAL_BOOKING_DATE'); $globalPreparationTime = Tools::getValue('GLOBAL_PREPARATION_TIME'); $maxGlobalBookingDateFormatted = date('Y-m-d', strtotime($maxGlobalBookingDate)); From 8cf4209b4ba268fbcf9895525c86ba9e1fba0a17 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Mon, 27 May 2024 12:53:25 +0530 Subject: [PATCH 21/82] removed non required comment --- controllers/admin/AdminOrderPreferencesController.php | 1 - 1 file changed, 1 deletion(-) diff --git a/controllers/admin/AdminOrderPreferencesController.php b/controllers/admin/AdminOrderPreferencesController.php index cd5329be0..4f17df8e0 100644 --- a/controllers/admin/AdminOrderPreferencesController.php +++ b/controllers/admin/AdminOrderPreferencesController.php @@ -336,7 +336,6 @@ class AdminOrderPreferencesControllerCore extends AdminController // To prevent this from saving in the configuration table unset($_POST['max_global_booking_date_formatted']); - // To prevent the saving of the wrong $_POST['MAX_GLOBAL_BOOKING_DATE'] = date('Y-m-d', strtotime(Tools::getValue('MAX_GLOBAL_BOOKING_DATE'))); $maxGlobalBookingDate = Tools::getValue('MAX_GLOBAL_BOOKING_DATE'); $globalPreparationTime = Tools::getValue('GLOBAL_PREPARATION_TIME'); From 9454e1ae76bac93293822e47bbbfa8dedd56139c Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Tue, 28 May 2024 15:16:05 +0530 Subject: [PATCH 22/82] Updated: centeralized the function to get the count of the rooms with their booiking statuses --- controllers/admin/AdminStatsController.php | 100 +++++++++------------ 1 file changed, 43 insertions(+), 57 deletions(-) diff --git a/controllers/admin/AdminStatsController.php b/controllers/admin/AdminStatsController.php index 5530ea491..be7129d0d 100644 --- a/controllers/admin/AdminStatsController.php +++ b/controllers/admin/AdminStatsController.php @@ -850,7 +850,12 @@ class AdminStatsControllerCore extends AdminStatsTabController break; case 'occupied_rooms': - $value = AdminStatsController::getOccupiedRooms(0, date('Y-m-d')); + $value = AdminStatsController::getDistinctRoomBookingsCount( + date('Y-m-d', strtotime('-1 day')), + date('Y-m-d'), + 0, + HotelBookingDetail::STATUS_CHECKED_IN + ); break; @@ -858,13 +863,23 @@ class AdminStatsControllerCore extends AdminStatsTabController $totalUnAvailRooms = AdminStatsController::getDisabledRoomsForDiscreteDates(date('Y-m-d'), null, 0); $totalUnAvailRooms = $totalUnAvailRooms[strtotime(date('Y-m-d'))]; $totalRooms = AdminStatsController::getTotalRooms(0); - $totalOccupiedRooms = AdminStatsController::getOccupiedRooms(0, date('Y-m-d')); + $totalOccupiedRooms = AdminStatsController::getDistinctRoomBookingsCount( + date('Y-m-d', strtotime('-1 day')), + date('Y-m-d'), + 0, + HotelBookingDetail::STATUS_CHECKED_IN + ); $value = $totalRooms - ($totalUnAvailRooms + $totalOccupiedRooms); break; case 'booked_rooms': - $value = AdminStatsController::getBookedRooms(0); + $value = AdminStatsController::getDistinctRoomBookingsCount( + date('Y-m-d'), + date('Y-m-d', strtotime('+1 day')), + 0, + HotelBookingDetail::STATUS_ALLOTED + ); break; @@ -1098,13 +1113,14 @@ class AdminStatsControllerCore extends AdminStatsTabController ); } - public static function getTotalRooms($idHotel = null) + public static function getTotalRooms($idHotel = null, $active = null) { $sql = 'SELECT COUNT(hri.`id`) FROM `'._DB_PREFIX_.'htl_room_information` hri INNER JOIN `'._DB_PREFIX_.'product` p ON (p.`id_product` = hri.`id_product`) WHERE p.`booking_product` = 1 '. + (!is_null($active) ? ' AND p.`active` ='.(int) $active : ' '). (!is_null($idHotel) ? HotelBranchInformation::addHotelRestriction($idHotel, 'hri') : ''); return Db::getInstance()->getValue($sql); @@ -1118,16 +1134,7 @@ class AdminStatsControllerCore extends AdminStatsTabController $occupancyData = array('count_total' => 0, 'count_occupied' => 0, 'count_available' => 0, 'count_unavailable' => 0); - $countTotal = Db::getInstance()->getValue( - 'SELECT COUNT(hri.`id`) - FROM `'._DB_PREFIX_.'htl_room_information` hri - INNER JOIN `'._DB_PREFIX_.'htl_branch_info` hbi - ON (hbi.`id` = hri.`id_hotel`) - LEFT JOIN `'._DB_PREFIX_.'product` p - ON (p.`id_product` = hri.`id_product`) - WHERE p.`active` = 1'. - HotelBranchInformation::addHotelRestriction($idsHotel, 'hri') - ); + $countTotal = self::getTotalRooms($idsHotel, true); $occupancyData['count_total'] = $countTotal; // Occupied rooms are booked rooms that are not refunded in the date range @@ -1412,7 +1419,27 @@ class AdminStatsControllerCore extends AdminStatsTabController return $result; } - public static function getTotalOccupiedRooms($dateFrom, $dateTo, $idHotel = null) + public static function getDistinctRoomBookingsCount($dateFrom = false, $dateTo = false, $idHotel = null, $roomBookingStatus = null) + { + $sql = 'SELECT COUNT(DISTINCT hbd.`id_room`) + FROM `'._DB_PREFIX_.'htl_booking_detail` hbd + LEFT JOIN `'._DB_PREFIX_.'htl_room_information` hri + ON (hri.`id` = hbd.`id_room`) + LEFT JOIN `'._DB_PREFIX_.'product` p + ON (p.`id_product` = hri.`id_product`) + WHERE p.`active` = 1 + AND hbd.`is_refunded` = 0 + AND hbd.`is_cancelled` = 0 '. + (($dateFrom && $dateTo) ? ' AND hbd.`date_from` <= "'.pSQL($dateTo).' 00:00:00" AND hbd.`date_to` > "'.pSQL($dateFrom).' 00:00:00" ': ' '). + (!is_null($roomBookingStatus) ? ' AND hbd.`id_status` = '.(int) $roomBookingStatus : ' '). + (!is_null($idHotel) ? HotelBranchInformation::addHotelRestriction($idHotel, 'hbd') : ''); + $result = Db::getInstance()->getValue($sql); + + return $result ? $result : 0; + + } + + public static function getTotalBookedRooms($dateFrom, $dateTo, $idHotel = null) { $sql = 'SELECT COUNT(hbd.`id_room`) FROM `'._DB_PREFIX_.'htl_booking_detail` hbd @@ -1790,47 +1817,6 @@ class AdminStatsControllerCore extends AdminStatsTabController return $result; } - /** - * Returns the number of rooms that have been checked-in. - */ - public static function getOccupiedRooms($idHotel = null, $date = false) - { - $sql = 'SELECT COUNT(DISTINCT hbd.`id_room`) - FROM `'._DB_PREFIX_.'htl_booking_detail` hbd - LEFT JOIN `'._DB_PREFIX_.'htl_room_information` hri - ON (hri.`id` = hbd.`id_room`) - LEFT JOIN `'._DB_PREFIX_.'product` p - ON (p.`id_product` = hri.`id_product`) - WHERE p.`active` = 1 - AND hbd.`is_refunded` = 0 - AND hbd.`is_cancelled` = 0 - AND hbd.`id_status` = '.(int) HotelBookingDetail::STATUS_CHECKED_IN. - (($date) ? ' AND ("'.pSQL($date).'" BETWEEN hbd.`date_from` AND hbd.`date_to`) ' : ''); - (!is_null($idHotel) ? HotelBranchInformation::addHotelRestriction($idHotel, 'hbd') : ''); - $result = Db::getInstance()->getValue($sql); - - return $result; - } - - /** - * Returns the number of rooms that have been booked but not checked-in yet. - */ - public static function getBookedRooms($idHotel = null) - { - $dateToday = date('Y-m-d'); - - $sql = 'SELECT COUNT(DISTINCT hbd.`id_room`) - FROM `'._DB_PREFIX_.'htl_booking_detail` hbd - WHERE hbd.`is_refunded` = 0 - AND hbd.`is_cancelled` = 0 - AND hbd.`id_status` = '.(int) HotelBookingDetail::STATUS_ALLOTED.' - AND hbd.`date_from` = "'.pSQL($dateToday).' 00:00:00"'. - (!is_null($idHotel) ? HotelBranchInformation::addHotelRestriction($idHotel, 'hbd') : ''); - $result = Db::getInstance()->getValue($sql); - - return $result; - } - public static function getTotalFrequentCustomers($nbOrders = 5, $idHotel = null) { $sql = 'SELECT COUNT(t.`id_customer`) @@ -1972,7 +1958,7 @@ class AdminStatsControllerCore extends AdminStatsTabController $nightsBookedByDate = self::getRoomNightsData($dateFrom, $dateTo, $idHotel); $totalNightsBooked = array_sum($nightsBookedByDate); - $totalOccupiedRoom = self::getTotalOccupiedRooms($dateFrom, $dateTo, $idHotel); + $totalOccupiedRoom = self::getTotalBookedRooms($dateFrom, $dateTo, $idHotel); return $totalOccupiedRoom ? ($totalNightsBooked / $totalOccupiedRoom) : 0; } From 1a4635e769f8661fe36f6c0e7c5248804d38bcf1 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Wed, 29 May 2024 11:56:26 +0530 Subject: [PATCH 23/82] Fixed: admin can create new account using the baaned account email --- .../admin/AdminCustomersController.php | 42 ++++++++++++++++ js/admin/customers.js | 50 +++++++++++++++++++ 2 files changed, 92 insertions(+) create mode 100644 js/admin/customers.js diff --git a/controllers/admin/AdminCustomersController.php b/controllers/admin/AdminCustomersController.php index 6c763f10c..148c5effe 100644 --- a/controllers/admin/AdminCustomersController.php +++ b/controllers/admin/AdminCustomersController.php @@ -1049,6 +1049,9 @@ class AdminCustomersControllerCore extends AdminController $this->errors[] = Tools::displayError('An account already exists for this email address:').' '.$customer_email; $this->display = 'edit'; return $customer; + } elseif (trim(Customer::customerExists($customer_email, false, true))) { + $this->errors[] = Tools::displayError('The email is already associated with a banned account. Please use a different one.'); + $this->display = 'edit'; } elseif (trim(Tools::getValue('passwd')) == '') { $this->validateRules(); $this->errors[] = Tools::displayError('Password can not be empty.'); @@ -1289,4 +1292,43 @@ class AdminCustomersControllerCore extends AdminController die('ok'); } } + + public function ajaxProcessVerifyCustomerEmail() + { + $response = array( + 'status' => true + ); + if ($email = Tools::getValue('email')) { + $newIdCustomer = Tools::getValue('id_customer', 0); + $oldIdCustomer = Customer::customerExists($email, true, false); + if ($oldIdCustomer) { // means that the account exists. + $objCustomer = Customer::getByEmail($email, null, false); + if (!$objCustomer // means that the customer was deleted + && $oldIdCustomer != $newIdCustomer // the admin is trying to update another account in case the new id is not zero + ) { + $response['status'] = false; + $response['msg'] = Tools::displayError('The email is already associated with a banned account. Please use a different one.'); + } + } + } + + $this->ajaxDie(json_encode($response)); + } + + public function setMedia() + { + parent::setMedia(); + if ($this->loadObject(true) + && ($this->display == 'edit' || $this->display == 'add') + ) { + $idCustomer = $this->object->id ? $this->object->id : 0; + Media::addJSDef( + array( + 'customer_controller_url' => self::$currentIndex.'&token='.$this->token, + 'id_customer' => $idCustomer + ) + ); + $this->addJS(_PS_JS_DIR_.'admin/customers.js'); + } + } } diff --git a/js/admin/customers.js b/js/admin/customers.js new file mode 100644 index 000000000..206df3c61 --- /dev/null +++ b/js/admin/customers.js @@ -0,0 +1,50 @@ +/* +* Copyright since 2010 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 Since 2010 Webkul IN +* @license https://store.webkul.com/license.html +*/ + +$(document).ready(function() { + $(document).on('focusout', '#email', function() { + var email = $.trim($('#email').val()); + if (email != '') { + $.ajax({ + url: customer_controller_url, + method: 'POST', + dataType: 'json', + data: { + ajax : 1, + id_customer: id_customer, + email: email, + action: 'verifyCustomerEmail' + }, + success: function(response) { + if (!response.status) { + if ($('#email').closest('.input-group').parent().find('.customer_email_msg').length) { + $('.customer_email_msg').text(response.msg); + } else { + $('#email').closest('.input-group').parent().append('

    '+ response.msg+'

    '); + } + + $('.customer_email_msg').show(); + } else { + $('.customer_email_msg').hide(); + } + } + }); + } + }); +}); \ No newline at end of file From 707393d2d7d8ef0182c61a580f050e8b59162b4e Mon Sep 17 00:00:00 2001 From: Shreesh Arora Date: Wed, 29 May 2024 19:54:05 +0530 Subject: [PATCH 24/82] Added: option to add voucher expiry date while managing refund request --- .../admin/AdminOrderRefundRequestsController.php | 14 +++++++++++++- .../views/js/admin/wk_refund_request.js | 15 +++++++++++++++ .../order_refund_requests/helpers/view/view.tpl | 14 ++++++++++++++ 3 files changed, 42 insertions(+), 1 deletion(-) diff --git a/modules/hotelreservationsystem/controllers/admin/AdminOrderRefundRequestsController.php b/modules/hotelreservationsystem/controllers/admin/AdminOrderRefundRequestsController.php index fa74ab46a..5cc134d9d 100644 --- a/modules/hotelreservationsystem/controllers/admin/AdminOrderRefundRequestsController.php +++ b/modules/hotelreservationsystem/controllers/admin/AdminOrderRefundRequestsController.php @@ -338,6 +338,11 @@ class AdminOrderRefundRequestsController extends ModuleAdminController } else { $this->errors[] = $this->l('Invalid refund state.'); } + if ($voucher_expiry_date = Tools::getValue('voucher_expiry_date')) { + if (!Validate::isDate($voucher_expiry_date)) { + $this->errors[] = $this->l('Invalid voucher expiry date.'); + } + } } else { $this->errors[] = $this->l('Invalid refund information found.'); } @@ -491,7 +496,12 @@ class AdminOrderRefundRequestsController extends ModuleAdminController $cartrule->id_customer = $objOrder->id_customer; $now = time(); $cartrule->date_from = date('Y-m-d H:i:s', $now); - $cartrule->date_to = date('Y-m-d H:i:s', $now + (3600 * 24 * 365.25)); /* 1 year */ + // generateDiscount + if ($voucher_expiry_date) { + $cartrule->date_to = date('Y-m-d H:i:s', strtotime($voucher_expiry_date)); + } else { + $cartrule->date_to = date('Y-m-d H:i:s', $now + (3600 * 24 * 365.25)); /* 1 year */ + } $cartrule->active = 1; $cartrule->highlight = 1; $cartrule->reduction_amount = $totalRefundedAmount; @@ -570,6 +580,8 @@ class AdminOrderRefundRequestsController extends ModuleAdminController parent::setMedia(); $this->addJqueryUI('ui.tooltip', 'base', true); + $this->removeJS(Media::getJqueryUIPath('effects.core', 'base', false), false); + $this->addJs(_MODULE_DIR_.$this->module->name.'/views/js/admin/wk_refund_request.js'); $this->addCSS(_MODULE_DIR_.$this->module->name.'/views/css/admin/wk_refund_request.css'); diff --git a/modules/hotelreservationsystem/views/js/admin/wk_refund_request.js b/modules/hotelreservationsystem/views/js/admin/wk_refund_request.js index 4395ff914..f87b8e3f5 100644 --- a/modules/hotelreservationsystem/views/js/admin/wk_refund_request.js +++ b/modules/hotelreservationsystem/views/js/admin/wk_refund_request.js @@ -70,6 +70,21 @@ $(document).ready(function() { } }); + $('#voucher_expiry').datepicker({ + dateFormat: 'dd-mm-yy', + altFormat: 'yy-mm-dd', + altField: '#voucher_expiry_date', + minDate: 0, + }); + + $(document).on('change', '#generateDiscount', function() { + if ($(this).is(':checked')) { + $(".generate_discount_fields").show(200); + } else { + $(".generate_discount_fields").hide(200); + } + }); + $('#id_refund_state').on('change', function() { if ($("#id_refund_state option:selected").attr('refunded') == 1) { $(".refunded_state_fields").show(200); diff --git a/modules/hotelreservationsystem/views/templates/admin/order_refund_requests/helpers/view/view.tpl b/modules/hotelreservationsystem/views/templates/admin/order_refund_requests/helpers/view/view.tpl index e65a96df7..90cb90f65 100644 --- a/modules/hotelreservationsystem/views/templates/admin/order_refund_requests/helpers/view/view.tpl +++ b/modules/hotelreservationsystem/views/templates/admin/order_refund_requests/helpers/view/view.tpl @@ -353,6 +353,20 @@
    + {/if} {/if} From e8551769b87221eda98f65acb166216a9c8cd4a8 Mon Sep 17 00:00:00 2001 From: Shreesh Arora Date: Thu, 6 Jun 2024 19:47:06 +0530 Subject: [PATCH 25/82] Added: Different Advance price rule for different group for same date ranges --- .../classes/HotelRoomTypeFeaturePricing.php | 46 +++++++++++-------- .../admin/AdminHotelFeaturePricesSettings.php | 11 ++++- 2 files changed, 37 insertions(+), 20 deletions(-) diff --git a/modules/hotelreservationsystem/classes/HotelRoomTypeFeaturePricing.php b/modules/hotelreservationsystem/classes/HotelRoomTypeFeaturePricing.php index 5dbfbd1db..a49d60ec1 100644 --- a/modules/hotelreservationsystem/classes/HotelRoomTypeFeaturePricing.php +++ b/modules/hotelreservationsystem/classes/HotelRoomTypeFeaturePricing.php @@ -180,6 +180,7 @@ class HotelRoomTypeFeaturePricing extends ObjectModel $id_product, $date_from, $date_to, + $groups, $type = 'date_range', $current_Special_days = false, $id_feature_price = 0 @@ -188,20 +189,26 @@ class HotelRoomTypeFeaturePricing extends ObjectModel $date_to = date('Y-m-d', strtotime($date_to)); if ($type == 'specific_date') { return Db::getInstance()->getRow( - 'SELECT * FROM `'._DB_PREFIX_.'htl_room_type_feature_pricing` - WHERE `id_product`='.(int) $id_product.' AND `active`=1 - AND `date_selection_type` = '.(int) self::DATE_SELECTION_TYPE_SPECIFIC.' - AND `date_from` = \''.pSQL($date_from).'\' - AND `id_feature_price`!='.(int) $id_feature_price + 'SELECT * FROM `'._DB_PREFIX_.'htl_room_type_feature_pricing` rtfp + INNER JOIN `'._DB_PREFIX_.'htl_room_type_feature_pricing_group` rtfpg + ON (rtfp.`id_feature_price` = rtfpg.`id_feature_price`) + WHERE rtfp.`id_product`='.(int) $id_product.' AND rtfp.`active`=1 + AND rtfp.`date_selection_type` = '.(int) self::DATE_SELECTION_TYPE_SPECIFIC.' + AND rtfp.`date_from` = \''.pSQL($date_from).'\' + AND rtfp.`id_feature_price`!='.(int) $id_feature_price.' + AND rtfpg.`id_group` IN ('.pSQL(implode(', ',$groups)).')' ); } elseif ($type == 'special_day') { $featurePrices = Db::getInstance()->executeS( - 'SELECT * FROM `'._DB_PREFIX_.'htl_room_type_feature_pricing` - WHERE `id_product`='.(int) $id_product.' - AND `is_special_days_exists`=1 AND `active`=1 - AND `date_from` < \''.pSQL($date_to).'\' - AND `date_to` > \''.pSQL($date_from).'\' - AND `id_feature_price`!='.(int) $id_feature_price + 'SELECT * FROM `'._DB_PREFIX_.'htl_room_type_feature_pricing` rtfp + INNER JOIN `'._DB_PREFIX_.'htl_room_type_feature_pricing_group` rtfpg + ON (rtfp.`id_feature_price` = rtfpg.`id_feature_price`) + WHERE rtfp.`id_product`='.(int) $id_product.' + AND rtfp.`is_special_days_exists`=1 AND `active`=1 + AND rtfp.`date_from` < \''.pSQL($date_to).'\' + AND rtfp.`date_to` > \''.pSQL($date_from).'\' + AND rtfp.`id_feature_price`!='.(int) $id_feature_price.' + AND rtfpg.`id_group` IN ('.pSQL(implode(', ',$groups)).')' ); if ($featurePrices) { foreach ($featurePrices as $featurePrice) { @@ -216,13 +223,16 @@ class HotelRoomTypeFeaturePricing extends ObjectModel return false; } elseif ($type == 'date_range') { return Db::getInstance()->getRow( - 'SELECT * FROM `'._DB_PREFIX_.'htl_room_type_feature_pricing` - WHERE `id_product`='.(int) $id_product.' AND `active`=1 - AND `date_selection_type` = '.(int) self::DATE_SELECTION_TYPE_RANGE.' - AND `is_special_days_exists`=0 - AND `date_from` <= \''.pSQL($date_to).'\' - AND `date_to` >= \''.pSQL($date_from).'\' - AND `id_feature_price`!='.(int) $id_feature_price + 'SELECT * FROM `'._DB_PREFIX_.'htl_room_type_feature_pricing` rtfp + INNER JOIN `'._DB_PREFIX_.'htl_room_type_feature_pricing_group` rtfpg + ON (rtfp.`id_feature_price` = rtfpg.`id_feature_price`) + WHERE rtfp.`id_product`='.(int) $id_product.' AND rtfp.`active`=1 + AND rtfp.`date_selection_type` = '.(int) self::DATE_SELECTION_TYPE_RANGE.' + AND rtfp.`is_special_days_exists`=0 + AND rtfp.`date_from` <= \''.pSQL($date_to).'\' + AND rtfp.`date_to` >= \''.pSQL($date_from).'\' + AND rtfp.`id_feature_price`!='.(int) $id_feature_price.' + AND rtfpg.`id_group` IN ('.pSQL(implode(', ',$groups)).')' ); } return false; diff --git a/modules/hotelreservationsystem/controllers/admin/AdminHotelFeaturePricesSettings.php b/modules/hotelreservationsystem/controllers/admin/AdminHotelFeaturePricesSettings.php index d77a293a2..0652f90c7 100644 --- a/modules/hotelreservationsystem/controllers/admin/AdminHotelFeaturePricesSettings.php +++ b/modules/hotelreservationsystem/controllers/admin/AdminHotelFeaturePricesSettings.php @@ -182,6 +182,7 @@ class AdminHotelFeaturePricesSettingsController extends ModuleAdminController $objFeaturePricing->id_product, $objFeaturePricing->date_from, $objFeaturePricing->date_to, + $objFeaturePricing->getGroups($objFeaturePricing->id), $objFeaturePricing->id, $objFeaturePricing->is_special_days_exists, $objFeaturePricing->special_days @@ -283,6 +284,7 @@ class AdminHotelFeaturePricesSettingsController extends ModuleAdminController $roomTypeId, $dateFrom, $dateTo, + $group, $idFeaturePrice, $isSpecialDaysExists = false, $jsonSpecialDays = "false" @@ -293,6 +295,7 @@ class AdminHotelFeaturePricesSettingsController extends ModuleAdminController $roomTypeId, $dateFrom, $dateTo, + $group, 'specific_date', false, $idFeaturePrice @@ -302,6 +305,7 @@ class AdminHotelFeaturePricesSettingsController extends ModuleAdminController $roomTypeId, $dateFrom, $dateTo, + $group, 'special_day', $jsonSpecialDays, $idFeaturePrice @@ -311,6 +315,7 @@ class AdminHotelFeaturePricesSettingsController extends ModuleAdminController $roomTypeId, $dateFrom, $dateTo, + $group, 'date_range', false, $idFeaturePrice @@ -335,6 +340,7 @@ class AdminHotelFeaturePricesSettingsController extends ModuleAdminController $impactValue = Tools::getValue('impact_value'); $dateSelectionType = Tools::getValue('date_selection_type'); $specificDate = date('Y-m-d', strtotime(Tools::getValue('specific_date'))); + $groups = Tools::getValue('groupBox'); $jsonSpecialDays = json_encode($specialDays); $defaultLangId = Configuration::get('PS_LANG_DEFAULT'); @@ -361,6 +367,7 @@ class AdminHotelFeaturePricesSettingsController extends ModuleAdminController $roomTypeId, $dateFrom, $dateTo, + $groups, $idFeaturePrice, $isSpecialDaysExists, $jsonSpecialDays @@ -435,7 +442,7 @@ class AdminHotelFeaturePricesSettingsController extends ModuleAdminController } } - if (!(bool)Tools::getValue('groupBox')) { + if (!(bool)$groups) { $this->errors[] = $this->l('Please select at least one group for the group access'); } @@ -467,7 +474,7 @@ class AdminHotelFeaturePricesSettingsController extends ModuleAdminController $objFeaturePricing->active = $enableFeaturePrice; // set the values of the groups for this feature price - $objFeaturePricing->groupBox = Tools::getValue('groupBox'); + $objFeaturePricing->groupBox = $groups; if ($objFeaturePricing->save()) { if (Tools::isSubmit('submitAdd'.$this->table.'AndStay')) { From 08d9017845a894307685f73e815030adcfe43dba Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Tue, 11 Jun 2024 12:02:44 +0530 Subject: [PATCH 26/82] applied changes to the new uploaded files after merge --- .../wkroomsearchblock/views/templates/front/hotel-options.tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/wkroomsearchblock/views/templates/front/hotel-options.tpl b/modules/wkroomsearchblock/views/templates/front/hotel-options.tpl index b6dd9cd0d..1c258d2c8 100644 --- a/modules/wkroomsearchblock/views/templates/front/hotel-options.tpl +++ b/modules/wkroomsearchblock/views/templates/front/hotel-options.tpl @@ -20,7 +20,7 @@ {if isset($hotels_info) && is_array($hotels_info)} {foreach from=$hotels_info item=hotel_info} - {/foreach} From e7c85cd15424cfa48b93175dfeab5f9ea4df8903 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Wed, 12 Jun 2024 11:28:54 +0530 Subject: [PATCH 27/82] Fixed: Hotel locations is displayed on the google map at order-detail and category page even if option 'Display Google Maps For Hotel Location' is disabled --- controllers/front/GuestTrackingController.php | 4 +++- controllers/front/OrderDetailController.php | 5 ++++- .../admin/AdminHotelGeneralSettingsController.php | 2 +- modules/hotelreservationsystem/hotelreservationsystem.php | 4 +++- themes/hotel-reservation-theme/order-detail.tpl | 4 ++-- 5 files changed, 13 insertions(+), 6 deletions(-) diff --git a/controllers/front/GuestTrackingController.php b/controllers/front/GuestTrackingController.php index e7017e12f..b58af864e 100644 --- a/controllers/front/GuestTrackingController.php +++ b/controllers/front/GuestTrackingController.php @@ -629,7 +629,9 @@ class GuestTrackingControllerCore extends FrontController if ($idHotel = HotelBookingDetail::getIdHotelByIdOrder($objOrder->id)) { $objHotelBranchInformation = new HotelBranchInformation($idHotel, $this->context->language->id); if (Validate::isLoadedObject($objHotelBranchInformation)) { - if ($apiKey = Configuration::get('PS_API_KEY')) { + if (($apiKey = Configuration::get('PS_API_KEY')) + && Configuration::get('WK_GOOGLE_ACTIVE_MAP') + ) { if (floatval($objHotelBranchInformation->latitude) != 0 && floatval($objHotelBranchInformation->longitude) != 0 ) { diff --git a/controllers/front/OrderDetailController.php b/controllers/front/OrderDetailController.php index afa1ea9e8..ed11b9cc3 100644 --- a/controllers/front/OrderDetailController.php +++ b/controllers/front/OrderDetailController.php @@ -406,6 +406,7 @@ class OrderDetailControllerCore extends FrontController 'obj_hotel_branch_information' => $objHotelBranchInformation, 'hotel_address_info' => $hotelAddressInfo, 'hotel_refund_rules' => $hotelRefundRules, + 'view_on_google_map' => Configuration::get('WK_GOOGLE_ACTIVE_MAP'), ) ); // } @@ -782,7 +783,9 @@ class OrderDetailControllerCore extends FrontController if ($idHotel = HotelBookingDetail::getIdHotelByIdOrder(Tools::getValue('id_order'))) { $objHotelBranchInformation = new HotelBranchInformation($idHotel, $this->context->language->id); if (Validate::isLoadedObject($objHotelBranchInformation)) { - if ($apiKey = Configuration::get('PS_API_KEY')) { + if (($apiKey = Configuration::get('PS_API_KEY')) + && Configuration::get('WK_GOOGLE_ACTIVE_MAP') + ) { if (floatval($objHotelBranchInformation->latitude) != 0 && floatval($objHotelBranchInformation->longitude) != 0 ) { diff --git a/modules/hotelreservationsystem/controllers/admin/AdminHotelGeneralSettingsController.php b/modules/hotelreservationsystem/controllers/admin/AdminHotelGeneralSettingsController.php index 2d8d7ff6d..a0fb09dad 100644 --- a/modules/hotelreservationsystem/controllers/admin/AdminHotelGeneralSettingsController.php +++ b/modules/hotelreservationsystem/controllers/admin/AdminHotelGeneralSettingsController.php @@ -307,7 +307,7 @@ class AdminHotelGeneralSettingsController extends ModuleAdminController 'value' => 0, ), ), - 'hint' => $this->l('If set to No, Google Maps will not be displayed for hotel location. You need to set hotels location from edit hotel page to display location on the map at contact-us page.'), + 'hint' => $this->l('If set to No, Google Maps will not be displayed for hotel location. You need to set hotels location from edit hotel page to display location on the map on front office.'), ), 'WK_MAP_HOTEL_ACTIVE_ONLY' => array( 'title' => $this->l('Display Active Hotels Only'), diff --git a/modules/hotelreservationsystem/hotelreservationsystem.php b/modules/hotelreservationsystem/hotelreservationsystem.php index 76a6c3bae..d2bfe7cb0 100644 --- a/modules/hotelreservationsystem/hotelreservationsystem.php +++ b/modules/hotelreservationsystem/hotelreservationsystem.php @@ -293,7 +293,9 @@ class HotelReservationSystem extends Module public function hookDisplayLeftColumn() { if (Tools::getValue('controller') == 'category') { - if ($apiKey = Configuration::get('PS_API_KEY')) { + if (($apiKey = Configuration::get('PS_API_KEY')) + && Configuration::get('WK_GOOGLE_ACTIVE_MAP') + ) { $idCategory = Tools::getValue('id_category'); $idHotel = HotelBranchInformation::getHotelIdByIdCategory($idCategory); $objHotel = new HotelBranchInformation($idHotel, $this->context->language->id); diff --git a/themes/hotel-reservation-theme/order-detail.tpl b/themes/hotel-reservation-theme/order-detail.tpl index e0000be46..ebbc7575e 100644 --- a/themes/hotel-reservation-theme/order-detail.tpl +++ b/themes/hotel-reservation-theme/order-detail.tpl @@ -155,7 +155,7 @@
    {l s='Hotel location not available.'}
    {/if} - {if ($obj_hotel_branch_information->latitude|floatval != 0 && $obj_hotel_branch_information->longitude|floatval != 0)} + {if ($obj_hotel_branch_information->latitude|floatval != 0 && $obj_hotel_branch_information->longitude|floatval != 0) && $view_on_google_map}
    @@ -542,7 +542,7 @@
    {l s='Hotel location not available.'}
    {/if} - {if ($obj_hotel_branch_information->latitude|floatval != 0 && $obj_hotel_branch_information->longitude|floatval != 0)} + {if ($obj_hotel_branch_information->latitude|floatval != 0 && $obj_hotel_branch_information->longitude|floatval != 0) && $view_google_map}
    From 601e51b514c42848b0c7562cd7f9307982fe72fd Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Fri, 14 Jun 2024 12:39:42 +0530 Subject: [PATCH 28/82] Fixed the new customer KPI --- .../admin/AdminCustomersController.php | 20 +++++++++++++++++++ controllers/admin/AdminStatsController.php | 8 +++++++- modules/dashactivity/views/js/dashactivity.js | 6 ++++-- .../templates/hook/dashboard_zone_one.tpl | 2 +- 4 files changed, 32 insertions(+), 4 deletions(-) diff --git a/controllers/admin/AdminCustomersController.php b/controllers/admin/AdminCustomersController.php index 6c763f10c..526c59dbb 100644 --- a/controllers/admin/AdminCustomersController.php +++ b/controllers/admin/AdminCustomersController.php @@ -230,6 +230,23 @@ class AdminCustomersControllerCore extends AdminController )); } + $prefix = $this->getCookieFilterPrefix(); + if (Tools::getValue('filterOnlyNewCustomer')) { + if (($dateFrom = Tools::getValue('date_from')) + && ($dateTo = Tools::getValue('date_to')) + && strtotime($dateTo) >= strtotime($dateFrom) + ) { + $this->processResetFilters(); + $this->context->cookie->{'submitFilter'.$this->table} = true; + //Updating the date format of the filter dates to the desired format. + $dateFrom = date('Y-m-d', strtotime($dateFrom)); + $dateTo = date('Y-m-d', strtotime($dateTo)); + $this->context->cookie->{$prefix.$this->table.'Filter_date_add'} = json_encode(array($dateFrom, $dateTo)); + } + + $this->redirect_after = $this->context->link->getAdminLink('AdminCustomers'); + } + if (!$this->can_add_customer && !$this->display) { $this->informations[] = $this->l('You have to select a shop if you want to create a customer.'); } @@ -739,6 +756,9 @@ class AdminCustomersControllerCore extends AdminController $helper->color = 'color4'; $helper->title = $this->l('New Customers', null, null, false); $nbDaysNewCustomers = Validate::isUnsignedInt(Configuration::get('PS_KPI_NEW_CUSTOMERS_NB_DAYS')) ? Configuration::get('PS_KPI_NEW_CUSTOMERS_NB_DAYS') : 30; + $date_from = date('Y-m-d', strtotime('-'.$nbDaysNewCustomers.' day')); + $date_to = date('Y-m-d'); + $helper->href = $this->context->link->getAdminLink('AdminCustomers').'&filterOnlyNewCustomer=1&date_from='.$date_from.'&date_to='.$date_to; $helper->subtitle = sprintf($this->l('%d Days', null, null, false), (int) $nbDaysNewCustomers); $helper->source = $this->context->link->getAdminLink('AdminStats').'&ajax=1&action=getKpi&kpi=total_new_customers'; $helper->tooltip = $this->l('The total number of new customers who registered in given period of time.', null, null, false); diff --git a/controllers/admin/AdminStatsController.php b/controllers/admin/AdminStatsController.php index f647411b1..abd0d9be7 100644 --- a/controllers/admin/AdminStatsController.php +++ b/controllers/admin/AdminStatsController.php @@ -981,6 +981,12 @@ class AdminStatsControllerCore extends AdminStatsTabController case 'average_lead_time': $dateToday = date('Y-m-d'); $value = Tools::ps_round(AdminStatsController::getAverageLeadTime(), 2); + if ($value && $value <= 1) { + $value .= ' '.$this->l('day'); + } else { + $value .= ' '.$this->l('days'); + } + break; case 'average_guest_in_booking': $dateToday = date('Y-m-d'); @@ -1879,7 +1885,7 @@ class AdminStatsControllerCore extends AdminStatsTabController public static function getTotalNewCustomers($nbDaysNewCustomers) { - $maxDateAdd = date('Y-m-d H:i:s', strtotime('-'.$nbDaysNewCustomers.' day')); + $maxDateAdd = date('Y-m-d', strtotime('-'.$nbDaysNewCustomers.' day')); $sql = 'SELECT COUNT(c.`id_customer`) FROM `'._DB_PREFIX_.'customer` c WHERE c.`date_add` >= "'.pSQL($maxDateAdd).'" AND c.`deleted` = 0'; diff --git a/modules/dashactivity/views/js/dashactivity.js b/modules/dashactivity/views/js/dashactivity.js index a84820e02..1aa71314a 100644 --- a/modules/dashactivity/views/js/dashactivity.js +++ b/modules/dashactivity/views/js/dashactivity.js @@ -58,7 +58,8 @@ $(document).ready(function() { $('#date-start').change(function() { start = Date.parseDate($('#date-start').val(), 'Y-m-d'); end = Date.parseDate($('#date-end').val(), 'Y-m-d'); - + var url = $('#dash_filter_new_customers').data('href') + '&date_from='+start.format('Y-m-d')+ '&date_to='+ end.format('Y-m-d'); + $('#dash_filter_new_customers').attr('href', url); $('#customers-newsletters-subtitle').html(sprintf(date_subtitle, start.format(date_format), end.format(date_format))); $('#traffic-subtitle').html(sprintf(date_subtitle, start.format(date_format), end.format(date_format))); }); @@ -66,7 +67,8 @@ $(document).ready(function() { $('#date-end').change(function() { start = Date.parseDate($('#date-start').val(), 'Y-m-d'); end = Date.parseDate($('#date-end').val(), 'Y-m-d'); - + var url = $('#dash_filter_new_customers').data('href') + '&date_from='+start.format('Y-m-d')+ '&date_to='+ end.format('Y-m-d'); + $('#dash_filter_new_customers').attr('href', url); $('#customers-newsletters-subtitle').html(sprintf(date_subtitle, start.format(date_format), end.format(date_format))); $('#traffic-subtitle').html(sprintf(date_subtitle, start.format(date_format), end.format(date_format))); }); diff --git a/modules/dashactivity/views/templates/hook/dashboard_zone_one.tpl b/modules/dashactivity/views/templates/hook/dashboard_zone_one.tpl index 95cee2cd3..a649805a3 100644 --- a/modules/dashactivity/views/templates/hook/dashboard_zone_one.tpl +++ b/modules/dashactivity/views/templates/hook/dashboard_zone_one.tpl @@ -121,7 +121,7 @@
    '+v['id_cms']+' - {l s='Tax rate'} + {l s='Tax rule'} {l s='Per day price calculation'} diff --git a/admin/themes/default/template/controllers/products/serviceproduct.tpl b/admin/themes/default/template/controllers/products/serviceproduct.tpl index e7b2001cb..ac93c1ed9 100644 --- a/admin/themes/default/template/controllers/products/serviceproduct.tpl +++ b/admin/themes/default/template/controllers/products/serviceproduct.tpl @@ -27,7 +27,7 @@ {l s='Price'} - {l s='Tax'} + {l s='Tax rule'}