From 55cf83563a2fe25ad09920aaeecfae4f1d960e76 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Wed, 3 Apr 2024 18:53:21 +0530 Subject: [PATCH 001/130] 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 002/130] 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 003/130] 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 @@
    - +
    - - + + @@ -77,7 +77,7 @@ - + diff --git a/admin/themes/default/template/controllers/orders/modals/_extra_services_service_products_tab_content.tpl b/admin/themes/default/template/controllers/orders/modals/_extra_services_service_products_tab_content.tpl index 67412d3fc..ac4ce1231 100644 --- a/admin/themes/default/template/controllers/orders/modals/_extra_services_service_products_tab_content.tpl +++ b/admin/themes/default/template/controllers/orders/modals/_extra_services_service_products_tab_content.tpl @@ -33,8 +33,8 @@ - - + + @@ -101,7 +101,7 @@ - + From 2081d72d74a4377553bfd8cc064ca28414239159 Mon Sep 17 00:00:00 2001 From: Sumit Panwar Date: Wed, 22 May 2024 18:48:19 +0530 Subject: [PATCH 026/130] Fixed: Showing status booked on header even after all bookings are refunded on order detail page in back-office --- .../default/template/controllers/orders/helpers/view/view.tpl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/admin/themes/default/template/controllers/orders/helpers/view/view.tpl b/admin/themes/default/template/controllers/orders/helpers/view/view.tpl index 74eb8d437..9f884e2b1 100644 --- a/admin/themes/default/template/controllers/orders/helpers/view/view.tpl +++ b/admin/themes/default/template/controllers/orders/helpers/view/view.tpl @@ -28,9 +28,9 @@ {block name=pageTitle}

    {if is_array($title)}{$title|end|strip_tags}{else}{$title|strip_tags}{/if} - {if $currentState == Configuration::get('PS_OS_REFUND')} + {if $currentState->id == Configuration::get('PS_OS_REFUND')} {l s='Refunded'} - {elseif $currentState == Configuration::get('PS_OS_CANCELED')} + {elseif $currentState->id == Configuration::get('PS_OS_CANCELED')} {l s='Cancelled'} {else} {l s='Booked'} From 3433aec4b222d5fb79e33c9575b30608ff119b83 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Mon, 27 May 2024 12:00:37 +0530 Subject: [PATCH 027/130] Updated: The google maps will now display the store icon insted of the default marker --- controllers/front/StoresController.php | 6 +++++- modules/hotelreservationsystem/hotelreservationsystem.php | 7 +++++++ .../views/js/HotelReservationAdmin.js | 1 + .../hotelreservationsystem/views/js/searchResultsMap.js | 1 + themes/hotel-reservation-theme/js/contact-form.js | 1 + themes/hotel-reservation-theme/js/order-detail.js | 1 + themes/hotel-reservation-theme/js/product.js | 1 + 7 files changed, 17 insertions(+), 1 deletion(-) diff --git a/controllers/front/StoresController.php b/controllers/front/StoresController.php index 89f21c5ac..901f5ec7d 100644 --- a/controllers/front/StoresController.php +++ b/controllers/front/StoresController.php @@ -208,8 +208,12 @@ class StoresControllerCore extends FrontController */ protected function assignStores() { - $this->context->smarty->assign('hasStoreIcon', Tools::file_get_contents($this->context->link->getMediaLink(_PS_IMG_DIR_.Configuration::get('PS_STORES_ICON')))); // by webkul to get media link. + $hasStoreIcon = false; + if (Tools::file_get_contents($this->context->link->getMediaLink(_PS_IMG_.Configuration::get('PS_STORES_ICON')))) { // by webkul to get media link. + $hasStoreIcon = true; + } + $this->context->smarty->assign('hasStoreIcon', $hasStoreIcon); $distance_unit = Configuration::get('PS_DISTANCE_UNIT'); if (!in_array($distance_unit, array('km', 'mi'))) { $distance_unit = 'km'; diff --git a/modules/hotelreservationsystem/hotelreservationsystem.php b/modules/hotelreservationsystem/hotelreservationsystem.php index bf6473245..0466fcf00 100644 --- a/modules/hotelreservationsystem/hotelreservationsystem.php +++ b/modules/hotelreservationsystem/hotelreservationsystem.php @@ -87,6 +87,9 @@ class HotelReservationSystem extends Module public function hookActionFrontControllerSetMedia() { + Media::addJsDef(array( + 'PS_STORES_ICON' => $this->context->link->getMediaLink(_PS_IMG_.Configuration::get('PS_STORES_ICON')) + )); if (Configuration::get('WK_CUSTOMER_SUPPORT_PHONE_NUMBER') != '' || Configuration::get('WK_CUSTOMER_SUPPORT_EMAIL') != '' ) { @@ -492,6 +495,10 @@ class HotelReservationSystem extends Module public function hookDisplayBackOfficeHeader() { + Media::addJsDef(array( + 'PS_STORES_ICON' => $this->context->link->getMediaLink(_PS_IMG_.Configuration::get('PS_STORES_ICON')) + )); + $this->context->controller->addCSS($this->_path.'views/css/admin/css/hotel_admin_tab_logo.css'); } diff --git a/modules/hotelreservationsystem/views/js/HotelReservationAdmin.js b/modules/hotelreservationsystem/views/js/HotelReservationAdmin.js index c923b0eea..160df0a5f 100644 --- a/modules/hotelreservationsystem/views/js/HotelReservationAdmin.js +++ b/modules/hotelreservationsystem/views/js/HotelReservationAdmin.js @@ -217,6 +217,7 @@ var GoogleMapsManager = { position: latLng, map: that.map, draggable: true, + icon: PS_STORES_ICON }); that.markers.push(marker); marker.addListener('dragend', function(e) { diff --git a/modules/hotelreservationsystem/views/js/searchResultsMap.js b/modules/hotelreservationsystem/views/js/searchResultsMap.js index cc58afebd..f24c762c4 100644 --- a/modules/hotelreservationsystem/views/js/searchResultsMap.js +++ b/modules/hotelreservationsystem/views/js/searchResultsMap.js @@ -34,6 +34,7 @@ function initMap() { position: hotelLocation, map: map, title: hotel_name, + icon: PS_STORES_ICON }); marker.addListener('click', function() { diff --git a/themes/hotel-reservation-theme/js/contact-form.js b/themes/hotel-reservation-theme/js/contact-form.js index 8a77661d6..4f8f51dc2 100644 --- a/themes/hotel-reservation-theme/js/contact-form.js +++ b/themes/hotel-reservation-theme/js/contact-form.js @@ -93,6 +93,7 @@ function initMap() { map: map, title: location.hotel_name, animation: google.maps.Animation.DROP, + icon: PS_STORES_ICON }); // Allow each marker to have an info window diff --git a/themes/hotel-reservation-theme/js/order-detail.js b/themes/hotel-reservation-theme/js/order-detail.js index 6a54f74b0..26d1fcb99 100644 --- a/themes/hotel-reservation-theme/js/order-detail.js +++ b/themes/hotel-reservation-theme/js/order-detail.js @@ -115,6 +115,7 @@ function initMap() { position: hotelLocation, map: map, title: hotel_name, + icon: PS_STORES_ICON }); marker.addListener('click', function() { diff --git a/themes/hotel-reservation-theme/js/product.js b/themes/hotel-reservation-theme/js/product.js index 4974d31e2..4d340fcf9 100644 --- a/themes/hotel-reservation-theme/js/product.js +++ b/themes/hotel-reservation-theme/js/product.js @@ -1275,6 +1275,7 @@ function initMap() { const marker = new google.maps.Marker({ position: hotelLatLng, map: map, + icon: PS_STORES_ICON }); const uiContent = $('#room-info-map-ui-content .hotel-info-wrap').get(0); From d47362e483ff44f82d93aa9c69e8d3d16431ccd9 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Mon, 27 May 2024 12:52:09 +0530 Subject: [PATCH 028/130] 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 029/130] 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 030/130] 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 cbf7a64e114c07fd008c7a4e75f75f894063fd30 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Tue, 28 May 2024 17:09:18 +0530 Subject: [PATCH 031/130] Added: option to view new customers in Admin Customer list using the KPI and the new customers option in dashboard --- .../admin/AdminCustomersController.php | 20 +++++++++++++++++++ controllers/admin/AdminStatsController.php | 2 +- modules/dashactivity/views/js/dashactivity.js | 4 ++++ .../templates/hook/dashboard_zone_one.tpl | 2 +- 4 files changed, 26 insertions(+), 2 deletions(-) diff --git a/controllers/admin/AdminCustomersController.php b/controllers/admin/AdminCustomersController.php index 6c763f10c..cdc291da4 100644 --- a/controllers/admin/AdminCustomersController.php +++ b/controllers/admin/AdminCustomersController.php @@ -217,6 +217,23 @@ class AdminCustomersControllerCore extends AdminController $this->redirect_after = $this->context->link->getAdminLink('AdminCustomers'); } + if (Tools::getValue('action') == '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; + $prefix = $this->getCookieFilterPrefix(); + //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'); + } + parent::postProcess(); } @@ -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 2de11a362..86e20a67f 100644 --- a/controllers/admin/AdminStatsController.php +++ b/controllers/admin/AdminStatsController.php @@ -1885,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..8343efa89 100644 --- a/modules/dashactivity/views/js/dashactivity.js +++ b/modules/dashactivity/views/js/dashactivity.js @@ -58,6 +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,6 +68,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..a0d0a48c8 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 @@
    • - + {l s="New Customers" mod='dashactivity'} From 19e74a7ff27d66dd1c05a19046668e7faf95dca8 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Wed, 29 May 2024 09:56:56 +0530 Subject: [PATCH 032/130] Added: Admin can now filter the using banned status of the customer in the listing in the admin customer controller --- controllers/admin/AdminCustomersController.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/controllers/admin/AdminCustomersController.php b/controllers/admin/AdminCustomersController.php index cdc291da4..3344f23a2 100644 --- a/controllers/admin/AdminCustomersController.php +++ b/controllers/admin/AdminCustomersController.php @@ -170,6 +170,11 @@ class AdminCustomersControllerCore extends AdminController 'type' => 'datetime', 'search' => false, 'havingFilter' => true + ), + 'deleted' => array( + 'title' => $this->l('Banned'), + 'type' => 'bool', + 'displayed' => false, ) )); @@ -217,14 +222,14 @@ class AdminCustomersControllerCore extends AdminController $this->redirect_after = $this->context->link->getAdminLink('AdminCustomers'); } - if (Tools::getValue('action') == 'filterOnlyNewCustomer') { + $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; - $prefix = $this->getCookieFilterPrefix(); //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)); @@ -235,6 +240,10 @@ class AdminCustomersControllerCore extends AdminController } parent::postProcess(); + $filters = $this->context->cookie->getFamily($prefix.$this->table.'Filter_'); + if (isset($filters[$prefix.$this->table.'Filter_deleted']) && $filters[$prefix.$this->table.'Filter_deleted'] == 1) { + $this->deleted = false; + } } public function initContent() From 1a4635e769f8661fe36f6c0e7c5248804d38bcf1 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Wed, 29 May 2024 11:56:26 +0530 Subject: [PATCH 033/130] 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 034/130] 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 04132d354cc2c6cd2ccf14b07c3615318c58dae3 Mon Sep 17 00:00:00 2001 From: Sumit Panwar Date: Sat, 1 Jun 2024 13:57:13 +0530 Subject: [PATCH 035/130] Fixed: Text mentioned in the manual allotment is not visible on the order detail page in back-office --- .../controllers/orders/helpers/view/view.tpl | 6 ++- .../orders/modals/_room_allotment_comment.tpl | 28 +++++++++++ controllers/admin/AdminOrdersController.php | 24 ++++++++++ js/admin/orders.js | 46 +++++++++++++++++++ 4 files changed, 103 insertions(+), 1 deletion(-) create mode 100644 admin/themes/default/template/controllers/orders/modals/_room_allotment_comment.tpl diff --git a/admin/themes/default/template/controllers/orders/helpers/view/view.tpl b/admin/themes/default/template/controllers/orders/helpers/view/view.tpl index 9f884e2b1..ab8516fb5 100644 --- a/admin/themes/default/template/controllers/orders/helpers/view/view.tpl +++ b/admin/themes/default/template/controllers/orders/helpers/view/view.tpl @@ -125,7 +125,7 @@

    {/foreach} diff --git a/admin/themes/default/template/controllers/orders/modals/_room_allotment_comment.tpl b/admin/themes/default/template/controllers/orders/modals/_room_allotment_comment.tpl new file mode 100644 index 000000000..859ee5cb0 --- /dev/null +++ b/admin/themes/default/template/controllers/orders/modals/_room_allotment_comment.tpl @@ -0,0 +1,28 @@ +{* +* 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 +*} + + diff --git a/controllers/admin/AdminOrdersController.php b/controllers/admin/AdminOrdersController.php index c08b5f111..ef9e6ad44 100644 --- a/controllers/admin/AdminOrdersController.php +++ b/controllers/admin/AdminOrdersController.php @@ -779,6 +779,30 @@ class AdminOrdersControllerCore extends AdminController die(Tools::jsonEncode($response)); } + public function ajaxProcessInitRoomAllotmentCommentModal() + { + $response['hasError'] = 1; + if (Validate::isLoadedObject($objBookingDetail = new HotelBookingDetail(Tools::getValue('id_hotel_booking')))) { + if ($objBookingDetail->booking_type == HotelBookingDetail::ALLOTMENT_MANUAL) { + // get booking information by order + $this->context->smarty->assign('comment', $objBookingDetail->comment); + $modal = array( + 'modal_id' => 'room-allotment-comment-modal', + 'modal_class' => 'modal-md order_detail_modal', + 'modal_title' => '  '.$this->l('Room Manual Allotment Comment'), + 'modal_content' => $this->context->smarty->fetch('controllers/orders/modals/_room_allotment_comment.tpl'), + 'modal_actions' => array(), + ); + + $this->context->smarty->assign($modal); + $response['hasError'] = 0; + $response['modalHtml'] = $this->context->smarty->fetch('modal.tpl'); + } + } + + die(Tools::jsonEncode($response)); + } + public function ajaxProcessInitRoomReallocationModal() { // set modal details diff --git a/js/admin/orders.js b/js/admin/orders.js index 25d8111a3..4eaab342f 100644 --- a/js/admin/orders.js +++ b/js/admin/orders.js @@ -1705,6 +1705,18 @@ $(document).ready(function() { // End: RoomStatusModal: Processes // ====================================== + + // Start: RoomAllotmentCommentModal: Processes + $(document).on('click', '.manual_allotment_comment', function(e){ + e.preventDefault(); + + RoomAllotmentCommentModal.show(this); + }); + // End: RoomAllotmentCommentModal: Processes + // ====================================== + + + // Start: RoomReallocationModal: Processes // For processing room reallocation and swapping $(document).on('click', '.room_reallocate_swap', function(e) { @@ -2718,6 +2730,40 @@ const CancelRoomBookingModal = { } }; +// Modal object to handle comment on rooms for manual cancellation +const RoomAllotmentCommentModal = { + show: function(element) { + $(".loading_overlay").show(); + let idHtlBooking = parseInt($(element).attr('data-id_hotel_booking_detail')); + $.ajax({ + type: 'POST', + headers: { + "cache-control": "no-cache" + }, + url: admin_order_tab_link, + dataType: 'JSON', + cache: false, + data: 'ajax=true&id_hotel_booking='+idHtlBooking+'&action=initRoomAllotmentCommentModal', + success: function(result) { + if (result.hasError == 0 && result.modalHtml) { + $('#footer').next('.bootstrap').append(result.modalHtml); + + $('#room-allotment-comment-modal').modal('show'); + + } else { + showErrorMessage(txtSomeErr); + } + }, + complete: function() { + $(".loading_overlay").hide(); + } + }); + }, + close: function() { + $('#room-allotment-comment-modal').modal('hide'); + } +}; + function updateAdditionalServices(element) { var id_room_type_service_product_order_detail = $(element).data('id_room_type_service_product_order_detail'); From 0dbd6290480ccaaf7beae25b0282ee57fa51ba1f Mon Sep 17 00:00:00 2001 From: Sumit Panwar Date: Sat, 1 Jun 2024 15:31:21 +0530 Subject: [PATCH 036/130] Fixed:Should have some gap between Refund status and refund amount on order detail page. --- admin/themes/default/sass/controllers/_order.sass | 5 ++++- .../template/controllers/orders/helpers/view/view.tpl | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/admin/themes/default/sass/controllers/_order.sass b/admin/themes/default/sass/controllers/_order.sass index c32768ed0..d061c8615 100644 --- a/admin/themes/default/sass/controllers/_order.sass +++ b/admin/themes/default/sass/controllers/_order.sass @@ -79,4 +79,7 @@ white-space: normal #noteContent - max-height: 200px \ No newline at end of file + max-height: 200px + +.panel-refund-request .refunded_amount + margin-top: 2px \ No newline at end of file diff --git a/admin/themes/default/template/controllers/orders/helpers/view/view.tpl b/admin/themes/default/template/controllers/orders/helpers/view/view.tpl index ab8516fb5..1ddf349a9 100644 --- a/admin/themes/default/template/controllers/orders/helpers/view/view.tpl +++ b/admin/themes/default/template/controllers/orders/helpers/view/view.tpl @@ -785,7 +785,7 @@ {/if} -
    +
     {l s='Refund Requests'}
    @@ -816,7 +816,7 @@
    From 4740b83032f86d0e95cc7bf6a6ef73103aacd77a Mon Sep 17 00:00:00 2001 From: Sumit Panwar Date: Sat, 1 Jun 2024 15:58:26 +0530 Subject: [PATCH 037/130] Fixed: Children's age with Under 1 showing 0 in order detail page in back-office --- .../controllers/orders/_overbookings.tpl | 10 +++++++--- .../controllers/orders/_product_line.tpl | 6 +++++- .../classes/HotelBookingDetail.php | 16 ++++++++++------ 3 files changed, 22 insertions(+), 10 deletions(-) diff --git a/admin/themes/default/template/controllers/orders/_overbookings.tpl b/admin/themes/default/template/controllers/orders/_overbookings.tpl index b2b89fa6c..154adbccf 100644 --- a/admin/themes/default/template/controllers/orders/_overbookings.tpl +++ b/admin/themes/default/template/controllers/orders/_overbookings.tpl @@ -43,15 +43,19 @@ + @@ -125,25 +126,28 @@ - + {/foreach} @@ -1250,10 +1254,9 @@ {addJsDefL name='select_room_txt'}{l s='Select room' js=1}{/addJsDefL} {addJsDef max_child_age=$max_child_age|escape:'quotes':'UTF-8'} {addJsDef max_child_in_room=$max_child_in_room|escape:'quotes':'UTF-8'} - {addJsDef ROOM_STATUS_ALLOTED=$ROOM_STATUS_ALLOTED|escape:'quotes':'UTF-8'} {addJsDef ROOM_STATUS_CHECKED_IN=$ROOM_STATUS_CHECKED_IN|escape:'quotes':'UTF-8'} {addJsDef ROOM_STATUS_CHECKED_OUT=$ROOM_STATUS_CHECKED_OUT|escape:'quotes':'UTF-8'} - + {addJsDef ALLOTMENT_MANUAL=$ALLOTMENT_MANUAL|escape:'quotes':'UTF-8'} {addJsDefL name=txt_booking_document_upload_success}{l s='Document uploaded successfully.' js=1}{/addJsDefL} {addJsDefL name=txt_booking_document_delete_confirm}{l s='Are you sure?' js=1}{/addJsDefL} {addJsDefL name=txt_booking_document_delete_success}{l s='Document deleted successfully.' js=1}{/addJsDefL} diff --git a/admin/themes/default/template/controllers/orders/modals/_room_reallocation.tpl b/admin/themes/default/template/controllers/orders/modals/_room_reallocation.tpl index 3f2e32f8c..e74ccb1f4 100644 --- a/admin/themes/default/template/controllers/orders/modals/_room_reallocation.tpl +++ b/admin/themes/default/template/controllers/orders/modals/_room_reallocation.tpl @@ -28,15 +28,25 @@
    +
    +
    + +
     
    +
    +
    + +
    +
    +
     
     
    -
    - -
     
    +
    + +
    @@ -90,15 +100,25 @@
    +
    +
    + +
     
    +
    +
    + +
    +
    +
     
     
    -
    - -
     
    +
    + +

    diff --git a/controllers/admin/AdminOrdersController.php b/controllers/admin/AdminOrdersController.php index b7b60278b..08f42a0ac 100644 --- a/controllers/admin/AdminOrdersController.php +++ b/controllers/admin/AdminOrdersController.php @@ -2950,9 +2950,9 @@ class AdminOrdersControllerCore extends AdminController ), 'isCancelledRoom' => $isCancelledRoom, 'orderDocuments' => $order->getDocuments(), - 'ROOM_STATUS_ALLOTED' => HotelBookingDetail::STATUS_ALLOTED, 'ROOM_STATUS_CHECKED_IN' => HotelBookingDetail::STATUS_CHECKED_IN, 'ROOM_STATUS_CHECKED_OUT' => HotelBookingDetail::STATUS_CHECKED_OUT, + 'ALLOTMENT_MANUAL' => HotelBookingDetail::ALLOTMENT_MANUAL, ); return parent::renderView(); diff --git a/js/admin/orders.js b/js/admin/orders.js index 4eaab342f..a792c3e59 100644 --- a/js/admin/orders.js +++ b/js/admin/orders.js @@ -306,11 +306,17 @@ function init() e.preventDefault(); }); + // voucher modal show and close $('#add_voucher').unbind('click').click(function(e) { e.preventDefault(); VoucherModal.show(); }); + $(document).on('hidden.bs.modal', '#voucher-modal', function(){ + $('#voucher-modal').remove(); + }); + // End: voucher modal show and close + $(document).on('change','#discount_type', function(e) { // Percent type if ($(this).val() == 1) @@ -342,11 +348,18 @@ function init() $('select[name=discount_invoice]').attr('disabled', false); }); + // payment information modal show and close $('.open_payment_information').unbind('click').click(function(e) { e.preventDefault(); OrderPaymentDetailModal.show($(this)); }); + $(document).on('hidden.bs.modal', '#payment-detail-modal', function(){ + $('#payment-detail-modal').remove(); + }); + // End: payment information modal show and close + + initRoomEvents(); initProductEvents(); } @@ -1168,15 +1181,21 @@ function initRoomEvents() e.preventDefault(); }); + // order-payment-modal hide and show $('#add_new_payment').on('click', function(e) { e.preventDefault(); OrderPaymentModal.show(); }); + $(document).on('hidden.bs.modal', '#order-payment-modal', function(){ + $('#order-payment-modal').remove(); + }); + $('#cancle_add_payment').on('click', function(e) { e.preventDefault(); OrderPaymentModal.hide(); }); + // end order-payment-modal hide and show } function addRoomRefreshTotal() { var quantity = parseInt($('#add_product_product_quantity').val()); @@ -1644,6 +1663,10 @@ $(document).ready(function() { DocumentNoteModal.show($(this)); }); + $(document).on('hidden.bs.modal', '#document-note-modal', function(){ + $('#document-note-modal').remove(); + }); + $(document).on('click', '.submitDocumentNote', function(e) { e.preventDefault(); DocumentNoteModal.submit(); @@ -1658,6 +1681,10 @@ $(document).ready(function() { TravellerModal.show(); }); + $(document).on('hidden.bs.modal', '#traveller-modal', function(){ + $('#traveller-modal').remove(); + }); + $(document).on('click', '.submitTravellerInfo', function(e) { e.preventDefault(); TravellerModal.submit(); @@ -1698,6 +1725,10 @@ $(document).ready(function() { RoomStatusModal.show($(this)); }); + $(document).on('hidden.bs.modal', '#room-status-modal', function(){ + $('#room-status-modal').remove(); + }); + $(document).on('click', '.submitRoomStatus', function(e) { e.preventDefault(); RoomStatusModal.submit(); @@ -1712,11 +1743,13 @@ $(document).ready(function() { RoomAllotmentCommentModal.show(this); }); + + $(document).on('hidden.bs.modal', '#room-allotment-comment-modal', function(){ + $('#room-allotment-comment-modal').remove(); + }); // End: RoomAllotmentCommentModal: Processes // ====================================== - - // Start: RoomReallocationModal: Processes // For processing room reallocation and swapping $(document).on('click', '.room_reallocate_swap', function(e) { @@ -1822,6 +1855,10 @@ $(document).ready(function() { CancelRoomBookingModal.show(); }); + $(document).on('hidden.bs.modal', '#cancel-room-booking-modal', function(){ + $('#cancel-room-booking-modal').remove(); + }); + $(document).on('click', '.submitCancelBooking', function(e) { e.preventDefault(); CancelRoomBookingModal.submit(); @@ -2304,18 +2341,25 @@ const RoomReallocationModal = { success: function(result) { if (result.hasError == 0 && result.modalHtml) { $('#footer').next('.bootstrap').append(result.modalHtml); - $(".modal_id_htl_booking").val(roomObj.data('id_htl_booking')); $("input.modal_curr_room_num").val(roomObj.data('room_num')); $("span.modal_curr_room_num").text(roomObj.data('room_num') + ', ' + roomObj.data('room_type_name')); $(".cust_name").text(roomObj.data('cust_name')); $(".cust_email").text(roomObj.data('cust_email')); + $(".modal_curr_allotent_type").text(roomObj.data('allotment_type_label')); // reset price difference fields $("#reallocation_price_diff").val(0); $("#reallocation_price_diff_block").hide(); $(".realloc_roomtype_change_message").hide(); + if (roomObj.data('allotment_type') == ALLOTMENT_MANUAL) { + $(".allotment_comment_block .modal_curr_allotment_comment").text(roomObj.data('comment')); + $(".allotment_comment_block").show(); + } else { + $(".allotment_comment_block").hide(); + } + // For Rooms Swapping var json_arr_rm_swp = roomObj.data('avail_rm_swap'); if (roomObj.data('avail_rm_swap') != 'false' && json_arr_rm_swp.length != 0) { From 190907346b24d1eb4d197026a345480b3be2a2ab Mon Sep 17 00:00:00 2001 From: Sumit Panwar Date: Wed, 5 Jun 2024 16:21:22 +0530 Subject: [PATCH 039/130] Updated: decimal maximum limit is removed from price validation Validate::isPrice() --- classes/Validate.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/classes/Validate.php b/classes/Validate.php index 63dcacc75..9a080dd61 100644 --- a/classes/Validate.php +++ b/classes/Validate.php @@ -233,7 +233,7 @@ class ValidateCore */ public static function isPrice($price) { - return preg_match('/^[0-9]{1,10}(\.[0-9]{1,9})?$/', $price); + return preg_match('/^[0-9]{1,10}(\.[0-9]{1,})?$/', $price); } /** @@ -244,7 +244,7 @@ class ValidateCore */ public static function isNegativePrice($price) { - return preg_match('/^[-]?[0-9]{1,10}(\.[0-9]{1,9})?$/', $price); + return preg_match('/^[-]?[0-9]{1,10}(\.[0-9]{1,})?$/', $price); } /** From 2a1e2df946f6284c4a0c4b5866e75dd009ef4d73 Mon Sep 17 00:00:00 2001 From: Sumit Panwar Date: Thu, 6 Jun 2024 15:29:13 +0530 Subject: [PATCH 040/130] Updated: Set the order currency at first element of currencies in Add Payment form in Back-office order detail page --- controllers/admin/AdminOrdersController.php | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/controllers/admin/AdminOrdersController.php b/controllers/admin/AdminOrdersController.php index 08f42a0ac..970e130f1 100644 --- a/controllers/admin/AdminOrdersController.php +++ b/controllers/admin/AdminOrdersController.php @@ -630,11 +630,23 @@ class AdminOrdersControllerCore extends AdminController $payment_methods[] = $module->displayName; } } + + // Set the order currency at first element of currencies + if ($currencies = Currency::getCurrenciesByIdShop($objOrder->id_shop)) { + foreach ($currencies as $key => $currency) { + if ($currency['id_currency'] == $objOrder->id_currency) { + unset($currencies[$key]); + array_unshift($currencies, $currency); + break; + } + } + } + $this->context->smarty->assign( array( 'current_index' => self::$currentIndex, 'order' => $objOrder, - 'currencies' => Currency::getCurrenciesByIdShop($objOrder->id_shop), + 'currencies' => $currencies, 'payment_methods' => $payment_methods, 'payment_types' => $this->getPaymentsTypes(), 'invoices_collection' => $objOrder->getInvoicesCollection(), From e8551769b87221eda98f65acb166216a9c8cd4a8 Mon Sep 17 00:00:00 2001 From: Shreesh Arora Date: Thu, 6 Jun 2024 19:47:06 +0530 Subject: [PATCH 041/130] 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 5098c0ce678fd1287e6752c45dd2884190d31c79 Mon Sep 17 00:00:00 2001 From: Sumit Panwar Date: Fri, 7 Jun 2024 11:32:15 +0530 Subject: [PATCH 042/130] Fixed: Add room booking modal element comes multiple time in the html when open the modal multiple times --- js/admin/orders.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/js/admin/orders.js b/js/admin/orders.js index cfb99a362..bda5ba196 100644 --- a/js/admin/orders.js +++ b/js/admin/orders.js @@ -1802,6 +1802,10 @@ $(document).ready(function() { $('.submitAddRoom').attr('disabled', true); } }); + + $(document).on('hidden.bs.modal', '#add-room-booking-modal', function(){ + $('#add-room-booking-modal').remove(); + }); // End: AddRoomBookingModal: Processes // ====================================== From ba321cbf16d08d9d39750b6b80dccf2c5d9c8896 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Fri, 7 Jun 2024 12:53:58 +0530 Subject: [PATCH 043/130] Added measurement unit with the average lead time in the KPI --- controllers/admin/AdminStatsController.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/controllers/admin/AdminStatsController.php b/controllers/admin/AdminStatsController.php index 86e20a67f..cdcfcca53 100644 --- a/controllers/admin/AdminStatsController.php +++ b/controllers/admin/AdminStatsController.php @@ -959,6 +959,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'); From c1bb83eefc4c70f25c812755bfc2d9e4025a6094 Mon Sep 17 00:00:00 2001 From: Sumit Panwar Date: Tue, 11 Jun 2024 11:51:22 +0530 Subject: [PATCH 044/130] Updated: Detailed price and tax information in total costs section in Order Detail page of Back-office --- .../controllers/orders/helpers/view/view.tpl | 100 +++++++++++------- 1 file changed, 59 insertions(+), 41 deletions(-) diff --git a/admin/themes/default/template/controllers/orders/helpers/view/view.tpl b/admin/themes/default/template/controllers/orders/helpers/view/view.tpl index 6fc92ec12..047541e76 100644 --- a/admin/themes/default/template/controllers/orders/helpers/view/view.tpl +++ b/admin/themes/default/template/controllers/orders/helpers/view/view.tpl @@ -924,7 +924,7 @@ {assign var=additional_service_price_tax_incl value=($order->getTotalProductsWithTaxes(false, false, Product::SERVICE_PRODUCT_WITH_ROOMTYPE) + $totalDemandsPriceTI)} {if $room_price_tax_excl}
    - + @@ -933,34 +933,16 @@ {/if} {if isset($additional_service_price_tax_excl) && $additional_service_price_tax_excl > 0} - + {/if} - {* {if $room_price_tax_excl} - - - - - - {/if} - {if isset($additional_service_price_tax_excl) && $additional_service_price_tax_excl > 0} - - - - - - {/if} *} {if $service_products_price_tax_excl} - + @@ -968,10 +950,64 @@ {/if} + {if isset($totalConvenienceFeeTE) && $totalConvenienceFeeTE > 0} + + + + + + {/if} + + {if $room_price_tax_excl} + + + + + + {/if} + {if isset($additional_service_price_tax_excl) && $additional_service_price_tax_excl > 0} + + + + + + {/if} + {if isset($totalConvenienceFeeTE) && $totalConvenienceFeeTE > 0} + + + + + + {/if} + + {* {if ($order->getTaxCalculationMethod() == $smarty.const.PS_TAX_EXC)} *} + + + + + + {* {/if} *} total_discounts_tax_incl == 0}style="display: none;"{/if}> - + + + + total_discounts_tax_incl == 0}style="display: none;"{/if}> + + @@ -982,24 +1018,6 @@ - {if isset($totalConvenienceFeeTI) && $totalConvenienceFeeTI > 0} - - - - - - {/if} - {* {if ($order->getTaxCalculationMethod() == $smarty.const.PS_TAX_EXC)} *} - - - - - - {* {/if} *} + {foreach $cmsPages as $cmsPage} + + + + + + {/foreach} + +
    From 960808ce364b9644561cbeb957a6dbe993a065dc Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Thu, 2 May 2024 11:21:51 +0530 Subject: [PATCH 006/130] 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 007/130] 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 008/130] 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 646f45c78393cc085d227efbca3d1b6c71c87bd1 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Tue, 7 May 2024 13:07:36 +0530 Subject: [PATCH 009/130] Fixed: The noticies on the Admin controllers when the identifier provided manually by editing the url does not exists in the database --- classes/order/Order.php | 2 +- controllers/admin/AdminCmsContentController.php | 6 ++++-- controllers/admin/AdminFeaturesController.php | 5 ++--- controllers/admin/AdminNormalProductsController.php | 6 ++++++ controllers/admin/AdminOrdersController.php | 10 +++++----- controllers/admin/AdminProductsController.php | 6 ++++++ controllers/admin/AdminRequestSqlController.php | 6 ++---- .../admin/AdminOrderRefundRequestsController.php | 2 +- 8 files changed, 27 insertions(+), 16 deletions(-) diff --git a/classes/order/Order.php b/classes/order/Order.php index a4e7a5e6b..dc29f2652 100644 --- a/classes/order/Order.php +++ b/classes/order/Order.php @@ -1804,7 +1804,7 @@ class OrderCore extends ObjectModel SELECT opd.`amount` as `real_paid_amount`, opd.*, op.* FROM `'._DB_PREFIX_.'order_payment_detail` opd INNER JOIN `'._DB_PREFIX_.'order_payment` op ON (opd.`id_order_payment` = op.`id_order_payment`) - WHERE `id_order` = '.$this->id + WHERE `id_order` = '.(int) $this->id ); } diff --git a/controllers/admin/AdminCmsContentController.php b/controllers/admin/AdminCmsContentController.php index 9bf088b58..6708fa987 100644 --- a/controllers/admin/AdminCmsContentController.php +++ b/controllers/admin/AdminCmsContentController.php @@ -85,6 +85,7 @@ class AdminCmsContentControllerCore extends AdminController public function initContent() { + $this->loadObject(true); $this->initTabModuleList(); $this->renderPageHeaderToolbar(); @@ -151,8 +152,9 @@ class AdminCmsContentControllerCore extends AdminController if (Tools::getValue('addcms') !== false) { $this->toolbar_title[] = $this->l('Add new'); - } elseif ($id_cms_page) { - $cms_page = new CMS($id_cms_page); + } elseif ($id_cms_page + && Validate::isLoadedObject($cms_page = new CMS($id_cms_page)) + ) { $this->toolbar_title[] = sprintf($this->l('Edit: %s'), $cms_page->meta_title[$this->context->employee->id_lang]); } } else { diff --git a/controllers/admin/AdminFeaturesController.php b/controllers/admin/AdminFeaturesController.php index c581d2604..c57d5d807 100644 --- a/controllers/admin/AdminFeaturesController.php +++ b/controllers/admin/AdminFeaturesController.php @@ -452,10 +452,9 @@ class AdminFeaturesControllerCore extends AdminController $this->initToolbar(); $this->initPageHeaderToolbar(); if ($this->display == 'edit' || $this->display == 'add') { - if (!$this->loadObject(true)) { - return; + if ($this->loadObject(true)) { + $this->content .= $this->renderForm(); } - $this->content .= $this->renderForm(); } elseif ($this->display == 'view') { // Some controllers use the view action without an object if ($this->className) { diff --git a/controllers/admin/AdminNormalProductsController.php b/controllers/admin/AdminNormalProductsController.php index 87a959951..6cd378dbf 100644 --- a/controllers/admin/AdminNormalProductsController.php +++ b/controllers/admin/AdminNormalProductsController.php @@ -398,6 +398,12 @@ class AdminNormalProductsControllerCore extends AdminController $bo_theme = 'default'; } + Media::addJsDef( + array( + 'tb_pathToImage' => '../img/loadingAnimation.gif' + ) + ); + $this->addJs(__PS_BASE_URI__.$this->admin_webpath.'/themes/'.$bo_theme.'/js/jquery.iframe-transport.js'); $this->addJs(__PS_BASE_URI__.$this->admin_webpath.'/themes/'.$bo_theme.'/js/jquery.fileupload.js'); $this->addJs(__PS_BASE_URI__.$this->admin_webpath.'/themes/'.$bo_theme.'/js/jquery.fileupload-process.js'); diff --git a/controllers/admin/AdminOrdersController.php b/controllers/admin/AdminOrdersController.php index 9c6d1fe61..870ac9432 100644 --- a/controllers/admin/AdminOrdersController.php +++ b/controllers/admin/AdminOrdersController.php @@ -482,8 +482,7 @@ class AdminOrdersControllerCore extends AdminController { if ($this->display == 'view') { /** @var Order $order */ - $order = $this->loadObject(); - + $order = new Order(Tools::getValue($this->identifier)); // hotel link in header if ($idHotel = HotelBookingDetail::getIdHotelByIdOrder($order->id)) { $this->toolbar_btn['hotel'] = array( @@ -997,7 +996,9 @@ class AdminOrdersControllerCore extends AdminController $this->addJS(_PS_JS_DIR_.'vendor/d3.v3.min.js'); if ($this->tabAccess['edit'] == 1 && $this->display == 'view') { - $this->addJS(_PS_JS_DIR_.'admin/orders.js'); + if ($this->loadObject(true)) { + $this->addJS(_PS_JS_DIR_.'admin/orders.js'); + } // $this->addJS(_PS_JS_DIR_.'admin/orders-product-event.js'); // $this->addJS(_PS_JS_DIR_.'admin/orders-room-event.js'); $this->addJS(_PS_JS_DIR_.'tools.js'); @@ -2477,11 +2478,10 @@ class AdminOrdersControllerCore extends AdminController { $order = new Order(Tools::getValue('id_order')); if (!Validate::isLoadedObject($order)) { - $this->errors[] = Tools::displayError('The order cannot be found within your database.'); + return false; } $this->content .= $this->renderKpis(); - $customer = new Customer($order->id_customer); $carrier = new Carrier($order->id_carrier); $products = $this->getProducts($order); diff --git a/controllers/admin/AdminProductsController.php b/controllers/admin/AdminProductsController.php index 811207d39..4f4277bdb 100644 --- a/controllers/admin/AdminProductsController.php +++ b/controllers/admin/AdminProductsController.php @@ -468,6 +468,12 @@ class AdminProductsControllerCore extends AdminController $bo_theme = 'default'; } + Media::addJsDef( + array( + 'tb_pathToImage' => '../img/loadingAnimation.gif' + ) + ); + $this->addJs(__PS_BASE_URI__.$this->admin_webpath.'/themes/'.$bo_theme.'/js/jquery.iframe-transport.js'); $this->addJs(__PS_BASE_URI__.$this->admin_webpath.'/themes/'.$bo_theme.'/js/jquery.fileupload.js'); $this->addJs(__PS_BASE_URI__.$this->admin_webpath.'/themes/'.$bo_theme.'/js/jquery.fileupload-process.js'); diff --git a/controllers/admin/AdminRequestSqlController.php b/controllers/admin/AdminRequestSqlController.php index a8e5507b1..068face35 100644 --- a/controllers/admin/AdminRequestSqlController.php +++ b/controllers/admin/AdminRequestSqlController.php @@ -283,11 +283,9 @@ class AdminRequestSqlControllerCore extends AdminController $this->initToolbar(); $this->initPageHeaderToolbar(); if ($this->display == 'edit' || $this->display == 'add') { - if (!$this->loadObject(true)) { - return; + if ($this->loadObject(true)) { + $this->content .= $this->renderForm(); } - - $this->content .= $this->renderForm(); } elseif ($this->display == 'view') { // Some controllers use the view action without an object if ($this->className) { diff --git a/modules/hotelreservationsystem/controllers/admin/AdminOrderRefundRequestsController.php b/modules/hotelreservationsystem/controllers/admin/AdminOrderRefundRequestsController.php index f6eb2fb5f..916e6c1c2 100644 --- a/modules/hotelreservationsystem/controllers/admin/AdminOrderRefundRequestsController.php +++ b/modules/hotelreservationsystem/controllers/admin/AdminOrderRefundRequestsController.php @@ -135,7 +135,7 @@ class AdminOrderRefundRequestsController extends ModuleAdminController public function renderView() { - if (!($objOrderReturn = $this->loadObject(true))) { + if (!($objOrderReturn = $this->loadObject())) { return; } $refundStatuses = OrderReturnStateCore::getOrderReturnStates($this->context->language->id); From 1f18100fc5a2b84222cc5da904f211e389cebbfa Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Fri, 10 May 2024 16:22:02 +0530 Subject: [PATCH 010/130] 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 011/130] 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 012/130] 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 013/130] 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 014/130] 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 015/130] 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 016/130] 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 017/130] 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 018/130] 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 c91935a28d7eac3d08f5db3c00b0fe8e09858b32 Mon Sep 17 00:00:00 2001 From: Sumit Panwar Date: Tue, 21 May 2024 17:50:06 +0530 Subject: [PATCH 019/130] Fixed:The option to select children's age is not showing in the popup while editing occupancy on the order detail page. --- .../controllers/orders/modals/_edit_room_tab_content.tpl | 2 ++ js/admin/orders.js | 3 --- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/admin/themes/default/template/controllers/orders/modals/_edit_room_tab_content.tpl b/admin/themes/default/template/controllers/orders/modals/_edit_room_tab_content.tpl index 444182bab..02d5ae38c 100644 --- a/admin/themes/default/template/controllers/orders/modals/_edit_room_tab_content.tpl +++ b/admin/themes/default/template/controllers/orders/modals/_edit_room_tab_content.tpl @@ -89,6 +89,8 @@
    + +

    diff --git a/js/admin/orders.js b/js/admin/orders.js index 8a551b4fa..25d8111a3 100644 --- a/js/admin/orders.js +++ b/js/admin/orders.js @@ -523,15 +523,12 @@ function initProductEvents() $(this).val(max_child_in_room); if (elementVal == 1) { showOccupancyError(no_children_allowed_txt, $(this).closest(".occupancy_info_block")); - haserror = true; } else { showOccupancyError(max_children_txt, $(this).closest(".occupancy_info_block")); - haserror = true; } } else if (elementVal > max_allowed_for_current) { $(this).val(max_allowed_for_current); showOccupancyError(max_occupancy_reached_txt, $(this).closest(".occupancy_info_block")); - haserror = true; } } else { max_adults_in_room = $(this).closest(".booking_occupancy_wrapper").find('.max_adults').val(); From 906ed2b693fcbb6a1819e7d71c98ad7ce6c9bffb Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Wed, 22 May 2024 10:16:55 +0530 Subject: [PATCH 020/130] 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 f9ccc67a4e7ffb6da88e69210aafc75d9be14973 Mon Sep 17 00:00:00 2001 From: Sumit Panwar Date: Wed, 22 May 2024 12:23:38 +0530 Subject: [PATCH 021/130] Fixed:During addition of rooms in booking from backoffice, scrolling the page displaces the suggested room types from input in the modal --- admin/themes/default/sass/vendor/bootstrap-sass/_modals.scss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/admin/themes/default/sass/vendor/bootstrap-sass/_modals.scss b/admin/themes/default/sass/vendor/bootstrap-sass/_modals.scss index 8240fa4ad..a126c3986 100644 --- a/admin/themes/default/sass/vendor/bootstrap-sass/_modals.scss +++ b/admin/themes/default/sass/vendor/bootstrap-sass/_modals.scss @@ -9,7 +9,7 @@ // Kill the scroll on the body .modal-open { - overflow-x: hidden; + overflow: hidden; } // Container that the modal scrolls within From 8407a4ba5191582246c65e5a6613ca7e547b1855 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Wed, 22 May 2024 13:29:59 +0530 Subject: [PATCH 022/130] 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 c19a195d8b26ef134eb58d8206324f75e998f33e Mon Sep 17 00:00:00 2001 From: Sumit Panwar Date: Wed, 22 May 2024 15:22:54 +0530 Subject: [PATCH 023/130] Fixed: Time is not shown with date for check-In and check-out status in Room Status section in back-office order detail page --- .../default/template/controllers/orders/helpers/view/view.tpl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/admin/themes/default/template/controllers/orders/helpers/view/view.tpl b/admin/themes/default/template/controllers/orders/helpers/view/view.tpl index f28080e92..f20d03ea1 100644 --- a/admin/themes/default/template/controllers/orders/helpers/view/view.tpl +++ b/admin/themes/default/template/controllers/orders/helpers/view/view.tpl @@ -127,9 +127,9 @@ {if $data['id_status'] == $hotel_order_status['STATUS_ALLOTED']['id_status']} {l s='Alloted'} {elseif $data['id_status'] == $hotel_order_status['STATUS_CHECKED_IN']['id_status']} - {l s='Checked in on'} {dateFormat date=$data['check_in']} + {l s='Checked in on'} {dateFormat date=$data['check_in'] full=1} {elseif $data['id_status'] == $hotel_order_status['STATUS_CHECKED_OUT']['id_status']} - {l s='Checked out on'} {dateFormat date=$data['check_out']} + {l s='Checked out on'} {dateFormat date=$data['check_out'] full=1} {/if}
    From e7f3fd1beb23b3fb8cb5d5b9f5009f075c85f9fd Mon Sep 17 00:00:00 2001 From: Sumit Panwar Date: Wed, 22 May 2024 15:48:16 +0530 Subject: [PATCH 024/130] add scrollbar in Private note on order detail page --- admin/themes/default/sass/controllers/_order.sass | 3 +++ 1 file changed, 3 insertions(+) diff --git a/admin/themes/default/sass/controllers/_order.sass b/admin/themes/default/sass/controllers/_order.sass index c5315218e..c32768ed0 100644 --- a/admin/themes/default/sass/controllers/_order.sass +++ b/admin/themes/default/sass/controllers/_order.sass @@ -77,3 +77,6 @@ .room_status_info_form .room_status white-space: normal + +#noteContent + max-height: 200px \ No newline at end of file From e879c6638d58917c81d47198a71510865fb33da0 Mon Sep 17 00:00:00 2001 From: Sumit Panwar Date: Wed, 22 May 2024 18:40:30 +0530 Subject: [PATCH 025/130] Fixed:At the time of room edit mention price is tax included or excluded --- .../controllers/orders/modals/_add_room_booking.tpl | 4 ++-- .../controllers/orders/modals/_edit_room_tab_content.tpl | 2 +- .../modals/_extra_services_facilities_tab_content.tpl | 6 +++--- .../modals/_extra_services_service_products_tab_content.tpl | 6 +++--- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/admin/themes/default/template/controllers/orders/modals/_add_room_booking.tpl b/admin/themes/default/template/controllers/orders/modals/_add_room_booking.tpl index 63d96c205..92beca110 100644 --- a/admin/themes/default/template/controllers/orders/modals/_add_room_booking.tpl +++ b/admin/themes/default/template/controllers/orders/modals/_add_room_booking.tpl @@ -49,7 +49,7 @@
    - +
    {if $currency->format % 2}
    {$currency->sign}
    {/if} @@ -57,7 +57,7 @@
    - +
    {if $currency->format % 2}
    {$currency->sign}
    {/if} diff --git a/admin/themes/default/template/controllers/orders/modals/_edit_room_tab_content.tpl b/admin/themes/default/template/controllers/orders/modals/_edit_room_tab_content.tpl index 02d5ae38c..932b0bc19 100644 --- a/admin/themes/default/template/controllers/orders/modals/_edit_room_tab_content.tpl +++ b/admin/themes/default/template/controllers/orders/modals/_edit_room_tab_content.tpl @@ -50,7 +50,7 @@
    - +
    {if $currency->format % 2}
    {$currency->sign}
    {/if} diff --git a/admin/themes/default/template/controllers/orders/modals/_extra_services_facilities_tab_content.tpl b/admin/themes/default/template/controllers/orders/modals/_extra_services_facilities_tab_content.tpl index 1231752ca..4dee95332 100644 --- a/admin/themes/default/template/controllers/orders/modals/_extra_services_facilities_tab_content.tpl +++ b/admin/themes/default/template/controllers/orders/modals/_extra_services_facilities_tab_content.tpl @@ -31,8 +31,8 @@
    {l s='Name'}{l s='Unit Price'}{l s='Total Price'}{l s='Unit Price (tax excl.)'}{l s='Total Price (tax excl.)'} {l s='Action'}
    {l s='Name'} {l s='Option'}{l s='Unit Price'}{l s='Unit Price (tax excl.)'}
    {l s='Name'} {l s='Quantity'}{l s='Unit Price'}{l s='Total Price'}{l s='Unit Price (tax excl.)'}{l s='Total Price (tax excl.)'} {l s='Action'}
    {l s='Name'} {l s='Quantity'}{l s='Unit Price'}{l s='Unit Price (tax excl.)'}
    {if $data['id_status'] == $hotel_order_status['STATUS_ALLOTED']['id_status']} - {l s='Alloted'} + {l s='Alloted'} {if $data['booking_type'] == HotelBookingDetail::ALLOTMENT_MANUAL}({l s='Manually'}){/if} {elseif $data['id_status'] == $hotel_order_status['STATUS_CHECKED_IN']['id_status']} {l s='Checked in on'} {dateFormat date=$data['check_in'] full=1} {elseif $data['id_status'] == $hotel_order_status['STATUS_CHECKED_OUT']['id_status']} @@ -140,6 +140,10 @@ {/if} + + {if $data['booking_type'] == HotelBookingDetail::ALLOTMENT_MANUAL && $data['comment'] != ''} + + {/if}
    {$return_info.state_name} {if $return_info.refunded_amount > 0} -  {displayPrice price=$return_info.refunded_amount currency=$currency->id} +  {displayPrice price=$return_info.refunded_amount currency=$currency->id} {/if}
    {if $order->with_occupancy && $data['children']} {l s='Duration'} {l s='Documents'} {l s='Room Status'}{l s='Allotment'} {l s='Action'}
    {if $data['id_status'] == $hotel_order_status['STATUS_ALLOTED']['id_status']} - {l s='Alloted'} {if $data['booking_type'] == HotelBookingDetail::ALLOTMENT_MANUAL}({l s='Manually'}){/if} + {l s='Alloted'} {elseif $data['id_status'] == $hotel_order_status['STATUS_CHECKED_IN']['id_status']} {l s='Checked in on'} {dateFormat date=$data['check_in'] full=1} {elseif $data['id_status'] == $hotel_order_status['STATUS_CHECKED_OUT']['id_status']} {l s='Checked out on'} {dateFormat date=$data['check_out'] full=1} {/if} + + {if $data['booking_type'] == $ALLOTMENT_MANUAL} + {l s='Manual'}  {if $data['comment'] != ''}{/if} + {else} + {l s='Auto'} + {/if} + {if $data.is_refunded || $data.is_cancelled} {if $data.is_cancelled}{l s='Cancelled'}{else}{l s='Refunded'}{/if} {else} - + {l s='Edit'} {/if} - - {if $data['booking_type'] == HotelBookingDetail::ALLOTMENT_MANUAL && $data['comment'] != ''} - - {/if}
    {l s='Total Rooms Cost (tax excl.)'}{l s='Total Rooms Cost (Tax excl.)'} {displayPrice price=$room_price_tax_excl currency=$currency->id}
    {l s='Total Extra services (tax excl.)'}{l s='Total Extra services (Tax excl.)'} {displayPrice price=($additional_service_price_tax_excl - $totalConvenienceFeeTE) currency=$currency->id}
    {l s='Total Rooms Tax'} - {displayPrice price=($room_price_tax_incl - $room_price_tax_excl) currency=$currency->id} -
    {l s='Extra services Tax'} - {displayPrice price=($additional_service_price_tax_incl - $additional_service_price_tax_excl) currency=$currency->id} -
    {l s='Total service products cost (tax excl.)'}{l s='Total service products cost (Tax excl.)'} {displayPrice price=$service_products_price_tax_excl currency=$currency->id}
    {l s='Convenience Fee (Tax excl.)'} + {displayPrice price=$totalConvenienceFeeTE currency=$currency->id} +
    {l s='Total Rooms Tax'} + {displayPrice price=($room_price_tax_incl - $room_price_tax_excl) currency=$currency->id} +
    {l s='Extra services Tax'} + {displayPrice price=(($additional_service_price_tax_incl - $additional_service_price_tax_excl) - ($totalConvenienceFeeTI - $totalConvenienceFeeTE)) currency=$currency->id} +
    {l s='Convenience Fee Tax'} + {displayPrice price=($totalConvenienceFeeTI - $totalConvenienceFeeTE) currency=$currency->id} +
    {l s='Total Taxes'} + {displayPrice price=(($order->total_paid_tax_incl + $order->total_discounts_tax_incl) - ($order->total_paid_tax_excl + $order->total_discounts_tax_excl)) currency=$currency->id} +
    {l s='Discounts'}{l s='Total Booking Amount'} - -{displayPrice price=$order_discount_price currency=$currency->id} + {displayPrice price=($order->total_paid_tax_incl + $order->total_discounts_tax_incl) currency=$currency->id} +
    {l s='Discounts'} + -{displayPrice price=$order->total_discounts_tax_incl currency=$currency->id}
    {l s='Convenience Fee'} - {displayPrice price=$totalConvenienceFeeTE currency=$currency->id} -
    {l s='Total Taxes'} - {displayPrice price=($order->total_paid_tax_incl - $order->total_paid_tax_excl) currency=$currency->id} -
    {l s='Final Booking Total'} From 08d9017845a894307685f73e815030adcfe43dba Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Tue, 11 Jun 2024 12:02:44 +0530 Subject: [PATCH 045/130] 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 046/130] 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 df643828f0a8e5104bea2bcd5c82d273125b3ca0 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Wed, 12 Jun 2024 15:21:31 +0530 Subject: [PATCH 047/130] updated the customer delete and ban process --- .../customers/helpers/view/view.tpl | 24 ++++++++++++++----- classes/Customer.php | 5 +++- .../admin/AdminCustomersController.php | 10 ++++++-- 3 files changed, 30 insertions(+), 9 deletions(-) diff --git a/admin/themes/default/template/controllers/customers/helpers/view/view.tpl b/admin/themes/default/template/controllers/customers/helpers/view/view.tpl index 88da2734e..294f6dd69 100644 --- a/admin/themes/default/template/controllers/customers/helpers/view/view.tpl +++ b/admin/themes/default/template/controllers/customers/helpers/view/view.tpl @@ -146,15 +146,27 @@

    - {if $customer->active} - - - {l s='Active'} + {if !$customer->deleted} + {if $customer->active} + + + {l s='Active'} + + {else} + + + {l s='Inactive'} + + {/if} + {else if $customer->deleted == Customer::STATUS_BANNED} + + + {l s='Banned'} - {else} + {else if $customer->deleted == Customer::STATUS_DELETED} - {l s='Inactive'} + {l s='Deleted'} {/if}

    diff --git a/classes/Customer.php b/classes/Customer.php index a8c4c3609..fd46a853a 100644 --- a/classes/Customer.php +++ b/classes/Customer.php @@ -135,6 +135,9 @@ class CustomerCore extends ObjectModel public $groupBox; + const STATUS_BANNED = 1; + const STATUS_DELETED = 2; + protected $webserviceParameters = array( 'fields' => array( 'id_default_group' => array('xlink_resource' => 'groups'), @@ -179,7 +182,7 @@ class CustomerCore extends ObjectModel 'id_risk' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt', 'copy_post' => false), 'max_payment_days' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt', 'copy_post' => false), 'active' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool', 'copy_post' => false), - 'deleted' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool', 'copy_post' => false), + 'deleted' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt', 'copy_post' => false), 'note' => array('type' => self::TYPE_HTML, 'validate' => 'isCleanHtml', 'size' => 65000, 'copy_post' => false), 'is_guest' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool', 'copy_post' => false), 'id_shop' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'copy_post' => false), diff --git a/controllers/admin/AdminCustomersController.php b/controllers/admin/AdminCustomersController.php index 3344f23a2..58527d92f 100644 --- a/controllers/admin/AdminCustomersController.php +++ b/controllers/admin/AdminCustomersController.php @@ -236,6 +236,11 @@ class AdminCustomersControllerCore extends AdminController $this->context->cookie->{$prefix.$this->table.'Filter_date_add'} = json_encode(array($dateFrom, $dateTo)); } + $this->redirect_after = $this->context->link->getAdminLink('AdminCustomers'); + } else if (Tools::getValue('filterOnlyBannedCustomer')) { + $this->processResetFilters(); + $this->context->cookie->{'submitFilter'.$this->table} = true; + $this->context->cookie->{$prefix.$this->table.'Filter_deleted'} = Customer::STATUS_BANNED; $this->redirect_after = $this->context->link->getAdminLink('AdminCustomers'); } @@ -779,6 +784,7 @@ class AdminCustomersControllerCore extends AdminController $helper->color = 'color2'; $helper->title = $this->l('Banned Customers', null, null, false); $helper->subtitle = $this->l('All Time', null, null, false); + $helper->href = $this->context->link->getAdminLink('AdminCustomers').'&filterOnlyBannedCustomer=1'; $helper->source = $this->context->link->getAdminLink('AdminStats').'&ajax=1&action=getKpi&kpi=total_banned_customers'; $helper->tooltip = $this->l('The total number of banned customers.', null, null, false); $kpis[] = $helper; @@ -988,7 +994,7 @@ class AdminCustomersControllerCore extends AdminController if (Validate::isLoadedObject($objCustomer = $this->loadObject())) { if ($this->delete_mode == 'real' && Order::getCustomerOrders($objCustomer->id, true)) { $objCustomer->email = 'anonymous'.'-'.$objCustomer->id.'@'.Tools::getShopDomain(); - $objCustomer->deleted = 1; + $objCustomer->deleted = Customer::STATUS_DELETED; if (!$objCustomer->update()) { $this->errors[] = Tools::displayError('Some error ocurred while deleting the Customer'); return; @@ -1029,7 +1035,7 @@ class AdminCustomersControllerCore extends AdminController // check if customer has orders for email change else customer will be deleted if (Order::getCustomerOrders($objCustomer->id, true)) { $objCustomer->email = 'anonymous'.'-'.$objCustomer->id.'@'.Tools::getShopDomain(); - $objCustomer->deleted = 1; + $objCustomer->deleted = Customer::STATUS_DELETED; if ($objCustomer->update()) { // unset the customer which is processed // not processed customers will be deleted with default process if no errors are there From 67dcad12e4e163b1bd18ed867be1969ecea50a31 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Wed, 12 Jun 2024 19:04:43 +0530 Subject: [PATCH 048/130] Removed extra spaces to fix error caused by smarty --- .../template/controllers/customers/helpers/view/view.tpl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/admin/themes/default/template/controllers/customers/helpers/view/view.tpl b/admin/themes/default/template/controllers/customers/helpers/view/view.tpl index 294f6dd69..18145ce07 100644 --- a/admin/themes/default/template/controllers/customers/helpers/view/view.tpl +++ b/admin/themes/default/template/controllers/customers/helpers/view/view.tpl @@ -158,12 +158,12 @@ {l s='Inactive'} {/if} - {else if $customer->deleted == Customer::STATUS_BANNED} + {elseif $customer->deleted == Customer::STATUS_BANNED} {l s='Banned'} - {else if $customer->deleted == Customer::STATUS_DELETED} + {elseif $customer->deleted == Customer::STATUS_DELETED} {l s='Deleted'} From 5d5071b487644a4d7d7a59304e59543af1061715 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Thu, 13 Jun 2024 09:58:22 +0530 Subject: [PATCH 049/130] Updated the newsletter deletion process for the deleted customers with new flow --- modules/blocknewsletter/blocknewsletter.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/modules/blocknewsletter/blocknewsletter.php b/modules/blocknewsletter/blocknewsletter.php index a7a0612d6..d4ab3bbe2 100644 --- a/modules/blocknewsletter/blocknewsletter.php +++ b/modules/blocknewsletter/blocknewsletter.php @@ -84,11 +84,23 @@ class Blocknewsletter extends Module 'actionCustomerAccountAdd', 'registerGDPRConsent', 'actionExportGDPRData', + 'actionObjectCustomerUpdateBefore', 'actionDeleteGDPRCustomer' ) ); } + public function hookActionObjectCustomerUpdateBefore($params) + { + $objCustomer = new Customer ($params['object']->id); + if ($params['object']->deleted == Customer::STATUS_DELETED + && ($register_status = $this->isNewsletterRegistered($objCustomer->email)) + && $register_status > 0 + ) { + $this->unregister($objCustomer->email, $register_status); + } + } + public function hookActionExportGDPRData($customer) { if (!Tools::isEmpty($customer['email']) && Validate::isEmail($customer['email'])) { From 601e51b514c42848b0c7562cd7f9307982fe72fd Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Fri, 14 Jun 2024 12:39:42 +0530 Subject: [PATCH 050/130] 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 @@
    + +
    + {$cmsPage.id_cms|escape:'htmlall':'UTF-8'}
    +
    + {/foreach}
    {/if}
    From 9e56a0f11d8cdab7f7a9c3de94dd8dcd43b97ac6 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Thu, 11 Jul 2024 12:09:14 +0530 Subject: [PATCH 109/130] Fixed: some of the errors from parent order controller are not displayed in the front --- controllers/front/OrderOpcController.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/controllers/front/OrderOpcController.php b/controllers/front/OrderOpcController.php index feed31828..ee809dc2f 100644 --- a/controllers/front/OrderOpcController.php +++ b/controllers/front/OrderOpcController.php @@ -426,7 +426,9 @@ class OrderOpcControllerCore extends ParentOrderController public function initContent() { // validate room types before payment by customer - $this->errors = HotelCartBookingData::validateCartBookings(); + if ($orderRestrictErr = HotelCartBookingData::validateCartBookings()) { + $this->errors = array_merge($this->errors, $orderRestrictErr); + } parent::initContent(); @@ -494,7 +496,7 @@ class OrderOpcControllerCore extends ParentOrderController // $objCurrency = new Currency(Configuration::get('PS_CURRENCY_DEFAULT')); $this->context->smarty->assign( array( - 'orderRestrictErr' => count($this->errors) ? 1 : 0, + 'orderRestrictErr' => count($orderRestrictErr) ? 1 : 0, // 'allDemands' => $allDemands, // 'defaultcurrencySign' => $objCurrency->sign, 'THEME_DIR' => _THEME_DIR_, From ac0de7b6f52ba281ef6b2361001daa65e9fd71cd Mon Sep 17 00:00:00 2001 From: Shreesh Arora Date: Thu, 11 Jul 2024 13:19:11 +0530 Subject: [PATCH 110/130] set voucher expiry is required --- .../admin/AdminOrderRefundRequestsController.php | 8 ++++---- .../views/js/admin/wk_refund_request.js | 15 +++++++++++++++ .../order_refund_requests/helpers/view/view.tpl | 2 +- 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/modules/hotelreservationsystem/controllers/admin/AdminOrderRefundRequestsController.php b/modules/hotelreservationsystem/controllers/admin/AdminOrderRefundRequestsController.php index 5346dedae..c777cfa43 100644 --- a/modules/hotelreservationsystem/controllers/admin/AdminOrderRefundRequestsController.php +++ b/modules/hotelreservationsystem/controllers/admin/AdminOrderRefundRequestsController.php @@ -326,10 +326,10 @@ 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.'); - } + if (!$voucher_expiry_date = Tools::getValue('voucher_expiry_date')) { + $this->errors[] = $this->l('Voucher expiry date is required.'); + } elseif (!Validate::isDate($voucher_expiry_date)) { + $this->errors[] = $this->l('Invalid voucher expiry date.'); } } else { $this->errors[] = $this->l('Invalid refund information found.'); diff --git a/modules/hotelreservationsystem/views/js/admin/wk_refund_request.js b/modules/hotelreservationsystem/views/js/admin/wk_refund_request.js index f87b8e3f5..c6e99a85b 100644 --- a/modules/hotelreservationsystem/views/js/admin/wk_refund_request.js +++ b/modules/hotelreservationsystem/views/js/admin/wk_refund_request.js @@ -23,6 +23,21 @@ $(document).ready(function() { manageRefundOptions(); } + $('#order_return_form').on('submit', function() { + if ($("#id_refund_state option:selected").attr('refunded') == 1) { + if ($('#generateDiscount:checked').length) { + if ($('#voucher_expiry').val() == '') { + $('#voucher_expiry').parent().addClass('has-error'); + return false; + } + } + } + }); + + $('#voucher_expiry').on('focus', function() { + $('#voucher_expiry').parent().removeClass('has-error'); + }); + // initialize tootip for room price if ($('#rooms_refund_info .price_info').length) { $('#rooms_refund_info .price_info').each(function (i, element) { 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 84fa3659b..ad04059d2 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 @@ -372,7 +372,7 @@