Merge branch 'develop' into gli-2241-2
This commit is contained in:
@@ -86,6 +86,8 @@ class Blocknewsletter extends Module
|
||||
'actionExportGDPRData',
|
||||
'actionObjectCustomerUpdateBefore',
|
||||
'actionDeleteGDPRCustomer',
|
||||
'actionCustomerCartRulesModifier',
|
||||
'actionValidateCartRule',
|
||||
'actionObjectCustomerDeleteAfter',
|
||||
)
|
||||
);
|
||||
@@ -133,6 +135,40 @@ class Blocknewsletter extends Module
|
||||
}
|
||||
}
|
||||
|
||||
public function hookActionCustomerCartRulesModifier($params)
|
||||
{
|
||||
$customer = new Customer($params['id_customer']);
|
||||
foreach($params['cart_rules'] as $key => $cartRule) {
|
||||
if ($cartRule['code'] == Configuration::get('NW_VOUCHER_CODE')) {
|
||||
if ($customer->id && !$customer->is_guest) {
|
||||
if (count(Order::getCustomerOrders($customer->id))) {
|
||||
// remove welcome voucher
|
||||
unset($params['cart_rules'][$key]);
|
||||
}
|
||||
} else {
|
||||
// remove welcome voucher
|
||||
unset($params['cart_rules'][$key]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function hookActionValidateCartRule($params)
|
||||
{
|
||||
$customer = new Customer($params['context']->cart->id_customer);
|
||||
if ($params['cart_rule']->code == Configuration::get('NW_VOUCHER_CODE')) {
|
||||
if ($customer->id && !$customer->is_guest) {
|
||||
if (count(Order::getCustomerOrders($customer->id))) {
|
||||
$params['isValidatedByModules'] = false;
|
||||
$params['isValidatedByModulesError'] = $this->l('This voucher is not available for this booking.');
|
||||
}
|
||||
} else {
|
||||
$params['isValidatedByModules'] = false;
|
||||
$params['isValidatedByModulesError'] = $this->l('This voucher is not available for this booking.');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function install()
|
||||
{
|
||||
if (!parent::install() || !$this->registerHooks() || !$this->callInstallTab()) {
|
||||
|
||||
@@ -87,7 +87,12 @@
|
||||
<p data-html-only="1" style="border-bottom:1px solid #D6D4D4;margin:3px 0 7px;text-transform:uppercase;font-weight:500;font-size:18px;padding-bottom:10px">
|
||||
Newsletter subscription </p>
|
||||
<span style="color:#777">
|
||||
Regarding your newsletter subscription, we are pleased to offer you the following voucher: <span style="color:#333"><strong>{discount}</strong></span>
|
||||
Regarding your newsletter subscription, we are pleased to offer you the welcome voucher: <span style="color:#333"><strong>{discount}</strong></span>
|
||||
</span>
|
||||
<br>
|
||||
<br>
|
||||
<span style="color:#777">
|
||||
Please note that the voucher will be valid on your first order.
|
||||
</span>
|
||||
</font>
|
||||
</td>
|
||||
|
||||
@@ -4,7 +4,9 @@
|
||||
Hi,
|
||||
|
||||
Regarding your newsletter subscription, we are pleased to offer
|
||||
you the following voucher: {discount}
|
||||
you the welcome voucher: {discount}
|
||||
|
||||
Please note that the voucher will be valid on your first order.
|
||||
|
||||
{shop_name} [/{shop_url}] powered by Webkul(tm)
|
||||
[https://webkul.com]
|
||||
|
||||
@@ -80,7 +80,7 @@
|
||||
<ul class="stats-list">
|
||||
<li>
|
||||
<span class="item-label">
|
||||
<a href="{$link->getAdminLink("AdminOrders")|escape:"html":"UTF-8"}" target="_blank">
|
||||
<a href="{$link->getAdminLink("AdminOrders")|escape:"html":"UTF-8"}&orders_not_paid=1" target="_blank">
|
||||
<span>{l s="Bookings (not paid)" mod='dashactivity'}</span>
|
||||
</a>
|
||||
</span>
|
||||
@@ -90,7 +90,7 @@
|
||||
</li>
|
||||
<li>
|
||||
<span class="item-label">
|
||||
<a href="{$link->getAdminLink("AdminOrderRefundRequests")|escape:"html":"UTF-8"}&&submitFilterorder_return=1&order_returnFilter_total_pending_requests=1" target="_blank">
|
||||
<a href="{$link->getAdminLink("AdminOrderRefundRequests")|escape:"html":"UTF-8"}&&submitFilterorder_return=1&order_returnFilter_total_pending_requests[0]=1" target="_blank">
|
||||
<span>{l s="Refunds" mod='dashactivity'}</span>
|
||||
</a>
|
||||
</span>
|
||||
@@ -100,7 +100,7 @@
|
||||
</li>
|
||||
<li>
|
||||
<span class="item-label">
|
||||
<a href="{$link->getAdminLink("AdminCarts")|escape:"html":"UTF-8"}&submitFiltercart=1&cartFilter_filter_ids_order=Abandoned cart" target="_blank">
|
||||
<a href="{$link->getAdminLink("AdminCarts")|escape:"html":"UTF-8"}&action=filterOnlyAbandonedCarts" target="_blank">
|
||||
<span>{l s="Abandoned Carts" mod='dashactivity'}</span>
|
||||
</a>
|
||||
</span>
|
||||
|
||||
@@ -21,9 +21,8 @@ function line_chart_dashinsights(widget_name, chart_details) {
|
||||
$('#dashinsights_room_nights svg').html('');
|
||||
nv.addGraph(function () {
|
||||
var chart = nv.models.lineChart()
|
||||
.useInteractiveGuideline(true)
|
||||
.x(function (d) { return (d !== undefined ? d[0] : 0); })
|
||||
.y(function (d) { return (d !== undefined ? d[1] : 0); })
|
||||
.y(function (d) { return (d !== undefined ? parseInt(d[1]) : 0); })
|
||||
.forceY([0, 1])
|
||||
.margin({
|
||||
left: 40,
|
||||
@@ -32,7 +31,7 @@ function line_chart_dashinsights(widget_name, chart_details) {
|
||||
|
||||
chart.yAxis.scale().domain([0, 1]);
|
||||
// create content for the tooltip of chart
|
||||
chart.interactiveLayer.tooltip.contentGenerator((obj, element) => {
|
||||
chart.tooltip.contentGenerator((obj, element) => {
|
||||
var totalNightsBooked = 0;
|
||||
var tooltipContent = '';
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
<section>
|
||||
<div class="row stats-wrap">
|
||||
<div class="col-xs-6 col-lg-3">
|
||||
<div class="stat-box label-tooltip" data-toggle="tooltip" data-original-title="{l s='Average Daily Rate (ADR) represents the average rental income per paid occupied room over a given time period.' mod='dashperformance'}" data-placement="top" style="background-color: #B7F0FF;">
|
||||
<div class="stat-box label-tooltip" data-toggle="tooltip" data-original-title="{l s='Average Daily Rate (ADR) represents the average rental income per occupied room over a given time period.' mod='dashperformance'}" data-placement="top" style="background-color: #B7F0FF;">
|
||||
<div class="title-wrapper">
|
||||
<p>{l s='Average Daily Rate' mod='dashperformance'}</p>
|
||||
</div>
|
||||
|
||||
@@ -107,6 +107,7 @@ class Dashtrends extends Module
|
||||
$tmp_data['total_paid_tax_excl'][$date] = $tmp_data['orders'][$date] * $tmp_data['average_cart_value'][$date];
|
||||
$tmp_data['total_purchases'][$date] = $tmp_data['total_paid_tax_excl'][$date] * rand(50, 70) / 100;
|
||||
$tmp_data['total_expenses'][$date] = $tmp_data['total_paid_tax_excl'][$date] * rand(0, 10) / 100;
|
||||
$tmp_data['total_refunds'][$date] = $tmp_data['total_paid_tax_excl'][$date] * rand(0, 5) / 100;
|
||||
}
|
||||
} else {
|
||||
$tmp_data['visits'] = AdminStatsController::getVisits(false, $date_from, $date_to, 'day');
|
||||
@@ -114,6 +115,7 @@ class Dashtrends extends Module
|
||||
$tmp_data['total_paid_tax_excl'] = AdminStatsController::getTotalSales($date_from, $date_to, 'day', $id_hotel);
|
||||
$tmp_data['total_purchases'] = AdminStatsController::getPurchases($date_from, $date_to, 'day', $id_hotel);
|
||||
$tmp_data['total_expenses'] = AdminStatsController::getExpenses($date_from, $date_to, 'day', $id_hotel);
|
||||
$tmp_data['total_refunds'] = AdminStatsController::getRefunds($date_from, $date_to, 'day', $id_hotel);
|
||||
}
|
||||
|
||||
return $tmp_data;
|
||||
@@ -151,6 +153,7 @@ class Dashtrends extends Module
|
||||
$refined_data['net_profits'][$date] += (isset($gross_data['total_paid_tax_excl'][$date]) ? $gross_data['total_paid_tax_excl'][$date] : 0);
|
||||
$refined_data['net_profits'][$date] -= (isset($gross_data['total_purchases'][$date]) ? $gross_data['total_purchases'][$date] : 0);
|
||||
$refined_data['net_profits'][$date] -= (isset($gross_data['total_expenses'][$date]) ? $gross_data['total_expenses'][$date] : 0);
|
||||
$refined_data['net_profits'][$date] -= (isset($gross_data['total_refunds'][$date]) ? $gross_data['total_refunds'][$date] : 0);
|
||||
}
|
||||
|
||||
return $refined_data;
|
||||
|
||||
@@ -75,6 +75,7 @@ class HotelBookingDemands extends ObjectModel
|
||||
$groupByRoom = 1,
|
||||
$getTotalPrice = 0,
|
||||
$useTax = 1,
|
||||
$idHtlBookingDetail = 0,
|
||||
$idOrderDetail = 0
|
||||
) {
|
||||
$moduleObj = Module::getInstanceByName('hotelreservationsystem');
|
||||
@@ -89,25 +90,28 @@ class HotelBookingDemands extends ObjectModel
|
||||
$totalDemandsPrice = 0;
|
||||
$sql = 'SELECT hb.`id_room`, hb.`adults`, hb.`children`, hd.* FROM `'._DB_PREFIX_.'htl_booking_demands` hd
|
||||
LEFT JOIN `'._DB_PREFIX_.'htl_booking_detail` hb ON (hd.`id_htl_booking` = hb.`id`)
|
||||
WHERE hd.`id_htl_booking` IN
|
||||
(SELECT `id` FROM `'._DB_PREFIX_.'htl_booking_detail`
|
||||
WHERE `id_order`='.(int) $idOrder;
|
||||
WHERE hb.`id_order` ='.(int) $idOrder;
|
||||
|
||||
|
||||
if ($idOrderDetail) {
|
||||
$sql .= ' AND `id_order_detail`='.(int)$idOrderDetail;
|
||||
}
|
||||
if ($idProduct) {
|
||||
$sql .= ' AND `id_product`='.(int)$idProduct;
|
||||
$sql .= ' AND hb.`id_product`='.(int)$idProduct;
|
||||
}
|
||||
if ($idRoom) {
|
||||
$sql .= ' AND `id_room`='.(int)$idRoom;
|
||||
$sql .= ' AND hb.`id_room`='.(int)$idRoom;
|
||||
}
|
||||
if ($dateFrom && $dateTo) {
|
||||
$dateFrom = date('Y-m-d', strtotime($dateFrom));
|
||||
$dateTo = date('Y-m-d', strtotime($dateTo));
|
||||
$sql .= ' AND `date_from`=\''.pSQL($dateFrom).'\' AND `date_to`= \''.pSQL($dateTo).'\'';
|
||||
$sql .= ' AND hb.`date_from`=\''.pSQL($dateFrom).'\' AND hb.`date_to`= \''.pSQL($dateTo).'\'';
|
||||
}
|
||||
$sql .= ')';
|
||||
|
||||
if ($idHtlBookingDetail) {
|
||||
$sql .= ' AND hb.`id` = '.(int)$idHtlBookingDetail;
|
||||
}
|
||||
|
||||
if ($getTotalPrice) {
|
||||
$totalDemandsPrice = 0;
|
||||
}
|
||||
|
||||
@@ -185,7 +185,7 @@ class HotelBookingDetail extends ObjectModel
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function getBookingDataParams($params)
|
||||
public function getBookingDataParams(&$params)
|
||||
{
|
||||
if (!isset($params['id_room_type'])) {
|
||||
$params['id_room_type'] = 0;
|
||||
@@ -211,6 +211,9 @@ class HotelBookingDetail extends ObjectModel
|
||||
if (!isset($params['search_cart_rms'])) {
|
||||
$params['search_cart_rms'] = 0;
|
||||
}
|
||||
if (!isset($params['hourly_booking'])) {
|
||||
$params['hourly_booking'] = false;
|
||||
}
|
||||
|
||||
if (!isset($params['only_active_roomtype'])) {
|
||||
$params['only_active_roomtype'] = 1;
|
||||
@@ -237,6 +240,8 @@ class HotelBookingDetail extends ObjectModel
|
||||
$params['full_detail'] = 0;
|
||||
}
|
||||
|
||||
Hook::exec('actionBookingDataParamsModifier', array('params' => &$params));
|
||||
|
||||
return $params;
|
||||
}
|
||||
|
||||
@@ -293,32 +298,34 @@ class HotelBookingDetail extends ObjectModel
|
||||
|
||||
// Unavailable Rooms
|
||||
if ($search_unavai) {
|
||||
$params = array(
|
||||
$searchParams = array(
|
||||
'idHotel' => $hotel_id,
|
||||
'dateFrom' => $date_from,
|
||||
'dateTo' => $date_to,
|
||||
'idRoomType' => $id_room_type,
|
||||
'allowedIdRoomTypes' => $allowedIdRoomTypes,
|
||||
'applyLosRestriction' => $applyLosRestriction,
|
||||
'allParams' => $params,
|
||||
);
|
||||
$unavailRoomTypes = $this->getSearchUnavailableRooms($params);
|
||||
$unavailRoomTypes = $this->getSearchUnavailableRooms($searchParams);
|
||||
}
|
||||
|
||||
// Cart Rooms
|
||||
if ($search_cart_rms) {
|
||||
$params = array(
|
||||
$searchParams = array(
|
||||
'idHotel' => $hotel_id,
|
||||
'idCart' => $id_cart,
|
||||
'idGuest' => $id_guest,
|
||||
'idRoomType' => $id_room_type,
|
||||
'allowedIdRoomTypes' => $allowedIdRoomTypes,
|
||||
'allParams' => $params,
|
||||
);
|
||||
$cartRoomTypes = $this->getSearchCartRooms($params);
|
||||
$cartRoomTypes = $this->getSearchCartRooms($searchParams);
|
||||
}
|
||||
|
||||
// Available Rooms
|
||||
if ($search_available) {
|
||||
$params = array(
|
||||
$searchParams = array(
|
||||
'idHotel' => $hotel_id,
|
||||
'dateFrom' => $date_from,
|
||||
'dateTo' => $date_to,
|
||||
@@ -328,16 +335,28 @@ class HotelBookingDetail extends ObjectModel
|
||||
'searchOccupancy' => $occupancy,
|
||||
'allowedIdRoomTypes' => $allowedIdRoomTypes,
|
||||
'applyLosRestriction' => $applyLosRestriction,
|
||||
'hourlyBooking' => $hourly_booking,
|
||||
'allParams' => $params,
|
||||
);
|
||||
$availableRoomTypes = $this->getSearchAvailableRooms($params);
|
||||
$availableRoomTypes = $this->getSearchAvailableRooms($searchParams);
|
||||
if ($availableRoomTypes['unavailableRoomTypes'] && $search_unavai) {
|
||||
// format unavailable room types
|
||||
foreach ($availableRoomTypes['unavailableRoomTypes'] as $idProduct => $roomTypeDetail) {
|
||||
if (!isset($unavailRoomTypes[$idProduct])) {
|
||||
$unavailRoomTypes[$idProduct] = array();
|
||||
foreach ($roomTypeDetail as $idRoom => $roomDetail) {
|
||||
if (!isset($unavailRoomTypes[$idProduct][$idRoom])) {
|
||||
$unavailRoomTypes[$idProduct][$idRoom] = array(
|
||||
'id_product' => $roomDetail['id_product'],
|
||||
'id_room' => $roomDetail['id_room'],
|
||||
'id_hotel' => $roomDetail['id_hotel'],
|
||||
'room_num' => $roomDetail['room_num'],
|
||||
'detail' => array()
|
||||
);
|
||||
}
|
||||
$unavailRoomTypes[$idProduct][$idRoom]['detail'][] = array(
|
||||
'id_status' => $roomDetail['id_status'],
|
||||
'room_comment' => $roomDetail['room_comment']
|
||||
);
|
||||
}
|
||||
|
||||
// FYI: used array_merge because we have int index
|
||||
$unavailRoomTypes[$idProduct] = array_merge($unavailRoomTypes[$idProduct], $roomTypeDetail);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -346,19 +365,20 @@ class HotelBookingDetail extends ObjectModel
|
||||
|
||||
// Booked Rooms
|
||||
if ($search_booked) {
|
||||
$params = array(
|
||||
$searchParams = array(
|
||||
'idHotel' => $hotel_id,
|
||||
'dateFrom' => $date_from,
|
||||
'dateTo' => $date_to,
|
||||
'idRoomType' => $id_room_type,
|
||||
'allowedIdRoomTypes' => $allowedIdRoomTypes,
|
||||
'allParams' => $params,
|
||||
);
|
||||
$bookedRoomTypes = $this->getSearchBookedRooms($params);
|
||||
$bookedRoomTypes = $this->getSearchBookedRooms($searchParams);
|
||||
}
|
||||
|
||||
// Partially available Rooms
|
||||
if ($search_partial) {
|
||||
$params = array(
|
||||
$searchParams = array(
|
||||
'idHotel' => $hotel_id,
|
||||
'dateFrom' => $date_from,
|
||||
'dateTo' => $date_to,
|
||||
@@ -367,21 +387,14 @@ class HotelBookingDetail extends ObjectModel
|
||||
'idRoomType' => $id_room_type,
|
||||
'searchOccupancy' => $occupancy,
|
||||
'allowedIdRoomTypes' => $allowedIdRoomTypes,
|
||||
'hourlyBooking' => $hourly_booking,
|
||||
'allParams' => $params,
|
||||
);
|
||||
|
||||
$partiallyAvailRoomTypes = $this->getSearchPartiallyAvailRooms($params);
|
||||
|
||||
if ($partiallyAvailRoomTypes['unavailableRoomTypes'] && $search_unavai) {
|
||||
foreach ($partiallyAvailRoomTypes['unavailableRoomTypes'] as $idProduct => $roomTypeDetail) {
|
||||
if (!isset($unavailRoomTypes[$idProduct])) {
|
||||
$unavailRoomTypes[$idProduct] = array();
|
||||
}
|
||||
|
||||
// FYI: used array_merge because we have int index
|
||||
$unavailRoomTypes[$idProduct] = array_merge($unavailRoomTypes[$idProduct], $roomTypeDetail);
|
||||
}
|
||||
}
|
||||
$partiallyAvailRoomTypes = $this->getSearchPartiallyAvailRooms($searchParams);
|
||||
|
||||
// Unavailable rooms and booked rooms are already included in there respective search
|
||||
// So, no need to seperate them here
|
||||
$partiallyAvailRoomsCount = $partiallyAvailRoomTypes['partiallyAvailRoomsCount'];
|
||||
$partiallyAvailRoomTypes = $partiallyAvailRoomTypes['partiallyAvailRooms'];
|
||||
}
|
||||
@@ -478,6 +491,7 @@ class HotelBookingDetail extends ObjectModel
|
||||
* 'idRoomType' => ...,
|
||||
* 'allowedIdRoomTypes' => ...,
|
||||
* 'applyLosRestriction' => ...,
|
||||
* 'allParams' => ...,
|
||||
* );
|
||||
*/
|
||||
protected function getSearchUnavailableRooms($params)
|
||||
@@ -499,34 +513,64 @@ class HotelBookingDetail extends ObjectModel
|
||||
$stayStartDate = date('Y-m-d', strtotime($dateFrom));
|
||||
|
||||
// Room status inactive
|
||||
$sql1 = 'SELECT `id` AS `id_room`, `id_product`, `id_hotel`, `room_num`, `comment` AS `room_comment`
|
||||
$sql = array();
|
||||
$sql[] = 'SELECT `id` AS `id_room`, `id_product`, `id_hotel`, `room_num`, `comment` AS `room_comment`, `id_status`, NULL AS `date_from`, NULL AS `date_to`
|
||||
FROM `'._DB_PREFIX_.'htl_room_information`
|
||||
WHERE `id_hotel`='.(int)$idHotel.' AND `id_status` = '. HotelRoomInformation::STATUS_INACTIVE.' AND IF('.(int)$idRoomType.' > 0, `id_product` = '.(int)$idRoomType.', 1) AND `id_product` IN ('.$allowedIdRoomTypes.')';
|
||||
|
||||
// check room is temperory inactive
|
||||
$sql2 = 'SELECT hri.`id` AS `id_room`, hri.`id_product`, hri.`id_hotel`, hri.`room_num`, hri.`comment` AS `room_comment`
|
||||
$sql[] = 'SELECT hri.`id` AS `id_room`, hri.`id_product`, hri.`id_hotel`, hri.`room_num`, hri.`comment` AS `room_comment`, hri.`id_status`, hrdd.`date_from` AS `date_from`, hrdd.`date_to` AS `date_to`
|
||||
FROM `'._DB_PREFIX_.'htl_room_information` AS hri
|
||||
INNER JOIN `'._DB_PREFIX_.'htl_room_disable_dates` AS hrdd ON (hrdd.`id_room_type` = hri.`id_product` AND hrdd. id_room = hri.`id`)
|
||||
WHERE hri.`id_hotel`='.$idHotel.' AND hri.`id_status` = '. HotelRoomInformation::STATUS_TEMPORARY_INACTIVE .' AND hrdd.`date_from` <= \''.pSql($dateFrom).'\' AND hrdd.`date_to` >= \''.pSql($dateTo).'\' AND IF('.(int)$idRoomType.' > 0, hri.`id_product` = '.(int)$idRoomType.', 1) AND hri.`id_product` IN ('.$allowedIdRoomTypes.')';
|
||||
WHERE hri.`id_hotel`='.$idHotel.' AND hri.`id_status` = '. HotelRoomInformation::STATUS_TEMPORARY_INACTIVE .' AND (
|
||||
(hrdd.`date_from` <= \''.pSQL($dateFrom).'\' AND hrdd.`date_to` > \''.pSQL($dateFrom).'\' AND hrdd.`date_to` <= \''.pSQL($dateTo).'\') OR
|
||||
(hrdd.`date_from` >= \''.pSQL($dateFrom).'\' AND hrdd.`date_to` > \''.pSQL($dateFrom).'\' AND hrdd.`date_to` <= \''.pSQL($dateTo).'\') OR
|
||||
(hrdd.`date_from` >= \''.pSQL($dateFrom).'\' AND hrdd.`date_from` < \''.pSQL($dateTo).'\' AND hrdd.`date_to` >= \''.pSQL($dateTo).'\') OR
|
||||
(hrdd.`date_from` <= \''.pSql($dateFrom).'\' AND hrdd.`date_to` >= \''.pSql($dateTo).'\')
|
||||
) AND IF('.(int)$idRoomType.' > 0, hri.`id_product` = '.(int)$idRoomType.', 1) AND hri.`id_product` IN ('.$allowedIdRoomTypes.')';
|
||||
|
||||
$sql = $sql1.' UNION '.$sql2;
|
||||
|
||||
if ($applyLosRestriction) {
|
||||
$sql3 = 'SELECT hri.`id` AS `id_room`, hri.`id_product`, hri.`id_hotel`, hri.`room_num`, hri.`comment` AS `room_comment`
|
||||
$sql[] = 'SELECT hri.`id` AS `id_room`, hri.`id_product`, hri.`id_hotel`, hri.`room_num`, hri.`comment` AS `room_comment`, '.HotelRoomInformation::STATUS_SEARCH_LOS_UNSATISFIED.' AS `id_status`, NULL AS `date_from`, NULL AS `date_to`
|
||||
FROM `'._DB_PREFIX_.'htl_room_information` AS hri
|
||||
INNER JOIN `'._DB_PREFIX_.'htl_room_type` AS hrt ON (hrt.`id_product` = hri.`id_product`)
|
||||
LEFT JOIN `'._DB_PREFIX_.'htl_room_type_restriction_date_range` AS hrtr ON (hrt.`id_product` = hrtr.`id_product` AND (hrtr.`date_from` <= \''.pSQL($stayStartDate).'\' AND hrtr.`date_to` > \''.pSQL($stayStartDate).'\'))
|
||||
WHERE hri.`id_hotel`='.(int)$idHotel.' AND (IFNULL(hrtr.`min_los`, hrt.`min_los`) >'. (int)$lengthOfStay.' OR IF(IFNULL(hrtr.`max_los`, hrt.`max_los`) > 0, IFNULL(hrtr.`max_los`, hrt.`max_los`) < '.(int)$lengthOfStay.', 0)) AND IF('.(int)$idRoomType.' > 0, hri.`id_product` = '.(int)$idRoomType.', 1) AND hri.`id_product` IN ('.$allowedIdRoomTypes.')';
|
||||
|
||||
$sql = $sql.' UNION '.$sql3;
|
||||
}
|
||||
|
||||
$sql .= ' ORDER BY id_room ASC';
|
||||
Hook::exec('actionUnavailRoomSearchSqlModifier', array(
|
||||
'sql' => &$sql,
|
||||
'params' => array(
|
||||
'id_hotel' => $idHotel,
|
||||
'id_product' => $idRoomType,
|
||||
'date_from' => $dateFrom,
|
||||
'date_to' => $dateTo,
|
||||
'all_params' => $allParams
|
||||
)
|
||||
));
|
||||
|
||||
$sql = implode(' UNION ', $sql);
|
||||
$sql .= ' ORDER BY `id_room`, `date_from` ASC';
|
||||
|
||||
$unavailRoomTypes = array();
|
||||
if ($unavailRooms = Db::getInstance()->executeS($sql)) {
|
||||
foreach ($unavailRooms as $unavailRoomDetail) {
|
||||
$unavailRoomTypes[$unavailRoomDetail['id_product']][] = $unavailRoomDetail;
|
||||
if (!isset($unavailRoomTypes[$unavailRoomDetail['id_product']][$unavailRoomDetail['id_room']])) {
|
||||
$unavailRoomTypes[$unavailRoomDetail['id_product']][$unavailRoomDetail['id_room']] = array(
|
||||
'id_product' => $unavailRoomDetail['id_product'],
|
||||
'id_room' => $unavailRoomDetail['id_room'],
|
||||
'id_hotel' => $unavailRoomDetail['id_hotel'],
|
||||
'room_num' => $unavailRoomDetail['room_num'],
|
||||
'detail' => array()
|
||||
);
|
||||
}
|
||||
$unavailRoomTypes[$unavailRoomDetail['id_product']][$unavailRoomDetail['id_room']]['detail'][] = array(
|
||||
'id_status' => $unavailRoomDetail['id_status'],
|
||||
'room_comment' => $unavailRoomDetail['room_comment'],
|
||||
'date_from' => $unavailRoomDetail['date_from'],
|
||||
'date_to' => $unavailRoomDetail['date_to'],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -540,6 +584,7 @@ class HotelBookingDetail extends ObjectModel
|
||||
* 'idGuest' => ...,
|
||||
* 'idRoomType' => ...,
|
||||
* 'allowedIdRoomTypes' => ...,
|
||||
* 'allParams' => ...,
|
||||
* );
|
||||
*/
|
||||
protected function getSearchCartRooms($params)
|
||||
@@ -548,10 +593,40 @@ class HotelBookingDetail extends ObjectModel
|
||||
|
||||
$cartRoomTypes = array();
|
||||
if ($idCart && $idGuest) {
|
||||
$sql = 'SELECT cbd.`id_product`, cbd.`id_room`, cbd.`id_hotel`, cbd.`booking_type`, cbd.`comment`, rf.`room_num`, cbd.`date_from`, cbd.`date_to`
|
||||
FROM `'._DB_PREFIX_.'htl_cart_booking_data` AS cbd
|
||||
INNER JOIN `'._DB_PREFIX_.'htl_room_information` AS rf ON (rf.`id` = cbd.`id_room`)
|
||||
WHERE cbd.`id_hotel`= '.(int)$idHotel.' AND cbd.`id_cart` = '.(int)$idCart.' AND cbd.`id_guest` ='.(int)$idGuest.' AND cbd.`is_refunded` = 0 AND cbd.`is_back_order` = 0 AND IF('.(int)$idRoomType.' > 0, rf.`id_product` = '.(int)$idRoomType.', 1) AND rf.`id_product` IN ('.$allowedIdRoomTypes.')';
|
||||
$selectCartRoomSearch = 'SELECT cbd.`id_product`, cbd.`id_room`, cbd.`id_hotel`, cbd.`booking_type`,
|
||||
cbd.`comment`, rf.`room_num`, cbd.`date_from`, cbd.`date_to`';
|
||||
$joinCartRoomSearch = 'INNER JOIN `'._DB_PREFIX_.'htl_room_information` AS rf ON (rf.`id` = cbd.`id_room`)';
|
||||
$whereCartRoomSearch = 'WHERE cbd.`id_hotel`= '.(int)$idHotel.' AND cbd.`id_cart` = '.(int)$idCart.'
|
||||
AND cbd.`id_guest` ='.(int)$idGuest.' AND cbd.`is_refunded` = 0 AND cbd.`is_back_order` = 0
|
||||
AND IF('.(int)$idRoomType.' > 0, rf.`id_product` = '.(int)$idRoomType.', 1) AND rf.`id_product`
|
||||
IN ('.$allowedIdRoomTypes.')';
|
||||
$groupByCartRoomSearch = '';
|
||||
$orderByCartRoomSearch = '';
|
||||
$orderWayCartRoomSearch = '';
|
||||
|
||||
Hook::exec('actionCartRoomSearchSqlModifier', array(
|
||||
'select' => $selectCartRoomSearch,
|
||||
'join' => &$joinCartRoomSearch,
|
||||
'where' => &$whereCartRoomSearch,
|
||||
'group_by' => &$groupByCartRoomSearch,
|
||||
'order_by' => &$orderByCartRoomSearch,
|
||||
'order_way' => &$orderWayCartRoomSearch,
|
||||
'params' => array(
|
||||
'id_hotel' => $idHotel,
|
||||
'id_product' => $idRoomType,
|
||||
'idCart' => $idCart,
|
||||
'idGuest' => $idGuest,
|
||||
'all_params' => $allParams
|
||||
)
|
||||
));
|
||||
|
||||
$sql = $selectCartRoomSearch;
|
||||
$sql .= ' FROM `'._DB_PREFIX_.'htl_cart_booking_data` AS cbd';
|
||||
$sql .= ' '.$joinCartRoomSearch;
|
||||
$sql .= ' '.$whereCartRoomSearch;
|
||||
$sql .= ' '.$groupByCartRoomSearch;
|
||||
$sql .= ' '.$orderByCartRoomSearch;
|
||||
$sql .= ' '.$orderWayCartRoomSearch;
|
||||
|
||||
if ($cartRooms = Db::getInstance()->executeS($sql)) {
|
||||
foreach ($cartRooms as $cartRoomDetail) {
|
||||
@@ -566,15 +641,17 @@ class HotelBookingDetail extends ObjectModel
|
||||
|
||||
/**
|
||||
* $params = array(
|
||||
* 'idHotel' => ...,
|
||||
* 'dateFrom' => ...,
|
||||
* 'dateTo' => ...,
|
||||
* 'idCart' => ...,
|
||||
* 'idGuest' => ...,
|
||||
* 'idRoomType' => ...,
|
||||
* 'searchOccupancy' => ...,
|
||||
* 'allowedIdRoomTypes' => ...,
|
||||
* 'applyLosRestriction' => ...,
|
||||
* 'idHotel' => ...,
|
||||
* 'dateFrom' => ...,
|
||||
* 'dateTo' => ...,
|
||||
* 'idCart' => ...,
|
||||
* 'idGuest' => ...,
|
||||
* 'idRoomType' => ...,
|
||||
* 'searchOccupancy' => ...,
|
||||
* 'allowedIdRoomTypes' => ...,
|
||||
* 'applyLosRestriction' => ...,
|
||||
* 'hourlyBooking' => ...,
|
||||
* 'allParams' => ...,
|
||||
* );
|
||||
*/
|
||||
protected function getSearchAvailableRooms($params)
|
||||
@@ -604,15 +681,15 @@ class HotelBookingDetail extends ObjectModel
|
||||
}
|
||||
|
||||
// Exculde Booked rooms
|
||||
$exclude_ids = 'SELECT `id_room`
|
||||
$excludeRoomId = array();
|
||||
$excludeRoomId['checked_out'] = 'SELECT `id_room`
|
||||
FROM `'._DB_PREFIX_.'htl_booking_detail`
|
||||
WHERE `id_hotel` = '.(int)$idHotel.' AND `is_back_order` = 0 AND `is_refunded` = 0 AND IF(`id_status` = '. self::STATUS_CHECKED_OUT.', (
|
||||
(DATE_FORMAT(`check_out`, "%Y-%m-%d") > \''.pSQL($dateFrom).'\' AND DATE_FORMAT(`check_out`, "%Y-%m-%d") <= \''.PSQL($dateTo).'\') AND (
|
||||
WHERE `id_hotel` = '.(int)$idHotel.' AND `is_back_order` = 0 AND `is_refunded` = 0 AND IF(`id_status` = '. self::STATUS_CHECKED_OUT.',
|
||||
IF('.(int) $hourlyBooking.', 1, (DATE_FORMAT(`check_out`, "%Y-%m-%d") != DATE_FORMAT(\''.pSQL($dateFrom).'\', "%Y-%m-%d")) AND (`check_out` > \''.pSQL($dateFrom).'\' AND `check_out` <= \''.PSQL($dateTo).'\')) AND (
|
||||
(`date_from` <= \''.pSQL($dateFrom).'\' AND `check_out` > \''.pSQL($dateFrom).'\' AND `check_out` <= \''.PSQL($dateTo).'\') OR
|
||||
(`date_from` >= \''.pSQL($dateFrom).'\' AND `check_out` > \''.pSQL($dateFrom).'\' AND `check_out` <= \''.pSQL($dateTo).'\') OR
|
||||
(`date_from` >= \''.pSQL($dateFrom).'\' AND `date_from` < \''.pSQL($dateTo).'\' AND `check_out` >= \''.pSQL($dateTo).'\') OR
|
||||
(`date_from` <= \''.pSQL($dateFrom).'\' AND `check_out` >= \''.pSQL($dateTo).'\')
|
||||
)
|
||||
), (
|
||||
(`date_from` <= \''.pSQL($dateFrom).'\' AND `date_to` > \''.pSQL($dateFrom).'\' AND `date_to` <= \''.PSQL($dateTo).'\') OR
|
||||
(`date_from` >= \''.pSQL($dateFrom).'\' AND `date_to` <= \''.pSQL($dateTo).'\') OR
|
||||
@@ -620,55 +697,54 @@ class HotelBookingDetail extends ObjectModel
|
||||
(`date_from` <= \''.pSQL($dateFrom).'\' AND `date_to` >= \''.pSQL($dateTo).'\')
|
||||
)) AND IF('.(int)$idRoomType.' > 0, `id_product` = '.(int)$idRoomType.', 1) AND `id_product` IN ('.$allowedIdRoomTypes.')';
|
||||
|
||||
// We have removed cart rooms after finally getting available rooms from booking
|
||||
// Exclude temporary disable rooms
|
||||
$exclude_ids .= ' UNION
|
||||
SELECT hri.`id` AS id_room
|
||||
$excludeRoomId['disabled'] = 'SELECT hri.`id` AS id_room
|
||||
FROM `'._DB_PREFIX_.'htl_room_information` AS hri
|
||||
INNER JOIN `'._DB_PREFIX_.'htl_room_disable_dates` AS hrdd ON (hrdd.`id_room_type` = hri.`id_product` AND hrdd.`id_room` = hri.`id`)
|
||||
WHERE hri.`id_hotel`='.(int)$idHotel.' AND hri.`id_status` = '. HotelRoomInformation::STATUS_TEMPORARY_INACTIVE .' AND (hrdd.`date_from` < \''.pSql($dateTo).'\' AND hrdd.`date_to` > \''.pSql($dateFrom).'\') AND IF('.(int)$idRoomType.' > 0, hri.`id_product` = '.(int)$idRoomType.', 1) AND hri.`id_product` IN ('.$allowedIdRoomTypes.')';
|
||||
|
||||
// LOS Restriction. Also, Remember to check max LOS restriction is greater than zero
|
||||
if ($applyLosRestriction) {
|
||||
$exclude_ids .= ' UNION
|
||||
SELECT hri.`id` AS `id_room`
|
||||
$excludeRoomId['length_of_stay'] = 'SELECT hri.`id` AS `id_room`
|
||||
FROM `'._DB_PREFIX_.'htl_room_information` AS hri
|
||||
INNER JOIN `'._DB_PREFIX_.'htl_room_type` AS hrt ON (hrt.`id_product` = hri.`id_product`)
|
||||
LEFT JOIN `'._DB_PREFIX_.'htl_room_type_restriction_date_range` AS hrtr ON (hrt.`id_product` = hrtr.`id_product` AND (hrtr.`date_from` <= \''.pSQL($stayStartDate).'\' AND hrtr.`date_to` > \''.pSQL($stayStartDate).'\'))
|
||||
WHERE hri.`id_hotel`='.(int)$idHotel.' AND (IFNULL(hrtr.`min_los`, hrt.`min_los`) >'. (int)$lengthOfStay.' OR IF(IFNULL(hrtr.`max_los`, hrt.`max_los`) > 0, IFNULL(hrtr.`max_los`, hrt.`max_los`) < '.(int)$lengthOfStay.', 0)) AND IF('.(int)$idRoomType.' > 0, hri.`id_product` = '.(int)$idRoomType.', 1) AND hri.`id_product` IN ('.$allowedIdRoomTypes.')';
|
||||
}
|
||||
// We will remove cart rooms after finally getting available rooms from booking
|
||||
|
||||
$selectAvailRoomSearch = 'SELECT ri.`id` AS `id_room`, ri.`id_product`, ri.`id_hotel`, ri.`room_num`, ri.`comment` AS `room_comment`, hrt.`max_adults` AS max_adult, hrt.`max_children`, hrt.`max_guests` AS max_occupancy';
|
||||
|
||||
$joinAvailRoomSearch = 'INNER JOIN `'._DB_PREFIX_.'htl_room_type` AS hrt ON (hrt.`id_product` = ri.`id_product`)';
|
||||
|
||||
$whereAvailRoomSearch = 'WHERE ri.`id_hotel`='.(int)$idHotel.' AND ri.`id_status` != '. HotelRoomInformation::STATUS_INACTIVE.' AND ri.`id` NOT IN ('.$exclude_ids.') AND IF('.(int)$idRoomType.' > 0, ri.`id_product` = '.(int)$idRoomType.', 1) AND ri.`id_product` IN ('.$allowedIdRoomTypes.')';
|
||||
$whereAvailRoomSearch = 'WHERE ri.`id_hotel`='.(int)$idHotel.' AND ri.`id_status` != '. HotelRoomInformation::STATUS_INACTIVE.' AND IF('.(int)$idRoomType.' > 0, ri.`id_product` = '.(int)$idRoomType.', 1) AND ri.`id_product` IN ('.$allowedIdRoomTypes.')';
|
||||
|
||||
$groupByAvailRoomSearch = '';
|
||||
$orderByAvailRoomSearch = 'ORDER BY ri.`id`';
|
||||
$orderWayAvailRoomSearch = 'ASC';
|
||||
|
||||
Hook::exec('actionAvailRoomSearchSqlModifier',
|
||||
array(
|
||||
'select' => $selectAvailRoomSearch,
|
||||
'join' => &$joinAvailRoomSearch,
|
||||
'where' => &$whereAvailRoomSearch,
|
||||
'group_by' => &$groupByAvailRoomSearch,
|
||||
'order_by' => &$orderByAvailRoomSearch,
|
||||
'order_way' => &$orderWayAvailRoomSearch,
|
||||
'params' => array(
|
||||
'id_hotel' => $idHotel,
|
||||
'id_product' => $idRoomType,
|
||||
'date_from' => $dateFrom,
|
||||
'date_to' => $dateTo
|
||||
)
|
||||
Hook::exec('actionAvailRoomSearchSqlModifier', array(
|
||||
'select' => $selectAvailRoomSearch,
|
||||
'join' => &$joinAvailRoomSearch,
|
||||
'where' => &$whereAvailRoomSearch,
|
||||
'exclude_room_id' => &$excludeRoomId,
|
||||
'group_by' => &$groupByAvailRoomSearch,
|
||||
'order_by' => &$orderByAvailRoomSearch,
|
||||
'order_way' => &$orderWayAvailRoomSearch,
|
||||
'params' => array(
|
||||
'id_hotel' => $idHotel,
|
||||
'id_product' => $idRoomType,
|
||||
'date_from' => $dateFrom,
|
||||
'date_to' => $dateTo,
|
||||
'all_params' => $allParams
|
||||
)
|
||||
);
|
||||
));
|
||||
|
||||
$sql = $selectAvailRoomSearch;
|
||||
$sql .= ' FROM `'._DB_PREFIX_.'htl_room_information` AS ri';
|
||||
$sql .= ' '.$joinAvailRoomSearch;
|
||||
$sql .= ' '.$whereAvailRoomSearch;
|
||||
$sql .= ' AND ri.`id` NOT IN ('.implode(' UNION ', $excludeRoomId).')';
|
||||
$sql .= ' '.$groupByAvailRoomSearch;
|
||||
$sql .= ' '.$orderByAvailRoomSearch;
|
||||
$sql .= ' '.$orderWayAvailRoomSearch;
|
||||
@@ -706,7 +782,19 @@ class HotelBookingDetail extends ObjectModel
|
||||
|
||||
if ($QLO_SEARCH_TYPE == HotelBookingDetail::SEARCH_TYPE_OWS && $searchOccupancy) {
|
||||
$availableRoomTypes = $this->getAvailableRoomSatisfingOccupancy($searchOccupancy, $availableRoomTypes, $QLO_OWS_SEARCH_ALGO_TYPE);
|
||||
|
||||
// segregating available and unavailable roomTypes
|
||||
$unavailableRoomTypes = $availableRoomTypes['unavailableRoomTypes'];
|
||||
if ($unavailableRoomTypes) {
|
||||
// Adding an id_status key to the unavailable rooms array to identify rooms unavailable due to unsatisfied occupancy search criteria.
|
||||
// if in case we need to add multiple keys then we can use array union operator
|
||||
// Instead of looping here, we can do this in the getavailableRoomSatisfingOccupancy function
|
||||
foreach ($unavailableRoomTypes as $idProduct => $roomTypeDetail) {
|
||||
foreach ($roomTypeDetail as $idRoom => $roomDetail) {
|
||||
$unavailableRoomTypes[$idProduct][$roomDetail['id_room']]['id_status'] = HotelRoomInformation::STATUS_SEARCH_OCCUPANCY_UNSATISFIED;
|
||||
}
|
||||
}
|
||||
}
|
||||
$availableRoomTypes = $availableRoomTypes['availableRoomTypes'];
|
||||
}
|
||||
|
||||
@@ -913,29 +1001,30 @@ class HotelBookingDetail extends ObjectModel
|
||||
* 'idRoomType' => ...,
|
||||
* 'searchOccupancy' => ...,
|
||||
* 'allowedIdRoomTypes' => ...,
|
||||
* 'hourlyBooking' => ...,
|
||||
* 'allParams' => ...,
|
||||
* );
|
||||
*/
|
||||
protected function getSearchPartiallyAvailRooms($params)
|
||||
{
|
||||
extract($params);
|
||||
|
||||
$sql1 = 'SELECT bd.`id_product`, bd.`id_room`, bd.`id_hotel`, bd.`id_customer`, bd.`booking_type`, bd.`id_status` AS booking_status, bd.`comment` AS `room_comment`, rf.`room_num`, bd.`date_from`, IF(bd.`id_status` = '. self::STATUS_CHECKED_OUT .', bd.`check_out`, bd.`date_to`) AS `date_to`, hrt.`max_adults` AS `max_adult`, hrt.`max_children`, hrt.`max_guests` AS `max_occupancy`
|
||||
$sql = array();
|
||||
$sql[] = 'SELECT bd.`id_product`, bd.`id_room`, bd.`id_hotel`, bd.`id_customer`, bd.`booking_type`, bd.`id_status` AS booking_status, bd.`comment` AS `room_comment`, rf.`room_num`, bd.`date_from`, IF(bd.`id_status` = '. self::STATUS_CHECKED_OUT .', bd.`check_out`, bd.`date_to`) AS `date_to`, hrt.`max_adults` AS `max_adult`, hrt.`max_children`, hrt.`max_guests` AS `max_occupancy`
|
||||
FROM `'._DB_PREFIX_.'htl_booking_detail` AS bd
|
||||
INNER JOIN `'._DB_PREFIX_.'htl_room_information` AS rf ON (rf.`id` = bd.`id_room`)
|
||||
INNER JOIN `'._DB_PREFIX_.'htl_room_type` AS hrt ON (hrt.`id_product` = rf.`id_product`)
|
||||
WHERE bd.`id_hotel`='.(int)$idHotel.' AND rf.`id_status` != '. HotelRoomInformation::STATUS_INACTIVE .' AND bd.`is_back_order` = 0 AND bd.`is_refunded` = 0 AND IF(bd.`id_status` = '. self::STATUS_CHECKED_OUT .', (
|
||||
(DATE_FORMAT(`check_out`, "%Y-%m-%d") > \''.pSQL($dateFrom).'\' AND DATE_FORMAT(`check_out`, "%Y-%m-%d") < \''.PSQL($dateTo).'\') AND (
|
||||
(bd.`date_from` <= \''.pSQL($dateFrom).'\' AND bd.`check_out` > \''.pSQL($dateFrom).'\' AND bd.`check_out` < \''.pSQL($dateTo).'\') OR
|
||||
(bd.`date_from` > \''.pSQL($dateFrom).'\' AND bd.`date_from` < \''.pSQL($dateTo).'\' AND bd.`check_out` >= \''.pSQL($dateTo).'\') OR
|
||||
(bd.`date_from` > \''.pSQL($dateFrom).'\' AND bd.`date_from` < \''.pSQL($dateTo).'\' AND bd.`check_out` > \''.pSQL($dateFrom).'\' AND bd.`check_out` < \''.pSQL($dateTo).'\')
|
||||
)
|
||||
WHERE bd.`id_hotel`='.(int)$idHotel.' AND rf.`id_status` != '. HotelRoomInformation::STATUS_INACTIVE .' AND bd.`is_back_order` = 0 AND bd.`is_refunded` = 0 AND IF(bd.`id_status` = '. self::STATUS_CHECKED_OUT .', IF('.(int) $hourlyBooking.', 1, (DATE_FORMAT(`check_out`, "%Y-%m-%d") != DATE_FORMAT(\''.pSQL($dateFrom).'\', "%Y-%m-%d")) AND (`check_out` > \''.pSQL($dateFrom).'\' AND `check_out` <= \''.PSQL($dateTo).'\')) AND (
|
||||
(bd.`date_from` <= \''.pSQL($dateFrom).'\' AND bd.`check_out` > \''.pSQL($dateFrom).'\' AND bd.`check_out` < \''.pSQL($dateTo).'\') OR
|
||||
(bd.`date_from` > \''.pSQL($dateFrom).'\' AND bd.`date_from` < \''.pSQL($dateTo).'\' AND bd.`check_out` >= \''.pSQL($dateTo).'\') OR
|
||||
(bd.`date_from` > \''.pSQL($dateFrom).'\' AND bd.`date_from` < \''.pSQL($dateTo).'\' AND bd.`check_out` > \''.pSQL($dateFrom).'\' AND bd.`check_out` < \''.pSQL($dateTo).'\')
|
||||
), (
|
||||
(bd.`date_from` <= \''.pSQL($dateFrom).'\' AND bd.`date_to` > \''.pSQL($dateFrom).'\' AND bd.`date_to` < \''.pSQL($dateTo).'\') OR
|
||||
(bd.`date_from` > \''.pSQL($dateFrom).'\' AND bd.`date_from` < \''.pSQL($dateTo).'\' AND bd.`date_to` >= \''.pSQL($dateTo).'\') OR
|
||||
(bd.`date_from` > \''.pSQL($dateFrom).'\' AND bd.`date_from` < \''.pSQL($dateTo).'\' AND bd.`date_to` < \''.pSQL($dateTo).'\')
|
||||
)) AND IF('.(int)$idRoomType.' > 0, rf.`id_product` = '.(int)$idRoomType.', 1) AND rf.`id_product` IN ('.$allowedIdRoomTypes.')';
|
||||
|
||||
$sql2 = 'SELECT hri.`id_product`, hrdd.`id_room`, hri.`id_hotel`, 0 AS `id_customer`, 0 AS `booking_type`, 0 AS `booking_status`, 0 AS `room_comment`, hri.`room_num`, hrdd.`date_from`, hrdd.`date_to`, hrt.`max_adults` AS `max_adult`, hrt.`max_children`, hrt.`max_guests` AS `max_occupancy`
|
||||
$sql[] = 'SELECT hri.`id_product`, hrdd.`id_room`, hri.`id_hotel`, 0 AS `id_customer`, 0 AS `booking_type`, 0 AS `booking_status`, 0 AS `room_comment`, hri.`room_num`, hrdd.`date_from`, hrdd.`date_to`, hrt.`max_adults` AS `max_adult`, hrt.`max_children`, hrt.`max_guests` AS `max_occupancy`
|
||||
FROM `'._DB_PREFIX_.'htl_room_information` AS hri
|
||||
INNER JOIN `'._DB_PREFIX_.'htl_room_type` AS hrt ON (hrt.`id_product` = hri.`id_product`)
|
||||
INNER JOIN `'._DB_PREFIX_.'htl_room_disable_dates` AS hrdd ON (hrdd.`id_room_type` = hri.`id_product` AND hrdd.`id_room` = hri.`id`)
|
||||
@@ -945,7 +1034,20 @@ class HotelBookingDetail extends ObjectModel
|
||||
(hrdd.`date_from` > \''.pSQL($dateFrom).'\' AND hrdd.`date_from` < \''.pSQL($dateTo).'\' AND hrdd.`date_to` < \''.pSQL($dateTo).'\')
|
||||
) AND IF('.(int)$idRoomType.' > 0, hri.`id_product` = '.(int)$idRoomType.', 1) AND hri.`id_product` IN ('.$allowedIdRoomTypes.')';
|
||||
|
||||
$sql = $sql1.' UNION '.$sql2.' ORDER BY id_room ASC';
|
||||
Hook::exec('actionPartiallyAvailRoomSearchSqlModifier', array(
|
||||
'sql' => &$sql,
|
||||
'params' => array(
|
||||
'id_hotel' => $idHotel,
|
||||
'id_product' => $idRoomType,
|
||||
'date_from' => $dateFrom,
|
||||
'date_to' => $dateTo,
|
||||
'all_params' => $allParams
|
||||
)
|
||||
));
|
||||
|
||||
$sql = implode(' UNION ', $sql);
|
||||
$sql .= ' ORDER BY id_room ASC';
|
||||
|
||||
$part_arr = Db::getInstance()->executeS($sql);
|
||||
|
||||
// Get date wise available rooms
|
||||
@@ -1205,16 +1307,14 @@ class HotelBookingDetail extends ObjectModel
|
||||
}
|
||||
} else {
|
||||
// If all dates are not covered then move all partially available room types to unavailable
|
||||
foreach ($partiallyAvailRooms as $roomDetail) {
|
||||
if (!isset($unavailableRoomTypes[$roomDetail['id_product']][$roomDetail['id_room']])) {
|
||||
$unavailableRoomTypes[$roomDetail['id_product']][$roomDetail['id_room']] = array(
|
||||
'id_room' => $roomDetail['id_room'],
|
||||
'id_product' => $roomDetail['id_product'],
|
||||
'id_hotel' => $roomDetail['id_hotel'],
|
||||
'room_num' => $roomDetail['room_num'],
|
||||
'room_comment' => ''
|
||||
);
|
||||
}
|
||||
foreach ($partiallyAvailRooms as $partAvailRoomDetail) {
|
||||
$unavailableRoomTypes[$partAvailRoomDetail['id_product']][$partAvailRoomDetail['id_room']] = array(
|
||||
'id_room' => $partAvailRoomDetail['id_room'],
|
||||
'id_product' => $partAvailRoomDetail['id_product'],
|
||||
'id_hotel' => $partAvailRoomDetail['id_hotel'],
|
||||
'room_num' => $partAvailRoomDetail['room_num'],
|
||||
'room_comment' => ''
|
||||
);
|
||||
}
|
||||
|
||||
$partiallyAvailRooms = array();
|
||||
@@ -1244,11 +1344,46 @@ class HotelBookingDetail extends ObjectModel
|
||||
{
|
||||
extract($params);
|
||||
|
||||
$sql = 'SELECT bd.`id`, bd.`id_product`, bd.`id_room`, bd.`id_hotel`, bd.`id_customer`, bd.`booking_type`, bd.`id_status` AS booking_status, bd.`comment`, rf.`room_num`, bd.`date_from`, bd.`date_to`
|
||||
FROM `'._DB_PREFIX_.'htl_booking_detail` AS bd
|
||||
INNER JOIN `'._DB_PREFIX_.'htl_room_information` AS rf ON (rf.`id` = bd.`id_room`)
|
||||
WHERE bd.`id_hotel`='.(int)$idHotel.' AND bd.`is_refunded` = 0 AND bd.`is_back_order` = 0 AND IF(bd.`id_status` = '. self::STATUS_CHECKED_OUT .', bd.`date_from` <= \''.pSQL($dateFrom).'\' AND bd.`check_out` >= \''.pSQL($dateTo).'\', bd.`date_from` <= \''.pSQL($dateFrom).'\' AND bd.date_to >= \''.pSQL($dateTo).'\') AND IF('.(int)$idRoomType.' > 0, rf.`id_product` = '.(int)$idRoomType.', 1) AND rf.`id_product` IN ('.$allowedIdRoomTypes.')
|
||||
ORDER BY bd.`id_room` ASC';
|
||||
$selectBookedRoomSearch = 'SELECT `id`, `id_order`, `id_product`, `id_room`, `id_hotel`, `id_customer`, `booking_type`, `id_status` AS booking_status, `comment`, `room_num`, `date_from`, IF(`id_status` = '. self::STATUS_CHECKED_OUT.', `check_out`,`date_to`) AS `date_to`, `check_in`, `check_out`, `date_to` AS `booking_date_to`';
|
||||
$joinBookedRoomSearch = '';
|
||||
$whereBookedRoomSearch = 'WHERE `id_hotel` = '.(int)$idHotel.' AND `is_back_order` = 0 AND `is_refunded` = 0 AND IF(`id_status` = '. self::STATUS_CHECKED_OUT.', (
|
||||
(`date_from` <= \''.pSQL($dateFrom).'\' AND `check_out` > \''.pSQL($dateFrom).'\' AND `check_out` <= \''.PSQL($dateTo).'\') OR
|
||||
(`date_from` >= \''.pSQL($dateFrom).'\' AND `check_out` > \''.pSQL($dateFrom).'\' AND `check_out` <= \''.pSQL($dateTo).'\') OR
|
||||
(`date_from` >= \''.pSQL($dateFrom).'\' AND `date_from` < \''.pSQL($dateTo).'\' AND `check_out` >= \''.pSQL($dateTo).'\') OR
|
||||
(`date_from` <= \''.pSQL($dateFrom).'\' AND `check_out` >= \''.pSQL($dateTo).'\')
|
||||
), (
|
||||
(`date_from` <= \''.pSQL($dateFrom).'\' AND `date_to` > \''.pSQL($dateFrom).'\' AND `date_to` <= \''.PSQL($dateTo).'\') OR
|
||||
(`date_from` >= \''.pSQL($dateFrom).'\' AND `date_to` <= \''.pSQL($dateTo).'\') OR
|
||||
(`date_from` >= \''.pSQL($dateFrom).'\' AND `date_from` < \''.pSQL($dateTo).'\' AND `date_to` >= \''.pSQL($dateTo).'\') OR
|
||||
(`date_from` <= \''.pSQL($dateFrom).'\' AND `date_to` >= \''.pSQL($dateTo).'\')
|
||||
)) AND IF('.(int)$idRoomType.' > 0, `id_product` = '.(int)$idRoomType.', 1) AND `id_product` IN ('.$allowedIdRoomTypes.')';
|
||||
$groupByBookedRoomSearch = '';
|
||||
$orderByBookedRoomSearch = 'ORDER BY `id_room`, `date_from`';
|
||||
$orderWayBookedRoomSearch = 'ASC';
|
||||
|
||||
Hook::exec('actionBookedRoomSearchSqlModifier', array(
|
||||
'select' => $selectBookedRoomSearch,
|
||||
'join' => &$joinBookedRoomSearch,
|
||||
'where' => &$whereBookedRoomSearch,
|
||||
'group_by' => &$groupByBookedRoomSearch,
|
||||
'order_by' => &$orderByBookedRoomSearch,
|
||||
'order_way' => &$orderWayBookedRoomSearch,
|
||||
'params' => array(
|
||||
'id_hotel' => $idHotel,
|
||||
'id_product' => $idRoomType,
|
||||
'date_from' => $dateFrom,
|
||||
'date_to' => $dateTo,
|
||||
'all_params' => $allParams
|
||||
)
|
||||
));
|
||||
|
||||
$sql = $selectBookedRoomSearch;
|
||||
$sql .= ' FROM `'._DB_PREFIX_.'htl_booking_detail`';
|
||||
$sql .= ' '.$joinBookedRoomSearch;
|
||||
$sql .= ' '.$whereBookedRoomSearch;
|
||||
$sql .= ' '.$groupByBookedRoomSearch;
|
||||
$sql .= ' '.$orderByBookedRoomSearch;
|
||||
$sql .= ' '.$orderWayBookedRoomSearch;
|
||||
|
||||
$bookedRoomTypes = array();
|
||||
if ($booked_rooms = Db::getInstance()->executeS($sql)) {
|
||||
@@ -1398,25 +1533,24 @@ class HotelBookingDetail extends ObjectModel
|
||||
* @param [date] $dateTo [End date of the booking]
|
||||
*
|
||||
* @return [int] [Returns number of days between two dates]
|
||||
* @deprecated use hotelBookingDetail::getDays() instead
|
||||
* @deprecated use HotelHelper::getNumberOfDays() instead
|
||||
*/
|
||||
public function getNumberOfDays($dateFrom, $dateTo)
|
||||
{
|
||||
return self::getDays($dateFrom, $dateTo);
|
||||
// $startDate = new DateTime($dateFrom);
|
||||
// $endDate = new DateTime($dateTo);
|
||||
// $daysDifference = $startDate->diff($endDate)->days;
|
||||
|
||||
// return $daysDifference;
|
||||
return HotelHelper::getNumberOfDays($dateFrom, $dateTo);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param [date] $dateFrom [Start date of the booking]
|
||||
* @param [date] $dateTo [End date of the booking]
|
||||
*
|
||||
* @return [int] [Returns number of days between two dates]
|
||||
* @deprecated use HotelHelper::getNumberOfDays() instead
|
||||
*/
|
||||
public static function getDays($dateFrom, $dateTo)
|
||||
{
|
||||
$startDate = new DateTime($dateFrom);
|
||||
$endDate = new DateTime($dateTo);
|
||||
$daysDifference = $startDate->diff($endDate)->days;
|
||||
|
||||
return $daysDifference;
|
||||
return HotelHelper::getNumberOfDays($dateFrom, $dateTo);
|
||||
}
|
||||
|
||||
public function generateRoomOccupancyWeight($availRoomTypeCount, $totalOccupancy, $totalAdult, $totalChildren)
|
||||
@@ -1510,10 +1644,18 @@ class HotelBookingDetail extends ObjectModel
|
||||
{
|
||||
$this->context = Context::getContext();
|
||||
|
||||
$bookingParams['search_available'] = 1;
|
||||
$bookingParams['search_partial'] = 0;
|
||||
$bookingParams['search_booked'] = 0;
|
||||
$bookingParams['search_unavai'] = 0;
|
||||
if (!isset($bookingParams['search_available'])) {
|
||||
$bookingParams['search_available'] = 1;
|
||||
}
|
||||
if (!isset($bookingParams['search_partial'])) {
|
||||
$bookingParams['search_partial'] = 0;
|
||||
}
|
||||
if (!isset($bookingParams['search_booked'])) {
|
||||
$bookingParams['search_booked'] = 0;
|
||||
}
|
||||
if (!isset($bookingParams['search_unavai'])) {
|
||||
$bookingParams['search_unavai'] = 0;
|
||||
}
|
||||
|
||||
$bookingParams['full_detail'] = 1;
|
||||
$bookingData = $this->getBookingData($bookingParams);
|
||||
@@ -2323,7 +2465,7 @@ class HotelBookingDetail extends ObjectModel
|
||||
return Db::getInstance()->executeS($sql);
|
||||
}
|
||||
|
||||
public function UpdateHotelCartHotelOrderOnOrderEdit(
|
||||
public function updateHotelCartHotelOrderOnOrderEdit(
|
||||
$idOrder,
|
||||
$idRoom,
|
||||
$oldDateFrom,
|
||||
@@ -2331,11 +2473,10 @@ class HotelBookingDetail extends ObjectModel
|
||||
$newDateFrom,
|
||||
$newDateTo,
|
||||
$occupancy,
|
||||
$newTotalPrice = null
|
||||
$newTotalPrice = null,
|
||||
$idHotelBookingDetail
|
||||
) {
|
||||
// retrieve HotelBookingDetail row
|
||||
$roomBookingData = $this->getRoomBookingData($idRoom, $idOrder, $oldDateFrom, $oldDateTo);
|
||||
$objHotelBookingDetail = new self($roomBookingData['id']);
|
||||
$objHotelBookingDetail = new self((int) $idHotelBookingDetail);
|
||||
if (Validate::isLoadedObject($objHotelBookingDetail)) {
|
||||
// retrieve HotelCartBookingData row
|
||||
$idHotelCartBookingData = Db::getInstance()->getValue(
|
||||
@@ -2702,9 +2843,6 @@ class HotelBookingDetail extends ObjectModel
|
||||
if (!$this->context->cart->id_address_invoice && isset($addresses[0])) {
|
||||
$this->context->cart->id_address_invoice = (int)$addresses[0]['id_address'];
|
||||
}
|
||||
if (!$this->context->cart->id_address_delivery && isset($addresses[0])) {
|
||||
$this->context->cart->id_address_delivery = $addresses[0]['id_address'];
|
||||
}
|
||||
$this->context->cart->setNoMultishipping();
|
||||
|
||||
if ($this->context->cart->save()) {
|
||||
@@ -3152,7 +3290,10 @@ class HotelBookingDetail extends ObjectModel
|
||||
$this->id_room,
|
||||
$this->date_from,
|
||||
$this->date_to,
|
||||
0
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
$this->id
|
||||
)) {
|
||||
foreach ($roomDemands as $roomDemand) {
|
||||
$objHotelBookingDemands = new HotelBookingDemands($roomDemand['id_booking_demand']);
|
||||
|
||||
@@ -71,10 +71,10 @@ class HotelBranchInformation extends ObjectModel
|
||||
public $zipcode;
|
||||
public $address;
|
||||
public $phone;
|
||||
public $use_global_max_order_date;
|
||||
public $max_order_date;
|
||||
public $use_global_preparation_time;
|
||||
public $preparation_time;
|
||||
public $use_global_max_order_date = 1;
|
||||
public $max_order_date = '0000-00-00';
|
||||
public $use_global_preparation_time = 1;
|
||||
public $preparation_time = '0000-00-00';
|
||||
|
||||
protected $webserviceParameters = array(
|
||||
'objectsNodeName' => 'hotels',
|
||||
@@ -140,7 +140,7 @@ class HotelBranchInformation extends ObjectModel
|
||||
$this->moduleInstance = Module::getInstanceByName('hotelreservationsystem');
|
||||
parent::__construct($id, $id_lang, $id_shop);
|
||||
|
||||
$this->use_global_max_order_date = $this->max_order_date = $this->use_global_preparation_time = $this->preparation_time = $this->id_country = $this->id_state = $this->city = $this->zipcode = $this->address = $this->phone = null;
|
||||
$this->id_country = $this->id_state = $this->city = $this->zipcode = $this->address = $this->phone = null;
|
||||
if ($id) {
|
||||
if ($hotelAddress = $this->getAddress($id)) {
|
||||
$this->id_country = $hotelAddress['id_country'];
|
||||
@@ -1015,18 +1015,26 @@ class HotelBranchInformation extends ObjectModel
|
||||
}
|
||||
|
||||
$hotelName = $this->hotel_name[Configuration::get('PS_LANG_DEFAULT')];
|
||||
$hotelName = preg_replace('/[0-9!<>,;"?=+()@#°{}_$%:]*/u', '', $hotelName);
|
||||
|
||||
$hotelName = trim(preg_replace('/[0-9!<>,;?=+()@#"°{}_$%:]*$/u', '', $hotelName));
|
||||
$objAddress->id_hotel = $this->id;
|
||||
$objAddress->id_country = $this->id_country;
|
||||
$objAddress->id_state = $this->id_state;
|
||||
$objAddress->city = $this->city;
|
||||
$objAddress->postcode = $this->zipcode;
|
||||
$objAddress->lastname = $hotelName;
|
||||
$objAddress->firstname = $hotelName;
|
||||
$objAddress->alias = $hotelName;
|
||||
$objAddress->address1 = $this->address;
|
||||
$objAddress->phone = $this->phone;
|
||||
$objAddress->alias = substr($hotelName, 0, 32);
|
||||
$addressFirstName = $hotelName;
|
||||
$addressLastName = $hotelName;
|
||||
if (Tools::strlen($hotelName) > 32) {
|
||||
$addressFirstName = trim(substr($hotelName, 0, 32));
|
||||
if (!$addressLastName = trim(substr($hotelName, 32, 32))) {
|
||||
$addressLastName = $addressFirstName;
|
||||
}
|
||||
}
|
||||
|
||||
$objAddress->firstname = $addressFirstName;
|
||||
$objAddress->lastname = $addressLastName;
|
||||
|
||||
return $objAddress->save();
|
||||
}
|
||||
@@ -1061,186 +1069,96 @@ class HotelBranchInformation extends ObjectModel
|
||||
if (isset($this->webservice_validation) && $this->webservice_validation) {
|
||||
if ($this->rating < 1 || $this->rating > 5) {
|
||||
$message = Tools::displayError('Rating must be between 1 and 5.');
|
||||
if ($die) {
|
||||
throw new PrestaShopException($message);
|
||||
}
|
||||
return $error_return ? $message : false;
|
||||
}
|
||||
|
||||
if (!strtotime($this->check_in)) {
|
||||
} elseif (!strtotime($this->check_in)) {
|
||||
$message = Tools::displayError('Check In time is invalid.');
|
||||
if ($die) {
|
||||
throw new PrestaShopException($message);
|
||||
}
|
||||
return $error_return ? $message : false;
|
||||
}
|
||||
if (!strtotime($this->check_out)) {
|
||||
} elseif (!strtotime($this->check_out)) {
|
||||
$message = Tools::displayError('Check out time is invalid.');
|
||||
if ($die) {
|
||||
throw new PrestaShopException($message);
|
||||
}
|
||||
return $error_return ? $message : false;
|
||||
}
|
||||
|
||||
if ($this->check_in && $this->check_out && strtotime($this->check_out) >= strtotime($this->check_in)) {
|
||||
} elseif ($this->check_in && $this->check_out && strtotime($this->check_out) >= strtotime($this->check_in)) {
|
||||
$message = Tools::displayError('Check Out time must be before Check In time.');
|
||||
if ($die) {
|
||||
throw new PrestaShopException($message);
|
||||
}
|
||||
return $error_return ? $message : false;
|
||||
}
|
||||
if (!$this->phone) {
|
||||
} elseif (!trim($this->phone)) {
|
||||
$message = Tools::displayError('Phone number is required field.');
|
||||
if ($die) {
|
||||
throw new PrestaShopException($message);
|
||||
}
|
||||
return $error_return ? $message : false;
|
||||
} elseif (!Validate::isPhoneNumber($this->phone)) {
|
||||
$message = Tools::displayError('Please enter a valid phone number.');
|
||||
if ($die) {
|
||||
throw new PrestaShopException($message);
|
||||
}
|
||||
return $error_return ? $message : false;
|
||||
}
|
||||
if ($this->address == '') {
|
||||
} elseif (trim($this->address) == '') {
|
||||
$message = Tools::displayError('Address is required field.');
|
||||
if ($die) {
|
||||
throw new PrestaShopException($message);
|
||||
}
|
||||
return $error_return ? $message : false;
|
||||
} elseif (!Validate::isAddress($this->address)) {
|
||||
$message = Tools::displayError('Address is invalid.');
|
||||
if ($die) {
|
||||
throw new PrestaShopException($message);
|
||||
}
|
||||
return $error_return ? $message : false;
|
||||
}
|
||||
|
||||
if (!$this->id_country) {
|
||||
} elseif (!$this->id_country) {
|
||||
$message = Tools::displayError('Country is required field.');
|
||||
if ($die) {
|
||||
throw new PrestaShopException($message);
|
||||
}
|
||||
return $error_return ? $message : false;
|
||||
} else {
|
||||
if (Validate::isLoadedObject($objCountry = new Country($this->id_country))) {
|
||||
$statesbycountry = State::getStatesByIdCountry($this->id_country);
|
||||
/*If selected country has states only the validate state field*/
|
||||
if ($this->id_state) {
|
||||
$objState = new State($this->id_state);
|
||||
if ($objState->id_country != $this->id_country) {
|
||||
$message = Tools::displayError('State is invalid.');
|
||||
if ($die) {
|
||||
throw new PrestaShopException($message);
|
||||
}
|
||||
return $error_return ? $message : false;
|
||||
}
|
||||
} else {
|
||||
if ($statesbycountry) {
|
||||
$message = Tools::displayError('State is required field.');
|
||||
if ($die) {
|
||||
throw new PrestaShopException($message);
|
||||
}
|
||||
return $error_return ? $message : false;
|
||||
}
|
||||
}
|
||||
/* Check zip code format */
|
||||
if (empty($this->zipcode) && $objCountry->need_zip_code) {
|
||||
$message = Tools::displayError('A Zip / Postal code is required.');
|
||||
if ($die) {
|
||||
throw new PrestaShopException($message);
|
||||
}
|
||||
return $error_return ? $message : false;
|
||||
} elseif ($objCountry->zip_code_format && !$objCountry->checkZipCode($this->zipcode)) {
|
||||
$message = sprintf(Tools::displayError('The Zip/Postal code you have entered is invalid. It must follow this format: %s'), str_replace('C', $objCountry->iso_code, str_replace('N', '0', str_replace('L', 'A', $objCountry->zip_code_format))));
|
||||
if ($die) {
|
||||
throw new PrestaShopException($message);
|
||||
}
|
||||
return $error_return ? $message : false;
|
||||
} elseif ($this->zipcode && !Validate::isPostCode($this->zipcode)) {
|
||||
$message = Tools::displayError('The Zip / Postal code is invalid.');
|
||||
if ($die) {
|
||||
throw new PrestaShopException($message);
|
||||
}
|
||||
return $error_return ? $message : false;
|
||||
}
|
||||
} else {
|
||||
$message = Tools::displayError('country is invalid.');
|
||||
if ($die) {
|
||||
throw new PrestaShopException($message);
|
||||
}
|
||||
return $error_return ? $message : false;
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->city == '') {
|
||||
} elseif ($this->city == '') {
|
||||
$message = Tools::displayError('City is required field.');
|
||||
if ($die) {
|
||||
throw new PrestaShopException($message);
|
||||
}
|
||||
return $error_return ? $message : false;
|
||||
} elseif (!Validate::isCityName($this->city)) {
|
||||
$message = Tools::displayError('Enter a Valid City Name.');
|
||||
if ($die) {
|
||||
throw new PrestaShopException($message);
|
||||
}
|
||||
return $error_return ? $message : false;
|
||||
}
|
||||
|
||||
if (!Validate::isBool($this->use_global_max_order_date)) {
|
||||
} elseif (!Validate::isBool($this->use_global_max_order_date)) {
|
||||
$message = Tools::displayError('invalid value for use_global_max_order_date.');
|
||||
if ($die) {
|
||||
throw new PrestaShopException($message);
|
||||
}
|
||||
return $error_return ? $message : false;
|
||||
}
|
||||
|
||||
if (!Validate::isBool($this->use_global_preparation_time)) {
|
||||
} elseif (!Validate::isBool($this->use_global_preparation_time)) {
|
||||
$message = Tools::displayError('invalid value for use_global_preparation_time.');
|
||||
} elseif (!$this->use_global_max_order_date && $this->max_order_date == '') {
|
||||
$message = Tools::displayError('Maximum date to book a room is required.');
|
||||
} elseif (!$this->use_global_max_order_date && !Validate::isDate($this->max_order_date)) {
|
||||
$message = Tools::displayError('Maximum date to book a room is invalid.');
|
||||
} elseif (!$this->use_global_max_order_date
|
||||
&& ($maxOrderDateFormatted = date('Y-m-d', strtotime($this->max_order_date)))
|
||||
&& strtotime($maxOrderDateFormatted) < strtotime(date('Y-m-d'))
|
||||
) {
|
||||
$message = Tools::displayError('Maximum Global Date to book a room can not be a past date. Please use a future date.');
|
||||
} elseif (!$this->use_global_preparation_time && $this->preparation_time === '') {
|
||||
$message = Tools::displayError('Minimum booking offset is a required.');
|
||||
} elseif (!$this->use_global_preparation_time && $this->preparation_time !== '0' && !Validate::isUnsignedInt($this->preparation_time)) {
|
||||
$message = Tools::displayError('Minimum booking offset is invalid.');
|
||||
} elseif (!Validate::isLoadedObject($objCountry = new Country($this->id_country))) {
|
||||
$message = Tools::displayError('country is invalid.');
|
||||
} elseif ($this->id_state
|
||||
&& (!Validate::isLoadedObject($objState = new State($this->id_state)) || $objState->id_country != $this->id_country)
|
||||
) {
|
||||
$message = Tools::displayError('State is invalid.');
|
||||
} elseif (State::getStatesByIdCountry($this->id_country) && !$this->id_state) {
|
||||
$message = Tools::displayError('State is required field.');
|
||||
} elseif (empty($this->zipcode) && $objCountry->need_zip_code) {
|
||||
$message = Tools::displayError('A Zip / Postal code is required.');
|
||||
} elseif ($objCountry->zip_code_format && !$objCountry->checkZipCode($this->zipcode)) {
|
||||
$message = sprintf(Tools::displayError('The Zip/Postal code you have entered is invalid. It must follow this format: %s'), str_replace('C', $objCountry->iso_code, str_replace('N', '0', str_replace('L', 'A', $objCountry->zip_code_format))));
|
||||
} elseif ($this->zipcode && !Validate::isPostCode($this->zipcode)) {
|
||||
$message = Tools::displayError('The Zip / Postal code is invalid.');
|
||||
} else {
|
||||
if ($addressValidation = Address::getValidationRules('Address')) {
|
||||
foreach ($addressValidation['size'] as $field => $maxSize) {
|
||||
if ('phone' == $field && Tools::strlen($this->phone) > $maxSize) {
|
||||
$message = sprintf(
|
||||
Tools::displayError('The Hotel phone number is too long (%1$d chars max).'),
|
||||
$maxSize
|
||||
);
|
||||
break;
|
||||
} elseif ('address1' == $field && Tools::strlen($this->address) > $maxSize) {
|
||||
$message = sprintf(
|
||||
Tools::displayError('The Hotel address is too long (%1$d chars max).'),
|
||||
$maxSize
|
||||
);
|
||||
break;
|
||||
} elseif ('city' == $field && Tools::strlen($this->city) > $maxSize) {
|
||||
$message = sprintf(
|
||||
Tools::displayError('The Hotel city name is too long (%1$d chars max).'),
|
||||
$maxSize
|
||||
);
|
||||
break;
|
||||
} elseif ('postcode' == $field && Tools::strlen($this->zipcode) > $maxSize) {
|
||||
$message = sprintf(
|
||||
Tools::displayError('The Hotel zip code is too long (%1$d chars max).'),
|
||||
$maxSize
|
||||
);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($message) && $message != '') {
|
||||
if ($die) {
|
||||
throw new PrestaShopException($message);
|
||||
}
|
||||
|
||||
return $error_return ? $message : false;
|
||||
}
|
||||
|
||||
if (!$this->use_global_max_order_date) {
|
||||
$maxOrderDateFormatted = date('Y-m-d', strtotime($this->max_order_date));
|
||||
if ($this->max_order_date == '') {
|
||||
$message = Tools::displayError('Maximum date to book a room is required.');
|
||||
if ($die) {
|
||||
throw new PrestaShopException($message);
|
||||
}
|
||||
return $error_return ? $message : false;
|
||||
} elseif (!Validate::isDate($this->max_order_date)) {
|
||||
$message = Tools::displayError('Maximum date to book a room is invalid.');
|
||||
if ($die) {
|
||||
throw new PrestaShopException($message);
|
||||
}
|
||||
return $error_return ? $message : false;
|
||||
} elseif (strtotime($maxOrderDateFormatted) < strtotime(date('Y-m-d'))) {
|
||||
$message = Tools::displayError('Maximum Global Date to book a room can not be a past date. Please use a future date.');
|
||||
if ($die) {
|
||||
throw new PrestaShopException($message);
|
||||
}
|
||||
return $error_return ? $message : false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$this->use_global_preparation_time) {
|
||||
if ($this->preparation_time === '') {
|
||||
$message = Tools::displayError('Minimum booking offset is a required.');
|
||||
if ($die) {
|
||||
throw new PrestaShopException($message);
|
||||
}
|
||||
return $error_return ? $message : false;
|
||||
} elseif ($this->preparation_time !== '0' && !Validate::isUnsignedInt($this->preparation_time)) {
|
||||
$message = Tools::displayError('Minimum booking offset is invalid.');
|
||||
if ($die) {
|
||||
throw new PrestaShopException($message);
|
||||
}
|
||||
return $error_return ? $message : false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return parent::validateFields($die, $error_return);
|
||||
@@ -1272,6 +1190,11 @@ class HotelBranchInformation extends ObjectModel
|
||||
}
|
||||
$objCountry = new Country();
|
||||
$countryName = $objCountry->getNameById($idLang, $this->id_country);
|
||||
$linkRewriteArray = array();
|
||||
foreach (Language::getLanguages(true) as $lang) {
|
||||
$linkRewriteArray[$lang['id_lang']] = Tools::link_rewrite($this->hotel_name[$lang['id_lang']]);
|
||||
}
|
||||
|
||||
if ($catCountry = $this->addCategory($countryName, false, $groupIds)) {
|
||||
if ($this->id_state) {
|
||||
$objState = new State();
|
||||
@@ -1284,8 +1207,15 @@ class HotelBranchInformation extends ObjectModel
|
||||
if ($catState) {
|
||||
if ($catCity = $this->addCategory($this->city, $catState, $groupIds)) {
|
||||
$hotelCatName = $this->hotel_name[Configuration::get('PS_LANG_DEFAULT')];
|
||||
if ($catHotel = $this->addCategory(
|
||||
$hotelCatName, $catCity, $groupIds, 1, $this->id
|
||||
if ($this->id_category) {
|
||||
$objCategory = new Category($this->id_category);
|
||||
$objCategory->name = $this->hotel_name;
|
||||
$objCategory->link_rewrite = $linkRewriteArray;
|
||||
$objCategory->id_parent = $catCity;
|
||||
$objCategory->save();
|
||||
Category::regenerateEntireNtree();
|
||||
} else if ($catHotel = $this->addCategory(
|
||||
$hotelCatName, $catCity, $groupIds, 1, $this->id, $linkRewriteArray
|
||||
)) {
|
||||
$this->id_category = $catHotel;
|
||||
$this->save();
|
||||
|
||||
@@ -1574,14 +1574,29 @@ class HotelCartBookingData extends ObjectModel
|
||||
$data_v['id_room'],
|
||||
0
|
||||
);
|
||||
$priceWithoutDiscount = HotelRoomTypeFeaturePricing::getRoomTypeTotalPrice(
|
||||
$product['id_product'],
|
||||
$data_v['date_from'],
|
||||
$data_v['date_to'],
|
||||
0,
|
||||
0,
|
||||
$context->cart->id,
|
||||
$context->cart->id_guest,
|
||||
$data_v['id_room'],
|
||||
1,
|
||||
0
|
||||
);
|
||||
if (!$price_tax) {
|
||||
$amount = $roomTypeDateRangePrice['total_price_tax_excl'];
|
||||
$amountWithoutAutoAdd = $roomTypeDateRangePriceWithoutAutoAdd['total_price_tax_excl'];
|
||||
$totalPriceWithoutDiscount = $priceWithoutDiscount['total_price_tax_excl'];
|
||||
} else {
|
||||
$amount = $roomTypeDateRangePrice['total_price_tax_incl'];
|
||||
$amountWithoutAutoAdd = $roomTypeDateRangePriceWithoutAutoAdd['total_price_tax_incl'];
|
||||
$totalPriceWithoutDiscount = $priceWithoutDiscount['total_price_tax_incl'];
|
||||
}
|
||||
$cartHotelData[$prodKey]['date_diff'][$dateJoin]['amount'] = $amount * $varQty;
|
||||
$cartHotelData[$prodKey]['date_diff'][$dateJoin]['total_price_without_discount'] = $totalPriceWithoutDiscount * $varQty;
|
||||
$cartHotelData[$prodKey]['date_diff'][$dateJoin]['amount_without_auto_add'] = $amountWithoutAutoAdd * $varQty;
|
||||
} else {
|
||||
$cartHotelData[$prodKey]['date_diff'][$dateJoin]['demand_price'] = $totalAdditionalServicePrice;
|
||||
@@ -1621,15 +1636,30 @@ class HotelCartBookingData extends ObjectModel
|
||||
$data_v['id_room'],
|
||||
0
|
||||
);
|
||||
$priceWithoutDiscount = HotelRoomTypeFeaturePricing::getRoomTypeTotalPrice(
|
||||
$product['id_product'],
|
||||
$data_v['date_from'],
|
||||
$data_v['date_to'],
|
||||
0,
|
||||
0,
|
||||
$context->cart->id,
|
||||
$context->cart->id_guest,
|
||||
$data_v['id_room'],
|
||||
1,
|
||||
0
|
||||
);
|
||||
if (!$price_tax) {
|
||||
$amount = $roomTypeDateRangePrice['total_price_tax_excl'];
|
||||
$amountWithoutAutoAdd = $roomTypeDateRangePriceWithoutAutoAdd['total_price_tax_excl'];
|
||||
$totalPriceWithoutDiscount = $priceWithoutDiscount['total_price_tax_excl'];
|
||||
} else {
|
||||
$amount = $roomTypeDateRangePrice['total_price_tax_incl'];
|
||||
$amountWithoutAutoAdd = $roomTypeDateRangePriceWithoutAutoAdd['total_price_tax_incl'];
|
||||
$totalPriceWithoutDiscount = $priceWithoutDiscount['total_price_tax_incl'];
|
||||
}
|
||||
$cartHotelData[$prodKey]['date_diff'][$dateJoin]['amount'] = $amount;
|
||||
$cartHotelData[$prodKey]['date_diff'][$dateJoin]['amount_without_auto_add'] = $amountWithoutAutoAdd;
|
||||
$cartHotelData[$prodKey]['date_diff'][$dateJoin]['total_price_without_discount'] = $totalPriceWithoutDiscount;
|
||||
$cartHotelData[$prodKey]['date_diff'][$dateJoin]['link'] = $context->link->getPageLink(
|
||||
'order-opc',
|
||||
null,
|
||||
@@ -1875,13 +1905,31 @@ class HotelCartBookingData extends ObjectModel
|
||||
}
|
||||
}
|
||||
|
||||
public function update($null_values = false)
|
||||
{
|
||||
if (!$this->extra_demands) {
|
||||
$this->extra_demands = json_encode(array());
|
||||
}
|
||||
|
||||
return parent::update($null_values);
|
||||
}
|
||||
|
||||
public function add($auto_date = true, $null_values = false)
|
||||
{
|
||||
if (!$this->extra_demands) {
|
||||
$this->extra_demands = json_encode(array());
|
||||
}
|
||||
|
||||
return parent::add($auto_date, $null_values);
|
||||
}
|
||||
|
||||
// Webservice :: get extra demands for the cart booking
|
||||
public function getWsExtraDemands()
|
||||
{
|
||||
$extraDemands = json_decode($this->extra_demands, true);
|
||||
if (count($extraDemands)) {
|
||||
foreach ($extraDemands as &$demnad) {
|
||||
$demnad['id'] = $demnad['id_global_demand'];
|
||||
if ($extraDemands) {
|
||||
foreach ($extraDemands as &$demand) {
|
||||
$demand['id'] = $demand['id_global_demand'];
|
||||
}
|
||||
return $extraDemands;
|
||||
}
|
||||
|
||||
@@ -2521,4 +2521,332 @@ class HotelHelper
|
||||
|
||||
return $isValid;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function is a utility function for creating an associative array for generating tree
|
||||
* provide tree structure in the following format
|
||||
* country --> root
|
||||
* state
|
||||
* city
|
||||
* hotel
|
||||
* room_type
|
||||
* room --> leaf
|
||||
*
|
||||
* You can edit the start and end point to generate tree for different levels
|
||||
* @param $rootNode = 'country'
|
||||
* @param $leafNode = 'room'
|
||||
* @param $rootNodeId int|array
|
||||
* @param $selectedElements int|array
|
||||
*/
|
||||
|
||||
const NODE_COUNTRY = 1;
|
||||
const NODE_STATE = 2;
|
||||
const NODE_CITY = 3;
|
||||
const NODE_HOTEL = 4;
|
||||
const NODE_ROOM_TYPE = 5;
|
||||
const NODE_ROOM = 6;
|
||||
|
||||
public static function generateTreeData($params)
|
||||
{
|
||||
extract($params);
|
||||
|
||||
if (!isset($rootNode)) {
|
||||
$rootNode = self::NODE_COUNTRY;
|
||||
}
|
||||
if (!isset($leafNode)) {
|
||||
$leafNode = self::NODE_ROOM;
|
||||
}
|
||||
if (!isset($selectedElements)) {
|
||||
$selectedElements = array();
|
||||
}
|
||||
if (!isset($rootNodeId)) {
|
||||
$rootNodeId = false;
|
||||
}
|
||||
$treeData = array();
|
||||
|
||||
if ($rootNode == self::NODE_COUNTRY) {
|
||||
$treeData = self::generateCountryNodes($rootNodeId, $leafNode, $selectedElements);
|
||||
} else if ($rootNode == self::NODE_STATE) {
|
||||
$treeData = self::generateStateNodes($rootNodeId, $leafNode, $selectedElements);
|
||||
} else if ($rootNode == self::NODE_CITY) {
|
||||
$treeData = self::generateCityNodes($rootNodeId, $leafNode, $selectedElements);
|
||||
} else if ($rootNode == self::NODE_HOTEL) {
|
||||
$treeData = self::generateHotelNodes($rootNodeId, $leafNode, $selectedElements);
|
||||
} else if ($rootNode == self::NODE_ROOM_TYPE) {
|
||||
$treeData = self::generateRoomTypeNodes($rootNodeId, $leafNode, $selectedElements);
|
||||
} else if ($rootNode == self::NODE_ROOM) {
|
||||
$treeData = self::generateRoomNodes($rootNodeId, $leafNode, $selectedElements);
|
||||
}
|
||||
|
||||
return $treeData;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate the node data for country
|
||||
*/
|
||||
protected static function generateCountryNodes($rootNodeId, $leafNode, $selectedElements, $previousElements = false)
|
||||
{
|
||||
$return = array();
|
||||
$countries = self::getcategoryByParent($previousElements, 3, 'country', $rootNodeId);
|
||||
$countriesIds = array_column($countries, 'value');
|
||||
|
||||
if ($leafNode > self::NODE_COUNTRY) {
|
||||
$states = self::generateStateNodes(false, $leafNode, $selectedElements, $countriesIds);
|
||||
}
|
||||
|
||||
foreach ($countries as $country) {
|
||||
if (isset($selectedElements['state']) && in_array($country['value'], $selectedElements['state'])) {
|
||||
$country['selected'] = true;
|
||||
}
|
||||
|
||||
if (isset($states[$country['value']])) {
|
||||
$country['children'] = $states[$country['value']];
|
||||
}
|
||||
|
||||
if ($previousElements) {
|
||||
$return[$country['id_parent']][] = $country;
|
||||
} else {
|
||||
$return[] = $country;
|
||||
}
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate the node data for state
|
||||
*/
|
||||
protected static function generateStateNodes($rootNodeId, $leafNode, $selectedElements, $previousElements = false)
|
||||
{
|
||||
$return = array();
|
||||
$states = self::getcategoryByParent($previousElements, 4, 'state', $rootNodeId);
|
||||
$stateIds = array_column($states, 'value');
|
||||
|
||||
if ($leafNode > self::NODE_STATE) {
|
||||
$cities = self::generateCityNodes(false, $leafNode, $selectedElements, $stateIds);
|
||||
}
|
||||
|
||||
foreach ($states as $state) {
|
||||
if (isset($selectedElements['state']) && in_array($state['value'], $selectedElements['state'])) {
|
||||
$state['selected'] = true;
|
||||
}
|
||||
|
||||
if (isset($cities[$state['value']])) {
|
||||
$state['children'] = $cities[$state['value']];
|
||||
}
|
||||
|
||||
if ($previousElements) {
|
||||
$return[$state['id_parent']][] = $state;
|
||||
} else {
|
||||
$return[] = $state;
|
||||
}
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate the node data for city
|
||||
*/
|
||||
protected static function generateCityNodes($rootNodeId, $leafNode, $selectedElements, $previousElements = false)
|
||||
{
|
||||
$return = array();
|
||||
$cities = self::getcategoryByParent($previousElements, 5, 'city', $rootNodeId);
|
||||
$cityIds = array_column($cities, 'value');
|
||||
|
||||
if ($leafNode > self::NODE_CITY) {
|
||||
$hotels = self::generateHotelNodes(false, $leafNode, $selectedElements, $cityIds);
|
||||
}
|
||||
|
||||
foreach ($cities as $city) {
|
||||
if (isset($selectedElements['city']) && in_array($city['value'], $selectedElements['city'])) {
|
||||
$city['selected'] = true;
|
||||
}
|
||||
|
||||
if (isset($hotels[$city['value']])) {
|
||||
$city['children'] = $hotels[$city['value']];
|
||||
}
|
||||
|
||||
if ($previousElements) {
|
||||
$return[$city['id_parent']][] = $city;
|
||||
} else {
|
||||
$return[] = $city;
|
||||
}
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate the node data for hotels
|
||||
*/
|
||||
protected static function generateHotelNodes($rootNodeId, $leafNode, $selectedElements, $previousElements = false)
|
||||
{
|
||||
$return = array();
|
||||
$hotels = self::getHotelsByIdCity($previousElements, $rootNodeId);
|
||||
$hotelIds = array_column($hotels, 'value');
|
||||
|
||||
if ($leafNode > self::NODE_HOTEL) {
|
||||
$roomTypes = self::generateRoomTypeNodes(false, $leafNode, $selectedElements, $hotelIds);
|
||||
}
|
||||
|
||||
foreach ($hotels as $hotel) {
|
||||
if (isset($selectedElements['hotel']) && in_array($hotel['value'], $selectedElements['hotel'])) {
|
||||
$hotel['selected'] = true;
|
||||
}
|
||||
|
||||
if (isset($roomTypes[$hotel['value']])) {
|
||||
$hotel['children'] = $roomTypes[$hotel['value']];
|
||||
}
|
||||
|
||||
if ($previousElements) {
|
||||
$return[$hotel['id_parent']][] = $hotel;
|
||||
} else {
|
||||
$return[] = $hotel;
|
||||
}
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate the node data for room types
|
||||
*/
|
||||
protected static function generateRoomTypeNodes($rootNodeId, $leafNode, $selectedElements, $previousElements = false)
|
||||
{
|
||||
$return = array();
|
||||
$roomTypes = self::getRoomTypesByHotelsId($previousElements, $rootNodeId);
|
||||
$roomTypeIds = array_column($roomTypes, 'value');
|
||||
|
||||
if ($leafNode > self::NODE_ROOM_TYPE) {
|
||||
$rooms = self::generateRoomNodes(false, $leafNode, $selectedElements, $roomTypeIds);
|
||||
}
|
||||
|
||||
foreach ($roomTypes as $roomType) {
|
||||
if (isset($selectedElements['room_type']) && in_array($roomType['value'], $selectedElements['room_type'])) {
|
||||
$roomType['selected'] = true;
|
||||
}
|
||||
|
||||
if (isset($rooms[$roomType['value']])) {
|
||||
$roomType['children'] = $rooms[$roomType['value']];
|
||||
}
|
||||
|
||||
if ($previousElements) {
|
||||
$return[$roomType['id_hotel']][] = $roomType;
|
||||
} else {
|
||||
$return[] = $roomType;
|
||||
}
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate the node data for rooms
|
||||
*/
|
||||
protected static function generateRoomNodes($rootNodeId, $leafNode, $selectedElements, $previousElements = false)
|
||||
{
|
||||
$return = array();
|
||||
$rooms = self::getRoomsByRoomTypeId($previousElements, $rootNodeId);
|
||||
|
||||
foreach ($rooms as $room) {
|
||||
if (isset($selectedElements['room']) && in_array($room['value'], $selectedElements['room'])) {
|
||||
$room['selected'] = true;
|
||||
}
|
||||
|
||||
if ($previousElements) {
|
||||
$return[$room['id_product']][] = $room;
|
||||
} else {
|
||||
$return[] = $room;
|
||||
}
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all the children category of the provided id categories
|
||||
*/
|
||||
protected static function getcategoryByParent($idParents, $levelDepth, $input_name, $rootNodeId)
|
||||
{
|
||||
$locationCategory = new Category(Configuration::get('PS_LOCATIONS_CATEGORY'));
|
||||
$sql = 'SELECT c.`id_category` as `value` , cl.`name`, "'.pSQL($input_name).'_box" as `input_name`, c.`id_parent`
|
||||
FROM `'._DB_PREFIX_.'category` AS c
|
||||
INNER JOIN `'._DB_PREFIX_.'category_lang` AS cl
|
||||
ON (c.`id_category` = cl.`id_category` AND cl.`id_lang`='.(int)Context::getContext()->language->id.')
|
||||
WHERE c.`nleft` > '.(int)$locationCategory->nleft.' AND c.`nright` < '.(int)$locationCategory->nright.'
|
||||
AND c.`level_depth` = '.(int)$levelDepth;
|
||||
|
||||
if ($idParents) {
|
||||
$sql .= ' AND c.`id_parent` IN ('.implode(', ', $idParents).')';
|
||||
}
|
||||
if ($rootNodeId) {
|
||||
$sql .= ' AND c.`id_category` = '.(int)$rootNodeId;
|
||||
}
|
||||
|
||||
return Db::getInstance()->executeS($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all the hotels of the passed cities (city id_category)
|
||||
*/
|
||||
protected static function getHotelsByIdCity($cities, $rootNodeId)
|
||||
{
|
||||
|
||||
$sql = 'SELECT hbi.`id` as `value` , hbil.`hotel_name` as `name`, "hotel_box" as `input_name`, c.`id_parent`
|
||||
FROM `'._DB_PREFIX_.'htl_branch_info` AS hbi
|
||||
INNER JOIN `'._DB_PREFIX_.'htl_branch_info_lang` AS hbil
|
||||
ON (hbi.`id` = hbil.`id` AND hbil.`id_lang`='.(int)Context::getContext()->language->id.')
|
||||
INNER JOIN `'._DB_PREFIX_.'category` AS c ON (hbi.`id_category` = c.`id_category`)
|
||||
WHERE 1';
|
||||
|
||||
if ($cities) {
|
||||
$sql .= ' AND c.`id_parent` IN ('.implode(', ', $cities).')';
|
||||
}
|
||||
if ($rootNodeId) {
|
||||
$sql .= ' AND hbi.`id` = '.(int)$rootNodeId;
|
||||
}
|
||||
return Db::getInstance()->executeS($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all the room types of the passed hotels
|
||||
*/
|
||||
protected static function getRoomTypesByHotelsId($hotels, $rootNodeId)
|
||||
{
|
||||
$sql = 'SELECT p.`id_product` AS `value`, pl.`name`, "room_type_box" as `input_name`, rt.`id_hotel`
|
||||
FROM `'._DB_PREFIX_.'htl_room_type` AS rt';
|
||||
|
||||
$sql .= ' INNER JOIN `'._DB_PREFIX_.'product` AS p ON (rt.`id_product` = p.`id_product`)
|
||||
INNER JOIN `'._DB_PREFIX_.'product_lang` AS pl
|
||||
ON (p.`id_product` = pl.`id_product` AND pl.`id_lang`='.(int)Context::getContext()->language->id.')
|
||||
WHERE 1';
|
||||
|
||||
if ($hotels) {
|
||||
$sql .= ' AND rt.`id_hotel` IN ('.implode(', ', $hotels).')';
|
||||
}
|
||||
if ($rootNodeId) {
|
||||
$sql .= ' AND p.`id_product` = '.(int)$rootNodeId;
|
||||
}
|
||||
|
||||
return Db::getInstance()->executeS($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all the rooms of the passed room types (city id_category)
|
||||
*/
|
||||
protected static function getRoomsByRoomTypeId($roomTypes, $rootNodeId)
|
||||
{
|
||||
$sql = 'SELECT `id` as `value`, `room_num` as `name`, "room_box" as `input_name`, `id_product`
|
||||
FROM `'._DB_PREFIX_.'htl_room_information`
|
||||
WHERE 1';
|
||||
if ($roomTypes) {
|
||||
$sql .= ' AND `id_product` IN ('.implode(', ', $roomTypes).')';
|
||||
}
|
||||
if ($rootNodeId) {
|
||||
$sql .= ' AND `id` = '.(int)$rootNodeId;
|
||||
}
|
||||
|
||||
return Db::getInstance()->executeS($sql);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -149,7 +149,9 @@ class HotelOrderRefundRules extends ObjectModel
|
||||
$objHtlBooking->date_from,
|
||||
$objHtlBooking->date_to,
|
||||
1,
|
||||
1
|
||||
1,
|
||||
1,
|
||||
$objHtlBooking->id
|
||||
);
|
||||
|
||||
$totalServicesPrice = $objRoomTypeServiceProductOrderDetail->getSelectedServicesForRoom(
|
||||
@@ -157,7 +159,7 @@ class HotelOrderRefundRules extends ObjectModel
|
||||
1,
|
||||
1
|
||||
);
|
||||
$paidAmount = $objHtlBooking->total_paid_amount + $totalDemandsPrice + $totalServicesPrice;
|
||||
$totalAmount = $objHtlBooking->total_price_tax_incl + $totalDemandsPrice + $totalServicesPrice;
|
||||
|
||||
if ($refundRules = $objHtlRefundRules->getHotelRefundRules($objHtlBooking->id_hotel, 0, 1)) {
|
||||
$orderCurrency = $objOrder->id_currency;
|
||||
@@ -185,7 +187,7 @@ class HotelOrderRefundRules extends ObjectModel
|
||||
|
||||
if ($refRule['payment_type'] == HotelOrderRefundRules::WK_REFUND_RULE_PAYMENT_TYPE_PERCENTAGE) {
|
||||
$bookingCancellationDetail['reduction_type'] = HotelOrderRefundRules::WK_REFUND_RULE_PAYMENT_TYPE_PERCENTAGE;
|
||||
$bookingCancellationDetail['cancelation_charge'] = $paidAmount * ($refundValue / 100);
|
||||
$bookingCancellationDetail['cancelation_charge'] = $totalAmount * ($refundValue / 100);
|
||||
} else {
|
||||
$bookingCancellationDetail['reduction_type'] = HotelOrderRefundRules::WK_REFUND_RULE_PAYMENT_TYPE_FIXED;
|
||||
if ($defaultCurrency != $orderCurrency) {
|
||||
@@ -197,11 +199,6 @@ class HotelOrderRefundRules extends ObjectModel
|
||||
} else {
|
||||
$bookingCancellationDetail['cancelation_charge'] = $refundValue;
|
||||
}
|
||||
|
||||
// if deduction amount is more than the order total cost
|
||||
if ($bookingCancellationDetail['cancelation_charge'] > $paidAmount) {
|
||||
$bookingCancellationDetail['cancelation_charge'] = $paidAmount;
|
||||
}
|
||||
}
|
||||
|
||||
$ruleApplied = true;
|
||||
@@ -210,12 +207,12 @@ class HotelOrderRefundRules extends ObjectModel
|
||||
}
|
||||
|
||||
if (!$ruleApplied) {
|
||||
$bookingCancellationDetail['cancelation_charge'] = $paidAmount;
|
||||
$bookingCancellationDetail['cancelation_charge'] = $totalAmount;
|
||||
$bookingCancellationDetail['reduction_type'] = HotelOrderRefundRules::WK_REFUND_RULE_PAYMENT_TYPE_PERCENTAGE;
|
||||
$bookingCancellationDetail['reduction_value'] = 100;
|
||||
}
|
||||
} else {
|
||||
$bookingCancellationDetail['cancelation_charge'] = $paidAmount;
|
||||
$bookingCancellationDetail['cancelation_charge'] = $totalAmount;
|
||||
$bookingCancellationDetail['reduction_type'] = HotelOrderRefundRules::WK_REFUND_RULE_PAYMENT_TYPE_PERCENTAGE;
|
||||
$bookingCancellationDetail['reduction_value'] = 100;
|
||||
}
|
||||
|
||||
@@ -34,6 +34,9 @@ class HotelRoomInformation extends ObjectModel
|
||||
const STATUS_INACTIVE = 2;
|
||||
const STATUS_TEMPORARY_INACTIVE = 3;
|
||||
|
||||
const STATUS_SEARCH_LOS_UNSATISFIED = 4;
|
||||
const STATUS_SEARCH_OCCUPANCY_UNSATISFIED = 5;
|
||||
|
||||
public static $definition = array(
|
||||
'table' => 'htl_room_information',
|
||||
'primary' => 'id',
|
||||
@@ -76,7 +79,7 @@ class HotelRoomInformation extends ObjectModel
|
||||
{
|
||||
if ($idRoom = $this->id) {
|
||||
// delete rooms from cart which are set inactive
|
||||
if ($this->id_status == self::STATUS_INACTIVE) {
|
||||
if ($this->id_status == HotelRoomInformation::STATUS_INACTIVE) {
|
||||
$objCartBookingData = new HotelCartBookingData();
|
||||
if (!$objCartBookingData->deleteCartBookingData(0, 0, $idRoom)) {
|
||||
return false;
|
||||
@@ -138,25 +141,37 @@ class HotelRoomInformation extends ObjectModel
|
||||
|
||||
public function getAllRoomStatus()
|
||||
{
|
||||
$moduleInstance = Module::getInstanceByName('hotelreservationsystem');
|
||||
|
||||
$status = array(
|
||||
'STATUS_ACTIVE' => array(
|
||||
'id' => self::STATUS_ACTIVE,
|
||||
'status' => $moduleInstance->l('Active', 'hotelreservationsystem')
|
||||
'id' => HotelRoomInformation::STATUS_ACTIVE,
|
||||
'status' => self::getRoomStatusTitle(HotelRoomInformation::STATUS_ACTIVE)
|
||||
),
|
||||
'STATUS_INACTIVE' => array(
|
||||
'id' => self::STATUS_INACTIVE,
|
||||
'status' => $moduleInstance->l('Inactive', 'hotelreservationsystem')
|
||||
'id' => HotelRoomInformation::STATUS_INACTIVE,
|
||||
'status' => self::getRoomStatusTitle(HotelRoomInformation::STATUS_INACTIVE)
|
||||
),
|
||||
'STATUS_TEMPORARY_INACTIVE' => array(
|
||||
'id' => self::STATUS_TEMPORARY_INACTIVE,
|
||||
'status' => $moduleInstance->l('Temporarily Inactive', 'hotelreservationsystem')
|
||||
'id' => HotelRoomInformation::STATUS_TEMPORARY_INACTIVE,
|
||||
'status' => self::getRoomStatusTitle(HotelRoomInformation::STATUS_TEMPORARY_INACTIVE)
|
||||
),
|
||||
);
|
||||
return $status;
|
||||
}
|
||||
|
||||
public static function getRoomStatusTitle($idStatus)
|
||||
{
|
||||
$moduleInstance = Module::getInstanceByName('hotelreservationsystem');
|
||||
$status = array(
|
||||
HotelRoomInformation::STATUS_ACTIVE => $moduleInstance->l('Active', 'hotelreservationsystem'),
|
||||
HotelRoomInformation::STATUS_INACTIVE => $moduleInstance->l('Inactive', 'hotelreservationsystem'),
|
||||
HotelRoomInformation::STATUS_TEMPORARY_INACTIVE => $moduleInstance->l('Temporarily Inactive', 'hotelreservationsystem'),
|
||||
HotelRoomInformation::STATUS_SEARCH_LOS_UNSATISFIED => $moduleInstance->l('Length of stay restriction not satisfied', 'hotelreservationsystem'),
|
||||
HotelRoomInformation::STATUS_SEARCH_OCCUPANCY_UNSATISFIED => $moduleInstance->l('Occupancy exceeds room capacity', 'hotelreservationsystem'),
|
||||
);
|
||||
|
||||
return isset($status[$idStatus]) ? $status[$idStatus] : '';
|
||||
}
|
||||
|
||||
/**
|
||||
* [getHotelRoomInfoByProductId :: To get all rooms information belong to a room type(product) by product id]
|
||||
* @param [int] $id_product [Id of the product]
|
||||
@@ -285,7 +300,10 @@ class HotelRoomInformation extends ObjectModel
|
||||
if ($roomTypeInfo = $objRoomType->getRoomTypeInfoByIdProduct($this->id_product)) {
|
||||
$this->id_hotel = $roomTypeInfo['id_hotel'];
|
||||
return $this->add($autodate, $null_values);
|
||||
} else {
|
||||
WebserviceRequest::getInstance()->setError(400, 'Invalid id product', 134);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -296,7 +314,10 @@ class HotelRoomInformation extends ObjectModel
|
||||
if ($roomTypeInfo = $objRoomType->getRoomTypeInfoByIdProduct($this->id_product)) {
|
||||
$this->id_hotel = $roomTypeInfo['id_hotel'];
|
||||
return $this->update($null_values);
|
||||
} else {
|
||||
WebserviceRequest::getInstance()->setError(400, 'Invalid id product', 134);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -425,4 +425,24 @@ class HotelRoomType extends ObjectModel
|
||||
'SELECT `id` FROM `'._DB_PREFIX_.'htl_room_information` WHERE `id_product` = '.(int)$this->id_product.' ORDER BY `id` ASC'
|
||||
);
|
||||
}
|
||||
|
||||
public function validateFields($die = true, $error_return = false)
|
||||
{
|
||||
if (isset($this->webservice_validation) && $this->webservice_validation) {
|
||||
if (!(int) $this->id_product || !Validate::isLoadedObject(new Product((int) $this->id_product))) {
|
||||
$message = Tools::displayError('Invalid Id product.');
|
||||
} elseif (!(int)$this->id_hotel || !Validate::isLoadedObject(new HotelBranchInformation((int) $this->id_hotel))) {
|
||||
$message = Tools::displayError('Invalid Id hotel.');
|
||||
}
|
||||
|
||||
if (isset($message)) {
|
||||
if ($die) {
|
||||
throw new PrestaShopException($message);
|
||||
}
|
||||
return $error_return ? $message : false;
|
||||
}
|
||||
}
|
||||
return parent::validateFields($die, $error_return);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -336,8 +336,10 @@ class HotelRoomTypeDemand extends ObjectModel
|
||||
$price = $objGlobalDemand->price;
|
||||
}
|
||||
}
|
||||
|
||||
$price = Tools::convertPrice($price, $idCurrency);
|
||||
}
|
||||
$price = Tools::convertPrice($price, $idCurrency);
|
||||
|
||||
// Tax calculation section
|
||||
$address->id_country = $idCountry;
|
||||
$address->id_state = $idState;
|
||||
|
||||
@@ -82,10 +82,6 @@ class HotelRoomTypeFeaturePricing extends ObjectModel
|
||||
protected $webserviceParameters = array(
|
||||
'objectsNodeName' => 'feature_prices',
|
||||
'objectNodeName' => 'feature_price',
|
||||
'objectMethods' => array(
|
||||
'add' => 'addWs',
|
||||
'update' => 'updateWs',
|
||||
),
|
||||
'fields' => array(
|
||||
'id_product' => array(
|
||||
'xlink_resource' => array(
|
||||
@@ -277,7 +273,7 @@ class HotelRoomTypeFeaturePricing extends ObjectModel
|
||||
$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);
|
||||
$currentDate = date('Y-m-d', strtotime($date));
|
||||
$nextDayDate = date('Y-m-d', strtotime('+1 day', strtotime($currentDate)));
|
||||
if ($id_product) {
|
||||
$bookingParams = array(
|
||||
@@ -647,15 +643,16 @@ class HotelRoomTypeFeaturePricing extends ObjectModel
|
||||
$id_cart = 0,
|
||||
$id_guest = 0,
|
||||
$id_room = 0,
|
||||
$with_auto_room_services = 1
|
||||
$with_auto_room_services = 1,
|
||||
$use_reduc = 1
|
||||
) {
|
||||
$totalPrice = array();
|
||||
$totalPrice['total_price_tax_incl'] = 0;
|
||||
$totalPrice['total_price_tax_excl'] = 0;
|
||||
$featureImpactPriceTE = 0;
|
||||
$featureImpactPriceTI = 0;
|
||||
$productPriceTI = Product::getPriceStatic((int) $id_product, true);
|
||||
$productPriceTE = Product::getPriceStatic((int) $id_product, false);
|
||||
$productPriceTI = Product::getPriceStatic((int) $id_product, true, false, 6, null, false, $use_reduc);
|
||||
$productPriceTE = Product::getPriceStatic((int) $id_product, false, false, 6, null, false, $use_reduc);
|
||||
if ($productPriceTE) {
|
||||
$taxRate = (($productPriceTI-$productPriceTE)/$productPriceTE)*100;
|
||||
} else {
|
||||
@@ -678,14 +675,14 @@ class HotelRoomTypeFeaturePricing extends ObjectModel
|
||||
$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(
|
||||
if ($use_reduc && ($featurePrice = $hotelCartBookingData->getProductFeaturePricePlanByDateByPriority(
|
||||
$id_product,
|
||||
$currentDate,
|
||||
$id_group,
|
||||
$id_cart,
|
||||
$id_guest,
|
||||
$id_room
|
||||
)) {
|
||||
))) {
|
||||
if ($featurePrice['impact_type'] == self::IMPACT_TYPE_PERCENTAGE) {
|
||||
//percentage
|
||||
$featureImpactPriceTE = $productPriceTE * ($featurePrice['impact_value'] / 100);
|
||||
@@ -728,7 +725,8 @@ class HotelRoomTypeFeaturePricing extends ObjectModel
|
||||
Product::PRICE_ADDITION_TYPE_WITH_ROOM,
|
||||
true,
|
||||
$id_cart,
|
||||
$id_guest
|
||||
$id_guest,
|
||||
$use_reduc
|
||||
)) {
|
||||
foreach($servicesWithTax as $service) {
|
||||
$totalPrice['total_price_tax_incl'] += $service['price'];
|
||||
@@ -741,7 +739,8 @@ class HotelRoomTypeFeaturePricing extends ObjectModel
|
||||
Product::PRICE_ADDITION_TYPE_WITH_ROOM,
|
||||
false,
|
||||
$id_cart,
|
||||
$id_guest
|
||||
$id_guest,
|
||||
$use_reduc
|
||||
)) {
|
||||
foreach($servicesWithoutTax as $service) {
|
||||
$totalPrice['total_price_tax_excl'] += $service['price'];
|
||||
@@ -771,7 +770,8 @@ class HotelRoomTypeFeaturePricing extends ObjectModel
|
||||
$id_cart = 0,
|
||||
$id_guest = 0,
|
||||
$id_room = 0,
|
||||
$with_auto_room_services = 1
|
||||
$with_auto_room_services = 1,
|
||||
$use_reduc = 1
|
||||
) {
|
||||
$dateFrom = date('Y-m-d', strtotime($date_from));
|
||||
$dateTo = date('Y-m-d', strtotime($date_to));
|
||||
@@ -784,7 +784,8 @@ class HotelRoomTypeFeaturePricing extends ObjectModel
|
||||
$id_cart,
|
||||
$id_guest,
|
||||
$id_room,
|
||||
$with_auto_room_services
|
||||
$with_auto_room_services,
|
||||
$use_reduc
|
||||
);
|
||||
|
||||
$totalDurationPriceTI = $totalDurationPrice['total_price_tax_incl'];
|
||||
@@ -832,9 +833,11 @@ class HotelRoomTypeFeaturePricing extends ObjectModel
|
||||
{
|
||||
return Db::getInstance()->execute(
|
||||
'DELETE FROM `'._DB_PREFIX_.'htl_room_type_feature_pricing`
|
||||
WHERE `id_cart` = '.(int) $id_cart.($id_product ? ' AND `id_product` = '.(int) $id_product.
|
||||
' AND `id_room` = '.(int) $id_room.' AND `date_from` = "'.pSQL($date_from).
|
||||
'" AND `date_to` = "'.pSQL($date_to).'"' : '')
|
||||
WHERE `id_cart` = '.(int) $id_cart.
|
||||
($id_product ? ' AND `id_product` = '.(int) $id_product : '').
|
||||
($id_room ? ' AND `id_room` = '.(int) $id_room : '').
|
||||
($date_from ? ' AND `date_from` = "'.pSQL($date_from) .'"' : '').
|
||||
($date_to ? ' AND `date_to` = "'.pSQL($date_to) .'"' : '')
|
||||
);
|
||||
}
|
||||
|
||||
@@ -917,72 +920,37 @@ class HotelRoomTypeFeaturePricing extends ObjectModel
|
||||
return true;
|
||||
}
|
||||
|
||||
// Webservice :: function will run when feature price added from API
|
||||
public function addWs($autodate = true, $null_values = false)
|
||||
public function validateFields($die = true, $error_return = false)
|
||||
{
|
||||
$postData = trim(file_get_contents('php://input'));
|
||||
libxml_use_internal_errors(true);
|
||||
$xml = simplexml_load_string(utf8_decode($postData));
|
||||
$postFieldsObj = json_decode(json_encode($xml));
|
||||
|
||||
// we will check this also as empty value comes in empty std class
|
||||
$specialDaysArray = (array) $postFieldsObj->feature_price->special_days;
|
||||
|
||||
if (!empty($postFieldsObj->feature_price->special_days)
|
||||
&& $postFieldsObj->feature_price->special_days
|
||||
&& $specialDaysArray
|
||||
) {
|
||||
if (isset($this->webservice_validation) && $this->webservice_validation) {
|
||||
$weekDays = ['mon', 'tue', 'wed', 'thu', 'fri', 'sat', 'sun'];
|
||||
$specialDays = json_decode($postFieldsObj->feature_price->special_days, true);
|
||||
if (is_array($specialDays) && $specialDays) {
|
||||
if (count(array_diff($specialDays, $weekDays))) {
|
||||
WebserviceRequest::getInstance()->setError(400, 'Invalid special days. format must match with : ["mon", "tue", "wed", "thu", "fri", "sat", "sun"]', 134);
|
||||
|
||||
return false;
|
||||
if($this->is_special_days_exists) {
|
||||
if ($this->special_days
|
||||
&& ($specialDays = json_decode($this->special_days, true))
|
||||
) {
|
||||
if (is_array($specialDays) && $specialDays) {
|
||||
if (count(array_diff($specialDays, $weekDays))) {
|
||||
$message = Tools::displayError('Invalid special days. format must match with : ["mon", "tue", "wed", "thu", "fri", "sat", "sun"]', false);
|
||||
}
|
||||
} else {
|
||||
$message = Tools::displayError('Invalid special days. format must match with : ["mon", "tue", "wed", "thu", "fri", "sat", "sun"]', false);
|
||||
}
|
||||
} else {
|
||||
$message = Tools::displayError('Invalid special days. format must match with : ["mon", "tue", "wed", "thu", "fri", "sat", "sun"]', false);
|
||||
}
|
||||
} else {
|
||||
WebserviceRequest::getInstance()->setError(400, 'Invalid special days. format must match with : ["mon", "tue", "wed", "thu", "fri", "sat", "sun"]', 134);
|
||||
}
|
||||
|
||||
return false;
|
||||
if (isset($message) && $message != '') {
|
||||
if ($die) {
|
||||
throw new PrestaShopException($message);
|
||||
}
|
||||
|
||||
return $error_return ? $message : false;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->add($autodate, $null_values);
|
||||
return parent::validateFields($die, $error_return);
|
||||
}
|
||||
|
||||
// Webservice :: function will run when feature price updated from API
|
||||
public function updateWs($null_values = false)
|
||||
{
|
||||
$postData = trim(file_get_contents('php://input'));
|
||||
libxml_use_internal_errors(true);
|
||||
$xml = simplexml_load_string(utf8_decode($postData));
|
||||
$postFieldsObj = json_decode(json_encode($xml));
|
||||
|
||||
// we will check this also as empty value comes in empty std class
|
||||
$specialDaysArray = (array) $postFieldsObj->feature_price->special_days;
|
||||
|
||||
if (!empty($postFieldsObj->feature_price->special_days)
|
||||
&& $postFieldsObj->feature_price->special_days
|
||||
&& $specialDaysArray
|
||||
) {
|
||||
$weekDays = ['mon', 'tue', 'wed', 'thu', 'fri', 'sat', 'sun'];
|
||||
$specialDays = json_decode($postFieldsObj->feature_price->special_days, true);
|
||||
if (is_array($specialDays) && $specialDays) {
|
||||
if (count(array_diff($specialDays, $weekDays))) {
|
||||
WebserviceRequest::getInstance()->setError(400, 'Invalid special days. format must match with : ["mon", "tue", "wed", "thu", "fri", "sat", "sun"]', 134);
|
||||
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
WebserviceRequest::getInstance()->setError(400, 'Invalid special days. format must match with : ["mon", "tue", "wed", "thu", "fri", "sat", "sun"]', 134);
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->update($null_values);
|
||||
}
|
||||
|
||||
public static function createAutoFeaturePrice($params)
|
||||
{
|
||||
$context = Context::getContext();
|
||||
|
||||
@@ -107,9 +107,9 @@ class RoomTypeServiceProduct extends ObjectModel
|
||||
);
|
||||
|
||||
if ($formated) {
|
||||
$response = array('hotels' => array(), 'room_types' => array());
|
||||
$response = array('hotel' => array(), 'room_type' => array());
|
||||
foreach($rows as $row) {
|
||||
$key = $row['element_type'] == self::WK_ELEMENT_TYPE_HOTEL ? 'hotels' : 'room_types';
|
||||
$key = $row['element_type'] == self::WK_ELEMENT_TYPE_HOTEL ? 'hotel' : 'room_type';
|
||||
$response[$key][] = $row['id_element'];
|
||||
}
|
||||
return $response;
|
||||
@@ -135,7 +135,7 @@ class RoomTypeServiceProduct extends ObjectModel
|
||||
return Db::getInstance()->getValue($sql);
|
||||
}
|
||||
|
||||
public static function getAutoAddServices($idProduct, $dateFrom = null, $dateTo = null, $priceAdditionType = null, $useTax = null, $idCart = 0, $idGuest = 0)
|
||||
public static function getAutoAddServices($idProduct, $dateFrom = null, $dateTo = null, $priceAdditionType = null, $useTax = null, $idCart = 0, $idGuest = 0, $use_reduc = 1)
|
||||
{
|
||||
if (Product::isBookingProduct($idProduct)) {
|
||||
$sql = 'SELECT p.`id_product` FROM `'._DB_PREFIX_.'htl_room_type_service_product` rsp
|
||||
@@ -157,7 +157,10 @@ class RoomTypeServiceProduct extends ObjectModel
|
||||
1,
|
||||
$dateFrom,
|
||||
$dateTo,
|
||||
$useTax
|
||||
$useTax,
|
||||
false,
|
||||
null,
|
||||
$use_reduc
|
||||
);
|
||||
}
|
||||
return $services;
|
||||
|
||||
@@ -69,9 +69,9 @@ class RoomTypeServiceProductOrderDetail extends ObjectModel
|
||||
$useTax = null,
|
||||
$autoAddToCart = 0,
|
||||
$priceAdditionType = null,
|
||||
$idOrderDetail = 0
|
||||
$idOrderDetail = 0,
|
||||
$idHtlBookingDetail = 0
|
||||
) {
|
||||
|
||||
if ($useTax === null) {
|
||||
$useTax = Product::$_taxCalculationMethod == PS_TAX_EXC ? false : true;
|
||||
}
|
||||
@@ -111,6 +111,9 @@ class RoomTypeServiceProductOrderDetail extends ObjectModel
|
||||
if ($idRoom) {
|
||||
$sql .= ' AND hbd.`id_room`='.(int) $idRoom;
|
||||
}
|
||||
if ($idHtlBookingDetail) {
|
||||
$sql .= ' AND hbd.`id` = '.(int)$idHtlBookingDetail;
|
||||
}
|
||||
$sql .= ' ORDER BY hbd.`id`';
|
||||
|
||||
if ($getTotalPrice) {
|
||||
@@ -192,7 +195,9 @@ class RoomTypeServiceProductOrderDetail extends ObjectModel
|
||||
public function getSelectedServicesForRoom(
|
||||
$idHotelBookingDetail,
|
||||
$getTotalPrice = 0,
|
||||
$useTax = null
|
||||
$useTax = null,
|
||||
$autoAddToCart = null,
|
||||
$priceAdditionType = null
|
||||
) {
|
||||
|
||||
if ($useTax === null) {
|
||||
@@ -212,6 +217,13 @@ class RoomTypeServiceProductOrderDetail extends ObjectModel
|
||||
|
||||
$sql .= ' WHERE hbd.`id` = '.(int)$idHotelBookingDetail;
|
||||
|
||||
if (!is_null($autoAddToCart)) {
|
||||
$sql .= ' AND od.`product_auto_add` = '. (int)$autoAddToCart;
|
||||
if ($autoAddToCart == 1 && !is_null($priceAdditionType)) {
|
||||
$sql .= ' AND od.`product_price_addition_type` = '.$priceAdditionType;
|
||||
}
|
||||
}
|
||||
|
||||
if ($getTotalPrice) {
|
||||
$totalPrice = 0;
|
||||
}
|
||||
|
||||
@@ -101,7 +101,7 @@ class RoomTypeServiceProductPrice extends ObjectModel
|
||||
);
|
||||
}
|
||||
|
||||
public function getServicePrice($idProduct, $idProductRoomType, $quantity, $dateFrom = null, $dateTo = null, $useTax = null, $id_cart = false, $id_address = null, $test= false)
|
||||
public function getServicePrice($idProduct, $idProductRoomType, $quantity, $dateFrom = null, $dateTo = null, $useTax = null, $id_cart = false, $id_address = null, $use_reduc= 1)
|
||||
{
|
||||
if ($useTax === null)
|
||||
$useTax = Product::$_taxCalculationMethod == PS_TAX_EXC ? false : true;
|
||||
@@ -115,7 +115,7 @@ class RoomTypeServiceProductPrice extends ObjectModel
|
||||
6,
|
||||
null,
|
||||
false,
|
||||
true,
|
||||
$use_reduc,
|
||||
(int)$quantity,
|
||||
false,
|
||||
null,
|
||||
|
||||
@@ -107,11 +107,15 @@ class WebserviceSpecificManagementQlo implements WebserviceSpecificManagementInt
|
||||
if (!isset($this->wsObject->urlFragments['id_hotel']) ) {
|
||||
throw new WebserviceException('You have to set \'id_hotel\', \'date_from\' and \'date_to\'parameters to get a result', array(100, 400));
|
||||
}
|
||||
$kwargs = [
|
||||
$dateFrom = isset($this->wsObject->urlFragments['date_from']) ? $this->wsObject->urlFragments['date_from'] : date('Y-m-d');
|
||||
$dateTo = isset($this->wsObject->urlFragments['date_to']) ? $this->wsObject->urlFragments['date_to'] : date('Y-m-d', strtotime($dateFrom.' + 1 day'));
|
||||
$kwargs = array(
|
||||
'idHotel' => $this->wsObject->urlFragments['id_hotel'],
|
||||
'dateFrom' => $this->wsObject->urlFragments['date_from'],
|
||||
'dateTo' => $this->wsObject->urlFragments['date_to'],
|
||||
];
|
||||
'dateFrom' => $dateFrom,
|
||||
'dateTo' => $dateTo,
|
||||
'idRoomType' => isset($this->wsObject->urlFragments['id_room_type']) ? $this->wsObject->urlFragments['id_room_type'] : 0,
|
||||
);
|
||||
|
||||
$this->output .= $objQloRoomType->getRoomRates($kwargs);
|
||||
break;
|
||||
|
||||
|
||||
@@ -274,7 +274,7 @@ class AdminAddHotelController extends ModuleAdminController
|
||||
}
|
||||
}
|
||||
|
||||
if (!$phone) {
|
||||
if (!$phone = trim($phone)) {
|
||||
$this->errors[] = $this->l('Phone number is required field.');
|
||||
} elseif (!Validate::isPhoneNumber($phone)) {
|
||||
$this->errors[] = $this->l('Please enter a valid phone number.');
|
||||
@@ -300,7 +300,7 @@ class AdminAddHotelController extends ModuleAdminController
|
||||
$this->errors[] = $this->l('Rating is required field.');
|
||||
}
|
||||
|
||||
if ($address == '') {
|
||||
if (!$address = trim($address)) {
|
||||
$this->errors[] = $this->l('Address is required field.');
|
||||
}
|
||||
|
||||
@@ -329,7 +329,39 @@ class AdminAddHotelController extends ModuleAdminController
|
||||
if ($city == '') {
|
||||
$this->errors[] = $this->l('City is required field.');
|
||||
} elseif (!Validate::isCityName($city)) {
|
||||
$this->errors[] = $this->l('Enter a Valid City Name.');
|
||||
$this->errors[] = $this->l('Enter a valid city name.');
|
||||
}
|
||||
|
||||
//Since the address for the hotel is saved in the address table. We are validating the hotel address here manually.
|
||||
$addressValidation = Address::getValidationRules('Address');
|
||||
foreach ($addressValidation['size'] as $field => $maxSize) {
|
||||
if ('phone' == $field && Tools::strlen($phone) > $maxSize) {
|
||||
$this->errors[] = sprintf(
|
||||
Tools::displayError('The Hotel phone number is too long (%1$d chars max).'),
|
||||
$maxSize
|
||||
);
|
||||
} else if ('address1' == $field && Tools::strlen($address) > $maxSize) {
|
||||
$this->errors[] = sprintf(
|
||||
Tools::displayError('The Hotel address is too long (%1$d chars max).'),
|
||||
$maxSize
|
||||
);
|
||||
} else if ('city' == $field && Tools::strlen($city) > $maxSize) {
|
||||
$this->errors[] = sprintf(
|
||||
Tools::displayError('The Hotel city name is too long (%1$d chars max).'),
|
||||
$maxSize
|
||||
);
|
||||
} else if ('postcode' == $field && Tools::strlen($zipcode) > $maxSize) {
|
||||
$this->errors[] = sprintf(
|
||||
Tools::displayError('The Hotel zip code is too long (%1$d chars max).'),
|
||||
$maxSize
|
||||
);
|
||||
} else if (($value = Tools::getValue($field)) && Tools::strlen($value) > $maxSize) {
|
||||
$this->errors[] = sprintf(
|
||||
Tools::displayError('The Hotel %1$s field is too long (%2$d chars max).'),
|
||||
$field,
|
||||
$maxSize
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if ($idHotel) {
|
||||
@@ -381,13 +413,13 @@ class AdminAddHotelController extends ModuleAdminController
|
||||
$linkRewriteArray = array();
|
||||
foreach ($languages as $lang) {
|
||||
if (!trim(Tools::getValue('hotel_name_'.$lang['id_lang']))) {
|
||||
$objHotelBranch->hotel_name[$lang['id_lang']] = Tools::getValue(
|
||||
$objHotelBranch->hotel_name[$lang['id_lang']] = trim(Tools::getValue(
|
||||
'hotel_name_'.$defaultLangId
|
||||
);
|
||||
));
|
||||
} else {
|
||||
$objHotelBranch->hotel_name[$lang['id_lang']] = Tools::getValue(
|
||||
$objHotelBranch->hotel_name[$lang['id_lang']] = trim(Tools::getValue(
|
||||
'hotel_name_'.$lang['id_lang']
|
||||
);
|
||||
));
|
||||
}
|
||||
|
||||
if (!trim(Tools::getValue('link_rewrite_'.$lang['id_lang']))) {
|
||||
@@ -476,19 +508,32 @@ class AdminAddHotelController extends ModuleAdminController
|
||||
} else {
|
||||
$objAddress = new Address();
|
||||
}
|
||||
|
||||
$objAddress->id_hotel = $newIdHotel;
|
||||
$objAddress->id_country = $country;
|
||||
$objAddress->id_state = $state;
|
||||
$objAddress->city = $city;
|
||||
$objAddress->postcode = $zipcode;
|
||||
$hotelName = $objHotelBranch->hotel_name[$defaultLangId];
|
||||
$objAddress->alias = $hotelName;
|
||||
$hotelName = preg_replace('/[0-9!<>,;?=+()@#"°{}_$%:]*$/u', '', $hotelName);
|
||||
$objAddress->lastname = $hotelName;
|
||||
$objAddress->firstname = $hotelName;
|
||||
$hotelName = trim(preg_replace('/[0-9!<>,;?=+()@#"°{}_$%:]*$/u', '', $hotelName));
|
||||
$objAddress->alias = trim(substr($hotelName, 0, 32));
|
||||
$addressFirstName = $hotelName;
|
||||
$addressLastName = $hotelName;
|
||||
// If hotel name is length is greater than 32 then we split it into two
|
||||
if (Tools::strlen($hotelName) > 32) {
|
||||
// Slicing and removing the extra spaces after slicing
|
||||
$addressFirstName = trim(substr($hotelName, 0, 32));
|
||||
// To remove the excess space from last name
|
||||
if (!$addressLastName = trim(substr($hotelName, 32, 32))) {
|
||||
// since the last name can also be an empty space we will then use first name as last name
|
||||
$addressLastName = $addressFirstName;
|
||||
}
|
||||
}
|
||||
|
||||
$objAddress->firstname = $addressFirstName;
|
||||
$objAddress->lastname = $addressLastName;
|
||||
$objAddress->address1 = $address;
|
||||
$objAddress->phone = $phone;
|
||||
|
||||
$objAddress->save();
|
||||
|
||||
// Save refund rules of the hotels
|
||||
@@ -537,6 +582,7 @@ class AdminAddHotelController extends ModuleAdminController
|
||||
if ($objHotelBranch->id_category) {
|
||||
$objCategory = new Category($objHotelBranch->id_category);
|
||||
$objCategory->name = $objHotelBranch->hotel_name;
|
||||
$objCategory->link_rewrite = $linkRewriteArray;
|
||||
$objCategory->id_parent = $catCity;
|
||||
$objCategory->save();
|
||||
Category::regenerateEntireNtree();
|
||||
|
||||
@@ -379,6 +379,7 @@ class AdminHotelRoomsBookingController extends ModuleAdminController
|
||||
'occupancy_required_for_booking' => $occupancyRequiredForBooking,
|
||||
'max_child_age' => Configuration::get('WK_GLOBAL_CHILD_MAX_AGE'),
|
||||
'max_child_in_room' => Configuration::get('WK_GLOBAL_MAX_CHILD_IN_ROOM'),
|
||||
'link' => $this->context->link
|
||||
));
|
||||
|
||||
if (Configuration::get('PS_BACKOFFICE_SEARCH_TYPE') == HotelBookingDetail::SEARCH_TYPE_OWS) {
|
||||
@@ -414,9 +415,11 @@ class AdminHotelRoomsBookingController extends ModuleAdminController
|
||||
$smartyVars['rms_in_cart'] = $objHotelCartBookingData->getCountRoomsInCart($this->id_cart, $this->id_guest);
|
||||
$smartyVars['products_in_cart'] = $products_in_cart;
|
||||
$smartyVars['total_products_in_cart'] = (int)$rms_in_cart + (int)$products_in_cart;
|
||||
$cartAmountTotal = $this->context->cart->getOrderTotal(false);
|
||||
$cartRoomsAmount = $this->context->cart->getOrderTotal(false, cart::ONLY_ROOMS) + $this->context->cart->getOrderTotal(false, cart::ONLY_ROOM_SERVICES_WITHOUT_CONVENIENCE_FEE);
|
||||
$cartAmountConvenienceFee = $this->context->cart->getOrderTotal(false, cart::ONLY_CONVENIENCE_FEE);
|
||||
$smartyVars['cart_tamount'] = $cartAmountTotal - $cartAmountConvenienceFee;
|
||||
$smartyVars['cart_rooms_amount'] = $cartRoomsAmount;
|
||||
$smartyVars['cart_amount_convenience_fee'] = $cartAmountConvenienceFee;
|
||||
$smartyVars['cart_tamount'] = $cartRoomsAmount + $cartAmountConvenienceFee;
|
||||
|
||||
$this->context->smarty->assign($smartyVars);
|
||||
}
|
||||
|
||||
@@ -128,6 +128,7 @@ class AdminOrderRefundRequestsController extends ModuleAdminController
|
||||
$this->fields_list['total_pending_requests'] = array(
|
||||
'title' => $this->l('Pending Requests'),
|
||||
'align' => 'center',
|
||||
'type' => 'range',
|
||||
'havingFilter' => true,
|
||||
);
|
||||
}
|
||||
@@ -267,61 +268,65 @@ class AdminOrderRefundRequestsController extends ModuleAdminController
|
||||
|
||||
$idRefundState = Tools::getValue('id_refund_state');
|
||||
if (Validate::isLoadedObject($objRefundState = new OrderReturnState($idRefundState))) {
|
||||
if ($objRefundState->refunded) {
|
||||
$refundedAmounts = Tools::getValue('refund_amounts');
|
||||
if ($hasOrderDiscountOrPayment) {
|
||||
if ($idsReturnDetail && count($idsReturnDetail)) {
|
||||
if ($refundedAmounts) {
|
||||
foreach ($idsReturnDetail as $idRetDetail) {
|
||||
if (!isset($refundedAmounts[$idRetDetail]) || !Validate::isPrice($refundedAmounts[$idRetDetail])) {
|
||||
$this->errors[] = $this->l('Invalid refund amount(s) entered.');
|
||||
if ($idRefundState != $objOrderReturn->state) {
|
||||
if ($objRefundState->refunded) {
|
||||
$refundedAmounts = Tools::getValue('refund_amounts');
|
||||
if ($hasOrderDiscountOrPayment) {
|
||||
if ($idsReturnDetail && count($idsReturnDetail)) {
|
||||
if ($refundedAmounts) {
|
||||
foreach ($idsReturnDetail as $idRetDetail) {
|
||||
if (!isset($refundedAmounts[$idRetDetail]) || !Validate::isPrice($refundedAmounts[$idRetDetail])) {
|
||||
$this->errors[] = $this->l('Invalid refund amount(s) entered.');
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$this->errors[] = $this->l('Invalid refund amount(s) entered.');
|
||||
}
|
||||
|
||||
// If there are no errors in the refund amounts the check validations depends on refund amount
|
||||
if (!count($this->errors)) {
|
||||
$totalRefundAmount = array_sum($refundedAmounts);
|
||||
if (Tools::isSubmit('generateCreditSlip')) {
|
||||
if ($totalRefundAmount <= 0) {
|
||||
$this->errors[] = $this->l('Invalid refund amount(s) for generating credit slip.');
|
||||
}
|
||||
}
|
||||
if (Tools::isSubmit('generateDiscount')) {
|
||||
if ($totalRefundAmount <= 0) {
|
||||
$this->errors[] = $this->l('Invalid refund amount(s) for generating voucher.');
|
||||
}
|
||||
}
|
||||
|
||||
if (Tools::isSubmit('refundTransactionAmount')) {
|
||||
if ($totalRefundAmount <= 0) {
|
||||
$this->errors[] = $this->l('Invalid refund amount(s) for entering refund transaction details.');
|
||||
} else {
|
||||
$paymentMode = Tools::getValue('payment_method');
|
||||
if (!$paymentMode) {
|
||||
$paymentMode = Tools::getValue('other_payment_mode');
|
||||
if (!$paymentMode) {
|
||||
$this->errors[] = $this->l('Please enter the payment mode of the refund transaction.');
|
||||
} elseif (!Validate::isGenericName($paymentMode)) {
|
||||
$this->errors[] = $this->l('Invalid payment mode entered.');
|
||||
}
|
||||
}
|
||||
|
||||
$idTransaction = Tools::getValue('id_transaction');
|
||||
if (!$idTransaction) {
|
||||
$this->errors[] = $this->l('Please enter the transaction id of the refund transaction.');
|
||||
} elseif (!Validate::isGenericName($idTransaction)) {
|
||||
$this->errors[] = $this->l('Invalid transaction id entered.');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$this->errors[] = $this->l('Invalid refund amount(s) entered.');
|
||||
$this->errors[] = $this->l('Select at least one booking for refund.');
|
||||
}
|
||||
|
||||
// If there are no errors in the refund amounts the check validations depends on refund amount
|
||||
if (!count($this->errors)) {
|
||||
$totalRefundAmount = array_sum($refundedAmounts);
|
||||
if (Tools::isSubmit('generateCreditSlip')) {
|
||||
if ($totalRefundAmount <= 0) {
|
||||
$this->errors[] = $this->l('Invalid refund amount(s) for generating credit slip.');
|
||||
}
|
||||
}
|
||||
if (Tools::isSubmit('generateDiscount')) {
|
||||
if ($totalRefundAmount <= 0) {
|
||||
$this->errors[] = $this->l('Invalid refund amount(s) for generating voucher.');
|
||||
}
|
||||
}
|
||||
|
||||
if (Tools::isSubmit('refundTransactionAmount')) {
|
||||
if ($totalRefundAmount <= 0) {
|
||||
$this->errors[] = $this->l('Invalid refund amount(s) for entering refund transaction details.');
|
||||
} else {
|
||||
$paymentMode = Tools::getValue('payment_method');
|
||||
if (!$paymentMode) {
|
||||
$paymentMode = Tools::getValue('other_payment_mode');
|
||||
if (!$paymentMode) {
|
||||
$this->errors[] = $this->l('Please enter the payment mode of the refund transaction.');
|
||||
} elseif (!Validate::isGenericName($paymentMode)) {
|
||||
$this->errors[] = $this->l('Invalid payment mode entered.');
|
||||
}
|
||||
}
|
||||
|
||||
$idTransaction = Tools::getValue('id_transaction');
|
||||
if (!$idTransaction) {
|
||||
$this->errors[] = $this->l('Please enter the transaction id of the refund transaction.');
|
||||
} elseif (!Validate::isGenericName($idTransaction)) {
|
||||
$this->errors[] = $this->l('Invalid transaction id entered.');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$this->errors[] = $this->l('Select at least one booking for refund.');
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$this->errors[] = $this->l('Please select a different refund status.');
|
||||
}
|
||||
} else {
|
||||
$this->errors[] = $this->l('Invalid refund state.');
|
||||
|
||||
@@ -54,6 +54,7 @@ class HotelReservationSystem extends Module
|
||||
'bookings' => array('description' => 'Order bookings', 'class' => 'HotelBookingDetail'),
|
||||
'booking_extra_demands' => array('description' => 'Booking extra demands', 'class' => 'HotelBookingDemands'),
|
||||
'extra_demands' => array('description' => 'Extra demands', 'class' => 'HotelRoomTypeGlobalDemand'),
|
||||
'extra_services' => array('description' => 'Extra services', 'class' => 'Product', 'parameters_attribute' => 'webserviceRoomTypeServicesParameters'),
|
||||
'demand_advance_options' => array('description' => 'Extra demand advance options', 'class' => 'HotelRoomTypeGlobalDemandAdvanceOption'),
|
||||
'hotel_ari' => array('description' => 'Search availability, rates and inventory', 'specific_management' => true),
|
||||
'qlo' => array('description' => 'qlo API', 'specific_management' => true),
|
||||
@@ -557,9 +558,8 @@ class HotelReservationSystem extends Module
|
||||
public function callInstallTab()
|
||||
{
|
||||
$this->installTab('AdminHotelReservationSystemManagement', 'Hotel Reservation System');
|
||||
$this->installTab('AdminHotelRoomsBooking', 'Book Now', 'AdminHotelReservationSystemManagement');
|
||||
$this->installTab('AdminHotelConfigurationSetting', 'Settings', 'AdminHotelReservationSystemManagement');
|
||||
$this->installTab('AdminAddHotel', 'Manage Hotel', 'AdminHotelReservationSystemManagement');
|
||||
$this->installTab('AdminHotelRoomsBooking', 'Book Now', 'AdminHotelReservationSystemManagement');
|
||||
$this->installTab('AdminHotelFeatures', 'Manage Hotel Features', 'AdminHotelReservationSystemManagement');
|
||||
$this->installTab(
|
||||
'AdminOrderRefundRules',
|
||||
@@ -572,6 +572,7 @@ class HotelReservationSystem extends Module
|
||||
'AdminHotelReservationSystemManagement'
|
||||
);
|
||||
|
||||
$this->installTab('AdminHotelConfigurationSetting', 'General Settings', 'AdminHotelReservationSystemManagement');
|
||||
// Controllers without tabs
|
||||
$this->installTab('AdminHotelGeneralSettings', 'Hotel General Configuration', 'AdminHotelConfigurationSetting', false);
|
||||
$this->installTab('AdminHotelFeaturePricesSettings', 'Advanced Price Rules', 'AdminHotelConfigurationSetting', false);
|
||||
|
||||
@@ -216,7 +216,13 @@ p.room_cat_data
|
||||
font-weight: 700;
|
||||
margin-bottom: 0px;
|
||||
}
|
||||
|
||||
.status-info-tooltip {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
left: 100%;
|
||||
margin-left: -10px;
|
||||
padding: 0px;
|
||||
}
|
||||
.color_indicate
|
||||
{
|
||||
width: 10px;
|
||||
@@ -239,6 +245,7 @@ p.room_cat_data
|
||||
margin: 10px 0px;
|
||||
}
|
||||
|
||||
|
||||
.cart-table-thead
|
||||
{
|
||||
border-bottom: 1px solid #555!important;
|
||||
@@ -261,6 +268,10 @@ p.room_cat_data
|
||||
font-weight: 600;
|
||||
font-size: 13px!important;
|
||||
}
|
||||
.cart_amt_div .table tbody>tr>td, .cart_amt_div .table tbody>tr>th {
|
||||
border: none;
|
||||
padding: 2px 8px;
|
||||
}
|
||||
|
||||
.margin-div
|
||||
{
|
||||
@@ -275,7 +286,10 @@ p.room_cat_data
|
||||
font-size: 14px!important;
|
||||
font-weight: 600!important;
|
||||
}
|
||||
|
||||
#htl_rooms_list table td {
|
||||
padding-top: 10px;
|
||||
padding-bottom: 10px;
|
||||
}
|
||||
#room-status-tabs li
|
||||
{
|
||||
font-size: 14px;
|
||||
@@ -323,7 +337,6 @@ p.room_cat_data
|
||||
.cart_table_container
|
||||
{
|
||||
max-height: 393px;
|
||||
min-height: 150px;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
|
||||
@@ -954,10 +954,56 @@ $(document).ready(function() {
|
||||
success: function(result) {
|
||||
if (result.success) {
|
||||
$(".htl_room_data_cont").html(result.data.stats_panel);
|
||||
initstatstooltip();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
initstatstooltip();
|
||||
|
||||
function initstatstooltip()
|
||||
{
|
||||
$(".htl_room_data_cont").find('.status-info-tooltip').tooltip({
|
||||
trigger : 'hover',
|
||||
show: {
|
||||
delay: 100,
|
||||
},
|
||||
hide: {
|
||||
delay: 300,
|
||||
},
|
||||
open: function(event, ui)
|
||||
{
|
||||
if(event.buttons == 1 || event.buttons == 3){
|
||||
ui.tooltip.remove();
|
||||
}
|
||||
|
||||
if (typeof(event.originalEvent) === 'undefined') {
|
||||
return false;
|
||||
}
|
||||
|
||||
var $id = $(ui.tooltip).attr('id');
|
||||
|
||||
// close any lingering tooltips
|
||||
if ($('div.ui-tooltip').not('#' + $id).length) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// ajax function to pull in data and add it to the tooltip goes here
|
||||
},
|
||||
close: function(event, ui)
|
||||
{
|
||||
ui.tooltip.hover(function() {
|
||||
$(this).stop(true).fadeTo(300, 1);
|
||||
},
|
||||
function() {
|
||||
$(this).fadeOut('300', function()
|
||||
{
|
||||
$(this).remove();
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
var allotmentTypes = {
|
||||
auto: ALLOTMENT_AUTO,
|
||||
|
||||
@@ -69,11 +69,22 @@
|
||||
<div class="row cart_amt_div">
|
||||
<table class="table table-responsive">
|
||||
<tr>
|
||||
<th colspan="2">{l s='Total Amount (Tax excl.):' mod='hotelreservationsystem'}</th>
|
||||
<th colspan="2" class="text-right" id="cart_total_amt">
|
||||
<td>{l s='Rooms Amount (Tax excl.):' mod='hotelreservationsystem'}</td>
|
||||
<td class="text-right" id="cart_rooms_amount">
|
||||
{if isset($cart_rooms_amount)}{convertPrice price=$cart_rooms_amount}{else}{convertPrice price=0}{/if}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{l s='Convenience Fee (Tax excl.):' mod='hotelreservationsystem'}</td>
|
||||
<td class="text-right" id="cart_convenience_fee">
|
||||
{if isset($cart_amount_convenience_fee)}{convertPrice price=$cart_amount_convenience_fee}{else}{convertPrice price=0}{/if}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{l s='Total Amount (Tax excl.):' mod='hotelreservationsystem'}</th>
|
||||
<th class="text-right" id="cart_total_amt">
|
||||
{if isset($cart_tamount)}{convertPrice price=$cart_tamount}{else}{convertPrice price=0}{/if}
|
||||
</th>
|
||||
<th colspan="1"></th>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
@@ -203,6 +203,7 @@
|
||||
<tr>
|
||||
<th><span class="title_box">{l s='Room No.' mod='hotelreservationsystem'}</span></th>
|
||||
<th><span class="title_box">{l s='Duration' mod='hotelreservationsystem'}</span></th>
|
||||
<th><span class="title_box">{l s='Order' mod='hotelreservationsystem'}</span></th>
|
||||
<th><span class="title_box">{l s='Message' mod='hotelreservationsystem'}</span></th>
|
||||
<th><span class="title_box">{l s='Allotment Type' mod='hotelreservationsystem'}</span></th>
|
||||
<th><span class="title_box">{l s='Reallocate' mod='hotelreservationsystem'}</span></th>
|
||||
@@ -216,6 +217,7 @@
|
||||
<td rowspan="{$booked_v['detail']|count}">{$booked_v['room_num']|escape:'htmlall':'UTF-8'} {hook h='displayRoomNumAfter' data=$booked_v key=$rm_dtl_k type='booked'}</td>
|
||||
{/if}
|
||||
<td>{dateFormat date=date('Y-m-d', strtotime($rm_dtl_v['date_from']))} - {dateFormat date=date('Y-m-d', strtotime($rm_dtl_v['date_to']))}</td>
|
||||
<td><a href="{$link->getAdminLink('AdminOrders')}&id_order={$rm_dtl_v['id_order']|intval}&vieworder" target="_blank">#{$rm_dtl_v['id_order']}</a></td>
|
||||
<td>{$rm_dtl_v['comment']|escape:'htmlall':'UTF-8'}</td>
|
||||
<td>
|
||||
{if $rm_dtl_v['booking_type'] == HotelBookingDetail::ALLOTMENT_AUTO}{l s='Auto Allotment' mod='hotelreservationsystem'}{elseif $rm_dtl_v['booking_type'] == HotelBookingDetail::ALLOTMENT_MANUAL}{l s='Manual Allotment' mod='hotelreservationsystem'}{/if}
|
||||
@@ -242,15 +244,29 @@
|
||||
<thead>
|
||||
<tr>
|
||||
<th><span class="title_box">{l s='Room No.' mod='hotelreservationsystem'}</span></th>
|
||||
<th><span class="title_box">{l s='Status' mod='hotelreservationsystem'}</span></th>
|
||||
<th><span class="title_box">{l s='Duration' mod='hotelreservationsystem'}</span></th>
|
||||
<th><span class="title_box">{l s='Message' mod='hotelreservationsystem'}</span></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{foreach from=$book_v['data']['unavailable'] key=unavai_k item=unavai_v}
|
||||
<tr>
|
||||
<td>{$unavai_v['room_num']|escape:'htmlall':'UTF-8'}</td>
|
||||
<td>{$unavai_v['room_comment']|escape:'htmlall':'UTF-8'}</td>
|
||||
</tr>
|
||||
{foreach from=$unavai_v['detail'] key=rm_dtl_k item=unavail_dtl_v}
|
||||
<tr>
|
||||
{if $unavail_dtl_v@first}
|
||||
<td rowspan="{$unavai_v['detail']|count}">{$unavai_v['room_num']|escape:'htmlall':'UTF-8'}</td>
|
||||
{/if}
|
||||
<td>{HotelRoomInformation::getRoomStatusTitle($unavail_dtl_v['id_status'])|escape:'htmlall':'UTF-8'}</td>
|
||||
<td>
|
||||
{if $unavail_dtl_v['date_from'] && $unavail_dtl_v['date_to']}
|
||||
{dateFormat date=date('Y-m-d', strtotime($unavail_dtl_v['date_from']))} - {dateFormat date=date('Y-m-d', strtotime($unavail_dtl_v['date_to']))}
|
||||
{else}
|
||||
--
|
||||
{/if}
|
||||
</td>
|
||||
<td>{$unavail_dtl_v['room_comment']|escape:'htmlall':'UTF-8'}</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
{/foreach}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
<div class="htl_room_data_cont">
|
||||
<div class="status-info-tooltip" title="{l s='Due to the dynamic nature of room availability, a single room can fall under multiple categories in the stats panel. For example, if a room is booked from 1st to 3th and then marked as unavailable for maintenance on 4th to 5th, it would be counted in both the "Booked Rooms" and "Unavailable Rooms" categories for those respective dates if search is done from 1st to 6th. This allows admin to understand the room\'s status across different periods accurately.' mod='hotelreservationsystem'}">
|
||||
<i class="icon-info-circle"></i>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-sm-6">
|
||||
<div class="row">
|
||||
|
||||
@@ -50,6 +50,28 @@ class QloCleaner extends Module
|
||||
$this->secure_key = Tools::encrypt($this->name);
|
||||
}
|
||||
|
||||
public function install()
|
||||
{
|
||||
if (!parent::install()
|
||||
|| !$this->registerHook('actionAdminControllerSetMedia')
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public function hookActionAdminControllerSetMedia()
|
||||
{
|
||||
if (Tools::getValue('controller') == 'AdminModules'
|
||||
&& Tools::getValue('configure') == $this->name
|
||||
) {
|
||||
Media::addJsDef(array(
|
||||
'confirm_txt' => $this->l('Are you sure, you want to perform the following action?')
|
||||
));
|
||||
$this->context->controller->addJS($this->_path.'views/js/qlocleaner_config.js');
|
||||
}
|
||||
}
|
||||
|
||||
public function getContent()
|
||||
{
|
||||
$html = '<h2>'.$this->l('Be really careful with this tool - There is no possible rollback!').'</h2>';
|
||||
@@ -61,6 +83,7 @@ class QloCleaner extends Module
|
||||
} else {
|
||||
$conf = $this->l('Nothing that need to be fixed please run database cleaning to clean your database');
|
||||
}
|
||||
Hook::exec('actionCleanData', array('method' => 'checkAndFix'));
|
||||
$html .= $this->displayConfirmation($conf);
|
||||
} elseif (Tools::isSubmit('submitCleanAndOptimize')) {
|
||||
$logs = self::cleanAndOptimize();
|
||||
@@ -70,12 +93,15 @@ class QloCleaner extends Module
|
||||
} else {
|
||||
$conf = $this->l('Nothing that need to be cleaned');
|
||||
}
|
||||
Hook::exec('actionCleanData', array('method' => 'cleanAndOptimize'));
|
||||
$html .= $this->displayConfirmation($conf);
|
||||
} elseif (Tools::getValue('submitTruncateCatalog') && Tools::getValue('checkTruncateCatalog')) {
|
||||
self::truncate('catalog');
|
||||
Hook::exec('actionCleanData', array('method' => 'catalog'));
|
||||
$html .= $this->displayConfirmation($this->l('Catalog truncated successfuly, please run functional Integrity constraints to clean the database.'));
|
||||
} elseif (Tools::getValue('submitTruncateSales') && Tools::getValue('checkTruncateSales')) {
|
||||
self::truncate('sales');
|
||||
Hook::exec('actionCleanData', array('method' => 'sales'));
|
||||
$html .= $this->displayConfirmation($this->l('Orders and customers truncated successfuly, please run functional Integrity constraints to clean the database'));
|
||||
}
|
||||
|
||||
@@ -244,6 +270,11 @@ class QloCleaner extends Module
|
||||
}
|
||||
}
|
||||
|
||||
Image::deleteAllImages(_PS_HOTEL_IMG_DIR_);
|
||||
if (!file_exists(_PS_HOTEL_IMG_DIR_)) {
|
||||
mkdir(_PS_HOTEL_IMG_DIR_);
|
||||
}
|
||||
|
||||
// Delete qlo modules's images
|
||||
QcCleanerHelper::deleteFolderImages(
|
||||
_PS_MODULE_DIR_.'wkabouthotelblock/views/img/hotel_interior/'
|
||||
@@ -314,21 +345,6 @@ class QloCleaner extends Module
|
||||
}
|
||||
}
|
||||
|
||||
// Delete Qlo tables
|
||||
$query = 'DELETE FROM `'._DB_PREFIX_.'htl_order_refund_rules`';
|
||||
if (Db::getInstance()->Execute($query)) {
|
||||
if ($affected_rows = Db::getInstance()->Affected_Rows()) {
|
||||
$logs[$query] = $affected_rows;
|
||||
}
|
||||
}
|
||||
|
||||
$query = 'DELETE FROM `'._DB_PREFIX_.'htl_order_refund_rules_lang`';
|
||||
if (Db::getInstance()->Execute($query)) {
|
||||
if ($affected_rows = Db::getInstance()->Affected_Rows()) {
|
||||
$logs[$query] = $affected_rows;
|
||||
}
|
||||
}
|
||||
|
||||
$parents = Db::getInstance()->ExecuteS('SELECT DISTINCT id_parent FROM '._DB_PREFIX_.'tab');
|
||||
foreach ($parents as $parent) {
|
||||
$children = Db::getInstance()->ExecuteS('SELECT id_tab FROM '._DB_PREFIX_.'tab WHERE id_parent = '.(int)$parent['id_parent'].' ORDER BY IF(class_name IN ("AdminHome", "AdminDashboard"), 1, 2), position ASC');
|
||||
@@ -753,12 +769,7 @@ class QloCleaner extends Module
|
||||
'customization_field',
|
||||
'customization_field_lang',
|
||||
'customized_data',
|
||||
'feature',
|
||||
'feature_lang',
|
||||
'feature_product',
|
||||
'feature_shop',
|
||||
'feature_value',
|
||||
'feature_value_lang',
|
||||
'pack',
|
||||
'search_index',
|
||||
'search_word',
|
||||
@@ -778,8 +789,6 @@ class QloCleaner extends Module
|
||||
'htl_branch_info_lang',
|
||||
'htl_image',
|
||||
'htl_branch_features',
|
||||
'htl_features',
|
||||
'htl_features_lang',
|
||||
'htl_advance_payment',
|
||||
'htl_branch_refund_rules',
|
||||
'htl_order_restrict_date',
|
||||
@@ -845,6 +854,8 @@ class QloCleaner extends Module
|
||||
'htl_room_type_service_product_order_detail',
|
||||
'htl_room_type_service_product_cart_detail',
|
||||
'htl_hotel_service_product_cart_detail',
|
||||
'htl_order_refund_rules',
|
||||
'htl_order_refund_rules_lang',
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
29
modules/qlocleaner/views/js/index.php
Normal file
29
modules/qlocleaner/views/js/index.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
/**
|
||||
* Since 2010 Webkul.
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* All right is reserved,
|
||||
* Please go through this link for complete license : https://store.webkul.com/license.html
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade this module to newer
|
||||
* versions in the future. If you wish to customize this module for your
|
||||
* needs please refer to https://store.webkul.com/customisation-guidelines/ for more information.
|
||||
*
|
||||
* @author Webkul IN <support@webkul.com>
|
||||
* @copyright Since 2010 Webkul IN
|
||||
* @license https://store.webkul.com/license.html
|
||||
*/
|
||||
|
||||
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
|
||||
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
|
||||
|
||||
header('Cache-Control: no-store, no-cache, must-revalidate');
|
||||
header('Cache-Control: post-check=0, pre-check=0', false);
|
||||
header('Pragma: no-cache');
|
||||
|
||||
header('Location: ../');
|
||||
exit;
|
||||
24
modules/qlocleaner/views/js/qlocleaner_config.js
Normal file
24
modules/qlocleaner/views/js/qlocleaner_config.js
Normal file
@@ -0,0 +1,24 @@
|
||||
/**
|
||||
* Since 2010 Webkul.
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* All right is reserved,
|
||||
* Please go through this link for complete license : https://store.webkul.com/license.html
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade this module to newer
|
||||
* versions in the future. If you wish to customize this module for your
|
||||
* needs please refer to https://store.webkul.com/customisation-guidelines/ for more information.
|
||||
*
|
||||
* @author Webkul IN <support@webkul.com>
|
||||
* @copyright Since 2010 Webkul IN
|
||||
* @license https://store.webkul.com/license.html
|
||||
*/
|
||||
|
||||
$(document).ready(function () {
|
||||
$('#module_form').on('submit', function() {
|
||||
return confirm(confirm_txt);
|
||||
})
|
||||
});
|
||||
@@ -134,6 +134,20 @@ class QhrHotelReviewDb
|
||||
);
|
||||
}
|
||||
|
||||
public static function truncateUserData()
|
||||
{
|
||||
$userTables = array('qhr_hotel_review',
|
||||
'qhr_review_category_rating',
|
||||
'qhr_review_usefulness',
|
||||
'qhr_review_report',
|
||||
'qhr_review_reply'
|
||||
);
|
||||
foreach ($userTables as $table) {
|
||||
DB::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.bqSQL($table).'`');
|
||||
}
|
||||
QhrHotelReview::cleanImagesDirectory();
|
||||
}
|
||||
|
||||
public static function getModuleDefaultConfig()
|
||||
{
|
||||
return array(
|
||||
|
||||
@@ -72,6 +72,7 @@ class QloHotelReview extends Module
|
||||
'displayBookingAction',
|
||||
'displayBackOfficeHeader',
|
||||
'displayAdminAfterHeader',
|
||||
'actionCleanData',
|
||||
)
|
||||
);
|
||||
}
|
||||
@@ -279,6 +280,13 @@ class QloHotelReview extends Module
|
||||
return $this->display(__FILE__, 'product-tab-content.tpl');
|
||||
}
|
||||
|
||||
public function hookActionCleanData($params)
|
||||
{
|
||||
if ($params['method'] == 'catalog' || $params['method'] == 'sales') {
|
||||
QhrHotelReviewDb::truncateUserData();
|
||||
}
|
||||
}
|
||||
|
||||
public function installModuleTabs()
|
||||
{
|
||||
$tabs = array(
|
||||
|
||||
@@ -271,9 +271,15 @@
|
||||
margin-right: 5px;
|
||||
}
|
||||
|
||||
#hotel-reviews .review-sort-by-container {
|
||||
display: inline-block;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
#hotel-reviews .review-sort-by button {
|
||||
text-align: left;
|
||||
min-width: 170px;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
#hotel-reviews .dropdown-menu {
|
||||
@@ -285,3 +291,12 @@
|
||||
top: 15px;
|
||||
right: 12px;
|
||||
}
|
||||
|
||||
#hotel-reviews.rtl .sort-by {
|
||||
margin-left: 5px;
|
||||
margin-right: unset;
|
||||
}
|
||||
|
||||
#hotel-reviews.rtl [class*=col]{
|
||||
float: right !important;
|
||||
}
|
||||
@@ -23,17 +23,19 @@
|
||||
<div class="">
|
||||
<div class="dropdown review-sort-by">
|
||||
<label class="sort-by">{l s='SORT BY' mod='qlohotelreview'}</label>
|
||||
<button class="btn btn-default dropdown-toggle" type="button" data-toggle="dropdown" data-value="{QhrHotelReview::QHR_SORT_BY_TIME_NEW}">
|
||||
<span>{l s='Newest First' mod='qlohotelreview'}</span>
|
||||
<span class="caret"></span>
|
||||
</button>
|
||||
<ul class="dropdown-menu text-left">
|
||||
<li><a class="sort-by-option" data-id-hotel="{$id_hotel}" data-value="{QhrHotelReview::QHR_SORT_BY_RELEVANCE}" href="#">{l s='Most Relevant' mod='qlohotelreview'}</a></li>
|
||||
<li><a class="sort-by-option" data-id-hotel="{$id_hotel}" data-value="{QhrHotelReview::QHR_SORT_BY_TIME_NEW}" href="#">{l s='Newest First' mod='qlohotelreview'}</a></li>
|
||||
<li><a class="sort-by-option" data-id-hotel="{$id_hotel}" data-value="{QhrHotelReview::QHR_SORT_BY_TIME_OLD}" href="#">{l s='Oldest First' mod='qlohotelreview'}</a></li>
|
||||
<li><a class="sort-by-option" data-id-hotel="{$id_hotel}" data-value="{QhrHotelReview::QHR_SORT_BY_RATING_HIGH}" href="#">{l s='Positive First' mod='qlohotelreview'}</a></li>
|
||||
<li><a class="sort-by-option" data-id-hotel="{$id_hotel}" data-value="{QhrHotelReview::QHR_SORT_BY_RATING_LOW}" href="#">{l s='Negative First' mod='qlohotelreview'}</a></li>
|
||||
</ul>
|
||||
<div class="review-sort-by-container">
|
||||
<button class="btn btn-default dropdown-toggle" type="button" data-toggle="dropdown" data-value="{QhrHotelReview::QHR_SORT_BY_TIME_NEW}">
|
||||
<span>{l s='Newest First' mod='qlohotelreview'}</span>
|
||||
<span class="caret"></span>
|
||||
</button>
|
||||
<ul class="dropdown-menu text-left">
|
||||
<li><a class="sort-by-option" data-id-hotel="{$id_hotel}" data-value="{QhrHotelReview::QHR_SORT_BY_RELEVANCE}" href="#">{l s='Most Relevant' mod='qlohotelreview'}</a></li>
|
||||
<li><a class="sort-by-option" data-id-hotel="{$id_hotel}" data-value="{QhrHotelReview::QHR_SORT_BY_TIME_NEW}" href="#">{l s='Newest First' mod='qlohotelreview'}</a></li>
|
||||
<li><a class="sort-by-option" data-id-hotel="{$id_hotel}" data-value="{QhrHotelReview::QHR_SORT_BY_TIME_OLD}" href="#">{l s='Oldest First' mod='qlohotelreview'}</a></li>
|
||||
<li><a class="sort-by-option" data-id-hotel="{$id_hotel}" data-value="{QhrHotelReview::QHR_SORT_BY_RATING_HIGH}" href="#">{l s='Positive First' mod='qlohotelreview'}</a></li>
|
||||
<li><a class="sort-by-option" data-id-hotel="{$id_hotel}" data-value="{QhrHotelReview::QHR_SORT_BY_RATING_LOW}" href="#">{l s='Negative First' mod='qlohotelreview'}</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
* @license LICENSE.txt
|
||||
*}
|
||||
|
||||
<div id="hotel-reviews" class="tab-pane card">
|
||||
<div id="hotel-reviews" class="tab-pane card {if isset($language_is_rtl) && $language_is_rtl} rtl {/if}">
|
||||
{if is_array($reviews) && count($reviews)}
|
||||
{include file='./_partials/review-summary.tpl'}
|
||||
{include file='./_partials/media-list.tpl'}
|
||||
|
||||
@@ -56,4 +56,11 @@ class WkHotelRoomDb
|
||||
`'._DB_PREFIX_.'htl_room_block_data`;
|
||||
');
|
||||
}
|
||||
|
||||
public static function truncateTables()
|
||||
{
|
||||
return DB::getInstance()->execute(
|
||||
'TRUNCATE TABLE `'._DB_PREFIX_.'htl_room_block_data`;
|
||||
');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,14 +65,32 @@ class WkHotelRoom extends Module
|
||||
ImageType::getFormatedName('large')
|
||||
);
|
||||
}
|
||||
$productPriceWithoutReduction = $product->getPriceWithoutReduct(!$useTax, false, 6, 1);
|
||||
$productPriceWithoutReduction = HotelRoomTypeFeaturePricing::getRoomTypeTotalPrice(
|
||||
$idProduct,
|
||||
$dateFrom,
|
||||
$dateTo,
|
||||
$useTax,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
0
|
||||
);
|
||||
|
||||
if ($useTax) {
|
||||
$priceWithoutReduction = $productPriceWithoutReduction['total_price_tax_incl'];
|
||||
} else {
|
||||
$priceWithoutReduction = $productPriceWithoutReduction['total_price_tax_excl'];
|
||||
}
|
||||
|
||||
$product_price = Product::getPriceStatic($idProduct, $useTax);
|
||||
$htlRoom['image'] = $prodImg;
|
||||
$htlRoom['description'] = $product->description_short;
|
||||
$htlRoom['name'] = $product->name;
|
||||
$htlRoom['show_price'] = $product->show_price;
|
||||
$htlRoom['price'] = $product_price;
|
||||
$htlRoom['price_without_reduction'] = $productPriceWithoutReduction;
|
||||
$htlRoom['price_without_reduction'] = $priceWithoutReduction;
|
||||
$featurePrice = HotelRoomTypeFeaturePricing::getRoomTypeFeaturePricesPerDay(
|
||||
$idProduct,
|
||||
$dateFrom,
|
||||
@@ -80,7 +98,7 @@ class WkHotelRoom extends Module
|
||||
$useTax
|
||||
);
|
||||
$htlRoom['feature_price'] = $featurePrice;
|
||||
$htlRoom['feature_price_diff'] = (float)($productPriceWithoutReduction - $featurePrice);
|
||||
$htlRoom['feature_price_diff'] = (float)($priceWithoutReduction - $featurePrice);
|
||||
}
|
||||
}
|
||||
$this->context->smarty->assign(
|
||||
@@ -141,6 +159,13 @@ class WkHotelRoom extends Module
|
||||
}
|
||||
}
|
||||
|
||||
public function hookActionCleanData($params)
|
||||
{
|
||||
if ($params['method'] == 'catalog') {
|
||||
WkHotelRoomDb::truncateTables();
|
||||
}
|
||||
}
|
||||
|
||||
public function callInstallTab()
|
||||
{
|
||||
//Controllers which are to be used in this modules but we have not to create tab for those controllers...
|
||||
@@ -198,7 +223,8 @@ class WkHotelRoom extends Module
|
||||
'actionProductDelete',
|
||||
'displayFooterExploreSectionHook',
|
||||
'actionProductSave',
|
||||
'actionObjectLanguageAddAfter'
|
||||
'actionObjectLanguageAddAfter',
|
||||
'actionCleanData',
|
||||
)
|
||||
);
|
||||
}
|
||||
@@ -220,7 +246,7 @@ class WkHotelRoom extends Module
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public function deleteConfigKeys()
|
||||
{
|
||||
$configVars = array(
|
||||
|
||||
@@ -41,6 +41,12 @@
|
||||
border-top: 0;
|
||||
box-shadow: 0 4px 5px rgba(0, 0, 0, 0.15);
|
||||
}
|
||||
.rtl .chosen-container .chosen-drop {
|
||||
right: -9999px;
|
||||
}
|
||||
.rtl .chosen-container.chosen-with-drop .chosen-drop {
|
||||
right: 0;
|
||||
}
|
||||
.chosen-container.chosen-container-single-nosearch .chosen-drop {
|
||||
top: 100%;
|
||||
}
|
||||
@@ -173,6 +179,10 @@
|
||||
left: -9999px;
|
||||
}
|
||||
|
||||
.rtl .chosen-container-single.chosen-container-single-nosearch .chosen-search {
|
||||
display:none;
|
||||
}
|
||||
|
||||
/* @end */
|
||||
/* @group Results */
|
||||
.chosen-container .chosen-results {
|
||||
|
||||
@@ -215,9 +215,7 @@
|
||||
border-radius: 4px;}
|
||||
.submit_occupancy_btn {
|
||||
background-color: #1292FF;
|
||||
font-size: 13px;
|
||||
border: none;
|
||||
padding: 5px 20px;
|
||||
border-radius: 4px;}
|
||||
|
||||
|
||||
@@ -229,7 +227,7 @@
|
||||
overflow: auto;
|
||||
box-shadow: 0 8px 25px -4px rgba(0,0,0,0.39);
|
||||
left: 0px;
|
||||
padding: 12px 20px;}
|
||||
padding: 15px 20px;}
|
||||
#search_occupancy_wrapper.top {
|
||||
top: unset;
|
||||
bottom: 100%; }
|
||||
@@ -253,8 +251,11 @@
|
||||
font-weight: bold;
|
||||
text-decoration: none;
|
||||
font-size: 14px;
|
||||
color: #0000FF;
|
||||
line-height: 24px;}
|
||||
color: #0000FF;}
|
||||
#search_occupancy_wrapper .occupancy_block_actions {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;}
|
||||
#search_occupancy_wrapper .add_new_occupancy_btn:active, #search_occupancy_wrapper .add_new_occupancy_btn:focus, #search_occupancy_wrapper .add_new_occupancy_btn:hover {
|
||||
text-decoration: none;
|
||||
color: #0000FF;}
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
<input type="hidden" id="max_order_date" name="max_order_date" value="{if isset($max_order_date)}{$max_order_date|escape:'htmlall':'UTF-8'}{/if}">
|
||||
<input type="hidden" id="preparation_time" name="preparation_time" value="{if isset($preparation_time)}{$preparation_time|escape:'htmlall':'UTF-8'}{/if}">
|
||||
|
||||
<div class="hotel-selector-wrap">
|
||||
<div class="hotel-selector-wrap {if isset($language_is_rtl) && $language_is_rtl}rtl{/if}">
|
||||
<select name="id_hotel" class="chosen header-rmsearch-input" data-placeholder="{l s='Select Hotel' mod='wkroomsearchblock'}" id="id_hotel_button">
|
||||
<option value=""></option>
|
||||
{foreach $hotels_info as $name_val}
|
||||
@@ -210,12 +210,12 @@
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
<div>
|
||||
<div class="occupancy_block_actions">
|
||||
<span id="add_new_occupancy">
|
||||
<a class="add_new_occupancy_btn" href="#"><i class="icon-plus"></i> <span>{l s='Add Room' mod='wkroomsearchblock'}</span></a>
|
||||
</span>
|
||||
<span>
|
||||
<button class="submit_occupancy_btn btn btn btn-primary pull-right">{l s='Done' mod='wkroomsearchblock'}</button>
|
||||
<button class="submit_occupancy_btn btn btn-primary">{l s='Done' mod='wkroomsearchblock'}</button>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user