Updated: Make room disable dates independent of room status
Co-authored-by: Name <sumit201@webkul.in>
This commit is contained in:
@@ -1439,7 +1439,7 @@ class AdminStatsControllerCore extends AdminStatsTabController
|
||||
|
||||
// Unavailable are:
|
||||
// - inactive rooms (unavailable for all nights in the range)
|
||||
// - temporarily inactive rooms for overlapping disabled date ranges (night-wise)
|
||||
// - active rooms for overlapping disabled date ranges (night-wise)
|
||||
$countInactiveRooms = (int)Db::getInstance()->getValue(
|
||||
'SELECT IFNULL(COUNT(hri.`id`), 0)
|
||||
FROM `'._DB_PREFIX_.'htl_room_information` hri
|
||||
@@ -1500,7 +1500,7 @@ class AdminStatsControllerCore extends AdminStatsTabController
|
||||
ON (hrdd.`id_room` = hri.`id`)
|
||||
LEFT JOIN `'._DB_PREFIX_.'product` p
|
||||
ON (p.`id_product` = hri.`id_product`)
|
||||
WHERE hri.`id_status` = '.(int)HotelRoomInformation::STATUS_TEMPORARY_INACTIVE.'
|
||||
WHERE hri.`id_status` = '.(int)HotelRoomInformation::STATUS_ACTIVE.'
|
||||
AND hrdd.`date_from` < "'.pSQL($dateTo).'"
|
||||
AND hrdd.`date_to` > "'.pSQL($dateFrom).'"
|
||||
AND p.`active` = 1
|
||||
@@ -1508,7 +1508,7 @@ class AdminStatsControllerCore extends AdminStatsTabController
|
||||
(!is_null($idsHotel) ? HotelBranchInformation::addHotelRestriction($idsHotel, 'hri') : '')
|
||||
);
|
||||
|
||||
// Booked nights overlapping temporary disable ranges should not be counted as unavailable.
|
||||
// Booked nights overlapping disable ranges should not be counted as unavailable.
|
||||
$countOccupiedTemporaryInactiveNights = (int)Db::getInstance()->getValue(
|
||||
'SELECT IFNULL(SUM(
|
||||
GREATEST(
|
||||
@@ -1537,7 +1537,7 @@ class AdminStatsControllerCore extends AdminStatsTabController
|
||||
ON (hri.`id` = hbd.`id_room`)
|
||||
LEFT JOIN `'._DB_PREFIX_.'product` p
|
||||
ON (p.`id_product` = hri.`id_product`)
|
||||
WHERE hri.`id_status` = '.(int)HotelRoomInformation::STATUS_TEMPORARY_INACTIVE.'
|
||||
WHERE hri.`id_status` = '.(int)HotelRoomInformation::STATUS_ACTIVE.'
|
||||
AND p.`active` = 1
|
||||
AND p.`booking_product` = 1
|
||||
AND hbd.`id` NOT IN ('.OrderReturn::getRefundedBookingIdsSubquery().')
|
||||
@@ -2023,13 +2023,13 @@ class AdminStatsControllerCore extends AdminStatsTabController
|
||||
(!is_null($idHotel) ? HotelBranchInformation::addHotelRestriction($idHotel, 'hri') : '').'
|
||||
) AS num_inactive,
|
||||
(
|
||||
SELECT IFNULL(COUNT(hri.`id`), 0)
|
||||
SELECT IFNULL(COUNT(DISTINCT hri.`id`), 0)
|
||||
FROM `'._DB_PREFIX_.'htl_room_information` hri
|
||||
LEFT JOIN `'._DB_PREFIX_.'htl_room_disable_dates` hrdd
|
||||
ON (hrdd.`id_room` = hri.`id`)
|
||||
LEFT JOIN `'._DB_PREFIX_.'product` p
|
||||
ON (p.`id_product` = hri.`id_product`)
|
||||
WHERE hri.`id_status` = '.(int) HotelRoomInformation::STATUS_TEMPORARY_INACTIVE.'
|
||||
WHERE hri.`id_status` = '.(int) HotelRoomInformation::STATUS_ACTIVE.'
|
||||
AND ("'.pSQL($discreteDate['date_from']).'" >= hrdd.`date_from` AND "'.pSQL($discreteDate['date_from']).'" < hrdd.`date_to`)
|
||||
AND p.`active` = 1'.
|
||||
(!is_null($idHotel) ? HotelBranchInformation::addHotelRestriction($idHotel, 'hri') : '').'
|
||||
@@ -2104,13 +2104,13 @@ class AdminStatsControllerCore extends AdminStatsTabController
|
||||
(!is_null($idHotel) ? HotelBranchInformation::addHotelRestriction($idHotel, 'hri') : '').'
|
||||
) AS num_inactive,
|
||||
(
|
||||
SELECT IFNULL(COUNT(hri.`id`), 0)
|
||||
SELECT IFNULL(COUNT(DISTINCT hri.`id`), 0)
|
||||
FROM `'._DB_PREFIX_.'htl_room_information` hri
|
||||
LEFT JOIN `'._DB_PREFIX_.'htl_room_disable_dates` hrdd
|
||||
ON (hrdd.`id_room` = hri.`id`)
|
||||
LEFT JOIN `'._DB_PREFIX_.'product` p
|
||||
ON (p.`id_product` = hri.`id_product`)
|
||||
WHERE hri.`id_status` = '.(int) HotelRoomInformation::STATUS_TEMPORARY_INACTIVE.'
|
||||
WHERE hri.`id_status` = '.(int) HotelRoomInformation::STATUS_ACTIVE.'
|
||||
AND ("'.pSQL($discreteDate['date_from']).'" >= hrdd.`date_from` AND "'.pSQL($discreteDate['date_from']).'" < hrdd.`date_to`)
|
||||
AND p.`active` = 1'.
|
||||
(!is_null($showAtFront) ? ' AND p.`show_at_front` = '.(int) $showAtFront : '').
|
||||
@@ -2168,13 +2168,13 @@ class AdminStatsControllerCore extends AdminStatsTabController
|
||||
(!is_null($idHotel) ? HotelBranchInformation::addHotelRestriction($idHotel, 'hri') : '').'
|
||||
) AS num_inactive,
|
||||
(
|
||||
SELECT IFNULL(COUNT(hri.`id`), 0)
|
||||
SELECT IFNULL(COUNT(DISTINCT hri.`id`), 0)
|
||||
FROM `'._DB_PREFIX_.'htl_room_information` hri
|
||||
LEFT JOIN `'._DB_PREFIX_.'htl_room_disable_dates` hrdd
|
||||
ON (hrdd.`id_room` = hri.`id`)
|
||||
LEFT JOIN `'._DB_PREFIX_.'product` p
|
||||
ON (p.`id_product` = hri.`id_product`)
|
||||
WHERE hri.`id_status` = '.(int) HotelRoomInformation::STATUS_TEMPORARY_INACTIVE.'
|
||||
WHERE hri.`id_status` = '.(int) HotelRoomInformation::STATUS_ACTIVE.'
|
||||
AND ("'.pSQL($discreteDate['date_from']).'" >= hrdd.`date_from` AND "'.pSQL($discreteDate['date_from']).'" < hrdd.`date_to`)
|
||||
AND p.`active` = 1'.
|
||||
(!is_null($idHotel) ? HotelBranchInformation::addHotelRestriction($idHotel, 'hri') : '').'
|
||||
|
||||
Reference in New Issue
Block a user