From 6a29d0bdb125ef79f83adc1039ef51ba87773b89 Mon Sep 17 00:00:00 2001 From: Sumit Panwar Date: Thu, 23 May 2024 16:46:53 +0530 Subject: [PATCH 01/40] Fixed: After check-out, it is showing occupied in the occupancy chart in dashboard for checkout date --- controllers/admin/AdminStatsController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/controllers/admin/AdminStatsController.php b/controllers/admin/AdminStatsController.php index 2de11a362..97fcfc65a 100644 --- a/controllers/admin/AdminStatsController.php +++ b/controllers/admin/AdminStatsController.php @@ -1140,7 +1140,7 @@ class AdminStatsControllerCore extends AdminStatsTabController ON (p.`id_product` = hri.`id_product`) WHERE p.`active` = 1 AND hbd.`is_refunded` = 0 - AND hbd.`date_from` < "'.pSQL($dateTo).' 00:00:00" AND hbd.`date_to` > "'.pSQL($dateFrom).' 00:00:00"'. + AND IF(hbd.`id_status` = '. HotelBookingDetail::STATUS_CHECKED_OUT .', hbd.`date_from` < DATE_FORMAT(hbd.`check_out`, "%Y-%m-%d") AND hbd.`date_from` < \''.pSQL($dateTo).'\' AND DATE_FORMAT(hbd.`check_out`, "%Y-%m-%d") > \''.pSQL($dateFrom).'\', hbd.`date_from` < \''.pSQL($dateTo).'\' AND hbd.`date_to` > \''.pSQL($dateFrom).'\')'. HotelBranchInformation::addHotelRestriction($idsHotel, 'hbd') ); From b458aee50abc83cfcd4b69f4f9ca6627689b2917 Mon Sep 17 00:00:00 2001 From: Sumit Panwar Date: Mon, 27 May 2024 17:44:23 +0530 Subject: [PATCH 02/40] Fixed:After disabling the demo option, demo data is still showing in the room nights graph until page reload. --- controllers/admin/AdminStatsController.php | 2 +- modules/dashinsights/views/js/dashinsights.js | 3 +-- .../views/templates/hook/dashboard_zone_two.tpl | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/controllers/admin/AdminStatsController.php b/controllers/admin/AdminStatsController.php index 97fcfc65a..917d5b3e1 100644 --- a/controllers/admin/AdminStatsController.php +++ b/controllers/admin/AdminStatsController.php @@ -1232,7 +1232,7 @@ class AdminStatsControllerCore extends AdminStatsTabController return $averageDailyRates; } - // Average Daily Rate is the average income per paid occupied room in a given time period + // Average Daily Rate is the average income per occupied room in a given time period public static function getAverageDailyRate($dateFrom, $dateTo, $idHotel = null) { $roomsRevenueByDates = self::getRoomsRevenueForDiscreteDates($dateFrom, $dateTo, $idHotel); diff --git a/modules/dashinsights/views/js/dashinsights.js b/modules/dashinsights/views/js/dashinsights.js index c4c065975..feb98d0d1 100644 --- a/modules/dashinsights/views/js/dashinsights.js +++ b/modules/dashinsights/views/js/dashinsights.js @@ -21,7 +21,6 @@ function line_chart_dashinsights(widget_name, chart_details) { $('#dashinsights_room_nights svg').html(''); nv.addGraph(function () { var chart = nv.models.lineChart() - .useInteractiveGuideline(true) .x(function (d) { return (d !== undefined ? d[0] : 0); }) .y(function (d) { return (d !== undefined ? d[1] : 0); }) .forceY([0, 1]) @@ -32,7 +31,7 @@ function line_chart_dashinsights(widget_name, chart_details) { chart.yAxis.scale().domain([0, 1]); // create content for the tooltip of chart - chart.interactiveLayer.tooltip.contentGenerator((obj, element) => { + chart.tooltip.contentGenerator((obj, element) => { var totalNightsBooked = 0; var tooltipContent = ''; diff --git a/modules/dashperformance/views/templates/hook/dashboard_zone_two.tpl b/modules/dashperformance/views/templates/hook/dashboard_zone_two.tpl index 97b3051de..fc59ed294 100644 --- a/modules/dashperformance/views/templates/hook/dashboard_zone_two.tpl +++ b/modules/dashperformance/views/templates/hook/dashboard_zone_two.tpl @@ -30,7 +30,7 @@
-
+

{l s='Average Daily Rate' mod='dashperformance'}

