Merge branch 'develop' into gli-2941
This commit is contained in:
@@ -679,6 +679,7 @@ class ProductControllerCore extends FrontController
|
||||
'id_room_type' => $idProduct,
|
||||
'id_cart' => $idCart,
|
||||
'id_guest' => $idGuest,
|
||||
'search_unavai' => 1,
|
||||
);
|
||||
if (Configuration::get('PS_FRONT_ROOM_UNIT_SELECTION_TYPE') == HotelBookingDetail::PS_ROOM_UNIT_SELECTION_TYPE_OCCUPANCY) {
|
||||
$bookingParams['occupancy'] = $occupancy;
|
||||
@@ -697,9 +698,39 @@ class ProductControllerCore extends FrontController
|
||||
}
|
||||
|
||||
$totalAvailableRooms = 0;
|
||||
$losRestrictionFailed = false;
|
||||
$losMinFailed = false;
|
||||
$losMaxFailed = false;
|
||||
// Initialize LOS values for the selected room type/date
|
||||
$objRoomTypeRestrictionDateRange = new HotelRoomTypeRestrictionDateRange();
|
||||
$losRestriction = $objRoomTypeRestrictionDateRange->getRoomTypeLengthOfStay($idProduct, $dateFrom);
|
||||
$losMinDays = (int) ($losRestriction ? $losRestriction['min_los'] : 1);
|
||||
$losMaxDays = (int) ($losRestriction ? $losRestriction['max_los'] : 0);
|
||||
if ($hotelRoomData = $objBookingDetail->dataForFrontSearch($bookingParams)) {
|
||||
$totalAvailableRooms = $hotelRoomData['stats']['num_avail'];
|
||||
$quantity = ($quantity > $totalAvailableRooms) ? $totalAvailableRooms : $quantity;
|
||||
// Check if rooms are unavailable due to LOS restriction
|
||||
if ($totalAvailableRooms <= 0 && !empty($hotelRoomData['rm_data'][$idProduct]['data']['unavailable'])) {
|
||||
foreach ($hotelRoomData['rm_data'][$idProduct]['data']['unavailable'] as $unavailableRoom) {
|
||||
if (empty($unavailableRoom['detail'])) {
|
||||
continue;
|
||||
}
|
||||
foreach ($unavailableRoom['detail'] as $detail) {
|
||||
if (!empty($detail['id_status']) && $detail['id_status'] == HotelRoomInformation::STATUS_SEARCH_LOS_UNSATISFIED) {
|
||||
$losRestrictionFailed = true;
|
||||
break 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($losRestrictionFailed) {
|
||||
// Determine which restriction failed
|
||||
if ($numDays < $losMinDays) {
|
||||
$losMinFailed = true;
|
||||
} elseif ($losMaxDays > 0 && $numDays > $losMaxDays) {
|
||||
$losMaxFailed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// calculate room type price first
|
||||
@@ -867,6 +898,11 @@ class ProductControllerCore extends FrontController
|
||||
$smartyVars['num_days'] = $numDays;
|
||||
$smartyVars['warning_count'] = $warningCount;
|
||||
$smartyVars['total_available_rooms'] = $totalAvailableRooms;
|
||||
$smartyVars['los_restriction_failed'] = $losRestrictionFailed;
|
||||
$smartyVars['los_min_days'] = $losMinDays;
|
||||
$smartyVars['los_max_days'] = $losMaxDays;
|
||||
$smartyVars['los_min_failed'] = $losMinFailed;
|
||||
$smartyVars['los_max_failed'] = $losMaxFailed;
|
||||
$smartyVars['has_room_type_demands'] = $roomTypeDemands ? true : false; // whether to show price breakup
|
||||
$smartyVars['rooms_price'] = $totalRoomPrice;
|
||||
$smartyVars['demands_price_per_room'] = $demandsPricePerRoom;
|
||||
|
||||
Reference in New Issue
Block a user