Merge branch 'develop' into gli-1916

This commit is contained in:
vishalsingh.qlo325
2024-09-12 11:16:44 +05:30
15 changed files with 1398 additions and 405 deletions

View File

@@ -1,2 +1,117 @@
#leave_bprice
margin-left: 0px
#deactiveDatesModal
.fc-popover-body .fc-daygrid-event-harness
.fc-event-end, .fc-event-start
margin-left: unset
margin-right: unset
.fc-popover.fc-more-popover
max-width: 450px
.fc-daygrid-event
box-shadow: 0px 1px 2px 0px rgba(171, 171, 171, 0.3)
border-radius: 4px
.fc-daygrid-day-bg
min-height: 40px
.fc-h-event.fc-event
border-color: #FFFFFF
background: #FFFFFF
.fc-h-event .fc-event-main
color: #333333
.fc-h-event.fc-event.calendar_hover_highlight
border-color: #CAE4FF
background: #CAE4FF
.fc-event-title-container
cursor: pointer
padding: 4px
.highlight-event-day
background: #F5F5F5
.fc-event-title
text-overflow: ellipsis
white-space: nowrap
max-width: 65%
overflow: hidden
padding-left: 10px
.event_title_container, .fc-popover-body .fc-event-title
border-left: 2px solid red
#disable_dates_form
.date_from_container, .date_to_container
.ui-datepicker
position: absolute
top: 62px
left: 5px
position: relative
textarea
border-radius: 4px
.form-group
.control-label
margin-bottom: 5px
.btn
border-radius: 5px
.modal-title
.add_disable_dates, .close
margin-right: 10px
.remove_disable_dates
margin-right: 20px
.close
line-height: 2
.disable_dates_title
.disable_dates_room_num
color: grey
display: inline-block
font-weight: 600
line-height: 2
.delete_disable_dates
margin-left: 10px
.delete_disable_dates:hover , .edit_disable_dates:hover
cursor: pointer
.tooltip_info_block
.tooltip_title
margin: 10px 5px
font-weight: 600
min-width: 340px
.tooltip_container
.tooltip_title
.close
opacity: 0.6
padding-bottom: 5px
font-weight: 600
.tooltip_label
font-weight: 400
color: #888888
margin-bottom: 5px
.tooltip_event_title
border: 1px solid #D9D9D9
border-radius: 6px
padding: 5px 10px
.tooltip_content
.tooltip_reason
word-wrap: break-word
max-height: 200px
overflow: auto
.tooltip_reason_container, .id_event
margin-top: 10px
&> div
display: inline-block
.row
margin-left: 0
margin-right: 0
ul.disable_dates_actions
.btn
text-align: left
display: block
border: none
padding-left: 0
margin-bottom: 0
list-style-type: none
font-size: 14px
z-index: 99999
position: absolute
min-width: 450px
max-width: 450px
background: #fff
box-shadow: 0 8px 25px -2px rgba(0,0,0,0.20)
padding: 15px
border-radius: 6px
.tooltip_action_block
min-width: unset

View File

@@ -137,6 +137,23 @@ body
padding-right: 8px
.form-group
margin-bottom: 8px
#page-loader
position: fixed
display: none
inset: 0
z-index: 10000
background-color: rgba(0, 0, 0, 0.5)
span
position: absolute
inset: 0
display: flex
justify-content: center
align-items: center
i
color: #fff
font-size: 50px
//data-focus
.data-focus

View File

@@ -124,3 +124,25 @@ html
ul#ellipsis_submenu
left: 0
right: unset
#deactiveDatesModal
.tooltip_container
.disable_dates_actions
.btn
text-align: right !important
padding-inline-start: unset
.fc-event-title
border-left: unset !important
border-right: 2px solid red !important
padding-right: 10px !important
padding-left: unset !important
.delete_disable_dates
margin-left: unset !important
margin-right: 10px
.remove_disable_dates
margin-right: 10px !important
margin-left: 20px
.alert.alert-danger
text-align: right !important
.error_message_label
float: right !important

View File

@@ -57,9 +57,11 @@
{if $service['allow_multiple_quantity']}
<div class="qty_container">
<input type="number" class="form-control qty" min="1" data-id_product="{$service['id_product']|escape:'html':'UTF-8'}" value="{$service['quantity']|escape:'html':'UTF-8'}">
<p style="display:{if $service['quantity'] > $service['max_quantity']}block{else}none{/if}; margin-top: 4px;">
<span class="label label-warning">{l s='Maximum allowed quantity: %s' sprintf=$service['max_quantity']}</span>
</p>
{if $service['max_quantity']}
<p style="display:{if $service['quantity'] > $service['max_quantity']}block{else}none{/if}; margin-top: 4px;">
<span class="label label-warning">{l s='Maximum allowed quantity: %s' sprintf=$service['max_quantity']}</span>
</p>
{/if}
</div>
{else}
--