From 32168b44e14e73c1604dca9dd79b1857c94c2126 Mon Sep 17 00:00:00 2001 From: Sumit Panwar Date: Mon, 27 May 2024 18:01:13 +0530 Subject: [PATCH 03/40] Fixed: In Dashinsight:Room Nights line graphs fail to scale y axis to max values --- modules/dashinsights/views/js/dashinsights.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/dashinsights/views/js/dashinsights.js b/modules/dashinsights/views/js/dashinsights.js index feb98d0d1..7cdfb2d66 100644 --- a/modules/dashinsights/views/js/dashinsights.js +++ b/modules/dashinsights/views/js/dashinsights.js @@ -22,7 +22,7 @@ function line_chart_dashinsights(widget_name, chart_details) { nv.addGraph(function () { var chart = nv.models.lineChart() .x(function (d) { return (d !== undefined ? d[0] : 0); }) - .y(function (d) { return (d !== undefined ? d[1] : 0); }) + .y(function (d) { return (d !== undefined ? parseInt(d[1]) : 0); }) .forceY([0, 1]) .margin({ left: 40, From 0655785564650fca621a381cfe54e5db3f346916 Mon Sep 17 00:00:00 2001 From: Sumit Panwar Date: Tue, 28 May 2024 13:41:34 +0530 Subject: [PATCH 04/40] FIxed:Traffic visits in the activity overview increment if the customer logs in and logs out multiple times --- classes/Guest.php | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/classes/Guest.php b/classes/Guest.php index 15a71165c..2ec8ebbef 100644 --- a/classes/Guest.php +++ b/classes/Guest.php @@ -173,9 +173,18 @@ class GuestCore extends ObjectModel public function mergeWithCustomer($idGuest, $idCustomer) { // Since the guests are merged, the guest id in the connections table must be changed too - Db::getInstance()->update('connections', [ - 'id_guest' => (int) $idGuest, - ], 'id_guest = ' . (int) $this->id); + // If guest entry is already there in the connection within 30 mins then delete the visitor entry else update it with guest id of the customer + + $sql = 'SELECT SQL_NO_CACHE `id_guest` FROM `'._DB_PREFIX_.'connections` + WHERE `id_guest` = '.(int)$idGuest.' AND `date_add` > \''.pSQL(date('Y-m-d H:i:00', time() - 1800)).'\''. + Shop::addSqlRestriction(Shop::SHARE_CUSTOMER).' ORDER BY `date_add` DESC'; + if (Db::getInstance()->getRow($sql, false)) { + Db::getInstance()->delete('connections', 'id_guest = ' . (int) $this->id); + } else { + Db::getInstance()->update('connections', [ + 'id_guest' => (int) $idGuest, + ], 'id_guest = ' . (int) $this->id); + } // Since the guests are merged, the guest id in the cart table must be changed too Db::getInstance()->update('cart', [ From 572ab9c2d5d69845a40f26b74f199b75174202af Mon Sep 17 00:00:00 2001 From: Sumit Panwar Date: Tue, 28 May 2024 14:50:59 +0530 Subject: [PATCH 05/40] Fixed: Filtered data is not correct for the links under Currently Pending section in dashboard. --- controllers/admin/AdminOrdersController.php | 6 ++++++ .../views/templates/hook/dashboard_zone_one.tpl | 6 +++--- .../admin/AdminOrderRefundRequestsController.php | 5 +++++ 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/controllers/admin/AdminOrdersController.php b/controllers/admin/AdminOrdersController.php index c08b5f111..ca1a817f7 100644 --- a/controllers/admin/AdminOrdersController.php +++ b/controllers/admin/AdminOrdersController.php @@ -102,6 +102,12 @@ class AdminOrdersControllerCore extends AdminController } elseif (Tools::getValue('orders_stay_over')) { $this->_where .= ' AND hbd.`is_refunded` = 0 AND hbd.`is_back_order` = 0 AND hbd.`id_status` = '.(int) HotelBookingDetail::STATUS_CHECKED_IN.' AND hbd.`date_to` > \''.pSQL(date('Y-m-d')).' 00:00:00\''; + } elseif (Tools::getValue('orders_not_paid')) { + $this->_where .= ' AND os.`paid` = 0 AND a.`current_state` NOT IN ('.implode(',', array( + Configuration::get('PS_OS_CANCELED'), + Configuration::get('PS_OS_REFUND'), + Configuration::get('PS_OS_ERROR') + )).')'; } $this->_orderBy = 'id_order'; diff --git a/modules/dashactivity/views/templates/hook/dashboard_zone_one.tpl b/modules/dashactivity/views/templates/hook/dashboard_zone_one.tpl index 95cee2cd3..7d4675f50 100644 --- a/modules/dashactivity/views/templates/hook/dashboard_zone_one.tpl +++ b/modules/dashactivity/views/templates/hook/dashboard_zone_one.tpl @@ -79,7 +79,7 @@
  • - + {l s="Bookings (not paid)" mod='dashactivity'} @@ -89,7 +89,7 @@
  • - + {l s="Refunds" mod='dashactivity'} @@ -99,7 +99,7 @@
  • - + {l s="Abandoned Carts" mod='dashactivity'} diff --git a/modules/hotelreservationsystem/controllers/admin/AdminOrderRefundRequestsController.php b/modules/hotelreservationsystem/controllers/admin/AdminOrderRefundRequestsController.php index fa74ab46a..7799f70af 100644 --- a/modules/hotelreservationsystem/controllers/admin/AdminOrderRefundRequestsController.php +++ b/modules/hotelreservationsystem/controllers/admin/AdminOrderRefundRequestsController.php @@ -38,6 +38,11 @@ class AdminOrderRefundRequestsController extends ModuleAdminController $this->_orderWay = 'DESC'; $this->_group = 'GROUP BY ord.`id_order`'; + // filter pending refund requests + if (Tools::getValue('action') == 'filterPendingRequests') { + $this->_filterHaving = ' AND `total_pending_requests` > 0'; + } + $orderStatuses = OrderState::getOrderStates($this->context->language->id); $ordStatuses = array(); foreach ($orderStatuses as $status) { From 00c4deb9ff52d52f91cdd4b6b4fc55a100c6d78c Mon Sep 17 00:00:00 2001 From: Sumit Panwar Date: Tue, 28 May 2024 16:09:32 +0530 Subject: [PATCH 06/40] Validation messages are improved for invalid date selection of the dates from calendar in admin dashboard --- controllers/admin/AdminDashboardController.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/controllers/admin/AdminDashboardController.php b/controllers/admin/AdminDashboardController.php index 11ffe69e6..1fc4a45ae 100644 --- a/controllers/admin/AdminDashboardController.php +++ b/controllers/admin/AdminDashboardController.php @@ -295,9 +295,12 @@ class AdminDashboardControllerCore extends AdminController public function postProcess() { if (Tools::isSubmit('submitDateRange')) { - if (!Validate::isDate(Tools::getValue('date_from')) - || !Validate::isDate(Tools::getValue('date_to'))) { + if (!Validate::isDate(Tools::getValue('date_from')) && !Validate::isDate(Tools::getValue('date_to'))) { $this->errors[] = Tools::displayError('The selected date range is not valid.'); + } elseif (!Validate::isDate(Tools::getValue('date_from'))) { + $this->errors[] = Tools::displayError('Date from in not selected. Please select a date range from the calendar.'); + } elseif (!Validate::isDate(Tools::getValue('date_to'))) { + $this->errors[] = Tools::displayError('Date to in not selected. Please select a date range from the calendar.'); } if (Tools::getValue('datepicker_compare')) { From 054005294027dd581261d7a6599696a511f64c26 Mon Sep 17 00:00:00 2001 From: Sumit Panwar Date: Wed, 29 May 2024 11:44:21 +0530 Subject: [PATCH 07/40] Fixed:If pending refund requests are more than 1 , then clicking on refunds redirects to the blank page. Change Abondant cart link also --- .../views/templates/hook/dashboard_zone_one.tpl | 2 +- .../admin/AdminOrderRefundRequestsController.php | 6 +----- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/modules/dashactivity/views/templates/hook/dashboard_zone_one.tpl b/modules/dashactivity/views/templates/hook/dashboard_zone_one.tpl index 7d4675f50..e78b1e692 100644 --- a/modules/dashactivity/views/templates/hook/dashboard_zone_one.tpl +++ b/modules/dashactivity/views/templates/hook/dashboard_zone_one.tpl @@ -89,7 +89,7 @@
  • - + {l s="Refunds" mod='dashactivity'} diff --git a/modules/hotelreservationsystem/controllers/admin/AdminOrderRefundRequestsController.php b/modules/hotelreservationsystem/controllers/admin/AdminOrderRefundRequestsController.php index 7799f70af..af9ee1d77 100644 --- a/modules/hotelreservationsystem/controllers/admin/AdminOrderRefundRequestsController.php +++ b/modules/hotelreservationsystem/controllers/admin/AdminOrderRefundRequestsController.php @@ -38,11 +38,6 @@ class AdminOrderRefundRequestsController extends ModuleAdminController $this->_orderWay = 'DESC'; $this->_group = 'GROUP BY ord.`id_order`'; - // filter pending refund requests - if (Tools::getValue('action') == 'filterPendingRequests') { - $this->_filterHaving = ' AND `total_pending_requests` > 0'; - } - $orderStatuses = OrderState::getOrderStates($this->context->language->id); $ordStatuses = array(); foreach ($orderStatuses as $status) { @@ -78,6 +73,7 @@ class AdminOrderRefundRequestsController extends ModuleAdminController 'total_pending_requests' => array( 'title' => $this->l('Pending Requests'), 'align' => 'center', + 'type' => 'range', 'havingFilter' => true, ), ); From e37b8be5ac1ff00ac93248492e78fd48efce53db Mon Sep 17 00:00:00 2001 From: Shreesh Arora Date: Fri, 7 Jun 2024 17:13:59 +0530 Subject: [PATCH 08/40] Added: Hooks in all room search function queries --- .../classes/HotelBookingDetail.php | 212 +++++++++++++----- 1 file changed, 161 insertions(+), 51 deletions(-) diff --git a/modules/hotelreservationsystem/classes/HotelBookingDetail.php b/modules/hotelreservationsystem/classes/HotelBookingDetail.php index 047e1de46..207c67d0e 100644 --- a/modules/hotelreservationsystem/classes/HotelBookingDetail.php +++ b/modules/hotelreservationsystem/classes/HotelBookingDetail.php @@ -292,32 +292,34 @@ class HotelBookingDetail extends ObjectModel // Unavailable Rooms if ($search_unavai) { - $params = array( + $searchParams = array( 'idHotel' => $hotel_id, 'dateFrom' => $date_from, 'dateTo' => $date_to, 'idRoomType' => $id_room_type, 'allowedIdRoomTypes' => $allowedIdRoomTypes, 'applyLosRestriction' => $applyLosRestriction, + 'extra_params' => $params, ); - $unavailRoomTypes = $this->getSearchUnavailableRooms($params); + $unavailRoomTypes = $this->getSearchUnavailableRooms($searchParams); } // Cart Rooms if ($search_cart_rms) { - $params = array( + $searchParams = array( 'idHotel' => $hotel_id, 'idCart' => $id_cart, 'idGuest' => $id_guest, 'idRoomType' => $id_room_type, 'allowedIdRoomTypes' => $allowedIdRoomTypes, + 'extra_params' => $params, ); - $cartRoomTypes = $this->getSearchCartRooms($params); + $cartRoomTypes = $this->getSearchCartRooms($searchParams); } // Available Rooms if ($search_available) { - $params = array( + $searchParams = array( 'idHotel' => $hotel_id, 'dateFrom' => $date_from, 'dateTo' => $date_to, @@ -327,8 +329,9 @@ class HotelBookingDetail extends ObjectModel 'searchOccupancy' => $occupancy, 'allowedIdRoomTypes' => $allowedIdRoomTypes, 'applyLosRestriction' => $applyLosRestriction, + 'extra_params' => $params, ); - $availableRoomTypes = $this->getSearchAvailableRooms($params); + $availableRoomTypes = $this->getSearchAvailableRooms($searchParams); if ($availableRoomTypes['unavailableRoomTypes'] && $search_unavai) { foreach ($availableRoomTypes['unavailableRoomTypes'] as $idProduct => $roomTypeDetail) { if (!isset($unavailRoomTypes[$idProduct])) { @@ -345,19 +348,20 @@ class HotelBookingDetail extends ObjectModel // Booked Rooms if ($search_booked) { - $params = array( + $searchParams = array( 'idHotel' => $hotel_id, 'dateFrom' => $date_from, 'dateTo' => $date_to, 'idRoomType' => $id_room_type, 'allowedIdRoomTypes' => $allowedIdRoomTypes, + 'extra_params' => $params, ); - $bookedRoomTypes = $this->getSearchBookedRooms($params); + $bookedRoomTypes = $this->getSearchBookedRooms($searchParams); } // Partially available Rooms if ($search_partial) { - $params = array( + $searchParams = array( 'idHotel' => $hotel_id, 'dateFrom' => $date_from, 'dateTo' => $date_to, @@ -366,9 +370,10 @@ class HotelBookingDetail extends ObjectModel 'idRoomType' => $id_room_type, 'searchOccupancy' => $occupancy, 'allowedIdRoomTypes' => $allowedIdRoomTypes, + 'extra_params' => $params, ); - $partiallyAvailRoomTypes = $this->getSearchPartiallyAvailRooms($params); + $partiallyAvailRoomTypes = $this->getSearchPartiallyAvailRooms($searchParams); if ($partiallyAvailRoomTypes['unavailableRoomTypes'] && $search_unavai) { foreach ($partiallyAvailRoomTypes['unavailableRoomTypes'] as $idProduct => $roomTypeDetail) { @@ -501,28 +506,42 @@ class HotelBookingDetail extends ObjectModel $stayStartDate = date('Y-m-d', strtotime($dateFrom)); // Room status inactive - $sql1 = 'SELECT `id` AS `id_room`, `id_product`, `id_hotel`, `room_num`, `comment` AS `room_comment` + $sql = array(); + $sql[] = 'SELECT `id` AS `id_room`, `id_product`, `id_hotel`, `room_num`, `comment` AS `room_comment` FROM `'._DB_PREFIX_.'htl_room_information` WHERE `id_hotel`='.(int)$idHotel.' AND `id_status` = '. HotelRoomInformation::STATUS_INACTIVE.' AND IF('.(int)$idRoomType.' > 0, `id_product` = '.(int)$idRoomType.', 1) AND `id_product` IN ('.$allowedIdRoomTypes.')'; // check room is temperory inactive - $sql2 = 'SELECT hri.`id` AS `id_room`, hri.`id_product`, hri.`id_hotel`, hri.`room_num`, hri.`comment` AS `room_comment` + $sql[] = 'SELECT hri.`id` AS `id_room`, hri.`id_product`, hri.`id_hotel`, hri.`room_num`, hri.`comment` AS `room_comment` FROM `'._DB_PREFIX_.'htl_room_information` AS hri INNER JOIN `'._DB_PREFIX_.'htl_room_disable_dates` AS hrdd ON (hrdd.`id_room_type` = hri.`id_product` AND hrdd. id_room = hri.`id`) WHERE hri.`id_hotel`='.$idHotel.' AND hri.`id_status` = '. HotelRoomInformation::STATUS_TEMPORARY_INACTIVE .' AND hrdd.`date_from` <= \''.pSql($dateFrom).'\' AND hrdd.`date_to` >= \''.pSql($dateTo).'\' AND IF('.(int)$idRoomType.' > 0, hri.`id_product` = '.(int)$idRoomType.', 1) AND hri.`id_product` IN ('.$allowedIdRoomTypes.')'; - $sql = $sql1.' UNION '.$sql2; if ($applyLosRestriction) { - $sql3 = 'SELECT hri.`id` AS `id_room`, hri.`id_product`, hri.`id_hotel`, hri.`room_num`, hri.`comment` AS `room_comment` + $sql[] = 'SELECT hri.`id` AS `id_room`, hri.`id_product`, hri.`id_hotel`, hri.`room_num`, hri.`comment` AS `room_comment` FROM `'._DB_PREFIX_.'htl_room_information` AS hri INNER JOIN `'._DB_PREFIX_.'htl_room_type` AS hrt ON (hrt.`id_product` = hri.`id_product`) LEFT JOIN `'._DB_PREFIX_.'htl_room_type_restriction_date_range` AS hrtr ON (hrt.`id_product` = hrtr.`id_product` AND (hrtr.`date_from` <= \''.pSQL($stayStartDate).'\' AND hrtr.`date_to` > \''.pSQL($stayStartDate).'\')) WHERE hri.`id_hotel`='.(int)$idHotel.' AND (IFNULL(hrtr.`min_los`, hrt.`min_los`) >'. (int)$lengthOfStay.' OR IF(IFNULL(hrtr.`max_los`, hrt.`max_los`) > 0, IFNULL(hrtr.`max_los`, hrt.`max_los`) < '.(int)$lengthOfStay.', 0)) AND IF('.(int)$idRoomType.' > 0, hri.`id_product` = '.(int)$idRoomType.', 1) AND hri.`id_product` IN ('.$allowedIdRoomTypes.')'; - $sql = $sql.' UNION '.$sql3; } + $hookParams = array( + 'sql' => &$sql, + 'params' => array( + 'id_hotel' => $idHotel, + 'id_product' => $idRoomType, + 'date_from' => $dateFrom, + 'date_to' => $dateTo, + ) + ); + if (isset($extra_params)) { + $hookParams['params']['extra_params'] = $extra_params; + } + Hook::exec('actionUnavailRoomSearchSqlModifier', $hookParams); + + $sql = implode(' UNION ', $sql); $sql .= ' ORDER BY id_room ASC'; $unavailRoomTypes = array(); @@ -550,10 +569,43 @@ class HotelBookingDetail extends ObjectModel $cartRoomTypes = array(); if ($idCart && $idGuest) { - $sql = 'SELECT cbd.`id_product`, cbd.`id_room`, cbd.`id_hotel`, cbd.`booking_type`, cbd.`comment`, rf.`room_num`, cbd.`date_from`, cbd.`date_to` - FROM `'._DB_PREFIX_.'htl_cart_booking_data` AS cbd - INNER JOIN `'._DB_PREFIX_.'htl_room_information` AS rf ON (rf.`id` = cbd.`id_room`) - WHERE cbd.`id_hotel`= '.(int)$idHotel.' AND cbd.`id_cart` = '.(int)$idCart.' AND cbd.`id_guest` ='.(int)$idGuest.' AND cbd.`is_refunded` = 0 AND cbd.`is_back_order` = 0 AND IF('.(int)$idRoomType.' > 0, rf.`id_product` = '.(int)$idRoomType.', 1) AND rf.`id_product` IN ('.$allowedIdRoomTypes.')'; + $selectCartRoomSearch = 'SELECT cbd.`id_product`, cbd.`id_room`, cbd.`id_hotel`, cbd.`booking_type`, + cbd.`comment`, rf.`room_num`, cbd.`date_from`, cbd.`date_to`'; + $joinCartRoomSearch = 'INNER JOIN `'._DB_PREFIX_.'htl_room_information` AS rf ON (rf.`id` = cbd.`id_room`)'; + $whereCartRoomSearch = 'WHERE cbd.`id_hotel`= '.(int)$idHotel.' AND cbd.`id_cart` = '.(int)$idCart.' + AND cbd.`id_guest` ='.(int)$idGuest.' AND cbd.`is_refunded` = 0 AND cbd.`is_back_order` = 0 + AND IF('.(int)$idRoomType.' > 0, rf.`id_product` = '.(int)$idRoomType.', 1) AND rf.`id_product` + IN ('.$allowedIdRoomTypes.')'; + $groupByCartRoomSearch = ''; + $orderByCartRoomSearch = ''; + $orderWayCartRoomSearch = ''; + + $hookParams = array( + 'select' => $selectCartRoomSearch, + 'join' => &$joinCartRoomSearch, + 'where' => &$whereCartRoomSearch, + 'group_by' => &$groupByCartRoomSearch, + 'order_by' => &$orderByCartRoomSearch, + 'order_way' => &$orderWayCartRoomSearch, + 'params' => array( + 'id_hotel' => $idHotel, + 'id_product' => $idRoomType, + 'idCart' => $idCart, + 'idGuest' => $idGuest, + ) + ); + if (isset($extra_params)) { + $hookParams['params']['extra_params'] = $extra_params; + } + Hook::exec('actionCartRoomSearchSqlModifier', $hookParams); + + $sql = $selectCartRoomSearch; + $sql .= ' FROM `'._DB_PREFIX_.'htl_cart_booking_data` AS cbd'; + $sql .= ' '.$joinCartRoomSearch; + $sql .= ' '.$whereCartRoomSearch; + $sql .= ' '.$groupByCartRoomSearch; + $sql .= ' '.$orderByCartRoomSearch; + $sql .= ' '.$orderWayCartRoomSearch; if ($cartRooms = Db::getInstance()->executeS($sql)) { foreach ($cartRooms as $cartRoomDetail) { @@ -606,7 +658,8 @@ class HotelBookingDetail extends ObjectModel } // Exculde Booked rooms - $exclude_ids = 'SELECT `id_room` + $exclude_ids = array(); + $exclude_ids['checked_out'] = 'SELECT `id_room` FROM `'._DB_PREFIX_.'htl_booking_detail` WHERE `id_hotel` = '.(int)$idHotel.' AND `is_back_order` = 0 AND `is_refunded` = 0 AND IF(`id_status` = '. self::STATUS_CHECKED_OUT.', ( (DATE_FORMAT(`check_out`, "%Y-%m-%d") > \''.pSQL($dateFrom).'\' AND DATE_FORMAT(`check_out`, "%Y-%m-%d") <= \''.PSQL($dateTo).'\') AND ( @@ -624,16 +677,14 @@ class HotelBookingDetail extends ObjectModel // We have removed cart rooms after finally getting available rooms from booking // Exclude temporary disable rooms - $exclude_ids .= ' UNION - SELECT hri.`id` AS id_room + $exclude_ids['disabled'] = 'SELECT hri.`id` AS id_room FROM `'._DB_PREFIX_.'htl_room_information` AS hri INNER JOIN `'._DB_PREFIX_.'htl_room_disable_dates` AS hrdd ON (hrdd.`id_room_type` = hri.`id_product` AND hrdd.`id_room` = hri.`id`) WHERE hri.`id_hotel`='.(int)$idHotel.' AND hri.`id_status` = '. HotelRoomInformation::STATUS_TEMPORARY_INACTIVE .' AND (hrdd.`date_from` < \''.pSql($dateTo).'\' AND hrdd.`date_to` > \''.pSql($dateFrom).'\') AND IF('.(int)$idRoomType.' > 0, hri.`id_product` = '.(int)$idRoomType.', 1) AND hri.`id_product` IN ('.$allowedIdRoomTypes.')'; // LOS Restriction. Also, Remember to check max LOS restriction is greater than zero if ($applyLosRestriction) { - $exclude_ids .= ' UNION - SELECT hri.`id` AS `id_room` + $exclude_ids['length_of_stay'] = 'SELECT hri.`id` AS `id_room` FROM `'._DB_PREFIX_.'htl_room_information` AS hri INNER JOIN `'._DB_PREFIX_.'htl_room_type` AS hrt ON (hrt.`id_product` = hri.`id_product`) LEFT JOIN `'._DB_PREFIX_.'htl_room_type_restriction_date_range` AS hrtr ON (hrt.`id_product` = hrtr.`id_product` AND (hrtr.`date_from` <= \''.pSQL($stayStartDate).'\' AND hrtr.`date_to` > \''.pSQL($stayStartDate).'\')) @@ -644,33 +695,37 @@ class HotelBookingDetail extends ObjectModel $joinAvailRoomSearch = 'INNER JOIN `'._DB_PREFIX_.'htl_room_type` AS hrt ON (hrt.`id_product` = ri.`id_product`)'; - $whereAvailRoomSearch = 'WHERE ri.`id_hotel`='.(int)$idHotel.' AND ri.`id_status` != '. HotelRoomInformation::STATUS_INACTIVE.' AND ri.`id` NOT IN ('.$exclude_ids.') AND IF('.(int)$idRoomType.' > 0, ri.`id_product` = '.(int)$idRoomType.', 1) AND ri.`id_product` IN ('.$allowedIdRoomTypes.')'; + $whereAvailRoomSearch = 'WHERE ri.`id_hotel`='.(int)$idHotel.' AND ri.`id_status` != '. HotelRoomInformation::STATUS_INACTIVE.' AND IF('.(int)$idRoomType.' > 0, ri.`id_product` = '.(int)$idRoomType.', 1) AND ri.`id_product` IN ('.$allowedIdRoomTypes.')'; $groupByAvailRoomSearch = ''; $orderByAvailRoomSearch = 'ORDER BY ri.`id`'; $orderWayAvailRoomSearch = 'ASC'; - Hook::exec('actionAvailRoomSearchSqlModifier', - array( - 'select' => $selectAvailRoomSearch, - 'join' => &$joinAvailRoomSearch, - 'where' => &$whereAvailRoomSearch, - 'group_by' => &$groupByAvailRoomSearch, - 'order_by' => &$orderByAvailRoomSearch, - 'order_way' => &$orderWayAvailRoomSearch, - 'params' => array( - 'id_hotel' => $idHotel, - 'id_product' => $idRoomType, - 'date_from' => $dateFrom, - 'date_to' => $dateTo - ) + $hookParams = array( + 'select' => $selectAvailRoomSearch, + 'join' => &$joinAvailRoomSearch, + 'where' => &$whereAvailRoomSearch, + 'exclude_ids' => &$exclude_ids, + 'group_by' => &$groupByAvailRoomSearch, + 'order_by' => &$orderByAvailRoomSearch, + 'order_way' => &$orderWayAvailRoomSearch, + 'params' => array( + 'id_hotel' => $idHotel, + 'id_product' => $idRoomType, + 'date_from' => $dateFrom, + 'date_to' => $dateTo, ) ); + if (isset($extra_params)) { + $hookParams['params']['extra_params'] = $extra_params; + } + Hook::exec('actionAvailRoomSearchSqlModifier', $hookParams); $sql = $selectAvailRoomSearch; $sql .= ' FROM `'._DB_PREFIX_.'htl_room_information` AS ri'; $sql .= ' '.$joinAvailRoomSearch; $sql .= ' '.$whereAvailRoomSearch; + $sql .= ' AND ri.`id` NOT IN ('.implode(' UNION ', $exclude_ids).')'; $sql .= ' '.$groupByAvailRoomSearch; $sql .= ' '.$orderByAvailRoomSearch; $sql .= ' '.$orderWayAvailRoomSearch; @@ -921,7 +976,8 @@ class HotelBookingDetail extends ObjectModel { extract($params); - $sql1 = 'SELECT bd.`id_product`, bd.`id_room`, bd.`id_hotel`, bd.`id_customer`, bd.`booking_type`, bd.`id_status` AS booking_status, bd.`comment` AS `room_comment`, rf.`room_num`, bd.`date_from`, IF(bd.`id_status` = '. self::STATUS_CHECKED_OUT .', bd.`check_out`, bd.`date_to`) AS `date_to`, hrt.`max_adults` AS `max_adult`, hrt.`max_children`, hrt.`max_guests` AS `max_occupancy` + $sql = array(); + $sql[] = 'SELECT bd.`id_product`, bd.`id_room`, bd.`id_hotel`, bd.`id_customer`, bd.`booking_type`, bd.`id_status` AS booking_status, bd.`comment` AS `room_comment`, rf.`room_num`, bd.`date_from`, IF(bd.`id_status` = '. self::STATUS_CHECKED_OUT .', bd.`check_out`, bd.`date_to`) AS `date_to`, hrt.`max_adults` AS `max_adult`, hrt.`max_children`, hrt.`max_guests` AS `max_occupancy` FROM `'._DB_PREFIX_.'htl_booking_detail` AS bd INNER JOIN `'._DB_PREFIX_.'htl_room_information` AS rf ON (rf.`id` = bd.`id_room`) INNER JOIN `'._DB_PREFIX_.'htl_room_type` AS hrt ON (hrt.`id_product` = rf.`id_product`) @@ -937,7 +993,7 @@ class HotelBookingDetail extends ObjectModel (bd.`date_from` > \''.pSQL($dateFrom).'\' AND bd.`date_from` < \''.pSQL($dateTo).'\' AND bd.`date_to` < \''.pSQL($dateTo).'\') )) AND IF('.(int)$idRoomType.' > 0, rf.`id_product` = '.(int)$idRoomType.', 1) AND rf.`id_product` IN ('.$allowedIdRoomTypes.')'; - $sql2 = 'SELECT hri.`id_product`, hrdd.`id_room`, hri.`id_hotel`, 0 AS `id_customer`, 0 AS `booking_type`, 0 AS `booking_status`, 0 AS `room_comment`, hri.`room_num`, hrdd.`date_from`, hrdd.`date_to`, hrt.`max_adults` AS `max_adult`, hrt.`max_children`, hrt.`max_guests` AS `max_occupancy` + $sql[] = 'SELECT hri.`id_product`, hrdd.`id_room`, hri.`id_hotel`, 0 AS `id_customer`, 0 AS `booking_type`, 0 AS `booking_status`, 0 AS `room_comment`, hri.`room_num`, hrdd.`date_from`, hrdd.`date_to`, hrt.`max_adults` AS `max_adult`, hrt.`max_children`, hrt.`max_guests` AS `max_occupancy` FROM `'._DB_PREFIX_.'htl_room_information` AS hri INNER JOIN `'._DB_PREFIX_.'htl_room_type` AS hrt ON (hrt.`id_product` = hri.`id_product`) INNER JOIN `'._DB_PREFIX_.'htl_room_disable_dates` AS hrdd ON (hrdd.`id_room_type` = hri.`id_product` AND hrdd.`id_room` = hri.`id`) @@ -947,7 +1003,23 @@ class HotelBookingDetail extends ObjectModel (hrdd.`date_from` > \''.pSQL($dateFrom).'\' AND hrdd.`date_from` < \''.pSQL($dateTo).'\' AND hrdd.`date_to` < \''.pSQL($dateTo).'\') ) AND IF('.(int)$idRoomType.' > 0, hri.`id_product` = '.(int)$idRoomType.', 1) AND hri.`id_product` IN ('.$allowedIdRoomTypes.')'; - $sql = $sql1.' UNION '.$sql2.' ORDER BY id_room ASC'; + $hookParams = array( + 'sql' => &$sql, + 'params' => array( + 'id_hotel' => $idHotel, + 'id_product' => $idRoomType, + 'date_from' => $dateFrom, + 'date_to' => $dateTo, + ) + ); + if (isset($extra_params)) { + $hookParams['params']['extra_params'] = $extra_params; + } + Hook::exec('actionPartiallyAvailRoomSearchSqlModifier', $hookParams); + + $sql = implode(' UNION ', $sql); + $sql .= ' ORDER BY id_room ASC'; + $part_arr = Db::getInstance()->executeS($sql); // Get date wise available rooms @@ -1246,11 +1318,41 @@ class HotelBookingDetail extends ObjectModel { extract($params); - $sql = 'SELECT bd.`id`, bd.`id_product`, bd.`id_room`, bd.`id_hotel`, bd.`id_customer`, bd.`booking_type`, bd.`id_status` AS booking_status, bd.`comment`, rf.`room_num`, bd.`date_from`, bd.`date_to` - FROM `'._DB_PREFIX_.'htl_booking_detail` AS bd - INNER JOIN `'._DB_PREFIX_.'htl_room_information` AS rf ON (rf.`id` = bd.`id_room`) - WHERE bd.`id_hotel`='.(int)$idHotel.' AND bd.`is_refunded` = 0 AND bd.`is_back_order` = 0 AND IF(bd.`id_status` = '. self::STATUS_CHECKED_OUT .', bd.`date_from` <= \''.pSQL($dateFrom).'\' AND bd.`check_out` >= \''.pSQL($dateTo).'\', bd.`date_from` <= \''.pSQL($dateFrom).'\' AND bd.date_to >= \''.pSQL($dateTo).'\') AND IF('.(int)$idRoomType.' > 0, rf.`id_product` = '.(int)$idRoomType.', 1) AND rf.`id_product` IN ('.$allowedIdRoomTypes.') - ORDER BY bd.`id_room` ASC'; + $selectBookedRoomSearch = 'SELECT bd.`id`, bd.`id_product`, bd.`id_room`, bd.`id_hotel`, bd.`id_customer`, + bd.`booking_type`, bd.`id_status` AS booking_status, bd.`comment`, rf.`room_num`, bd.`date_from`, + bd.`date_to`'; + $joinBookedRoomSearch = 'INNER JOIN `'._DB_PREFIX_.'htl_room_information` AS rf ON (rf.`id` = bd.`id_room`)'; + $whereBookedRoomSearch = 'WHERE bd.`id_hotel`='.(int)$idHotel.' AND bd.`is_refunded` = 0 AND bd.`is_back_order` = 0 AND IF(bd.`id_status` = '. self::STATUS_CHECKED_OUT .', bd.`date_from` <= \''.pSQL($dateFrom).'\' AND bd.`check_out` >= \''.pSQL($dateTo).'\', bd.`date_from` <= \''.pSQL($dateFrom).'\' AND bd.date_to >= \''.pSQL($dateTo).'\') AND IF('.(int)$idRoomType.' > 0, rf.`id_product` = '.(int)$idRoomType.', 1) AND rf.`id_product` IN ('.$allowedIdRoomTypes.')'; + $groupByBookedRoomSearch = ''; + $orderByBookedRoomSearch = 'ORDER BY bd.`id_room` ASC'; + $orderWayBookedRoomSearch = ''; + + $hookParams = array( + 'select' => $selectBookedRoomSearch, + 'join' => &$joinBookedRoomSearch, + 'where' => &$whereBookedRoomSearch, + 'group_by' => &$groupByBookedRoomSearch, + 'order_by' => &$orderByBookedRoomSearch, + 'order_way' => &$orderWayBookedRoomSearch, + 'params' => array( + 'id_hotel' => $idHotel, + 'id_product' => $idRoomType, + 'date_from' => $dateFrom, + 'date_to' => $dateTo, + ) + ); + if (isset($extra_params)) { + $hookParams['params']['extra_params'] = $extra_params; + } + Hook::exec('actionBookedRoomSearchSqlModifier', $hookParams); + + $sql = $selectBookedRoomSearch; + $sql .= ' FROM `'._DB_PREFIX_.'htl_booking_detail` AS bd'; + $sql .= ' '.$joinBookedRoomSearch; + $sql .= ' '.$whereBookedRoomSearch; + $sql .= ' '.$groupByBookedRoomSearch; + $sql .= ' '.$orderByBookedRoomSearch; + $sql .= ' '.$orderWayBookedRoomSearch; $bookedRoomTypes = array(); if ($booked_rooms = Db::getInstance()->executeS($sql)) { @@ -1517,10 +1619,18 @@ class HotelBookingDetail extends ObjectModel $this->context = Context::getContext(); - $bookingParams['search_available'] = 1; - $bookingParams['search_partial'] = 0; - $bookingParams['search_booked'] = 0; - $bookingParams['search_unavai'] = 0; + if (!isset($bookingParams['search_available'])) { + $bookingParams['search_available'] = 1; + } + if (!isset($bookingParams['search_partial'])) { + $bookingParams['search_partial'] = 0; + } + if (!isset($bookingParams['search_booked'])) { + $bookingParams['search_booked'] = 0; + } + if (!isset($bookingParams['search_unavai'])) { + $bookingParams['search_unavai'] = 0; + } $bookingData = $this->getBookingData($bookingParams); From 574790a18c2ffb0a8fb67779e1dd991d595453bb Mon Sep 17 00:00:00 2001 From: Sumit Panwar Date: Wed, 12 Jun 2024 15:38:46 +0530 Subject: [PATCH 09/40] Fixed:Net Profit amount on dashboard is not getting reduced until admin refund amount for all rooms available in the booking. --- controllers/admin/AdminStatsController.php | 40 ++++++++++++++++++++++ modules/dashtrends/dashtrends.php | 3 ++ 2 files changed, 43 insertions(+) diff --git a/controllers/admin/AdminStatsController.php b/controllers/admin/AdminStatsController.php index 83eb40591..0585557aa 100644 --- a/controllers/admin/AdminStatsController.php +++ b/controllers/admin/AdminStatsController.php @@ -516,6 +516,46 @@ class AdminStatsControllerCore extends AdminStatsTabController } } + public static function getRefunds($date_from, $date_to, $granularity = false, $id_hotel = 0) + { + if ($granularity == 'day') { + $refunds = array(); + $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS(' + SELECT + LEFT(`invoice_date`, 10) as date, + SUM(orr.`refunded_amount`) as total_refund_amount, + ( + SELECT hbd.`id_hotel` + FROM`'._DB_PREFIX_.'htl_booking_detail` hbd + WHERE hbd.`id_order` = o.`id_order` LIMIT 1 + ) AS id_hotel + FROM `'._DB_PREFIX_.'orders` o + LEFT JOIN `'._DB_PREFIX_.'order_return` orr ON (o.id_order = orr.id_order) + LEFT JOIN `'._DB_PREFIX_.'order_state` os ON (o.current_state = os.id_order_state) + WHERE orr.`payment_mode` != "" AND orr.`id_transaction` != "" AND `invoice_date` BETWEEN "'.pSQL($date_from).' 00:00:00" AND "'.pSQL($date_to).' 23:59:59" AND os.logable = 1'.' + GROUP BY LEFT(`invoice_date`, 10) HAVING 1 '.HotelBranchInformation::addHotelRestriction($id_hotel)); + + foreach ($result as $row) { + $refunds[strtotime($row['date'])] = $row['total_refund_amount']; + } + + return $refunds; + } else { + return Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue( + 'SELECT SUM(orr.`refunded_amount`), + ( + SELECT hbd.`id_hotel` + FROM`'._DB_PREFIX_.'htl_booking_detail` hbd + WHERE hbd.`id_order` = o.`id_order` LIMIT 1 + ) AS id_hotel + FROM `'._DB_PREFIX_.'orders` o + LEFT JOIN `'._DB_PREFIX_.'order_return` orr ON (o.id_order = orr.id_order) + LEFT JOIN `'._DB_PREFIX_.'order_state` os ON (o.current_state = os.id_order_state) + WHERE orr.`payment_mode` != "" AND orr.`id_transaction` != "" AND `invoice_date` BETWEEN "'.pSQL($date_from).' 00:00:00" AND "'.pSQL($date_to).' 23:59:59" AND os.logable = 1 HAVING 1 '.HotelBranchInformation::addHotelRestriction($id_hotel) + ); + } + } + public static function getExpenses($date_from, $date_to, $granularity = false, $id_hotel = 0) { $expenses = ($granularity == 'day' ? array() : 0); diff --git a/modules/dashtrends/dashtrends.php b/modules/dashtrends/dashtrends.php index 7c6f1d06a..ae009aafc 100644 --- a/modules/dashtrends/dashtrends.php +++ b/modules/dashtrends/dashtrends.php @@ -107,6 +107,7 @@ class Dashtrends extends Module $tmp_data['total_paid_tax_excl'][$date] = $tmp_data['orders'][$date] * $tmp_data['average_cart_value'][$date]; $tmp_data['total_purchases'][$date] = $tmp_data['total_paid_tax_excl'][$date] * rand(50, 70) / 100; $tmp_data['total_expenses'][$date] = $tmp_data['total_paid_tax_excl'][$date] * rand(0, 10) / 100; + $tmp_data['total_refunds'][$date] = $tmp_data['total_paid_tax_excl'][$date] * rand(0, 5) / 100; } } else { $tmp_data['visits'] = AdminStatsController::getVisits(false, $date_from, $date_to, 'day'); @@ -114,6 +115,7 @@ class Dashtrends extends Module $tmp_data['total_paid_tax_excl'] = AdminStatsController::getTotalSales($date_from, $date_to, 'day', $id_hotel); $tmp_data['total_purchases'] = AdminStatsController::getPurchases($date_from, $date_to, 'day', $id_hotel); $tmp_data['total_expenses'] = AdminStatsController::getExpenses($date_from, $date_to, 'day', $id_hotel); + $tmp_data['total_refunds'] = AdminStatsController::getRefunds($date_from, $date_to, 'day', $id_hotel); } return $tmp_data; @@ -151,6 +153,7 @@ class Dashtrends extends Module $refined_data['net_profits'][$date] += (isset($gross_data['total_paid_tax_excl'][$date]) ? $gross_data['total_paid_tax_excl'][$date] : 0); $refined_data['net_profits'][$date] -= (isset($gross_data['total_purchases'][$date]) ? $gross_data['total_purchases'][$date] : 0); $refined_data['net_profits'][$date] -= (isset($gross_data['total_expenses'][$date]) ? $gross_data['total_expenses'][$date] : 0); + $refined_data['net_profits'][$date] -= (isset($gross_data['total_refunds'][$date]) ? $gross_data['total_refunds'][$date] : 0); } return $refined_data; From 969b25bee2f8bb181682625b7975fe976ea12c82 Mon Sep 17 00:00:00 2001 From: Sumit Panwar Date: Wed, 12 Jun 2024 20:47:10 +0530 Subject: [PATCH 10/40] Fixed: Issues of TREVPAR and GOPPAR --- controllers/admin/AdminStatsController.php | 109 ++++++++++++--------- 1 file changed, 60 insertions(+), 49 deletions(-) diff --git a/controllers/admin/AdminStatsController.php b/controllers/admin/AdminStatsController.php index 0585557aa..b410c01b6 100644 --- a/controllers/admin/AdminStatsController.php +++ b/controllers/admin/AdminStatsController.php @@ -1553,7 +1553,8 @@ class AdminStatsControllerCore extends AdminStatsTabController return $result; } - public static function getTotalRevenueForDiscreteDates($dateFrom, $dateTo = null, $idHotel = null, $useCache = true) + // Calculate total services revenue (services and demands) + public static function getServicesRevenueForDiscreteDates($dateFrom, $dateTo = null, $idHotel = null, $useCache = true) { $dateTo = !$dateTo ? date('Y-m-d', strtotime('+1 day', strtotime($dateFrom))) : $dateTo; @@ -1571,41 +1572,53 @@ class AdminStatsControllerCore extends AdminStatsTabController $result = array(); foreach ($discreteDates as $discreteDate) { - $cacheKey = 'AdminStats::getTotalRevenueForDiscreteDates'.'_'.(int) $discreteDate['timestamp_from'].'_'. - (!is_array($idHotel) ? (int) $idHotel : implode('_', $idHotel)); - if (!Cache::isStored($cacheKey) || !$useCache) { - $sql = 'SELECT SUM((current_parts / total_parts) * total_paid_tax_excl) AS total_revenue - FROM ( - SELECT o.`id_order`, - o.`total_paid_tax_excl` / o.`conversion_rate` AS total_paid_tax_excl, - ( - SELECT SUM(DATEDIFF(hbd.`date_to`, hbd.`date_from`)) - FROM `'._DB_PREFIX_.'htl_booking_detail` hbd - INNER JOIN `'._DB_PREFIX_.'product` p ON (p.`id_product` = hbd.`id_product`) - WHERE hbd.`id_order` = o.`id_order` - AND p.`active` = 1 AND hbd.`is_refunded` = 0 AND o.`valid` = 1'. - (!is_null($idHotel) ? HotelBranchInformation::addHotelRestriction($idHotel, 'hbd') : '').' - ) AS total_parts, - ( - SELECT COUNT(*) - FROM `'._DB_PREFIX_.'htl_booking_detail` hbd - INNER JOIN `'._DB_PREFIX_.'product` p ON (p.`id_product` = hbd.`id_product`) - WHERE hbd.`id_order` = o.`id_order` - AND hbd.`date_from` <= "'.pSQL($discreteDate['date_from']).' 00:00:00" AND hbd.`date_to` >= "'.pSQL($discreteDate['date_to']).' 00:00:00" - AND p.`active` = 1 AND hbd.`is_refunded` = 0 AND o.`valid` = 1'. - (!is_null($idHotel) ? HotelBranchInformation::addHotelRestriction($idHotel, 'hbd') : '').' - ) AS current_parts - FROM `'._DB_PREFIX_.'orders` o - HAVING total_parts IS NOT NULL AND current_parts > 0 - ORDER BY o.`id_order` - ) AS t'; + $totalServicesRevenue = 0; + // Calculate services revenue + $servicesRevenueSql = 'SELECT SUM((rtspod.`total_price_tax_excl` / o.`conversion_rate`) / DATEDIFF(hbd.`date_to`, hbd.`date_from`)) + FROM `'._DB_PREFIX_.'htl_room_type_service_product_order_detail` rtspod + LEFT JOIN `'._DB_PREFIX_.'htl_booking_detail` hbd + ON (rtspod.`id_htl_booking_detail` = hbd.`id`) + LEFT JOIN `'._DB_PREFIX_.'product` p ON (p.`id_product` = hbd.`id_product`) + LEFT JOIN `'._DB_PREFIX_.'orders` o ON (o.`id_order` = hbd.`id_order`) + WHERE p.`active` = 1 + AND hbd.`is_refunded` = 0 + AND hbd.`date_from` < "'.pSQL($discreteDate['date_to']).' 00:00:00" AND hbd.`date_to` > "'.pSQL($discreteDate['date_from']).' 00:00:00"'. + (!is_null($idHotel) ? HotelBranchInformation::addHotelRestriction($idHotel, 'hbd') : ''); - $value = Db::getInstance()->getValue($sql); - $value = !$value ? 0: (float) $value; - Cache::store($cacheKey, $value); + if ($servicesRevenue = Db::getInstance()->getValue($servicesRevenueSql)) { + $totalServicesRevenue += $servicesRevenue; } - $result[$discreteDate['timestamp_from']] = Cache::retrieve($cacheKey); + // Calculate demands revenue + $demandsRevenueSql = 'SELECT SUM((hdmd.`total_price_tax_excl` / o.`conversion_rate`) / DATEDIFF(hbd.`date_to`, hbd.`date_from`)) + FROM `'._DB_PREFIX_.'htl_booking_demands` hdmd + LEFT JOIN `'._DB_PREFIX_.'htl_booking_detail` hbd + ON (hdmd.`id_htl_booking` = hbd.`id`) + LEFT JOIN `'._DB_PREFIX_.'product` p ON (p.`id_product` = hbd.`id_product`) + LEFT JOIN `'._DB_PREFIX_.'orders` o ON (o.`id_order` = hbd.`id_order`) + WHERE p.`active` = 1 + AND hbd.`is_refunded` = 0 + AND hbd.`date_from` < "'.pSQL($discreteDate['date_to']).' 00:00:00" AND hbd.`date_to` > "'.pSQL($discreteDate['date_from']).' 00:00:00"'. + (!is_null($idHotel) ? HotelBranchInformation::addHotelRestriction($idHotel, 'hbd') : ''); + + if ($demandsRevenue = Db::getInstance()->getValue($demandsRevenueSql)) { + $totalServicesRevenue += $demandsRevenue; + } + + $result[$discreteDate['timestamp_from']] = $totalServicesRevenue; + } + + return $result; + } + + public static function getTotalRevenueForDiscreteDates($dateFrom, $dateTo = null, $idHotel = null, $useCache = true) + { + $result = array(); + $servicesRevenueByDates = self::getServicesRevenueForDiscreteDates($dateFrom, $dateTo, $idHotel); + if ($roomsRevenueByDates = self::getRoomsRevenueForDiscreteDates($dateFrom, $dateTo, $idHotel)) { + foreach ($roomsRevenueByDates as $key => $value) { + $result[$key] = (isset($servicesRevenueByDates[$key]) ? $servicesRevenueByDates[$key] : 0) + $value; + } } return $result; @@ -2061,17 +2074,16 @@ class AdminStatsControllerCore extends AdminStatsTabController $roomsSql = 'SELECT IFNULL(SUM( CASE - WHEN od.`original_wholesale_price` <> "0.000000" - THEN od.`original_wholesale_price` - WHEN p.`wholesale_price` <> "0.000000" - THEN p.`wholesale_price` + WHEN od.`purchase_supplier_price` <> "0.000000" + THEN od.`purchase_supplier_price` + WHEN od.`purchase_supplier_price` = "0.000000" + THEN (od.`original_product_price` / o.`conversion_rate`) * '.(int)Configuration::get('CONF_AVERAGE_PRODUCT_MARGIN').' / 100 END ), 0) FROM `'._DB_PREFIX_.'htl_booking_detail` hbd - LEFT JOIN `'._DB_PREFIX_.'product` p - ON (p.`id_product` = hbd.`id_product`) - LEFT JOIN `'._DB_PREFIX_.'order_detail` od - ON (od.`id_order_detail` = hbd.`id_order_detail`) + LEFT JOIN `'._DB_PREFIX_.'product` p ON (p.`id_product` = hbd.`id_product`) + LEFT JOIN `'._DB_PREFIX_.'order_detail` od ON (od.`id_order_detail` = hbd.`id_order_detail`) + LEFT JOIN `'._DB_PREFIX_.'orders` o ON (od.`id_order` = o.`id_order`) WHERE p.`active` = 1 AND hbd.`is_refunded` = 0 AND hbd.`date_from` < "'.pSQL($discreteDate['date_to']).' 00:00:00" AND hbd.`date_to` > "'.pSQL($discreteDate['date_from']).' 00:00:00"'. @@ -2085,19 +2097,18 @@ class AdminStatsControllerCore extends AdminStatsTabController $servicesSql = 'SELECT IFNULL(SUM( CASE - WHEN od.`original_wholesale_price` <> "0.000000" - THEN od.`original_wholesale_price` - WHEN p.`wholesale_price` <> "0.000000" - THEN p.`wholesale_price` + WHEN od.`purchase_supplier_price` <> "0.000000" + THEN (od.`purchase_supplier_price` / (IF (od.`product_price_calculation_method` = '.Product::PRICE_CALCULATION_METHOD_PER_BOOKING.', DATEDIFF(hbd.`date_to`, hbd.`date_from`), 1))) + WHEN od.`purchase_supplier_price` = "0.000000" + THEN ((od.`original_product_price` / o.`conversion_rate`) * '.(int)Configuration::get('CONF_AVERAGE_PRODUCT_MARGIN').' / 100) / (IF (od.`product_price_calculation_method` = '.Product::PRICE_CALCULATION_METHOD_PER_BOOKING.', DATEDIFF(hbd.`date_to`, hbd.`date_from`), 1)) END ), 0) FROM `'._DB_PREFIX_.'htl_room_type_service_product_order_detail` rtspod LEFT JOIN `'._DB_PREFIX_.'htl_booking_detail` hbd ON (rtspod.`id_htl_booking_detail` = hbd.`id`) - LEFT JOIN `'._DB_PREFIX_.'product` p - ON (p.`id_product` = hbd.`id_product`) - LEFT JOIN `'._DB_PREFIX_.'order_detail` od - ON (od.`id_order_detail` = rtspod.`id_order_detail`) + LEFT JOIN `'._DB_PREFIX_.'product` p ON (p.`id_product` = rtspod.`id_product`) + LEFT JOIN `'._DB_PREFIX_.'order_detail` od ON (od.`id_order_detail` = rtspod.`id_order_detail`) + LEFT JOIN `'._DB_PREFIX_.'orders` o ON (od.`id_order` = o.`id_order`) WHERE p.`active` = 1 AND hbd.`is_refunded` = 0 AND hbd.`date_from` < "'.pSQL($discreteDate['date_to']).' 00:00:00" AND hbd.`date_to` > "'.pSQL($discreteDate['date_from']).' 00:00:00"'. From 63e31e7e59b80932c6b44596944e2644475e3cd0 Mon Sep 17 00:00:00 2001 From: Sumit Panwar Date: Wed, 12 Jun 2024 20:55:20 +0530 Subject: [PATCH 11/40] Fixed: Valid order condition for TREVPAR and GOPPAR --- controllers/admin/AdminStatsController.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/controllers/admin/AdminStatsController.php b/controllers/admin/AdminStatsController.php index b410c01b6..bfade8289 100644 --- a/controllers/admin/AdminStatsController.php +++ b/controllers/admin/AdminStatsController.php @@ -1581,6 +1581,7 @@ class AdminStatsControllerCore extends AdminStatsTabController LEFT JOIN `'._DB_PREFIX_.'product` p ON (p.`id_product` = hbd.`id_product`) LEFT JOIN `'._DB_PREFIX_.'orders` o ON (o.`id_order` = hbd.`id_order`) WHERE p.`active` = 1 + AND o.`valid` = 1 AND hbd.`is_refunded` = 0 AND hbd.`date_from` < "'.pSQL($discreteDate['date_to']).' 00:00:00" AND hbd.`date_to` > "'.pSQL($discreteDate['date_from']).' 00:00:00"'. (!is_null($idHotel) ? HotelBranchInformation::addHotelRestriction($idHotel, 'hbd') : ''); @@ -1597,6 +1598,7 @@ class AdminStatsControllerCore extends AdminStatsTabController LEFT JOIN `'._DB_PREFIX_.'product` p ON (p.`id_product` = hbd.`id_product`) LEFT JOIN `'._DB_PREFIX_.'orders` o ON (o.`id_order` = hbd.`id_order`) WHERE p.`active` = 1 + AND o.`valid` = 1 AND hbd.`is_refunded` = 0 AND hbd.`date_from` < "'.pSQL($discreteDate['date_to']).' 00:00:00" AND hbd.`date_to` > "'.pSQL($discreteDate['date_from']).' 00:00:00"'. (!is_null($idHotel) ? HotelBranchInformation::addHotelRestriction($idHotel, 'hbd') : ''); @@ -2085,6 +2087,7 @@ class AdminStatsControllerCore extends AdminStatsTabController LEFT JOIN `'._DB_PREFIX_.'order_detail` od ON (od.`id_order_detail` = hbd.`id_order_detail`) LEFT JOIN `'._DB_PREFIX_.'orders` o ON (od.`id_order` = o.`id_order`) WHERE p.`active` = 1 + AND o.`valid` = 1 AND hbd.`is_refunded` = 0 AND hbd.`date_from` < "'.pSQL($discreteDate['date_to']).' 00:00:00" AND hbd.`date_to` > "'.pSQL($discreteDate['date_from']).' 00:00:00"'. (!is_null($idHotel) ? HotelBranchInformation::addHotelRestriction($idHotel, 'hbd') : ''); @@ -2110,6 +2113,7 @@ class AdminStatsControllerCore extends AdminStatsTabController LEFT JOIN `'._DB_PREFIX_.'order_detail` od ON (od.`id_order_detail` = rtspod.`id_order_detail`) LEFT JOIN `'._DB_PREFIX_.'orders` o ON (od.`id_order` = o.`id_order`) WHERE p.`active` = 1 + AND o.`valid` = 1 AND hbd.`is_refunded` = 0 AND hbd.`date_from` < "'.pSQL($discreteDate['date_to']).' 00:00:00" AND hbd.`date_to` > "'.pSQL($discreteDate['date_from']).' 00:00:00"'. (!is_null($idHotel) ? HotelBranchInformation::addHotelRestriction($idHotel, 'hbd') : ''); From 337c37c96fb6abd9642febba50032077e1dc25cc Mon Sep 17 00:00:00 2001 From: Shreesh Arora Date: Fri, 12 Jul 2024 19:24:10 +0530 Subject: [PATCH 12/40] Updated: Rooms search algo|passed addition parameters in search hooks for data manipulation --- .../classes/HotelBookingDetail.php | 162 +++++++++++------- .../classes/HotelRoomInformation.php | 28 ++- .../AdminHotelRoomsBookingController.php | 2 +- .../views/css/HotelReservationAdmin.css | 14 +- .../views/js/admin/hotel_rooms_booking.js | 60 +++++++ .../helpers/view/_partials/booking-rooms.tpl | 24 ++- .../helpers/view/_partials/search-stats.tpl | 3 + 7 files changed, 223 insertions(+), 70 deletions(-) diff --git a/modules/hotelreservationsystem/classes/HotelBookingDetail.php b/modules/hotelreservationsystem/classes/HotelBookingDetail.php index 51b89bedf..9a6dfab3d 100644 --- a/modules/hotelreservationsystem/classes/HotelBookingDetail.php +++ b/modules/hotelreservationsystem/classes/HotelBookingDetail.php @@ -211,6 +211,9 @@ class HotelBookingDetail extends ObjectModel if (!isset($params['search_cart_rms'])) { $params['search_cart_rms'] = 0; } + if (!isset($params['hourly_booking'])) { + $params['hourly_booking'] = false; + } if (!isset($params['only_active_roomtype'])) { $params['only_active_roomtype'] = 1; @@ -329,17 +332,28 @@ class HotelBookingDetail extends ObjectModel 'searchOccupancy' => $occupancy, 'allowedIdRoomTypes' => $allowedIdRoomTypes, 'applyLosRestriction' => $applyLosRestriction, + 'hourlyBooking' => $hourly_booking, 'extra_params' => $params, ); $availableRoomTypes = $this->getSearchAvailableRooms($searchParams); if ($availableRoomTypes['unavailableRoomTypes'] && $search_unavai) { + // format unavailable room types foreach ($availableRoomTypes['unavailableRoomTypes'] as $idProduct => $roomTypeDetail) { - if (!isset($unavailRoomTypes[$idProduct])) { - $unavailRoomTypes[$idProduct] = array(); + foreach ($roomTypeDetail as $idRoom => $roomDetail) { + if (!isset($unavailRoomTypes[$idProduct][$idRoom])) { + $unavailRoomTypes[$idProduct][$idRoom] = array( + 'id_product' => $roomDetail['id_product'], + 'id_room' => $roomDetail['id_room'], + 'id_hotel' => $roomDetail['id_hotel'], + 'room_num' => $roomDetail['room_num'], + 'detail' => array() + ); + } + $unavailRoomTypes[$idProduct][$idRoom]['detail'][] = array( + 'id_status' => $roomDetail['id_status'], + 'room_comment' => $roomDetail['room_comment'] + ); } - - // FYI: used array_merge because we have int index - $unavailRoomTypes[$idProduct] = array_merge($unavailRoomTypes[$idProduct], $roomTypeDetail); } } @@ -370,22 +384,14 @@ class HotelBookingDetail extends ObjectModel 'idRoomType' => $id_room_type, 'searchOccupancy' => $occupancy, 'allowedIdRoomTypes' => $allowedIdRoomTypes, + 'hourlyBooking' => $hourly_booking, 'extra_params' => $params, ); $partiallyAvailRoomTypes = $this->getSearchPartiallyAvailRooms($searchParams); - if ($partiallyAvailRoomTypes['unavailableRoomTypes'] && $search_unavai) { - foreach ($partiallyAvailRoomTypes['unavailableRoomTypes'] as $idProduct => $roomTypeDetail) { - if (!isset($unavailRoomTypes[$idProduct])) { - $unavailRoomTypes[$idProduct] = array(); - } - - // FYI: used array_merge because we have int index - $unavailRoomTypes[$idProduct] = array_merge($unavailRoomTypes[$idProduct], $roomTypeDetail); - } - } - + // Unavailable rooms and booked rooms are already included in there respective search + // So, no need to seperate them here $partiallyAvailRoomsCount = $partiallyAvailRoomTypes['partiallyAvailRoomsCount']; $partiallyAvailRoomTypes = $partiallyAvailRoomTypes['partiallyAvailRooms']; } @@ -485,6 +491,7 @@ class HotelBookingDetail extends ObjectModel * 'idRoomType' => ..., * 'allowedIdRoomTypes' => ..., * 'applyLosRestriction' => ..., + * 'extra_params' => ..., * ); */ protected function getSearchUnavailableRooms($params) @@ -507,19 +514,24 @@ class HotelBookingDetail extends ObjectModel // Room status inactive $sql = array(); - $sql[] = 'SELECT `id` AS `id_room`, `id_product`, `id_hotel`, `room_num`, `comment` AS `room_comment` + $sql[] = 'SELECT `id` AS `id_room`, `id_product`, `id_hotel`, `room_num`, `comment` AS `room_comment`, `id_status`, NULL AS `date_from`, NULL AS `date_to` FROM `'._DB_PREFIX_.'htl_room_information` WHERE `id_hotel`='.(int)$idHotel.' AND `id_status` = '. HotelRoomInformation::STATUS_INACTIVE.' AND IF('.(int)$idRoomType.' > 0, `id_product` = '.(int)$idRoomType.', 1) AND `id_product` IN ('.$allowedIdRoomTypes.')'; // check room is temperory inactive - $sql[] = 'SELECT hri.`id` AS `id_room`, hri.`id_product`, hri.`id_hotel`, hri.`room_num`, hri.`comment` AS `room_comment` + $sql[] = 'SELECT hri.`id` AS `id_room`, hri.`id_product`, hri.`id_hotel`, hri.`room_num`, hri.`comment` AS `room_comment`, hri.`id_status`, hrdd.`date_from` AS `date_from`, hrdd.`date_to` AS `date_to` FROM `'._DB_PREFIX_.'htl_room_information` AS hri INNER JOIN `'._DB_PREFIX_.'htl_room_disable_dates` AS hrdd ON (hrdd.`id_room_type` = hri.`id_product` AND hrdd. id_room = hri.`id`) - WHERE hri.`id_hotel`='.$idHotel.' AND hri.`id_status` = '. HotelRoomInformation::STATUS_TEMPORARY_INACTIVE .' AND hrdd.`date_from` <= \''.pSql($dateFrom).'\' AND hrdd.`date_to` >= \''.pSql($dateTo).'\' AND IF('.(int)$idRoomType.' > 0, hri.`id_product` = '.(int)$idRoomType.', 1) AND hri.`id_product` IN ('.$allowedIdRoomTypes.')'; + WHERE hri.`id_hotel`='.$idHotel.' AND hri.`id_status` = '. HotelRoomInformation::STATUS_TEMPORARY_INACTIVE .' AND ( + (hrdd.`date_from` <= \''.pSQL($dateFrom).'\' AND hrdd.`date_to` > \''.pSQL($dateFrom).'\' AND hrdd.`date_to` <= \''.pSQL($dateTo).'\') OR + (hrdd.`date_from` >= \''.pSQL($dateFrom).'\' AND hrdd.`date_to` > \''.pSQL($dateFrom).'\' AND hrdd.`date_to` <= \''.pSQL($dateTo).'\') OR + (hrdd.`date_from` >= \''.pSQL($dateFrom).'\' AND hrdd.`date_from` < \''.pSQL($dateTo).'\' AND hrdd.`date_to` >= \''.pSQL($dateTo).'\') OR + (hrdd.`date_from` <= \''.pSql($dateFrom).'\' AND hrdd.`date_to` >= \''.pSql($dateTo).'\') + ) AND IF('.(int)$idRoomType.' > 0, hri.`id_product` = '.(int)$idRoomType.', 1) AND hri.`id_product` IN ('.$allowedIdRoomTypes.')'; if ($applyLosRestriction) { - $sql[] = 'SELECT hri.`id` AS `id_room`, hri.`id_product`, hri.`id_hotel`, hri.`room_num`, hri.`comment` AS `room_comment` + $sql[] = 'SELECT hri.`id` AS `id_room`, hri.`id_product`, hri.`id_hotel`, hri.`room_num`, hri.`comment` AS `room_comment`, '.HotelRoomInformation::STATUS_SEARCH_LOS_UNSATISFIED.' AS `id_status`, NULL AS `date_from`, NULL AS `date_to` FROM `'._DB_PREFIX_.'htl_room_information` AS hri INNER JOIN `'._DB_PREFIX_.'htl_room_type` AS hrt ON (hrt.`id_product` = hri.`id_product`) LEFT JOIN `'._DB_PREFIX_.'htl_room_type_restriction_date_range` AS hrtr ON (hrt.`id_product` = hrtr.`id_product` AND (hrtr.`date_from` <= \''.pSQL($stayStartDate).'\' AND hrtr.`date_to` > \''.pSQL($stayStartDate).'\')) @@ -542,12 +554,26 @@ class HotelBookingDetail extends ObjectModel Hook::exec('actionUnavailRoomSearchSqlModifier', $hookParams); $sql = implode(' UNION ', $sql); - $sql .= ' ORDER BY id_room ASC'; + $sql .= ' ORDER BY `id_room`, `date_from` ASC'; $unavailRoomTypes = array(); if ($unavailRooms = Db::getInstance()->executeS($sql)) { foreach ($unavailRooms as $unavailRoomDetail) { - $unavailRoomTypes[$unavailRoomDetail['id_product']][] = $unavailRoomDetail; + if (!isset($unavailRoomTypes[$unavailRoomDetail['id_product']][$unavailRoomDetail['id_room']])) { + $unavailRoomTypes[$unavailRoomDetail['id_product']][$unavailRoomDetail['id_room']] = array( + 'id_product' => $unavailRoomDetail['id_product'], + 'id_room' => $unavailRoomDetail['id_room'], + 'id_hotel' => $unavailRoomDetail['id_hotel'], + 'room_num' => $unavailRoomDetail['room_num'], + 'detail' => array() + ); + } + $unavailRoomTypes[$unavailRoomDetail['id_product']][$unavailRoomDetail['id_room']]['detail'][] = array( + 'id_status' => $unavailRoomDetail['id_status'], + 'room_comment' => $unavailRoomDetail['room_comment'], + 'date_from' => $unavailRoomDetail['date_from'], + 'date_to' => $unavailRoomDetail['date_to'], + ); } } @@ -561,6 +587,7 @@ class HotelBookingDetail extends ObjectModel * 'idGuest' => ..., * 'idRoomType' => ..., * 'allowedIdRoomTypes' => ..., + * 'extra_params' => ..., * ); */ protected function getSearchCartRooms($params) @@ -620,15 +647,17 @@ class HotelBookingDetail extends ObjectModel /** * $params = array( - * 'idHotel' => ..., - * 'dateFrom' => ..., - * 'dateTo' => ..., - * 'idCart' => ..., - * 'idGuest' => ..., - * 'idRoomType' => ..., - * 'searchOccupancy' => ..., - * 'allowedIdRoomTypes' => ..., - * 'applyLosRestriction' => ..., + * 'idHotel' => ..., + * 'dateFrom' => ..., + * 'dateTo' => ..., + * 'idCart' => ..., + * 'idGuest' => ..., + * 'idRoomType' => ..., + * 'searchOccupancy' => ..., + * 'allowedIdRoomTypes' => ..., + * 'applyLosRestriction' => ..., + * 'hourlyBooking' => ..., + * 'extra_params' => ..., * ); */ protected function getSearchAvailableRooms($params) @@ -661,13 +690,12 @@ class HotelBookingDetail extends ObjectModel $exclude_ids = array(); $exclude_ids['checked_out'] = 'SELECT `id_room` FROM `'._DB_PREFIX_.'htl_booking_detail` - WHERE `id_hotel` = '.(int)$idHotel.' AND `is_back_order` = 0 AND `is_refunded` = 0 AND IF(`id_status` = '. self::STATUS_CHECKED_OUT.', ( - (DATE_FORMAT(`check_out`, "%Y-%m-%d") > \''.pSQL($dateFrom).'\' AND DATE_FORMAT(`check_out`, "%Y-%m-%d") <= \''.PSQL($dateTo).'\') AND ( + WHERE `id_hotel` = '.(int)$idHotel.' AND `is_back_order` = 0 AND `is_refunded` = 0 AND IF(`id_status` = '. self::STATUS_CHECKED_OUT.', + IF('.(int) $hourlyBooking.', 1, (DATE_FORMAT(`check_out`, "%Y-%m-%d") != DATE_FORMAT(\''.pSQL($dateFrom).'\', "%Y-%m-%d")) AND (`check_out` > \''.pSQL($dateFrom).'\' AND `check_out` <= \''.PSQL($dateTo).'\')) AND ( (`date_from` <= \''.pSQL($dateFrom).'\' AND `check_out` > \''.pSQL($dateFrom).'\' AND `check_out` <= \''.PSQL($dateTo).'\') OR (`date_from` >= \''.pSQL($dateFrom).'\' AND `check_out` > \''.pSQL($dateFrom).'\' AND `check_out` <= \''.pSQL($dateTo).'\') OR (`date_from` >= \''.pSQL($dateFrom).'\' AND `date_from` < \''.pSQL($dateTo).'\' AND `check_out` >= \''.pSQL($dateTo).'\') OR (`date_from` <= \''.pSQL($dateFrom).'\' AND `check_out` >= \''.pSQL($dateTo).'\') - ) ), ( (`date_from` <= \''.pSQL($dateFrom).'\' AND `date_to` > \''.pSQL($dateFrom).'\' AND `date_to` <= \''.PSQL($dateTo).'\') OR (`date_from` >= \''.pSQL($dateFrom).'\' AND `date_to` <= \''.pSQL($dateTo).'\') OR @@ -675,7 +703,6 @@ class HotelBookingDetail extends ObjectModel (`date_from` <= \''.pSQL($dateFrom).'\' AND `date_to` >= \''.pSQL($dateTo).'\') )) AND IF('.(int)$idRoomType.' > 0, `id_product` = '.(int)$idRoomType.', 1) AND `id_product` IN ('.$allowedIdRoomTypes.')'; - // We have removed cart rooms after finally getting available rooms from booking // Exclude temporary disable rooms $exclude_ids['disabled'] = 'SELECT hri.`id` AS id_room FROM `'._DB_PREFIX_.'htl_room_information` AS hri @@ -690,6 +717,7 @@ class HotelBookingDetail extends ObjectModel LEFT JOIN `'._DB_PREFIX_.'htl_room_type_restriction_date_range` AS hrtr ON (hrt.`id_product` = hrtr.`id_product` AND (hrtr.`date_from` <= \''.pSQL($stayStartDate).'\' AND hrtr.`date_to` > \''.pSQL($stayStartDate).'\')) WHERE hri.`id_hotel`='.(int)$idHotel.' AND (IFNULL(hrtr.`min_los`, hrt.`min_los`) >'. (int)$lengthOfStay.' OR IF(IFNULL(hrtr.`max_los`, hrt.`max_los`) > 0, IFNULL(hrtr.`max_los`, hrt.`max_los`) < '.(int)$lengthOfStay.', 0)) AND IF('.(int)$idRoomType.' > 0, hri.`id_product` = '.(int)$idRoomType.', 1) AND hri.`id_product` IN ('.$allowedIdRoomTypes.')'; } + // We will remove cart rooms after finally getting available rooms from booking $selectAvailRoomSearch = 'SELECT ri.`id` AS `id_room`, ri.`id_product`, ri.`id_hotel`, ri.`room_num`, ri.`comment` AS `room_comment`, hrt.`max_adults` AS max_adult, hrt.`max_children`, hrt.`max_guests` AS max_occupancy'; @@ -763,7 +791,19 @@ class HotelBookingDetail extends ObjectModel if ($QLO_SEARCH_TYPE == HotelBookingDetail::SEARCH_TYPE_OWS && $searchOccupancy) { $availableRoomTypes = $this->getAvailableRoomSatisfingOccupancy($searchOccupancy, $availableRoomTypes, $QLO_OWS_SEARCH_ALGO_TYPE); + + // segregating available and unavailable roomTypes $unavailableRoomTypes = $availableRoomTypes['unavailableRoomTypes']; + if ($unavailableRoomTypes) { + // Adding an id_status key to the unavailable rooms array to identify rooms unavailable due to unsatisfied occupancy search criteria. + // if in case we need to add multiple keys then we can use array union operator + // Instead of looping here, we can do this in the getavailableRoomSatisfingOccupancy function + foreach ($unavailableRoomTypes as $idProduct => $roomTypeDetail) { + foreach ($roomTypeDetail as $idRoom => $roomDetail) { + $unavailableRoomTypes[$idProduct][$roomDetail['id_room']]['id_status'] = HotelRoomInformation::STATUS_SEARCH_OCCUPANCY_UNSATISFIED; + } + } + } $availableRoomTypes = $availableRoomTypes['availableRoomTypes']; } @@ -970,6 +1010,8 @@ class HotelBookingDetail extends ObjectModel * 'idRoomType' => ..., * 'searchOccupancy' => ..., * 'allowedIdRoomTypes' => ..., + * 'hourlyBooking' => ..., + * 'extra_params' => ..., * ); */ protected function getSearchPartiallyAvailRooms($params) @@ -981,12 +1023,10 @@ class HotelBookingDetail extends ObjectModel FROM `'._DB_PREFIX_.'htl_booking_detail` AS bd INNER JOIN `'._DB_PREFIX_.'htl_room_information` AS rf ON (rf.`id` = bd.`id_room`) INNER JOIN `'._DB_PREFIX_.'htl_room_type` AS hrt ON (hrt.`id_product` = rf.`id_product`) - WHERE bd.`id_hotel`='.(int)$idHotel.' AND rf.`id_status` != '. HotelRoomInformation::STATUS_INACTIVE .' AND bd.`is_back_order` = 0 AND bd.`is_refunded` = 0 AND IF(bd.`id_status` = '. self::STATUS_CHECKED_OUT .', ( - (DATE_FORMAT(`check_out`, "%Y-%m-%d") > \''.pSQL($dateFrom).'\' AND DATE_FORMAT(`check_out`, "%Y-%m-%d") < \''.PSQL($dateTo).'\') AND ( - (bd.`date_from` <= \''.pSQL($dateFrom).'\' AND bd.`check_out` > \''.pSQL($dateFrom).'\' AND bd.`check_out` < \''.pSQL($dateTo).'\') OR - (bd.`date_from` > \''.pSQL($dateFrom).'\' AND bd.`date_from` < \''.pSQL($dateTo).'\' AND bd.`check_out` >= \''.pSQL($dateTo).'\') OR - (bd.`date_from` > \''.pSQL($dateFrom).'\' AND bd.`date_from` < \''.pSQL($dateTo).'\' AND bd.`check_out` > \''.pSQL($dateFrom).'\' AND bd.`check_out` < \''.pSQL($dateTo).'\') - ) + WHERE bd.`id_hotel`='.(int)$idHotel.' AND rf.`id_status` != '. HotelRoomInformation::STATUS_INACTIVE .' AND bd.`is_back_order` = 0 AND bd.`is_refunded` = 0 AND IF(bd.`id_status` = '. self::STATUS_CHECKED_OUT .', IF('.(int) $hourlyBooking.', 1, (DATE_FORMAT(`check_out`, "%Y-%m-%d") != DATE_FORMAT(\''.pSQL($dateFrom).'\', "%Y-%m-%d")) AND (`check_out` > \''.pSQL($dateFrom).'\' AND `check_out` <= \''.PSQL($dateTo).'\')) AND ( + (bd.`date_from` <= \''.pSQL($dateFrom).'\' AND bd.`check_out` > \''.pSQL($dateFrom).'\' AND bd.`check_out` < \''.pSQL($dateTo).'\') OR + (bd.`date_from` > \''.pSQL($dateFrom).'\' AND bd.`date_from` < \''.pSQL($dateTo).'\' AND bd.`check_out` >= \''.pSQL($dateTo).'\') OR + (bd.`date_from` > \''.pSQL($dateFrom).'\' AND bd.`date_from` < \''.pSQL($dateTo).'\' AND bd.`check_out` > \''.pSQL($dateFrom).'\' AND bd.`check_out` < \''.pSQL($dateTo).'\') ), ( (bd.`date_from` <= \''.pSQL($dateFrom).'\' AND bd.`date_to` > \''.pSQL($dateFrom).'\' AND bd.`date_to` < \''.pSQL($dateTo).'\') OR (bd.`date_from` > \''.pSQL($dateFrom).'\' AND bd.`date_from` < \''.pSQL($dateTo).'\' AND bd.`date_to` >= \''.pSQL($dateTo).'\') OR @@ -1279,16 +1319,14 @@ class HotelBookingDetail extends ObjectModel } } else { // If all dates are not covered then move all partially available room types to unavailable - foreach ($partiallyAvailRooms as $roomDetail) { - if (!isset($unavailableRoomTypes[$roomDetail['id_product']][$roomDetail['id_room']])) { - $unavailableRoomTypes[$roomDetail['id_product']][$roomDetail['id_room']] = array( - 'id_room' => $roomDetail['id_room'], - 'id_product' => $roomDetail['id_product'], - 'id_hotel' => $roomDetail['id_hotel'], - 'room_num' => $roomDetail['room_num'], - 'room_comment' => '' - ); - } + foreach ($partiallyAvailRooms as $partAvailRoomDetail) { + $unavailableRoomTypes[$partAvailRoomDetail['id_product']][$partAvailRoomDetail['id_room']] = array( + 'id_room' => $partAvailRoomDetail['id_room'], + 'id_product' => $partAvailRoomDetail['id_product'], + 'id_hotel' => $partAvailRoomDetail['id_hotel'], + 'room_num' => $partAvailRoomDetail['room_num'], + 'room_comment' => '' + ); } $partiallyAvailRooms = array(); @@ -1318,13 +1356,21 @@ class HotelBookingDetail extends ObjectModel { extract($params); - $selectBookedRoomSearch = 'SELECT bd.`id`, bd.`id_product`, bd.`id_room`, bd.`id_hotel`, bd.`id_customer`, - bd.`booking_type`, bd.`id_status` AS booking_status, bd.`comment`, rf.`room_num`, bd.`date_from`, - bd.`date_to`'; - $joinBookedRoomSearch = 'INNER JOIN `'._DB_PREFIX_.'htl_room_information` AS rf ON (rf.`id` = bd.`id_room`)'; - $whereBookedRoomSearch = 'WHERE bd.`id_hotel`='.(int)$idHotel.' AND bd.`is_refunded` = 0 AND bd.`is_back_order` = 0 AND IF(bd.`id_status` = '. self::STATUS_CHECKED_OUT .', bd.`date_from` <= \''.pSQL($dateFrom).'\' AND bd.`check_out` >= \''.pSQL($dateTo).'\', bd.`date_from` <= \''.pSQL($dateFrom).'\' AND bd.date_to >= \''.pSQL($dateTo).'\') AND IF('.(int)$idRoomType.' > 0, rf.`id_product` = '.(int)$idRoomType.', 1) AND rf.`id_product` IN ('.$allowedIdRoomTypes.')'; + $selectBookedRoomSearch = 'SELECT `id`, `id_order`, `id_product`, `id_room`, `id_hotel`, `id_customer`, `booking_type`, `id_status` AS booking_status, `comment`, `room_num`, `date_from`, IF(`id_status` = '. self::STATUS_CHECKED_OUT.', `check_out`,`date_to`) AS `date_to`, `check_in`, `check_out`, `date_to` AS `booking_date_to`'; + $joinBookedRoomSearch = ''; + $whereBookedRoomSearch = 'WHERE `id_hotel` = '.(int)$idHotel.' AND `is_back_order` = 0 AND `is_refunded` = 0 AND IF(`id_status` = '. self::STATUS_CHECKED_OUT.', ( + (`date_from` <= \''.pSQL($dateFrom).'\' AND `check_out` > \''.pSQL($dateFrom).'\' AND `check_out` <= \''.PSQL($dateTo).'\') OR + (`date_from` >= \''.pSQL($dateFrom).'\' AND `check_out` > \''.pSQL($dateFrom).'\' AND `check_out` <= \''.pSQL($dateTo).'\') OR + (`date_from` >= \''.pSQL($dateFrom).'\' AND `date_from` < \''.pSQL($dateTo).'\' AND `check_out` >= \''.pSQL($dateTo).'\') OR + (`date_from` <= \''.pSQL($dateFrom).'\' AND `check_out` >= \''.pSQL($dateTo).'\') + ), ( + (`date_from` <= \''.pSQL($dateFrom).'\' AND `date_to` > \''.pSQL($dateFrom).'\' AND `date_to` <= \''.PSQL($dateTo).'\') OR + (`date_from` >= \''.pSQL($dateFrom).'\' AND `date_to` <= \''.pSQL($dateTo).'\') OR + (`date_from` >= \''.pSQL($dateFrom).'\' AND `date_from` < \''.pSQL($dateTo).'\' AND `date_to` >= \''.pSQL($dateTo).'\') OR + (`date_from` <= \''.pSQL($dateFrom).'\' AND `date_to` >= \''.pSQL($dateTo).'\') + )) AND IF('.(int)$idRoomType.' > 0, `id_product` = '.(int)$idRoomType.', 1) AND `id_product` IN ('.$allowedIdRoomTypes.')'; $groupByBookedRoomSearch = ''; - $orderByBookedRoomSearch = 'ORDER BY bd.`id_room` ASC'; + $orderByBookedRoomSearch = 'ORDER BY `id_room`, `date_from` ASC'; $orderWayBookedRoomSearch = ''; $hookParams = array( @@ -1347,7 +1393,7 @@ class HotelBookingDetail extends ObjectModel Hook::exec('actionBookedRoomSearchSqlModifier', $hookParams); $sql = $selectBookedRoomSearch; - $sql .= ' FROM `'._DB_PREFIX_.'htl_booking_detail` AS bd'; + $sql .= ' FROM `'._DB_PREFIX_.'htl_booking_detail`'; $sql .= ' '.$joinBookedRoomSearch; $sql .= ' '.$whereBookedRoomSearch; $sql .= ' '.$groupByBookedRoomSearch; diff --git a/modules/hotelreservationsystem/classes/HotelRoomInformation.php b/modules/hotelreservationsystem/classes/HotelRoomInformation.php index 26ffbbb5d..47eb7b53e 100644 --- a/modules/hotelreservationsystem/classes/HotelRoomInformation.php +++ b/modules/hotelreservationsystem/classes/HotelRoomInformation.php @@ -34,6 +34,9 @@ class HotelRoomInformation extends ObjectModel const STATUS_INACTIVE = 2; const STATUS_TEMPORARY_INACTIVE = 3; + const STATUS_SEARCH_LOS_UNSATISFIED = 4; + const STATUS_SEARCH_OCCUPANCY_UNSATISFIED = 5; + public static $definition = array( 'table' => 'htl_room_information', 'primary' => 'id', @@ -138,25 +141,40 @@ class HotelRoomInformation extends ObjectModel public function getAllRoomStatus() { - $moduleInstance = Module::getInstanceByName('hotelreservationsystem'); - $status = array( 'STATUS_ACTIVE' => array( 'id' => self::STATUS_ACTIVE, - 'status' => $moduleInstance->l('Active', 'hotelreservationsystem') + 'status' => self::getRoomStatusTitle(self::STATUS_ACTIVE) ), 'STATUS_INACTIVE' => array( 'id' => self::STATUS_INACTIVE, - 'status' => $moduleInstance->l('Inactive', 'hotelreservationsystem') + 'status' => self::getRoomStatusTitle(self::STATUS_INACTIVE) ), 'STATUS_TEMPORARY_INACTIVE' => array( 'id' => self::STATUS_TEMPORARY_INACTIVE, - 'status' => $moduleInstance->l('Temporarily Inactive', 'hotelreservationsystem') + 'status' => self::getRoomStatusTitle(self::STATUS_TEMPORARY_INACTIVE) ), ); return $status; } + public static function getRoomStatusTitle($idStatus = false) + { + $moduleInstance = Module::getInstanceByName('hotelreservationsystem'); + $status = array( + self::STATUS_ACTIVE => $moduleInstance->l('Active', 'hotelreservationsystem'), + self::STATUS_INACTIVE => $moduleInstance->l('Inactive', 'hotelreservationsystem'), + self::STATUS_TEMPORARY_INACTIVE => $moduleInstance->l('Temporarily Inactive', 'hotelreservationsystem'), + self::STATUS_SEARCH_LOS_UNSATISFIED => $moduleInstance->l('Lenght of stay', 'hotelreservationsystem'), + self::STATUS_SEARCH_OCCUPANCY_UNSATISFIED => $moduleInstance->l('Occupancy', 'hotelreservationsystem'), + ); + + if ($idStatus) { + return isset($status[$idStatus]) ? $status[$idStatus] : false; + } + return $status; + } + /** * [getHotelRoomInfoByProductId :: To get all rooms information belong to a room type(product) by product id] * @param [int] $id_product [Id of the product] diff --git a/modules/hotelreservationsystem/controllers/admin/AdminHotelRoomsBookingController.php b/modules/hotelreservationsystem/controllers/admin/AdminHotelRoomsBookingController.php index c8a575056..0557ebfeb 100644 --- a/modules/hotelreservationsystem/controllers/admin/AdminHotelRoomsBookingController.php +++ b/modules/hotelreservationsystem/controllers/admin/AdminHotelRoomsBookingController.php @@ -854,7 +854,7 @@ class AdminHotelRoomsBookingController extends ModuleAdminController } } } - + // ddd($booking_data); return $booking_data; } diff --git a/modules/hotelreservationsystem/views/css/HotelReservationAdmin.css b/modules/hotelreservationsystem/views/css/HotelReservationAdmin.css index 4a18f60be..2961a99cf 100644 --- a/modules/hotelreservationsystem/views/css/HotelReservationAdmin.css +++ b/modules/hotelreservationsystem/views/css/HotelReservationAdmin.css @@ -216,7 +216,13 @@ p.room_cat_data font-weight: 700; margin-bottom: 0px; } - +.status-info { + position: relative; + display: inline-block; + left: 100%; + margin-left: -10px; + padding: 0px; +} .color_indicate { width: 10px; @@ -239,6 +245,7 @@ p.room_cat_data margin: 10px 0px; } + .cart-table-thead { border-bottom: 1px solid #555!important; @@ -275,7 +282,10 @@ p.room_cat_data font-size: 14px!important; font-weight: 600!important; } - +#htl_rooms_list table td { + padding-top: 10px; + padding-bottom: 10px; +} #room-status-tabs li { font-size: 14px; diff --git a/modules/hotelreservationsystem/views/js/admin/hotel_rooms_booking.js b/modules/hotelreservationsystem/views/js/admin/hotel_rooms_booking.js index e7a4d00cd..8bf7f0eff 100644 --- a/modules/hotelreservationsystem/views/js/admin/hotel_rooms_booking.js +++ b/modules/hotelreservationsystem/views/js/admin/hotel_rooms_booking.js @@ -954,10 +954,70 @@ $(document).ready(function() { success: function(result) { if (result.success) { $(".htl_room_data_cont").html(result.data.stats_panel); + initstatstooltip(); } } }); } + initstatstooltip(); + + function initstatstooltip() + { + console.log($(".htl_room_data_cont").find('.status-info')); + $(".htl_room_data_cont").find('.status-info').tooltip({ + // content: function() + // { + // $('#date-stats-tooltop .tip_date').text(info.event.extendedProps.data.date_format); + // $.each(info.event.extendedProps.data.stats, function(elem, val) { + // if (elem == 'num_part_avai') { + // $('#date-stats-tooltop').find('.'+elem).hide().find('.tip_element_value').text(''); + // } else { + // $('#date-stats-tooltop').find('.'+elem).show().find('.tip_element_value').text(val); + // } + // }); + // return $('#date-stats-tooltop').html(); + // }, + // items: "div", + trigger : 'hover', + show: { + delay: 100, + }, + hide: { + delay: 300, + }, + open: function(event, ui) + { + if(event.buttons == 1 || event.buttons == 3){ + ui.tooltip.remove(); + } + + if (typeof(event.originalEvent) === 'undefined') { + return false; + } + + var $id = $(ui.tooltip).attr('id'); + + // close any lingering tooltips + if ($('div.ui-tooltip').not('#' + $id).length) { + return false; + } + + // ajax function to pull in data and add it to the tooltip goes here + }, + close: function(event, ui) + { + ui.tooltip.hover(function() { + $(this).stop(true).fadeTo(300, 1); + }, + function() { + $(this).fadeOut('300', function() + { + $(this).remove(); + }); + }); + } + }); + } var allotmentTypes = { auto: ALLOTMENT_AUTO, diff --git a/modules/hotelreservationsystem/views/templates/admin/hotel_rooms_booking/helpers/view/_partials/booking-rooms.tpl b/modules/hotelreservationsystem/views/templates/admin/hotel_rooms_booking/helpers/view/_partials/booking-rooms.tpl index 579eb756a..b5b37fac6 100644 --- a/modules/hotelreservationsystem/views/templates/admin/hotel_rooms_booking/helpers/view/_partials/booking-rooms.tpl +++ b/modules/hotelreservationsystem/views/templates/admin/hotel_rooms_booking/helpers/view/_partials/booking-rooms.tpl @@ -203,6 +203,7 @@ {l s='Room No.' mod='hotelreservationsystem'} {l s='Duration' mod='hotelreservationsystem'} + {l s='Order' mod='hotelreservationsystem'} {l s='Message' mod='hotelreservationsystem'} {l s='Allotment Type' mod='hotelreservationsystem'} {l s='Reallocate' mod='hotelreservationsystem'} @@ -216,6 +217,7 @@ {$booked_v['room_num']|escape:'htmlall':'UTF-8'} {hook h='displayRoomNumAfter' data=$booked_v key=$rm_dtl_k type='booked'} {/if} {dateFormat date=date('Y-m-d', strtotime($rm_dtl_v['date_from']))} - {dateFormat date=date('Y-m-d', strtotime($rm_dtl_v['date_to']))} + #{$rm_dtl_v['id_order']} {$rm_dtl_v['comment']|escape:'htmlall':'UTF-8'} {if $rm_dtl_v['booking_type'] == HotelBookingDetail::ALLOTMENT_AUTO}{l s='Auto Allotment' mod='hotelreservationsystem'}{elseif $rm_dtl_v['booking_type'] == HotelBookingDetail::ALLOTMENT_MANUAL}{l s='Manual Allotment' mod='hotelreservationsystem'}{/if} @@ -242,15 +244,29 @@ {l s='Room No.' mod='hotelreservationsystem'} + {l s='Status' mod='hotelreservationsystem'} + {l s='Duration' mod='hotelreservationsystem'} {l s='Message' mod='hotelreservationsystem'} {foreach from=$book_v['data']['unavailable'] key=unavai_k item=unavai_v} - - {$unavai_v['room_num']|escape:'htmlall':'UTF-8'} - {$unavai_v['room_comment']|escape:'htmlall':'UTF-8'} - + {foreach from=$unavai_v['detail'] key=rm_dtl_k item=unavail_dtl_v} + + {if $unavail_dtl_v@first} + {$unavai_v['room_num']|escape:'htmlall':'UTF-8'} + {/if} + {HotelRoomInformation::getRoomStatusTitle($unavail_dtl_v['id_status'])|escape:'htmlall':'UTF-8'} + + {if $unavail_dtl_v['date_from'] && $unavail_dtl_v['date_to']} + {dateFormat date=date('Y-m-d', strtotime($unavail_dtl_v['date_from']))} - {dateFormat date=date('Y-m-d', strtotime($unavail_dtl_v['date_to']))} + {else} + -- + {/if} + + {$unavail_dtl_v['room_comment']|escape:'htmlall':'UTF-8'} + + {/foreach} {/foreach} diff --git a/modules/hotelreservationsystem/views/templates/admin/hotel_rooms_booking/helpers/view/_partials/search-stats.tpl b/modules/hotelreservationsystem/views/templates/admin/hotel_rooms_booking/helpers/view/_partials/search-stats.tpl index 560836b5b..c672c941b 100644 --- a/modules/hotelreservationsystem/views/templates/admin/hotel_rooms_booking/helpers/view/_partials/search-stats.tpl +++ b/modules/hotelreservationsystem/views/templates/admin/hotel_rooms_booking/helpers/view/_partials/search-stats.tpl @@ -1,4 +1,7 @@
    +
    + +
    From 6c0622af234ed9c77129c0c69e15e4c5cd10eb4d Mon Sep 17 00:00:00 2001 From: Sumit Panwar Date: Sat, 13 Jul 2024 13:24:05 +0530 Subject: [PATCH 13/40] Fixed: The net profit amount should decrease if an admin issues a refund by creating a voucher or credit slip --- controllers/admin/AdminStatsController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/controllers/admin/AdminStatsController.php b/controllers/admin/AdminStatsController.php index 7d6846f18..151aeca79 100644 --- a/controllers/admin/AdminStatsController.php +++ b/controllers/admin/AdminStatsController.php @@ -532,7 +532,7 @@ class AdminStatsControllerCore extends AdminStatsTabController FROM `'._DB_PREFIX_.'orders` o LEFT JOIN `'._DB_PREFIX_.'order_return` orr ON (o.id_order = orr.id_order) LEFT JOIN `'._DB_PREFIX_.'order_state` os ON (o.current_state = os.id_order_state) - WHERE orr.`payment_mode` != "" AND orr.`id_transaction` != "" AND `invoice_date` BETWEEN "'.pSQL($date_from).' 00:00:00" AND "'.pSQL($date_to).' 23:59:59" AND os.logable = 1'.' + WHERE orr.`payment_mode` != "" AND `invoice_date` BETWEEN "'.pSQL($date_from).' 00:00:00" AND "'.pSQL($date_to).' 23:59:59" AND os.logable = 1'.' GROUP BY LEFT(`invoice_date`, 10) HAVING 1 '.HotelBranchInformation::addHotelRestriction($id_hotel)); foreach ($result as $row) { From c6c3d44a09bfd9791474b3ff9a5578d5bbaf28a2 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Fri, 2 Aug 2024 13:29:45 +0530 Subject: [PATCH 14/40] Fixed the design issues on the rtl languages and updated the done button design for occupancy blocks --- modules/wkroomsearchblock/views/css/chosen.css | 6 ++++++ .../views/css/wk-global-search.css | 11 ++++++----- .../views/templates/hook/searchForm.tpl | 6 +++--- .../_partials/occupancy_field.tpl | 4 ++-- themes/hotel-reservation-theme/css/occupancy.css | 14 +++++++++++--- 5 files changed, 28 insertions(+), 13 deletions(-) diff --git a/modules/wkroomsearchblock/views/css/chosen.css b/modules/wkroomsearchblock/views/css/chosen.css index 779c5e4c7..eba0b2181 100644 --- a/modules/wkroomsearchblock/views/css/chosen.css +++ b/modules/wkroomsearchblock/views/css/chosen.css @@ -41,6 +41,12 @@ border-top: 0; box-shadow: 0 4px 5px rgba(0, 0, 0, 0.15); } +.rtl .chosen-container .chosen-drop { + right: -9999px; +} +.rtl .chosen-container.chosen-with-drop .chosen-drop { + right: 0; +} .chosen-container.chosen-container-single-nosearch .chosen-drop { top: 100%; } diff --git a/modules/wkroomsearchblock/views/css/wk-global-search.css b/modules/wkroomsearchblock/views/css/wk-global-search.css index 3949a7c10..83edd356b 100644 --- a/modules/wkroomsearchblock/views/css/wk-global-search.css +++ b/modules/wkroomsearchblock/views/css/wk-global-search.css @@ -215,9 +215,7 @@ border-radius: 4px;} .submit_occupancy_btn { background-color: #1292FF; - font-size: 13px; border: none; - padding: 5px 20px; border-radius: 4px;} @@ -229,7 +227,7 @@ overflow: auto; box-shadow: 0 8px 25px -4px rgba(0,0,0,0.39); left: 0px; - padding: 12px 20px;} + padding: 15px 20px;} #search_occupancy_wrapper.top { top: unset; bottom: 100%; } @@ -253,8 +251,11 @@ font-weight: bold; text-decoration: none; font-size: 14px; - color: #0000FF; - line-height: 24px;} + color: #0000FF;} + #search_occupancy_wrapper .occupancy_block_actions { + display: flex; + justify-content: space-between; + align-items: center;} #search_occupancy_wrapper .add_new_occupancy_btn:active, #search_occupancy_wrapper .add_new_occupancy_btn:focus, #search_occupancy_wrapper .add_new_occupancy_btn:hover { text-decoration: none; color: #0000FF;} diff --git a/modules/wkroomsearchblock/views/templates/hook/searchForm.tpl b/modules/wkroomsearchblock/views/templates/hook/searchForm.tpl index 8bd27f7fc..a5a6e0bc9 100644 --- a/modules/wkroomsearchblock/views/templates/hook/searchForm.tpl +++ b/modules/wkroomsearchblock/views/templates/hook/searchForm.tpl @@ -40,7 +40,7 @@ -
    +