diff --git a/modules/hotelreservationsystem/classes/HotelCartBookingData.php b/modules/hotelreservationsystem/classes/HotelCartBookingData.php
index dc32346d2..df5c6c616 100644
--- a/modules/hotelreservationsystem/classes/HotelCartBookingData.php
+++ b/modules/hotelreservationsystem/classes/HotelCartBookingData.php
@@ -248,7 +248,7 @@ class HotelCartBookingData extends ObjectModel
*/
public function getCartCurrentDataByCartId($cart_id)
{
- $result = Db::getInstance()->executeS('SELECT * FROM `'._DB_PREFIX_.'htl_cart_booking_data` WHERE `id_cart`='.$cart_id);
+ $result = Db::getInstance()->executeS('SELECT * FROM `'._DB_PREFIX_.'htl_cart_booking_data` WHERE `id_cart`='.(int)$cart_id);
if ($result) {
return $result;
} else {
@@ -925,23 +925,34 @@ class HotelCartBookingData extends ObjectModel
return true;
}
+ // validate cart data if not available then remove from cart
public static function validateCartBookings()
{
$context = Context::getContext();
-
$errors = array();
+ $objModule = Module::getInstanceByName('hotelreservationsystem');
+
+ // For admin cart validations use this variable
+ $forAdminCart = 0;
+ if (isset($context->employee->id)) {
+ $forAdminCart = 1;
+ }
// validate room types if bookable from front office
if ($cartProducts = $context->cart->getProducts()) {
- $objHotelCartBookingData = new HotelCartBookingData();
- foreach ($cartProducts as $product) {
- if ($product['booking_product'] && !$product['show_at_front']) {
- $objHotelCartBookingData->deleteCartBookingData($context->cart->id, $product['id_product']);
+ if (!$forAdminCart) {
+ $objHotelCartBookingData = new HotelCartBookingData();
+ foreach ($cartProducts as $product) {
+ if ($product['booking_product'] && !$product['show_at_front']) {
+ $objHotelCartBookingData->deleteCartBookingData($context->cart->id, $product['id_product']);
+ }
}
}
+ } else {
+ $errors[] = $objModule->l('No booking found in the cart.', 'HotelOrderRestrictDate');
}
- // validate service products
+ // validate service products if not active not then remove from cart
if ($cartProducts = $context->cart->getProducts()) {
$objRoomTypeServiceProductCartDetail = new RoomTypeServiceProductCartDetail();
foreach ($cartProducts as $product) {
@@ -954,8 +965,20 @@ class HotelCartBookingData extends ObjectModel
}
}
+ // for admin/employee remove bookings of the back dates from cart if not allowed
+ if ($forAdminCart) {
+ if ($context->employee->isSuperAdmin()) {
+ $backOrderConfigKey = 'PS_BACKDATE_ORDER_SUPERADMIN';
+ } else {
+ $backOrderConfigKey = 'PS_BACKDATE_ORDER_EMPLOYEES';
+ }
+ if (!Configuration::get($backOrderConfigKey)) {
+ $objHotelCartBookingData = new HotelCartBookingData();
+ $objHotelCartBookingData->removeBackdateRoomsFromCart($context->cart->id);
+ }
+ }
+
// validate room types for restriction date
- $objModule = Module::getInstanceByName('hotelreservationsystem');
if ($cartProducts = $context->cart->getProducts()) {
$objHotelCartBookingData = new HotelCartBookingData();
$objHotelBookingDetail = new HotelBookingDetail();
@@ -977,43 +1000,43 @@ class HotelCartBookingData extends ObjectModel
}
foreach ($cartData as $roomData) {
- if ($maxOrderDate = HotelOrderRestrictDate::getMaxOrderDate($roomData['id_hotel'])) {
- if (strtotime('-1 day', strtotime($maxOrderDate)) < strtotime($roomData['date_from'])
- || strtotime($maxOrderDate) < strtotime($roomData['date_to'])
- ) {
- $objHotelBranchInformation = new HotelBranchInformation(
- $roomData['id_hotel'],
- $context->language->id
- );
- $errors[] = sprintf(
- 'You can not book rooms for hotel \'%s\' after date %s. Please remove rooms from %s - %s to proceed.',
- $objHotelBranchInformation->hotel_name,
- Tools::displayDate($maxOrderDate),
- Tools::displayDate($roomData['date_from']),
- Tools::displayDate($roomData['date_to'])
- );
- $error = true;
+ if (!$forAdminCart) {
+ if ($maxOrderDate = HotelOrderRestrictDate::getMaxOrderDate($roomData['id_hotel'])) {
+ if (strtotime('-1 day', strtotime($maxOrderDate)) < strtotime($roomData['date_from'])
+ || strtotime($maxOrderDate) < strtotime($roomData['date_to'])
+ ) {
+ $objHotelBranchInformation = new HotelBranchInformation(
+ $roomData['id_hotel'],
+ $context->language->id
+ );
+ $errors[] = sprintf(
+ 'You can not book rooms for hotel \'%s\' after date %s. Please remove rooms from %s - %s to proceed.',
+ $objHotelBranchInformation->hotel_name,
+ Tools::displayDate($maxOrderDate),
+ Tools::displayDate($roomData['date_from']),
+ Tools::displayDate($roomData['date_to'])
+ );
+ }
}
- }
- $preparationTime = HotelOrderRestrictDate::getPreparationTime($roomData['id_hotel']);
- if ($preparationTime !== false) {
- $minOrderDate = date('Y-m-d', strtotime('+'. ($preparationTime) .' days'));
- if (strtotime($minOrderDate) > strtotime($roomData['date_from'])
- || strtotime($minOrderDate . ' +1 day')> strtotime($roomData['date_to'])
- ) {
- $objHotelBranchInformation = new HotelBranchInformation(
- $roomData['id_hotel'],
- $context->language->id
- );
- $errors[] = sprintf(
- 'You can not book rooms for hotel \'%s\' before date %s. Please remove rooms from %s - %s to proceed.',
- $objHotelBranchInformation->hotel_name,
- Tools::displayDate($minOrderDate),
- Tools::displayDate($roomData['date_from']),
- Tools::displayDate($roomData['date_to'])
- );
- $error = true;
+ $preparationTime = HotelOrderRestrictDate::getPreparationTime($roomData['id_hotel']);
+ if ($preparationTime !== false) {
+ $minOrderDate = date('Y-m-d', strtotime('+'. ($preparationTime) .' days'));
+ if (strtotime($minOrderDate) > strtotime($roomData['date_from'])
+ || strtotime($minOrderDate . ' +1 day')> strtotime($roomData['date_to'])
+ ) {
+ $objHotelBranchInformation = new HotelBranchInformation(
+ $roomData['id_hotel'],
+ $context->language->id
+ );
+ $errors[] = sprintf(
+ 'You can not book rooms for hotel \'%s\' before date %s. Please remove rooms from %s - %s to proceed.',
+ $objHotelBranchInformation->hotel_name,
+ Tools::displayDate($minOrderDate),
+ Tools::displayDate($roomData['date_from']),
+ Tools::displayDate($roomData['date_to'])
+ );
+ }
}
}
@@ -1025,32 +1048,27 @@ class HotelCartBookingData extends ObjectModel
'only_search_data' => 1,
);
$bookingSearchData = $objHotelBookingDetail->dataForFrontSearch($bookingParams);
- $isRmBooked = 0;
+ $isRoomBooked = 0;
if (count($bookingSearchData['rm_data'][$product['id_product']]['data']['available']) < count($roomData['id_rms'])) {
foreach ($roomData['id_rms'] as $searchRoomData) {
- if($isRmBooked = $objHotelBookingDetail->chechRoomBooked($searchRoomData, $roomData['date_from'], $roomData['date_to'])){
+ if($isRoomBooked = $objHotelBookingDetail->chechRoomBooked($searchRoomData, $roomData['date_from'], $roomData['date_to'])){
break;
}
}
- if ($isRmBooked) {
+ if ($isRoomBooked) {
$errors[] = sprintf($objModule->l('The Room \'%s\' has been booked by another customer from \'%s\' to \'%s\' Please remove rooms from cart to proceed', 'HotelOrderRestrictDate'), $product['name'], date('d-m-Y', strtotime($roomData['date_from'])), date('d-m-Y', strtotime($roomData['date_to'])));
- $error = true;
} else {
$errors[] = sprintf($objModule->l('The Room \'%s\' is no longer avalable from \'%s\' to \'%s\' Please remove rooms from cart to proceed', 'HotelOrderRestrictDate'), $product['name'], date('d-m-Y', strtotime($roomData['date_from'])), date('d-m-Y', strtotime($roomData['date_to'])));
- $error = true;
}
}
}
}
} else {
- $error = true;
$errors[] = $objModule->l('You can not book rooms from "', 'HotelOrderRestrictDate'). $product['name'] .$objModule->l('". Please remove rooms from "', 'HotelOrderRestrictDate'). $product['name'] . $objModule->l('" from cart to proceed.', 'HotelOrderRestrictDate');
}
}
}
- $context->controller->errors = array_merge($context->controller->errors, $errors);
-
return $errors;
}
diff --git a/modules/hotelreservationsystem/classes/RoomTypeServiceProductCartDetail.php b/modules/hotelreservationsystem/classes/RoomTypeServiceProductCartDetail.php
index 5fad5a10b..e40082572 100644
--- a/modules/hotelreservationsystem/classes/RoomTypeServiceProductCartDetail.php
+++ b/modules/hotelreservationsystem/classes/RoomTypeServiceProductCartDetail.php
@@ -94,7 +94,7 @@ class RoomTypeServiceProductCartDetail extends ObjectModel
)) {
$updateQty = $product['quantity'];
if (Product::getProductPriceCalculation($product['id_product']) == Product::PRICE_CALCULATION_METHOD_PER_DAY) {
- $objHotelCartBookingData = new HotelCartBookingData($idHtlCartData);
+ $objHotelCartBookingData = new HotelCartBookingData($htlCartBookingId);
$numdays = HotelHelper::getNumberOfDays($objHotelCartBookingData->date_from, $objHotelCartBookingData->date_to);
$updateQty *= $numdays;
}
diff --git a/modules/hotelreservationsystem/controllers/admin/AdminHotelRoomsBookingController.php b/modules/hotelreservationsystem/controllers/admin/AdminHotelRoomsBookingController.php
index 0edf2d641..5113d2ee1 100644
--- a/modules/hotelreservationsystem/controllers/admin/AdminHotelRoomsBookingController.php
+++ b/modules/hotelreservationsystem/controllers/admin/AdminHotelRoomsBookingController.php
@@ -42,6 +42,9 @@ class AdminHotelRoomsBookingController extends ModuleAdminController
$objCart = new Cart($this->context->cookie->id_cart);
if (Validate::isLoadedObject($objCart) && !$objCart->orderExists()) {
$this->context->cart = $objCart;
+
+ // validate cart for removing invalid data from cart
+ HotelCartBookingData::validateCartBookings();
} else {
$this->context->cookie->id_cart = 0; // remove invalid id_cart
$this->context->cart = new Cart();
@@ -63,15 +66,6 @@ class AdminHotelRoomsBookingController extends ModuleAdminController
$objCustomer->id_guest = (int) $this->context->cookie->id_guest;
$this->context->customer = $objCustomer;
- if ($this->context->employee->isSuperAdmin()) {
- $backOrderConfigKey = 'PS_BACKDATE_ORDER_SUPERADMIN';
- } else {
- $backOrderConfigKey = 'PS_BACKDATE_ORDER_EMPLOYEES';
- }
- if (!Configuration::get($backOrderConfigKey)) {
- $htlCart = new HotelCartBookingData();
- $htlCart->removeBackdateRoomsFromCart($this->context->cart->id);
- }
}
protected function createNewCart()
diff --git a/modules/qlohotelreview/qlohotelreview.php b/modules/qlohotelreview/qlohotelreview.php
index e040fa903..9bd269f98 100644
--- a/modules/qlohotelreview/qlohotelreview.php
+++ b/modules/qlohotelreview/qlohotelreview.php
@@ -187,13 +187,14 @@ class QloHotelReview extends Module
if (QhrHotelReviewHelper::getIsReviewable($idOrder)
&& !QhrHotelReview::getByIdOrder($idOrder)
) {
- $hotel = QhrHotelReviewHelper::getHotelByOrder($idOrder);
- $this->smarty->assign(array(
- 'id_order' => (int) $idOrder,
- 'id_hotel' => $hotel['id_hotel'],
- 'hotel_name' => $hotel['hotel_name'],
- ));
- return $this->display(__FILE__, 'booking-action.tpl');
+ if ($hotel = QhrHotelReviewHelper::getHotelByOrder($idOrder)) {
+ $this->smarty->assign(array(
+ 'id_order' => (int) $idOrder,
+ 'id_hotel' => $hotel['id_hotel'],
+ 'hotel_name' => $hotel['hotel_name'],
+ ));
+ return $this->display(__FILE__, 'booking-action.tpl');
+ }
}
}
diff --git a/themes/hotel-reservation-theme/css/order-detail.css b/themes/hotel-reservation-theme/css/order-detail.css
index c128914d9..c84de4477 100644
--- a/themes/hotel-reservation-theme/css/order-detail.css
+++ b/themes/hotel-reservation-theme/css/order-detail.css
@@ -86,10 +86,6 @@
line-height: 27px;
}
-.card.card-toolbar .card-header {
- padding: 8px 18px;
-}
-
.card .card-subheader {
margin-bottom: 0;
font-size: 14px;
@@ -211,6 +207,10 @@
line-height: 16px;
}
+.payment-details .detail-row .status .processing {
+ font-size: 16px;
+}
+
.hotel-location p.hotel-address {
font-size: 16px;
line-height: 24px;
@@ -251,6 +251,10 @@
align-items: center;
}
+.room-details .card-header .booking-actions-wrap {
+ margin: -6px 0;
+}
+
.room-details .card-header .booking-actions-wrap .col-xs-12 {
display: flex;
flex-wrap: wrap;
diff --git a/themes/hotel-reservation-theme/order-detail.tpl b/themes/hotel-reservation-theme/order-detail.tpl
index b265ab018..e0000be46 100644
--- a/themes/hotel-reservation-theme/order-detail.tpl
+++ b/themes/hotel-reservation-theme/order-detail.tpl
@@ -116,13 +116,17 @@
{l s='Status'}
-
- {if $order_history[0].id_order_state|in_array:$overbooking_order_states}
- {l s='Order Not Confirmed'}
- {else}
- {$order_history[0].ostate_name|escape:'html':'UTF-8'}
- {/if}
-
+ {if isset($order_history[0]) && $order_history[0]}
+
+ {if $order_history[0].id_order_state|in_array:$overbooking_order_states}
+ {l s='Order Not Confirmed'}
+ {else}
+ {$order_history[0].ostate_name|escape:'html':'UTF-8'}
+ {/if}
+
+ {else}
+ {l s='Processing'}
+ {/if}
@@ -173,7 +177,7 @@
{/if}
{hook h='displayOrderDetailRoomDetailsBefore' id_order=$order->id}
-