View File

@@ -17,21 +17,17 @@
* @license LICENSE.txt
*}
{l s='This room already has bookings for highlighted date range(s):'}
<table width="70%">
<tr>
<th class="text-center">{l s='Order ID'}</th>
<th class="text-center">{l s='Date From'}</th>
<th class="text-center">{l s='Date To'}</th>
</tr>
{foreach from=$booked_rows_list item=booked_row}
<tr>
<td class="text-center">
<a href="{$link->getAdminLink('AdminOrders')}&id_order={$booked_row->id_order}&vieworder" target="_blank"><strong>#{$booked_row->id_order|intval}</strong></a>
</td>
<td class="text-center">{dateFormat date=$booked_row->date_from}</td>
<td class="text-center">{dateFormat date=$booked_row->date_to}</td>
</tr>
{/foreach}
</table>
{l s='This room already has a booking for the selected date range.'}
<div class="row">
<div class="col-xs-12">
<span class="error_message_label">{l s='Order ID'}:</span> <a href="{$link->getAdminLink('AdminOrders')}&id_order={$orderDetails->id_order}&vieworder" target="_blank"><strong>#{$orderDetails->id_order|intval}</strong></a>
</div>
<div class="col-xs-12">
<span class="error_message_label">{l s='Date From'}:</span> {dateFormat date=$orderDetails->date_from}
</div>
<div class="col-xs-12">
<span class="error_message_label">{l s='Date To'}:</span> {dateFormat date=$orderDetails->date_to}
</div>
<div>
</div>
</div>

View File

@@ -371,3 +371,4 @@
<div id="main">
<div id="content" class="{if !$bootstrap}nobootstrap{else}bootstrap{/if}">
{/if}
<div id="page-loader"><span><i class="icon-refresh icon-spin icon-fw"></i></span></div>

View File

