Skip to content

Commit cf4ff4f

Browse files
authored
Merge pull request #1242 from vishal-singh-webkul/gli-2352
Fixed: The default date ranges in the booking form are not correct in case los and minimum booking offset is applied on the room type in the front-office.
2 parents f8caa22 + 9d72906 commit cf4ff4f

File tree

1 file changed

+7
-15
lines changed

1 file changed

+7
-15
lines changed

controllers/front/ProductController.php

+7-15
Original file line numberDiff line numberDiff line change
@@ -337,27 +337,19 @@ public function initContent()
337337
$preparationTime = (int) HotelOrderRestrictDate::getPreparationTime($hotel_id);
338338
if (!($date_from = Tools::getValue('date_from'))) {
339339
$date_from = date('Y-m-d');
340-
// set date to according to los
341-
$objHotelRoomTypeRestrictionDateRange = new HotelRoomTypeRestrictionDateRange();
342-
$los = $objHotelRoomTypeRestrictionDateRange->getRoomTypeLengthOfStay($this->product->id, $date_from);
343-
$date_to = date('Y-m-d', strtotime('+'.$los['min_los'].' day', strtotime($date_from)));
344-
}
345-
if (!($date_to = Tools::getValue('date_to'))) {
346-
// set date to according to los
347-
$objHotelRoomTypeRestrictionDateRange = new HotelRoomTypeRestrictionDateRange();
348-
$los = $objHotelRoomTypeRestrictionDateRange->getRoomTypeLengthOfStay($this->product->id, $date_from);
349-
$date_to = date('Y-m-d', strtotime('+'.$los['min_los'].' day', strtotime($date_from)));
350340
}
351341

352342
if ($preparationTime
353343
&& strtotime(date('Y-m-d', strtotime('+'. ($preparationTime) .' days'))) > strtotime($date_from)
354344
) {
355345
$date_from = date('Y-m-d', strtotime('+ '.$preparationTime.' day'));
356-
if (strtotime($date_from) >= strtotime($date_to)) {
357-
$objHotelRoomTypeRestrictionDateRange = new HotelRoomTypeRestrictionDateRange();
358-
$los = $objHotelRoomTypeRestrictionDateRange->getRoomTypeLengthOfStay($this->product->id, $date_from);
359-
$date_to = date('Y-m-d', strtotime('+'.$los['min_los'].' day', strtotime($date_from)));
360-
}
346+
}
347+
348+
if (!($date_to = Tools::getValue('date_to'))) {
349+
// set date to according to los
350+
$objHotelRoomTypeRestrictionDateRange = new HotelRoomTypeRestrictionDateRange();
351+
$los = $objHotelRoomTypeRestrictionDateRange->getRoomTypeLengthOfStay($this->product->id, $date_from);
352+
$date_to = date('Y-m-d', strtotime('+'.$los['min_los'].' day', strtotime($date_from)));
361353
}
362354

363355
$hotel_branch_obj = new HotelBranchInformation($hotel_id);

0 commit comments

Comments
 (0)