From 4bcb749fc4248b14b1b2e5c53e27314e908edfbe Mon Sep 17 00:00:00 2001 From: shreesh arora Date: Fri, 20 Nov 2020 18:56:45 +0530 Subject: [PATCH 01/17] fix hotel selection in search for mobile --- modules/wkroomsearchblock/views/css/wk-global-search.css | 1 - 1 file changed, 1 deletion(-) diff --git a/modules/wkroomsearchblock/views/css/wk-global-search.css b/modules/wkroomsearchblock/views/css/wk-global-search.css index aa55d2c60..8b8899e41 100644 --- a/modules/wkroomsearchblock/views/css/wk-global-search.css +++ b/modules/wkroomsearchblock/views/css/wk-global-search.css @@ -78,7 +78,6 @@ .header-rmsearch-wrapper .hotel_dropdown_ul { position: absolute; font-size: 14px; - z-index: 100; font-weight: 400; padding: 0px; width: 100%; From e22c3c1a1d4beb910f4283fc86684515c9f4cc80 Mon Sep 17 00:00:00 2001 From: shreesh arora Date: Tue, 24 Nov 2020 13:59:07 +0530 Subject: [PATCH 02/17] fix new room issue for employee --- controllers/admin/AdminProductsController.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/controllers/admin/AdminProductsController.php b/controllers/admin/AdminProductsController.php index ec291c59e..1743dee63 100644 --- a/controllers/admin/AdminProductsController.php +++ b/controllers/admin/AdminProductsController.php @@ -80,9 +80,9 @@ class AdminProductsControllerCore extends AdminController // START send access query information to the admin controller $this->access_select = ' SELECT a.`id_product` FROM '._DB_PREFIX_.'product a'; - $this->access_join = ' INNER JOIN '._DB_PREFIX_.'htl_room_type hrt ON (hrt.id_product = a.id_product)'; + $this->access_join = ' LEFT JOIN '._DB_PREFIX_.'htl_room_type hrt ON (hrt.id_product = a.id_product)'; if ($acsHtls = HotelBranchInformation::getProfileAccessedHotels($this->context->employee->id_profile, 1, 1)) { - $this->access_where = ' WHERE hrt.id_hotel IN ('.implode(',', $acsHtls).')'; + $this->access_where = ' WHERE (hrt.id_hotel IN ('.implode(',', $acsHtls).') OR hrt.id_hotel IS NULL)'; } parent::__construct(); From 1427f8253dd823485cfe00bac8b110754780edaf Mon Sep 17 00:00:00 2001 From: shreesh arora Date: Wed, 25 Nov 2020 23:19:46 +0530 Subject: [PATCH 03/17] fix additional facility price issue --- modules/hotelreservationsystem/hotelreservationsystem.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/hotelreservationsystem/hotelreservationsystem.php b/modules/hotelreservationsystem/hotelreservationsystem.php index dbb501945..7111dfe36 100644 --- a/modules/hotelreservationsystem/hotelreservationsystem.php +++ b/modules/hotelreservationsystem/hotelreservationsystem.php @@ -201,7 +201,7 @@ class hotelreservationsystem extends Module $objCurrency = new Currency(Configuration::get('PS_CURRENCY_DEFAULT')); // get room type additional services $objRoomDemand = new HotelRoomTypeDemand(); - $roomDemandPrices = $objRoomDemand->getRoomTypeDemands($idProduct); + $roomDemandPrices = $objRoomDemand->getRoomTypeDemands($idProduct, 0, 0); $this->context->smarty->assign( array( 'idProduct' => $idProduct, From 11a885b5230608907f7fb485f1d63b9326286b5c Mon Sep 17 00:00:00 2001 From: shreesh arora Date: Tue, 5 Jan 2021 14:08:48 +0530 Subject: [PATCH 04/17] update room reallocation data --- .../classes/HotelBookingDetail.php | 31 +++++++++++-------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/modules/hotelreservationsystem/classes/HotelBookingDetail.php b/modules/hotelreservationsystem/classes/HotelBookingDetail.php index e8ba7aa68..90a0d6d34 100644 --- a/modules/hotelreservationsystem/classes/HotelBookingDetail.php +++ b/modules/hotelreservationsystem/classes/HotelBookingDetail.php @@ -962,16 +962,19 @@ class HotelBookingDetail extends ObjectModel { $date_from = date('Y-m-d H:i:s', strtotime($date_from)); $date_to = date('Y-m-d H:i:s', strtotime($date_to)); - $table = 'htl_booking_detail'; - $table2 = 'htl_cart_booking_data'; + $table = 'htl_cart_booking_data'; + $table2 = 'htl_booking_detail'; $data = array('id_room' => $swapped_room_id); $where = 'date_from=\''.pSQL($date_from).'\' AND date_to=\''.pSQL($date_to).'\' AND id_room='. (int)$current_room_id; - $result = Db::getInstance()->update($table, $data, $where); - $result2 = Db::getInstance()->update($table2, $data, $where); - if ($result) { - $result2 = Db::getInstance()->update($table2, $data, $where); - if ($result2) { + + if ($result = Db::getInstance()->update($table, $data, $where)) { + if($room_num = Db::getInstance()->getValue( + 'SELECT `room_num` FROM `'._DB_PREFIX_.'htl_room_information` WHERE `id` = '.$swapped_room_id + )) { + $data['room_num'] = $room_num; + } + if ($result2 = Db::getInstance()->update($table2, $data, $where)) { return true; } return false; @@ -1002,19 +1005,21 @@ class HotelBookingDetail extends ObjectModel '\' AND `date_to`=\''.pSQL($date_to).'\' AND `id_room`='.(int)$current_room_id ); - $id1 = Db::getInstance()->getValue( - 'SELECT `id` FROM `'._DB_PREFIX_.'htl_booking_detail` WHERE `date_from`=\''.pSQL($date_from). + $swap_room = Db::getInstance()->getRow( + 'SELECT `id`, `room_num` FROM `'._DB_PREFIX_.'htl_booking_detail` WHERE `date_from`=\''.pSQL($date_from). '\' AND `date_to`=\''.pSQL($date_to).'\' AND `id_room`='.(int)$swapped_room_id ); - $id2 = Db::getInstance()->getValue( - 'SELECT `id` FROM `'._DB_PREFIX_.'htl_booking_detail` WHERE `date_from`=\''.pSQL($date_from). + $curr_room = Db::getInstance()->getRow( + 'SELECT `id`, `room_num` FROM `'._DB_PREFIX_.'htl_booking_detail` WHERE `date_from`=\''.pSQL($date_from). '\' AND `date_to`=\''.pSQL($date_to).'\' AND `id_room`='.(int)$current_room_id ); $sql = 'UPDATE `'._DB_PREFIX_.'htl_cart_booking_data` SET `id_room`=IF(`id`='.(int)$idcrt1.','. (int)$current_room_id.','.(int)$swapped_room_id.') WHERE `id` IN('.(int)$idcrt1.','.(int)$idcrt2.')'; - $sql1 = 'UPDATE `'._DB_PREFIX_.'htl_booking_detail` SET `id_room`=IF(`id`='.(int)$id1.','.(int)$current_room_id. - ','.(int)$swapped_room_id.') WHERE `id` IN('.(int)$id1.','.(int)$id2.')'; + $sql1 = 'UPDATE `'._DB_PREFIX_.'htl_booking_detail` + SET `id_room`=IF(`id`='.(int)$swap_room['id'].','.(int)$current_room_id.','.(int)$swapped_room_id.'), + `room_num`=IF(`id`='.(int)$swap_room['id'].',\''.$curr_room['room_num'].'\',\''.$swap_room['room_num'].'\') + WHERE `id` IN('.(int)$swap_room['id'].','.(int)$curr_room.')'; if ($result = Db::getInstance()->execute($sql)) { $result2 = Db::getInstance()->execute($sql1); From 86873b6cd79a3b037aad26ac7bffb772b7c4ff42 Mon Sep 17 00:00:00 2001 From: shreesh arora Date: Tue, 5 Jan 2021 19:20:33 +0530 Subject: [PATCH 05/17] fix pricing issue --- .../classes/HotelRoomTypeFeaturePricing.php | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/modules/hotelreservationsystem/classes/HotelRoomTypeFeaturePricing.php b/modules/hotelreservationsystem/classes/HotelRoomTypeFeaturePricing.php index 605b41443..e8e8a3b3a 100644 --- a/modules/hotelreservationsystem/classes/HotelRoomTypeFeaturePricing.php +++ b/modules/hotelreservationsystem/classes/HotelRoomTypeFeaturePricing.php @@ -216,10 +216,11 @@ class HotelRoomTypeFeaturePricing extends ObjectModel */ public static function countFeaturePriceSpecialDays($specialDays, $date_from, $date_to) { - $totalDaySeconds = 24*60*60; $specialDaysCount = 0; + $date_from = date('Y-m-d', strtotime($date_from)); + $date_to = date('Y-m-d', strtotime($date_to)); - for ($date = strtotime($date_from); $date <= strtotime($date_to)-$totalDaySeconds; $date = ($date + $totalDaySeconds)) { + for($date = $date_from; $date < $date_to; $date = date('Y-m-d', strtotime('+1 day', strtotime($date)))) { if (in_array(strtolower(Date('D', $date)), $specialDays)) { $specialDaysCount++; } @@ -237,14 +238,15 @@ class HotelRoomTypeFeaturePricing extends ObjectModel */ public function getHotelRoomTypesRatesAndInventoryByDate($id_hotel, $id_product=0, $date_from, $date_to) { - $totalDaySeconds = 24*60*60; $hotelRoomType = new HotelRoomType(); $context = Context::getContext(); $roomTypeRatesAndInventory = array(); $hotelCartBookingData = new HotelCartBookingData(); $objBookingDetail = new HotelBookingDetail(); $incr = 0; - for ($date = strtotime($date_from); $date <= strtotime($date_to); $date = ($date + $totalDaySeconds)) { + $date_from = date('Y-m-d', strtotime($date_from)); + $date_to = date('Y-m-d', strtotime($date_to)); + for($date = $date_from; $date < $date_to; $date = date('Y-m-d', strtotime('+1 day', strtotime($date)))) { $currentDate = date('Y-m-d', $date); $nextDayDate = date('Y-m-d', strtotime('+1 day', strtotime($currentDate))); if ($id_product) { @@ -322,7 +324,6 @@ class HotelRoomTypeFeaturePricing extends ObjectModel $moduleInstance = new HotelReservationSystem(); $this->errors = array(); if ($featurePricePlans) { - $totalDaySeconds = 24*60*60; if (isset($featurePricePlans['data']) && $featurePricePlans['data']) { foreach ($featurePricePlans['data'] as $roomTypeRatesData) { $dateFrom = date('Y-m-d', strtotime($roomTypeRatesData['dateFrom'])); @@ -391,7 +392,7 @@ class HotelRoomTypeFeaturePricing extends ObjectModel $this->errors[] = $this->moduleInstance->l('Some error occured while saving Feature Price Plan Info:: Date From : ', 'HotelRoomTypeFeaturePricing').$params['dateFrom'].$this->moduleInstance->l(' Date To : ', 'HotelRoomTypeFeaturePricing').$params['dateFrom'].$this->moduleInstance->l(' Room Type Id : ', 'HotelRoomTypeFeaturePricing').$params['roomTypeId']; } } else { - for ($date = strtotime($dateFrom); $date <= strtotime($dateTo)-$totalDaySeconds; $date = ($date + $totalDaySeconds)) { + for($date = $date_from; $date < $date_to; $date = date('Y-m-d', strtotime('+1 day', strtotime($date)))) { $currentDate = date('Y-m-d', $date); $nextDayDate = date('Y-m-d', strtotime('+1 day', strtotime($currentDate))); $params['dateFrom'] = $currentDate; @@ -629,7 +630,6 @@ class HotelRoomTypeFeaturePricing extends ObjectModel */ public static function getRoomTypeTotalPrice($id_product, $date_from, $date_to, $quantity = 0, $id_group = 0) { - $totalDaySeconds = 24 * 60 * 60; $totalPrice = array(); $totalPrice['total_price_tax_incl'] = 0; $totalPrice['total_price_tax_excl'] = 0; @@ -650,14 +650,15 @@ class HotelRoomTypeFeaturePricing extends ObjectModel // if date_from and date_to are same then date_to will be the next date date of date_from if (strtotime($date_from) == strtotime($date_to)) { - $date_to = date('Y-m-d', (strtotime($date_from) + $totalDaySeconds)); + $date_to = date('Y-m-d', strtotime('+1 day', strtotime($date_from))); } $context = Context::getContext(); $id_currency = Validate::isLoadedObject($context->currency) ? (int)$context->currency->id : (int)Configuration::get('PS_CURRENCY_DEFAULT'); $hotelCartBookingData = new HotelCartBookingData(); - for ($date = strtotime($date_from); $date <= (strtotime($date_to)-$totalDaySeconds); $date = ($date+$totalDaySeconds)) { - $currentDate = date('Y-m-d', $date); + $date_from = date('Y-m-d', strtotime($date_from)); + $date_to = date('Y-m-d', strtotime($date_to)); + for($currentDate = $date_from; $currentDate < $date_to; $currentDate = date('Y-m-d', strtotime('+1 day', strtotime($currentDate)))) { if ($featurePrice = $hotelCartBookingData->getProductFeaturePricePlanByDateByPriority( $id_product, $currentDate, From 8a57b96f5fbe7b7f591d2118cd9a95a77e2d8ebd Mon Sep 17 00:00:00 2001 From: shreesh arora Date: Wed, 6 Jan 2021 12:45:24 +0530 Subject: [PATCH 06/17] updated helper list header --- admin/themes/default/template/helpers/list/list_header.tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/admin/themes/default/template/helpers/list/list_header.tpl b/admin/themes/default/template/helpers/list/list_header.tpl index cf05a89c9..82a11864c 100644 --- a/admin/themes/default/template/helpers/list/list_header.tpl +++ b/admin/themes/default/template/helpers/list/list_header.tpl @@ -25,7 +25,7 @@ {if $ajax}