@@ -3299,10 +3299,12 @@ class ProductCore extends ObjectModel
);
}
if (isset($priceForRoomInfo) && isset($priceForRoomInfo['price'])) {
$price = (float)$priceForRoomInfo['price'];
} elseif (!$specific_price || $specific_price['price'] < 0) {
$price = (float)$result['price'];
if (!$specific_price || $specific_price['price'] < 0) {
if (isset($priceForRoomInfo) && isset($priceForRoomInfo['price'])) {
$price = (float)$priceForRoomInfo['price'];
} else {
$price = (float)$result['price'];
}
} else {
$price = (float)$specific_price['price'];
}

View File

@@ -2938,7 +2938,8 @@ class AdminControllerCore extends Controller
'current' => self::$currentIndex,
'token' => $this->token,
'host_mode' => defined('_PS_HOST_MODE_') ? 1 : 0,
'stock_management' => (int)Configuration::get('PS_STOCK_MANAGEMENT')
'stock_management' => (int)Configuration::get('PS_STOCK_MANAGEMENT'),
'language_is_rtl' => $this->context->language->is_rtl
));
if ($this->display_header) {

View File

@@ -4994,7 +4994,7 @@ class AdminOrdersControllerCore extends AdminController
&& count($orderServiceProduct['additional_services'])
) {
foreach ($orderServiceProduct['additional_services'] as $serviceProduct) {
if (Product::getProductPriceCalculation($serviceProduct['id_product']) == Product::PRICE_CALCULATION_METHOD_PER_DAY) {
if ($serviceProduct['price_calculation_method'] == Product::PRICE_CALCULATION_METHOD_PER_DAY) {
$newNumDays = HotelHelper::getNumberOfDays($new_date_from, $new_date_to);
$objRoomTypeServiceProductOrderDetail = new RoomTypeServiceProductOrderDetail((int) $serviceProduct['id_room_type_service_product_order_detail']);
$unitPriceTaxExcl = $objRoomTypeServiceProductOrderDetail->unit_price_tax_excl;

View File

@@ -502,6 +502,9 @@ class AdminProductsControllerCore extends AdminController
$this->addJs(__PS_BASE_URI__.$this->admin_webpath.'/themes/'.$bo_theme.'/js/jquery.fileupload-validate.js');
$this->addJs(__PS_BASE_URI__.'js/vendor/spin.js');
$this->addJs(__PS_BASE_URI__.'js/vendor/ladda.js');
$this->addCSS(_PS_JS_DIR_.'fullcalendar/main.css');
$this->addJs(_PS_JS_DIR_.'fullcalendar/main.js');
$this->addJS(_PS_JS_DIR_.'/datatable/jquery.dataTables.min.js');
$this->addJS(_PS_JS_DIR_.'/datatable/dataTables.bootstrap.js');
}
@@ -2964,8 +2967,8 @@ class AdminProductsControllerCore extends AdminController
$room['booked_dates'] = json_encode($bookedDates);
if ($room['id_status'] == HotelRoomInformation::STATUS_TEMPORARY_INACTIVE) {
$disabledDates = $objRoomDisableDates->getRoomDisableDates($room['id']);
$room['disable_dates_json'] = json_encode($disabledDates);
$disableDates = $objRoomDisableDates->getRoomDisableDates($room['id']);
$room['disable_dates_json'] = json_encode($disableDates);
}
}
$data->assign('htl_room_info', $hotelRoomInfo);
@@ -2977,6 +2980,7 @@ class AdminProductsControllerCore extends AdminController
'product' => $obj,
'htl_info' => $hotelInfo,
'rm_status' => $roomStatus,
'locale' => $this->context->language->iso_code
)
);
} else {
@@ -3461,50 +3465,6 @@ class AdminProductsControllerCore extends AdminController
}
}
public function validateDisableDateRanges($disableDates, $roomIndex, $idRoom)
{
if (is_array($disableDates) && count($disableDates)) {
foreach ($disableDates as $disable_key => $disableDate) {
if (!$disableDate['date_to'] && !$disableDate['date_from']) {
unset($disableDates[$disable_key]);
} elseif (!Validate::isDate($disableDate['date_from']) || !Validate::isDate($disableDate['date_to'])) {
$this->errors[] = sprintf(
Tools::displayError('Please add valid disable dates for room %s.'),
$roomIndex
);
} elseif (($disableDate['date_from'] && !$disableDate['date_to']) || (!$disableDate['date_from'] && $disableDate['date_to'])) {
$this->errors[] = sprintf(
Tools::displayError('Please fill date from and date to for disable dates for room %s.'),
$roomIndex
);
} else {
$objHotelBookingDetail = new HotelBookingDetail();
foreach ($disableDates as $key => $disDate) {
if ($key != $disable_key) {
if ((($disableDate['date_from'] < $disDate['date_from']) && ($disableDate['date_to'] <= $disDate['date_from'])) || (($disableDate['date_from'] > $disDate['date_from']) && ($disableDate['date_from'] >= $disDate['date_to']))) {
// continue
} else {
$this->errors[] = sprintf(
Tools::displayError('Disable dates are conflicting for room %s. Please add non-conflicting dates.'),
$roomIndex
);
}
}
// check if room has booking for current date range
if ($objHotelBookingDetail->chechRoomBooked($idRoom, $disDate['date_from'], $disDate['date_to'])) {
$this->errors[] = sprintf(
Tools::displayError('The room %s already has bookings for selected disable dates. Please reselect disable dates.'),
$roomIndex
);
}
}
}
}
} else {
$this->errors[] = sprintf(Tools::displayError('Please add disable dates for room %s.'), $roomIndex);
}
}
public function processConfiguration()
{
// Check if save of configuration tab is submitted
@@ -3536,31 +3496,12 @@ class AdminProductsControllerCore extends AdminController
$objHotelRoomInfo->id_status = $roomInfo['id_status'];
$objHotelRoomInfo->floor = $roomInfo['floor'];
$objHotelRoomInfo->comment = $roomInfo['comment'];
if ($objHotelRoomInfo->save()) {
$idRoom = $objHotelRoomInfo->id;
if ($roomInfo['id_status'] == HotelRoomInformation::STATUS_TEMPORARY_INACTIVE) {
$objHotelRoomDisableDates = new HotelRoomDisableDates();
$objHotelRoomDisableDates->deleteRoomDisableDates($idRoom);
$disableDates = json_decode($roomInfo['disable_dates_json'], true);
foreach ($disableDates as $disableDate) {
$objHotelRoomDisableDates = new HotelRoomDisableDates();
$objHotelRoomDisableDates->id_room_type = $id_product;
$objHotelRoomDisableDates->id_room = $idRoom;
$objHotelRoomDisableDates->date_from = $disableDate['date_from'];
$objHotelRoomDisableDates->date_to = $disableDate['date_to'];
$objHotelRoomDisableDates->reason = $disableDate['reason'];
$objHotelRoomDisableDates->add();
}
Hook::exec(
'actionRoomDisableDatesAddAfter',
array(
'room_info' => $roomInfo,
'disable_dates' => $disableDates
)
);
}
if ($objHotelRoomInfo->save()
&& $objHotelRoomInfo->id_status != HotelRoomInformation::STATUS_TEMPORARY_INACTIVE
) {
// directly deleting the dates since we are validating the dates using hooks before this.
$objRoomDisableDates = new HotelRoomDisableDates();
$objRoomDisableDates->deleteRoomDisableDates($objHotelRoomInfo->id);
}
}
}
@@ -3597,7 +3538,6 @@ class AdminProductsControllerCore extends AdminController
if ($roomInfo['floor'] && !Validate::isGenericName($roomInfo['floor'])) {
$this->errors[] = sprintf(Tools::displayError('Invalid floor for room %s.'), $roomIndex);
}
if ($roomInfo['id_status'] == HotelRoomInformation::STATUS_INACTIVE) {
$objHotelRoomInformation = new HotelRoomInformation();
if (count($objHotelRoomInformation->getFutureBookings($roomInfo['id']))) {
@@ -3605,10 +3545,13 @@ class AdminProductsControllerCore extends AdminController
}
} elseif ($roomInfo['id_status'] == HotelRoomInformation::STATUS_TEMPORARY_INACTIVE) {
$disableDates = json_decode($roomInfo['disable_dates_json'], true);
if ($roomInfo['disable_dates_json'] !== 0) {
$this->validateDisableDateRanges($disableDates, $roomInfo['room_num'], $roomInfo['id']);
if (!is_array($disableDates)
|| !count($disableDates)
) {
$this->errors[] = sprintf(Tools::displayError('Please add disable dates for room %s.'), $roomIndex);
}
}
Hook::exec('actionValidateRoomInformation', array('room_information', $roomInfo));
}
} else {
$this->errors[] = Tools::displayError('Please add at least one room.');
@@ -5024,76 +4967,196 @@ class AdminProductsControllerCore extends AdminController
die(json_encode($response));
}
public function ajaxProcessValidateDisableDates()
public function assignAlerts()
{
$this->context->smarty->assign(array(
'errors' => $this->errors,
'confirmations' => $this->confirmations,
'warnings' => $this->warnings
));
}
public function ajaxProcessSubmitDisableDates()
{
$response = array('status' => false);
$idRoom = (int) Tools::getValue('id_room');
$disableDates = Tools::getValue('disable_dates');
$dateFrom = Tools::getValue('date_from');
$dateTo = Tools::getValue('date_to');
$idProduct = Tools::getValue('id_product');
if (!Validate::isDate($dateFrom) || !Validate::isDate($dateTo)) {
$this->errors[] = $this->l('Please select a valid date range to temporary disable this room');
} else if ($idRoom && Validate::isLoadedObject($objHotelRoomInfo = new HotelRoomInformation((int) $idRoom))) {
$dateTo = date('Y-m-d', strtotime($dateTo));
$objHotelBookingDetail = new HotelBookingDetail();
if ($bookingRow = $objHotelBookingDetail->chechRoomBooked($idRoom, $dateFrom, $dateTo)) {
$orderDetails = new HotelBookingDetail($bookingRow['id']);
$this->context->smarty->assign(array(
'link' => $this->context->link,
'orderDetails' => $orderDetails,
));
$rowsToHighlight = array();
$bookedRows = array();
if (is_array($disableDates) && count($disableDates)) {
foreach ($disableDates as $key => $dateRange) {
if (!Validate::isDate($dateRange['date_from']) || !Validate::isDate($dateRange['date_to'])) {
$this->errors[] = $this->l('Some dates are missing. Please select all the date ranges.');
$rowsToHighlight[] = $key;
$this->errors[] = $this->context->smarty->fetch('controllers/products/booked_room_date_ranges_list.tpl');
} else {
if (!Tools::getValue('id_disable_date')
|| !Validate::isLoadedObject($objHotelRoomDisableDates = new HotelRoomDisableDates((int) Tools::getValue('id_disable_date')))
) {
$objHotelRoomDisableDates = new HotelRoomDisableDates();
$objHotelRoomDisableDates->id_room_type = $idProduct;
$objHotelRoomDisableDates->id_room = $idRoom;
}
}
if (!count($this->errors)) {
foreach ($disableDates as $keyOuter => $dateRangeOuter) {
foreach ($disableDates as $keyInner => $dateRangeInner) {
if ($keyInner != $keyOuter) {
if ((($dateRangeOuter['date_from'] >= $dateRangeInner['date_from']) && ($dateRangeOuter['date_from'] < $dateRangeInner['date_to']))
|| (($dateRangeInner['date_from'] >= $dateRangeOuter['date_from']) && ($dateRangeInner['date_from'] < $dateRangeOuter['date_to']))
) {
$this->errors[] = $this->l('Some dates are conflicting with each other. Please check and reselect the date ranges.');
$rowsToHighlight[] = $keyOuter;
$rowsToHighlight[] = $keyInner;
}
}
}
}
}
if (!count($this->errors)) {
if ($idRoom) {
$objHotelBookingDetail = new HotelBookingDetail();
foreach ($disableDates as $key => $dateRange) {
if ($bookingRow = $objHotelBookingDetail->chechRoomBooked($idRoom, $dateRange['date_from'], $dateRange['date_to'])) {
$bookedRows[] = new HotelBookingDetail($bookingRow['id']);
$rowsToHighlight[] = $key;
}
$objHotelRoomDisableDates->date_from = $dateFrom;
$objHotelRoomDisableDates->date_to = $dateTo;
$objHotelRoomDisableDates->reason = trim(Tools::getValue('reason'));
$objHotelRoomInfo->id_status = HotelRoomInformation::STATUS_TEMPORARY_INACTIVE;
if ($objHotelRoomInfo->save()
&& $objHotelRoomDisableDates->save()
) {
$response['id_disable_date'] = $objHotelRoomDisableDates->id;
$response['event_title'] = $this->l('Disabled');
if (Tools::getValue('id_disable_date')) {
$this->confirmations[] = $this->l('Successfully updated.');
} else {
$this->confirmations[] = $this->l('Disable date added successfully.');
}
} else {
$this->errors[] = Tools::displayError('An error occurred while trying to save the disable dates.');
}
}
} else if (!$idRoom) {
$this->errors[] = Tools::displayError('You need to save this room first before adding any disabled dates.');
}
if (count($bookedRows)) {
$this->context->smarty->assign(array(
'link' => $this->context->link,
'booked_rows_list' => $bookedRows,
));
$this->errors[] = $this->context->smarty->fetch('controllers/products/booked_room_date_ranges_list.tpl');
}
$this->errors = array_unique($this->errors);
$rowsToHighlight = array_values(array_unique($rowsToHighlight));
if (!count($this->errors)) {
$response['status'] = true;
} else {
$this->context->smarty->assign(array(
'errors' => $this->errors,
));
$response['errors'] = $this->context->smarty->fetch('alerts.tpl');
$response['rows_to_highlight'] = $rowsToHighlight;
if ($this->errors) {
$this->errors = array_unique($this->errors);
$response['status'] = false;
} else {
$response['status'] = true;
}
$this->assignAlerts();
$response['msg'] = $this->context->smarty->fetch('alerts.tpl');
$this->ajaxDie(json_encode($response));
}
public function ajaxProcessRemoveDisableDatesInDateRange()
{
$response = array('status' => false);
$idRoom = (int) Tools::getValue('id_room');
$dateFrom = date('Y-m-d', strtotime(Tools::getValue('date_from')));
$dateTo = date('Y-m-d', strtotime(Tools::getValue('date_to')));
if (!Tools::getValue('date_from') || !Tools::getValue('date_to')) {
$this->errors[] = Tools::displayError('Please select valid date range.');
} else {
$objRoomDisableDates = new HotelRoomDisableDates();
$params = array(
'date_from' => $dateFrom,
'date_to' => $dateTo,
'id_room' => $idRoom
);
Hook::exec('actionRoomDisableDatesRemoveBefore', array('disable_dates', $params));
if (empty($this->errors)
&& ($disableDates = $objRoomDisableDates->checkIfRoomAlreadyDisabled($params))
) {
$newDates = array();
foreach ($disableDates as $disableDatesInfo) {
$objRoomDisableDates = new HotelRoomDisableDates($disableDatesInfo['id']);
$newDates[0]['date_from'] = $disableDatesInfo['date_from'];
$newDates[0]['date_to'] = $params['date_from'];
$newDates[1]['date_from'] = $params['date_to'];
$newDates[1]['date_to'] = date('Y-m-d', strtotime($disableDatesInfo['date_to']));
if (strtotime($newDates[0]['date_from']) >= strtotime($newDates[0]['date_to'])) {
unset($newDates[0]);
}
if (strtotime($newDates[1]['date_from']) >= strtotime($newDates[1]['date_to'])) {
unset($newDates[1]);
}
foreach ($newDates as $newDate) {
$objNewDisableDates = new HotelRoomDisableDates();
$objNewDisableDates->id_room_type = $objRoomDisableDates->id_room_type;
$objNewDisableDates->id_room = $objRoomDisableDates->id_room;
$objNewDisableDates->date_from = $newDate['date_from'];
$objNewDisableDates->date_to = $newDate['date_to'];
$objNewDisableDates->reason = $objRoomDisableDates->reason;
$objNewDisableDates->save();
}
$objRoomDisableDates->delete();
}
} else if (!$disableDates) {
$this->errors[] = Tools::displayError('Room is not disabled for the selected date range.');
}
}
if (count($this->errors)) {
$response['status'] = false;
} else {
$response['status'] = true;
$this->confirmations[] = $this->l('Removed successfully.');
if (!($disableDates = $objRoomDisableDates->getRoomDisableDates($idRoom))) {
$objRoomInfo = new HotelRoomInformation($idRoom);
$objRoomInfo->id_status = HotelRoomInformation::STATUS_ACTIVE;
$objRoomInfo->save();
}
$response['disable_dates'] = $disableDates;
}
$this->assignAlerts();
$response['msg'] = $this->context->smarty->fetch('alerts.tpl');
$this->ajaxDie(json_encode($response));
}
public function ajaxProcessGetDisableDates()
{
$response['status'] = false;
if (($idRoom = Tools::getValue('id_room'))
&& Validate::isLoadedObject(new HotelRoomInformation($idRoom))
) {
$objRoomDisableDates = new HotelRoomDisableDates();
$disableDates = $objRoomDisableDates->getRoomDisableDates($idRoom);
$response['status'] = true;
$response['disable_dates'] = $disableDates;
}
$this->ajaxDie(json_encode($response));
}
public function ajaxProcessDeleteDisableDate()
{
$response = array('status' => false);
$idDisableDate = Tools::getValue('id_disable_date');
Hook::exec('actionDisableDateDeleteBefore', array('id_disable_date', $idDisableDate));
if (empty($this->errors)
&& (int) $idDisableDate
&& Validate::isLoadedObject($objRoomDisableDates = new HotelRoomDisableDates($idDisableDate))
) {
$idRoom = $objRoomDisableDates->id_room;
if (!$objRoomDisableDates->delete()) {
$this->errors[] = Tools::displayError('An error occurred while trying to perform this operation.');
} else if (!$objRoomDisableDates->getRoomDisableDates($idRoom)) {
$objRoomInfo = new HotelRoomInformation($idRoom);
$objRoomInfo->id_status = HotelRoomInformation::STATUS_ACTIVE;
$objRoomInfo->save();
}
} else {
$this->errors[] = Tools::displayError('Invalid request');
}
if (count($this->errors)) {
$response['status'] = false;
} else {
$response['status'] = true;
$this->confirmations[] = $this->l('Removed successfully');
}
$this->assignAlerts();
$response['msg'] = $this->context->smarty->fetch('alerts.tpl');
$this->ajaxDie(json_encode($response));
}

View File

@@ -49,6 +49,9 @@ $(document).ready(function() {
action: 'initCartRuleDeleteModal',
id_cart_rule: id_cart_rule
},
beforeSend: function() {
$("#page-loader").show();
},
success: function(result) {
if (result.success && result.confirm_delete) {
$('#moduleConfirmDelete').remove();
@@ -61,6 +64,9 @@ $(document).ready(function() {
resolve(false);
});
}
},
complete: function() {
$("#page-loader").hide();
}
});
});

View File

@@ -1920,6 +1920,9 @@ const BookingDocumentsModal = {
dataType: 'JSON',
cache: false,
data: 'ajax=true&id_order='+id_order+'&action=InitBookingDocumentsModal',
beforeSend: function() {
$("#page-loader").show();
},
success: function(result) {
if (result.hasError == 0 && result.modalHtml) {
$('#footer').next('.bootstrap').append(result.modalHtml);
@@ -1935,6 +1938,7 @@ const BookingDocumentsModal = {
},
complete: function() {
$(".loading_overlay").hide();
$("#page-loader").hide();
}
});
@@ -2105,6 +2109,9 @@ const VoucherModal = {
dataType: 'JSON',
cache: false,
data: 'ajax=true&id_order='+id_order+'&action=InitVoucherModal',
beforeSend: function() {
$("#page-loader").show();
},
success: function(result) {
if (result.hasError == 0 && result.modalHtml) {
$('#footer').next('.bootstrap').append(result.modalHtml);
@@ -2115,6 +2122,7 @@ const VoucherModal = {
},
complete: function() {
$(".loading_overlay").hide();
$("#page-loader").hide();
}
});
},
@@ -2139,6 +2147,9 @@ const OrderPaymentModal = {
dataType: 'JSON',
cache: false,
data: 'ajax=true&id_order='+id_order+'&action=InitOrderPaymentModal',
beforeSend: function() {
$("#page-loader").show();
},
success: function(result) {
if (result.hasError == 0 && result.modalHtml) {
$('#footer').next('.bootstrap').append(result.modalHtml);
@@ -2149,6 +2160,7 @@ const OrderPaymentModal = {
},
complete: function() {
$(".loading_overlay").hide();
$("#page-loader").hide();
}
});
},
@@ -2173,6 +2185,9 @@ const OrderPaymentDetailModal = {
dataType: 'JSON',
cache: false,
data: 'ajax=true&id_order='+id_order+'&action=InitOrderPaymentDetailModal',
beforeSend: function() {
$("#page-loader").show();
},
success: function(result) {
if (result.hasError == 0 && result.modalHtml) {
$('#footer').next('.bootstrap').append(result.modalHtml);
@@ -2195,6 +2210,7 @@ const OrderPaymentDetailModal = {
},
complete: function() {
$(".loading_overlay").hide();
$("#page-loader").hide();
}
});
},
@@ -2216,6 +2232,9 @@ const DocumentNoteModal = {
dataType: 'JSON',
cache: false,
data: 'ajax=true&id_order='+id_order+'&action=InitOrderDocumentNoteModal',
beforeSend: function() {
$("#page-loader").show();
},
success: function(result) {
if (result.hasError == 0 && result.modalHtml) {
$('#footer').next('.bootstrap').append(result.modalHtml);
@@ -2228,6 +2247,7 @@ const DocumentNoteModal = {
},
complete: function() {
$(".loading_overlay").hide();
$("#page-loader").hide();
}
});
},
@@ -2252,6 +2272,9 @@ const TravellerModal = {
dataType: 'JSON',
cache: false,
data: 'ajax=true&id_order='+id_order+'&action=InitTravellerModal',
beforeSend: function() {
$("#page-loader").show();
},
success: function(result) {
if (result.hasError == 0 && result.modalHtml) {
$('#footer').next('.bootstrap').append(result.modalHtml);
@@ -2262,6 +2285,7 @@ const TravellerModal = {
},
complete: function() {
$(".loading_overlay").hide();
$("#page-loader").hide();
}
});
},
@@ -2330,6 +2354,9 @@ const RoomStatusModal = {
dataType: 'JSON',
cache: false,
data: 'ajax=true&id_order='+id_order+'&action=InitRoomStatusModal',
beforeSend: function() {
$("#page-loader").show();
},
success: function(result) {
if (result.hasError == 0 && result.modalHtml) {
$('#footer').next('.bootstrap').append(result.modalHtml);
@@ -2356,6 +2383,7 @@ const RoomStatusModal = {
},
complete: function() {
$(".loading_overlay").hide();
$("#page-loader").hide();
}
});
},
@@ -2380,6 +2408,9 @@ const AddRoomBookingModal = {
dataType: 'JSON',
cache: false,
data: 'ajax=true&id_order='+id_order+'&action=initAddRoomBookingModal',
beforeSend: function() {
$("#page-loader").show();
},
success: function(result) {
if (result.hasError == 0 && result.modalHtml) {
$('#footer').next('.bootstrap').append(result.modalHtml);
@@ -2467,6 +2498,7 @@ const AddRoomBookingModal = {
},
complete: function() {
$(".loading_overlay").hide();
$("#page-loader").hide();
}
});
},
@@ -2538,6 +2570,9 @@ const EditRoomBookingModal = {
dataType: 'JSON',
cache: false,
data: data,
beforeSend: function() {
$("#page-loader").show();
},
success: function(result) {
if (result.hasError == 0 && result.modalHtml) {
$('#footer').next('.bootstrap').append(result.modalHtml);
@@ -2564,6 +2599,7 @@ const EditRoomBookingModal = {
},
complete: function() {
$(".loading_overlay").hide();
$("#page-loader").hide();
}
});
},
@@ -2614,6 +2650,9 @@ const CancelRoomBookingModal = {
dataType: 'JSON',
cache: false,
data: 'ajax=true&id_order='+id_order+'&action=initCancelRoomBookingModal',
beforeSend: function() {
$("#page-loader").show();
},
success: function(result) {
if (result.hasError == 0 && result.modalHtml) {
$('#footer').next('.bootstrap').append(result.modalHtml);
@@ -2626,6 +2665,7 @@ const CancelRoomBookingModal = {
},
complete: function() {
$(".loading_overlay").hide();
$("#page-loader").hide();
}
});
},
@@ -2651,6 +2691,9 @@ const RoomAllotmentCommentModal = {
dataType: 'JSON',
cache: false,
data: 'ajax=true&id_hotel_booking='+idHtlBooking+'&action=initRoomAllotmentCommentModal',
beforeSend: function() {
$("#page-loader").show();
},
success: function(result) {
if (result.hasError == 0 && result.modalHtml) {
$('#footer').next('.bootstrap').append(result.modalHtml);
@@ -2663,6 +2706,7 @@ const RoomAllotmentCommentModal = {
},
complete: function() {
$(".loading_overlay").hide();
$("#page-loader").hide();
}
});
},

View File

@@ -45,7 +45,21 @@ class HotelRoomDisableDates extends ObjectModel
public function getRoomDisableDates($id_room)
{
return Db::getInstance()->executeS('SELECT `date_from`, `date_to`, `reason` FROM `'._DB_PREFIX_.'htl_room_disable_dates` WHERE `id_room`='.(int)$id_room);
$objModule = Module::getInstanceByName('hotelreservationsystem');
$disabledDates = Db::getInstance()->executeS('SELECT `id`, `date_from`, `date_to`, `reason`, `date_add`,
NULL AS `id_event`, NULL AS `event_url`, "'.$objModule->l('Disabled', 'HotelRoomDisableDates').'" AS `event_title`,
1 AS `is_editable`, 1 AS `is_deletable`
FROM `'._DB_PREFIX_.'htl_room_disable_dates` WHERE `id_room`='.(int) $id_room
);
Hook::exec('actionRoomDisabledDatesModifier',
array(
'disable_dates' => &$disabledDates,
'id_room' => $id_room
)
);
return $disabledDates;
}
public function checkIfRoomAlreadyDisabled($params)

View File

@@ -78,7 +78,7 @@ class RoomTypeServiceProductOrderDetail extends ObjectModel
$sql = 'SELECT rsod.*';
if (!$getTotalPrice) {
$sql .= ', hbd.`id_product` as `room_type_id_product`, od.`product_allow_multiple_quantity`, hbd.`id_room`, hbd.`adults`, hbd.`children`';
$sql .= ', hbd.`id_product` as `room_type_id_product`, od.`product_allow_multiple_quantity`, od.`product_price_calculation_method`, hbd.`id_room`, hbd.`adults`, hbd.`children`';
}
$sql .= ' FROM `'._DB_PREFIX_.'htl_booking_detail` hbd
LEFT JOIN `'._DB_PREFIX_.'htl_room_type_service_product_order_detail` rsod ON(rsod.`id_htl_booking_detail` = hbd.`id`)';
@@ -152,6 +152,7 @@ class RoomTypeServiceProductOrderDetail extends ObjectModel
'product_tax' => $product_tax,
'product_tax_label' => $product_tax_label,
'allow_multiple_quantity' => $product['product_allow_multiple_quantity'],
'price_calculation_method' => $product['product_price_calculation_method'],
'total_price_tax_excl' => $product['total_price_tax_excl'],
'total_price_tax_incl' => $product['total_price_tax_incl'],
);
@@ -175,6 +176,7 @@ class RoomTypeServiceProductOrderDetail extends ObjectModel
'name' => $product['name'],
'quantity' => $product['quantity'],
'allow_multiple_quantity' => $product['product_allow_multiple_quantity'],
'price_calculation_method' => $product['product_price_calculation_method'],
'product_tax' => $product_tax,
'product_tax_label' => $product_tax_label,
'total_price_tax_excl' => $product['total_price_tax_excl'],
@@ -213,7 +215,7 @@ class RoomTypeServiceProductOrderDetail extends ObjectModel
INNER JOIN `'._DB_PREFIX_.'htl_room_type_service_product_order_detail` rsod ON(rsod.`id_htl_booking_detail` = hbd.`id`)';
$sql .= ' LEFT JOIN `'._DB_PREFIX_.'order_detail` od ON(od.`id_order_detail` = rsod.`id_order_detail`)';
$sql .= ' INNER JOIN `'._DB_PREFIX_.'product` p ON (p.`id_product` = rsod.`id_product`)';
$sql .= ' LEFT JOIN `'._DB_PREFIX_.'product` p ON (p.`id_product` = rsod.`id_product`)';
$sql .= ' WHERE hbd.`id` = '.(int)$idHotelBookingDetail;