additional facilities removed
This commit is contained in:
@@ -125,7 +125,7 @@ var // currently active contextMenu trigger
|
||||
offset = {top: y, left: x};
|
||||
}
|
||||
|
||||
// correct offset if viewport demands it
|
||||
// correct offset if viewport it
|
||||
var bottom = $win.scrollTop() + $win.height(),
|
||||
right = $win.scrollLeft() + $win.width(),
|
||||
height = opt.$menu.height(),
|
||||
|
||||
@@ -107,92 +107,42 @@
|
||||
</td>
|
||||
<td>{displayWtPriceWithCurrency price=$room['feature_price_tax_excl'] currency=$currency}</td>
|
||||
<td>
|
||||
{if (isset($room['selected_demands']) && $room['selected_demands']) || (isset($room['selected_services']) && $room['selected_services'])}
|
||||
<a href="#" data-toggle="modal" data-target="#rooms_type_extra_demands_{$room['id']}">
|
||||
{displayWtPriceWithCurrency price=($room['demand_price'] + $room['additional_service_price'] + $room['additional_services_auto_add_price'])|escape:'html':'UTF-8' currency=$currency}
|
||||
{if isset($room['selected_services']) && $room['selected_services']}
|
||||
<a href="#" data-toggle="modal" data-target="#rooms_type_extra_services_{$room['id']}">
|
||||
{displayWtPriceWithCurrency price=($room['additional_service_price'] + $room['additional_services_auto_add_price'])|escape:'html':'UTF-8' currency=$currency}
|
||||
</a>
|
||||
{else}
|
||||
{displayWtPriceWithCurrency price=0 currency=$currency}
|
||||
{/if}
|
||||
</td>
|
||||
<td class="text-right">
|
||||
{if (isset($room['selected_demands']) && $room['selected_demands']) || (isset($room['selected_services']) && $room['selected_services'])}
|
||||
{displayWtPriceWithCurrency price=($room['amt_with_qty'] + $room['additional_services_auto_add_price'] + $room['demand_price'] + $room['additional_service_price'])|escape:'html':'UTF-8' currency=$currency}
|
||||
{if isset($room['selected_services']) && $room['selected_services']}
|
||||
{displayWtPriceWithCurrency price=($room['amt_with_qty'] + $room['additional_services_auto_add_price'] + $room['additional_service_price'])|escape:'html':'UTF-8' currency=$currency}
|
||||
{else}
|
||||
{displayWtPriceWithCurrency price=$room['amt_with_qty']|escape:'html':'UTF-8' currency=$currency}
|
||||
{/if}
|
||||
</td>
|
||||
</tr>
|
||||
<div class="modal" tabindex="-1" role="dialog" id="rooms_type_extra_demands_{$room['id']}">
|
||||
<div class="modal" tabindex="-1" role="dialog" id="rooms_type_extra_services_{$room['id']}">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-body" id="rooms_extra_demands">
|
||||
<div class="modal-body" id="rooms_extra_services">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
<ul class="nav nav-tabs" role="tablist">
|
||||
{if isset($room['selected_demands']) && $room['selected_demands']}
|
||||
<li role="presentation" class="active"><a href="#room_type_demands_desc_{$room['id']}" aria-controls="facilities" role="tab" data-toggle="tab">{l s='Facilities'}</a></li>
|
||||
{/if}
|
||||
{if isset($room['selected_services']) && $room['selected_services']}
|
||||
<li role="presentation" {if !isset($room['selected_demands']) || !$room['selected_demands']}class="active"{/if}><a href="#room_type_service_product_desc_{$room['id']}" aria-controls="services" role="tab" data-toggle="tab">{l s='Services'}</a></li>
|
||||
{/if}
|
||||
<li role="presentation" class="active" ><a href="#room_type_service_product_desc_{$room['id']}" aria-controls="services" role="tab" data-toggle="tab">{l s='Services'}</a></li>
|
||||
</ul>
|
||||
<div class="tab-content panel">
|
||||
{if isset($room['selected_demands']) && $room['selected_demands']}
|
||||
<div id="room_type_demands_desc_{$room['id']}" class="tab-pane active">
|
||||
<div id="room_type_demands_desc">
|
||||
{if isset($room['selected_demands']) && $room['selected_demands']}
|
||||
{assign var=roomCount value=1}
|
||||
{foreach $room['selected_demands'] as $demand}
|
||||
<div class="row room_demands_container">
|
||||
<div class="col-sm-12 room_demand_detail">
|
||||
{if isset($room['selected_demands']) && $room['selected_demands']}
|
||||
{foreach $room['extra_demands'] as $idGlobalDemand => $roomDemand}
|
||||
{if $demand.id_global_demand == $idGlobalDemand}
|
||||
<div class="row room_demand_block">
|
||||
<div class="col-xs-6">
|
||||
<div class="row">
|
||||
<div class="col-xs-10 demand_adv_option_block">
|
||||
<p>
|
||||
{$roomDemand['name']|escape:'html':'UTF-8'}<br>
|
||||
{if isset($roomDemand['adv_option']) && $roomDemand['adv_option']}
|
||||
{$roomDemand['adv_option'][$demand['id_option']]['name']}
|
||||
{/if}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-6">
|
||||
<p><span class="pull-right extra_demand_option_price">
|
||||
{if isset($roomDemand['adv_option']) && $roomDemand['adv_option']}
|
||||
{convertPrice price = $roomDemand['adv_option'][$demand['id_option']]['price_tax_excl']|escape:'html':'UTF-8'}
|
||||
{else}
|
||||
{convertPrice price = $roomDemand['price_tax_excl']|escape:'html':'UTF-8'}
|
||||
{/if}
|
||||
</span></p>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
{/foreach}
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
{assign var=roomCount value=$roomCount+1}
|
||||
{/foreach}
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
{if isset($room['selected_services']) && $room['selected_services']}
|
||||
<div id="room_type_service_product_desc_{$room['id']}" class="tab-pane{if !isset($room['selected_demands']) || !$room['selected_demands']} active{/if}">
|
||||
<div id="room_type_service_product_desc_{$room['id']}" class="tab-pane active">
|
||||
<div id="room_type_services_desc">
|
||||
{assign var=roomCount value=1}
|
||||
<div class="row room_demands_container">
|
||||
<div class="col-sm-12 room_demand_detail">
|
||||
<div class="row room_service_container">
|
||||
<div class="col-sm-12 room_service_detail">
|
||||
{if isset($room['selected_services']) && $room['selected_services']}
|
||||
{foreach $room['selected_services'] as $service}
|
||||
<div class="row room_demand_block">
|
||||
<div class="row room_service_block">
|
||||
<div class="col-xs-5">
|
||||
<div class="row">
|
||||
<div class="col-xs-10">
|
||||
|
||||
@@ -1,113 +0,0 @@
|
||||
{*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License version 3.0
|
||||
* that is bundled with this package in the file LICENSE.md
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* https://opensource.org/license/osl-3-0-php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to support@qloapps.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade this module to a 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
|
||||
* @copyright Since 2010 Webkul
|
||||
* @license https://opensource.org/license/osl-3-0-php Open Software License version 3.0
|
||||
*}
|
||||
|
||||
<div class="modal" tabindex="-1" role="dialog" id="rooms_type_extra_demands">
|
||||
<div class="modal-dialog modal-lg" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal"><i class="icon-remove-sign"></i></button>
|
||||
<h4 class="modal-title"><i class="icon icon-bed"></i> {l s='Room Services'}</h4>
|
||||
</div>
|
||||
<div class="modal-body" id="rooms_extra_demands">
|
||||
<ul class="nav nav-tabs" role="tablist">
|
||||
{if isset($selectedRoomDemands) && $selectedRoomDemands}
|
||||
<li role="presentation" class="active"><a href="#room_type_demands_desc" aria-controls="facilities" role="tab" data-toggle="tab">{l s='Facilities'}</a></li>
|
||||
{/if}
|
||||
<li role="presentation" {if !isset($selectedRoomDemands) || !$selectedRoomDemands}class="active"{/if}><a href="#room_type_service_product_desc" aria-controls="services" role="tab" data-toggle="tab">{l s='Services'}</a></li>
|
||||
</ul>
|
||||
<div class="tab-content">
|
||||
{if isset($selectedRoomDemands) && $selectedRoomDemands}
|
||||
<div id="room_type_demands_desc" class="tab-pane active">
|
||||
<div id="room_type_demands_desc">
|
||||
{if isset($selectedRoomDemands) && $selectedRoomDemands}
|
||||
{assign var=roomCount value=1}
|
||||
{foreach $selectedRoomDemands as $key => $roomDemand}
|
||||
<div class="row room_demands_container">
|
||||
<div class="col-sm-12 room_demand_detail">
|
||||
{if isset($roomTypeDemands) && $roomTypeDemands}
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th></th>
|
||||
<th>{l s='Name'}</th>
|
||||
<th>{l s='Options'}</th>
|
||||
<th>{l s='Unit Price (tax excl.)'}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{foreach $roomTypeDemands as $idGlobalDemand => $demand}
|
||||
<tr class="room_demand_block">
|
||||
<td>
|
||||
<input id_cart_booking="{$roomDemand['id']}" value="{$idGlobalDemand|escape:'html':'UTF-8'}" type="checkbox" class="id_room_type_demand" {if isset($roomDemand['selected_global_demands']) && $roomDemand['selected_global_demands'] && ($idGlobalDemand|in_array:$roomDemand['selected_global_demands'])}checked{/if} />
|
||||
</td>
|
||||
<td class="demand_adv_option_block">
|
||||
<p>{$demand['name']|escape:'html':'UTF-8'}</p>
|
||||
</td>
|
||||
<td class="demand_adv_option_block">
|
||||
{if isset($demand['adv_option']) && $demand['adv_option']}
|
||||
<select class="id_option">
|
||||
{foreach $demand['adv_option'] as $idOption => $option}
|
||||
{assign var=demand_key value="`$idGlobalDemand`-`$idOption`"}
|
||||
<option optionPrice="{$option['price_tax_excl']|escape:'html':'UTF-8'}" value="{$idOption|escape:'html':'UTF-8'}" {if isset($roomDemand['extra_demands'][$demand_key])}selected{/if} key="{$demand_key}">{$option['name']}</option>
|
||||
{if isset($roomDemand['extra_demands'][$demand_key])}
|
||||
{assign var=selected_adv_option value="$idOption"}
|
||||
{/if}
|
||||
{/foreach}
|
||||
</select>
|
||||
{else}
|
||||
--
|
||||
<input type="hidden" class="id_option" value="0" />
|
||||
{/if}
|
||||
</td>
|
||||
<td>
|
||||
<span class="extra_demand_option_price">
|
||||
{if isset($selected_adv_option) && isset($demand['adv_option'][$selected_adv_option]['price_tax_excl'])}{convertPrice price = $demand['adv_option'][$selected_adv_option]['price_tax_excl']|escape:'html':'UTF-8'}{else if isset($demand['adv_option']) && $demand['adv_option']}{convertPrice price = $demand['adv_option'][$demand['adv_option']|@key]['price_tax_excl']}{else}{convertPrice price = $demand['price_tax_excl']|escape:'html':'UTF-8'}{/if}
|
||||
</span>
|
||||
{if $demand['price_calc_method'] == HotelRoomTypeGlobalDemand::WK_PRICE_CALC_METHOD_EACH_DAY}
|
||||
{l s='/ night'}
|
||||
{/if}
|
||||
</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
</tbody>
|
||||
</table>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
{assign var=roomCount value=$roomCount+1}
|
||||
{/foreach}
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
{include file='controllers/orders/modals/_add_order_extra_services_tab_content.tpl'}
|
||||
</div>
|
||||
{if isset($loaderImg) && $loaderImg}
|
||||
<div class="loading_overlay">
|
||||
<img src='{$loaderImg}' class="loading-img"/>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,45 @@
|
||||
{*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License version 3.0
|
||||
* that is bundled with this package in the file LICENSE.md
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* https://opensource.org/license/osl-3-0-php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to support@qloapps.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade this module to a 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
|
||||
* @copyright Since 2010 Webkul
|
||||
* @license https://opensource.org/license/osl-3-0-php Open Software License version 3.0
|
||||
*}
|
||||
|
||||
<div class="modal" tabindex="-1" role="dialog" id="rooms_type_extra_services">
|
||||
<div class="modal-dialog modal-lg" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal"><i class="icon-remove-sign"></i></button>
|
||||
<h4 class="modal-title"><i class="icon icon-bed"></i> {l s='Room Services'}</h4>
|
||||
</div>
|
||||
<div class="modal-body" id="rooms_extra_services">
|
||||
<ul class="nav nav-tabs" role="tablist">
|
||||
<li role="presentation" class="active"><a href="#room_type_service_product_desc" aria-controls="services" role="tab" data-toggle="tab">{l s='Services'}</a></li>
|
||||
</ul>
|
||||
<div class="tab-content">
|
||||
{include file='controllers/orders/modals/_add_order_extra_services_tab_content.tpl'}
|
||||
</div>
|
||||
{if isset($loaderImg) && $loaderImg}
|
||||
<div class="loading_overlay">
|
||||
<img src='{$loaderImg}' class="loading-img"/>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -130,13 +130,13 @@
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
{displayPrice price=($data.demand_price + $data.additional_service_price + $data.additional_services_auto_add_price)|escape:'html':'UTF-8'}
|
||||
{displayPrice price=($data.additional_service_price + $data.additional_services_auto_add_price)|escape:'html':'UTF-8'}
|
||||
</td>
|
||||
{* <td class="cart_line_total_rooms_price" id="cart_detail_data_price_{$data.id|escape:'html':'UTF-8'}">
|
||||
{displayPrice price=$data.amt_with_qty}</td> *}
|
||||
<td class="cart_line_total_price">
|
||||
{if (isset($data.extra_demands) && $data.extra_demands) || (isset($data.additional_service) && $data.additional_service) || (isset($data.selected_services) && $data.selected_services)}
|
||||
{displayPrice price=($data.amt_with_qty + $data.additional_services_auto_add_price + $data.demand_price + $data.additional_service_price)|escape:'html':'UTF-8'}
|
||||
{if isset($data.additional_service) && $data.additional_service}
|
||||
{displayPrice price=($data.amt_with_qty + $data.additional_services_auto_add_price + $data.additional_service_price)|escape:'html':'UTF-8'}
|
||||
{else}
|
||||
{displayPrice price=$data.amt_with_qty|escape:'html':'UTF-8'}
|
||||
{/if}
|
||||
@@ -146,7 +146,7 @@
|
||||
<i class="icon-trash"></i> {l s='Delete'}
|
||||
</button>
|
||||
<br />
|
||||
<a href="#" id_hotel_cart_booking="{$data.id|escape:'html':'UTF-8'}" id_room="{$data.id_room|escape:'html':'UTF-8'}" date_from="{$data.date_from|escape:'html':'UTF-8'}" date_to="{$data.date_to|escape:'html':'UTF-8'}" id_product="{$data.id_product|escape:'html':'UTF-8'}" id_cart="{$data.id_cart|escape:'html':'UTF-8'}" class="open_rooms_extra_demands btn btn-success" title="{l s='Click here to add or remove the extra services of this room type.'}">
|
||||
<a href="#" id_hotel_cart_booking="{$data.id|escape:'html':'UTF-8'}" id_room="{$data.id_room|escape:'html':'UTF-8'}" date_from="{$data.date_from|escape:'html':'UTF-8'}" date_to="{$data.date_to|escape:'html':'UTF-8'}" id_product="{$data.id_product|escape:'html':'UTF-8'}" id_cart="{$data.id_cart|escape:'html':'UTF-8'}" class="open_rooms_extra_services btn btn-success" title="{l s='Click here to add or remove the extra services of this room type.'}">
|
||||
<i class="icon-pencil"></i> {l s='Services'}
|
||||
</a>
|
||||
</td>
|
||||
@@ -161,31 +161,22 @@
|
||||
</div>
|
||||
|
||||
{* Modal for extra demands *}
|
||||
{* <div class="modal" tabindex="-1" role="dialog" id="rooms_type_extra_demands">
|
||||
{* <div class="modal" tabindex="-1" role="dialog" id="rooms_type_extra_services">
|
||||
|
||||
</div> *}
|
||||
|
||||
{strip}
|
||||
{addJsDefL name=txtExtraDemandSucc}{l s='Updated Successfully' js=1}{/addJsDefL}
|
||||
{addJsDefL name=txtExtraDemandErr}{l s='Some error occurred while updating demands' js=1}{/addJsDefL}
|
||||
{/strip}
|
||||
|
||||
{* Css for handling extra demands changes *}
|
||||
{* Css for handling extra changes *}
|
||||
<style type="text/css">
|
||||
#customer_cart_details .extra-demand-list {
|
||||
padding-left:15px;}
|
||||
#customer_cart_details .delete_hotel_cart_data {
|
||||
margin-bottom:2px !important;}
|
||||
#customer_cart_details .room_type_old_price {
|
||||
text-decoration: line-through;
|
||||
color:#979797;
|
||||
font-size:12px;}
|
||||
/*Extra demands CSS*/
|
||||
#rooms_extra_demands .rooms_extra_demands_head {
|
||||
margin-bottom: 18px;}
|
||||
#rooms_extra_demands .room_demand_block {
|
||||
margin-bottom: 15px;
|
||||
color: #333;}
|
||||
#room_type_service_product_desc #back_to_service_btn {
|
||||
display: none;}
|
||||
#add_new_room_services_block {
|
||||
|
||||
@@ -76,8 +76,8 @@
|
||||
<p class="help-block">{l s='Per day price:'} {convertPriceWithCurrency price=$data['paid_unit_price_tax_excl'] currency=$currency->id}</p>
|
||||
</td>
|
||||
<td>
|
||||
{convertPriceWithCurrency price=($data['extra_demands_price_te'] + $data['additional_services_price_te'] + $data['convenience_fee_te'] + $data['additional_services_price_auto_add_te']) currency=$currency->id}
|
||||
{if $data['extra_demands']|count || $data['additional_services']|count}
|
||||
{convertPriceWithCurrency price=($data['additional_services_price_te'] + $data['convenience_fee_te'] + $data['additional_services_price_auto_add_te']) currency=$currency->id}
|
||||
{if $data['additional_services']|count}
|
||||
<a class="open_room_extra_services" href="#" date_from="{$data['date_from']}" date_to="{$data['date_to']}" id_product="{$data['id_product']}" id_room="{$data['id_room']}" id_order="{$order->id}" id_htl_booking="{$data['id']}">
|
||||
<i class="icon icon-lg icon-info-circle"></i>
|
||||
</a>
|
||||
|
||||
@@ -1546,10 +1546,10 @@
|
||||
});
|
||||
}
|
||||
|
||||
{* JS for handling extra demands changes *}
|
||||
{* JS for handling extra services changes *}
|
||||
$(document).ready(function() {
|
||||
// modalbox for extra demands
|
||||
$('body').on('click', '.open_rooms_extra_demands', function() {
|
||||
// modalbox for extra services
|
||||
$('body').on('click', '.open_rooms_extra_services', function() {
|
||||
var idProduct = $(this).attr('id_product');
|
||||
var idCart = $(this).attr('id_cart');
|
||||
var idRoom = $(this).attr('id_room');
|
||||
@@ -1574,7 +1574,7 @@
|
||||
id_product: idProduct,
|
||||
id_customer: id_customer,
|
||||
id_hotel_cart_booking: idHotelCartBooking,
|
||||
action: 'getRoomTypeCartDemands',
|
||||
action: 'getRoomTypeCartServices',
|
||||
ajax: true
|
||||
},
|
||||
success: function(response) {
|
||||
@@ -1587,10 +1587,8 @@
|
||||
errorHtml += '</ol>';
|
||||
showErrorMessage(errorHtml);
|
||||
} else {
|
||||
$('#customer_cart_details').after(response.html_exta_demands);
|
||||
// $('#rooms_type_extra_demands').find('#room_type_demands_desc').html('');
|
||||
// $('#rooms_type_extra_demands').find('#room_type_demands_desc').append(response.html_exta_demands);
|
||||
$('#rooms_type_extra_demands').modal('show');
|
||||
$('#customer_cart_details').after(response.html_exta_services);
|
||||
$('#rooms_type_extra_services').modal('show');
|
||||
}
|
||||
},
|
||||
complete: function() {
|
||||
@@ -1598,98 +1596,11 @@
|
||||
}
|
||||
});
|
||||
});
|
||||
$(document).on('hidden.bs.modal', '#rooms_type_extra_demands', function (e) {
|
||||
$(document).on('hidden.bs.modal', '#rooms_type_extra_services', function (e) {
|
||||
// reload to make changes reflect everywhere
|
||||
location.reload();
|
||||
});
|
||||
|
||||
// select/unselect extra demand
|
||||
$(document).on('click', '.id_room_type_demand', function() {
|
||||
var roomDemands = [];
|
||||
// get the selected extra demands by customer
|
||||
$(this).closest('.room_demand_detail').find('input:checkbox.id_room_type_demand:checked').each(function () {
|
||||
roomDemands.push({
|
||||
'id_global_demand':$(this).val(),
|
||||
'id_option': $(this).closest('.room_demand_block').find('.id_option').val()
|
||||
});
|
||||
});
|
||||
var idBookingCart = $(this).attr('id_cart_booking');
|
||||
$(".loading_overlay").show();
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
dataType: 'JSON',
|
||||
headers: {
|
||||
"cache-control": "no-cache"
|
||||
},
|
||||
url: "{$link->getAdminLink('AdminCarts')|addslashes}",
|
||||
dataType: 'JSON',
|
||||
cache: false,
|
||||
data: {
|
||||
id_cart_booking: idBookingCart,
|
||||
room_demands: JSON.stringify(roomDemands),
|
||||
action: 'changeRoomDemands',
|
||||
ajax: true
|
||||
},
|
||||
success: function(response) {
|
||||
if (response.status) {
|
||||
showSuccessMessage(txtExtraDemandSucc);
|
||||
} else {
|
||||
showErrorMessage(txtExtraDemandErr);
|
||||
}
|
||||
},
|
||||
complete: function() {
|
||||
$(".loading_overlay").hide();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// change advanced option of extra demand
|
||||
$(document).on('change', '.demand_adv_option_block .id_option', function(e) {
|
||||
var option_selected = $(this).find('option:selected');
|
||||
var extra_demand_price = option_selected.attr("optionPrice")
|
||||
extra_demand_price = parseFloat(extra_demand_price);
|
||||
extra_demand_price = formatCurrency(extra_demand_price, currency_format, currency_sign, currency_blank);
|
||||
$(this).closest('.room_demand_block').find('.extra_demand_option_price').text(extra_demand_price);
|
||||
var roomDemands = [];
|
||||
if ($(this).closest('.room_demand_block').find('input:checkbox.id_room_type_demand').is(':checked')) {
|
||||
// get the selected extra demands by customer
|
||||
$(this).closest('.room_demand_detail').find('input:checkbox.id_room_type_demand:checked').each(function () {
|
||||
roomDemands.push({
|
||||
'id_global_demand':$(this).val(),
|
||||
'id_option': $(this).closest('.room_demand_block').find('.id_option').val()
|
||||
});
|
||||
});
|
||||
var idBookingCart = $(this).closest('.room_demand_block').find('.id_room_type_demand').attr('id_cart_booking');
|
||||
$(".loading_overlay").show();
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
dataType: 'JSON',
|
||||
headers: {
|
||||
"cache-control": "no-cache"
|
||||
},
|
||||
url: "{$link->getAdminLink('AdminCarts')|addslashes}",
|
||||
dataType: 'JSON',
|
||||
cache: false,
|
||||
data: {
|
||||
id_cart_booking: idBookingCart,
|
||||
room_demands: JSON.stringify(roomDemands),
|
||||
action: 'changeRoomDemands',
|
||||
ajax: true
|
||||
},
|
||||
success: function(response) {
|
||||
if (response.status) {
|
||||
showSuccessMessage(txtExtraDemandSucc);
|
||||
} else {
|
||||
showErrorMessage(txtExtraDemandErr);
|
||||
}
|
||||
},
|
||||
complete: function() {
|
||||
$(".loading_overlay").hide();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
$(document).on('keyup', '#payment_module_name', function() {
|
||||
let paymentMethod = $('#payment_module_name').val().trim().toLowerCase();
|
||||
|
||||
@@ -1748,7 +1659,7 @@
|
||||
}
|
||||
});
|
||||
|
||||
// click on back button on created facilities while additional facilities edit
|
||||
// click on back button on created additional service edit
|
||||
$(document).on('click', '#back_to_service_btn', function() {
|
||||
$('#room_type_services_desc').show();
|
||||
$('#add_new_room_services_block').hide();
|
||||
@@ -1802,7 +1713,7 @@
|
||||
if (jsonData.service_panel) {
|
||||
$('#room_type_service_product_desc').replaceWith(jsonData.service_panel);
|
||||
}
|
||||
showSuccessMessage(txtExtraDemandSucc);
|
||||
showSuccessMessage(txtExtraServiceSucc);
|
||||
} else {
|
||||
var errorHtml = error_found_txt + ':<br>';
|
||||
errorHtml += '<ol>';
|
||||
@@ -1850,7 +1761,7 @@
|
||||
if (jsonData.service_panel) {
|
||||
$('#room_type_service_product_desc').replaceWith(jsonData.service_panel);
|
||||
}
|
||||
showSuccessMessage(txtExtraDemandSucc);
|
||||
showSuccessMessage(txtExtraServiceSucc);
|
||||
} else {
|
||||
if (jsonData.errors != 'undefined' && jsonData.errors.length) {
|
||||
var errorHtml = error_found_txt + ':<br>';
|
||||
|
||||
@@ -925,10 +925,6 @@
|
||||
{assign var=order_shipping_price value=$order->total_shipping_tax_incl}
|
||||
{/if}
|
||||
|
||||
{* total extra demands prices *}
|
||||
{* $totalDemandsPriceTE
|
||||
$totalDemandsPriceTI *}
|
||||
|
||||
{* Get total rooms prices *}
|
||||
{assign var=total_rooms_price_tax_excl value=$order->getTotalProductsWithoutTaxes(false, true)}
|
||||
{assign var=total_rooms_price_tax_incl value=$order->getTotalProductsWithTaxes(false, true)}
|
||||
@@ -937,16 +933,16 @@
|
||||
{assign var=total_products_price_tax_excl value=($order->getTotalProductsWithoutTaxes(false, false, Product::SELLING_PREFERENCE_HOTEL_STANDALONE) + $order->getTotalProductsWithoutTaxes(false, false, Product::SELLING_PREFERENCE_STANDALONE))}
|
||||
{assign var=total_products_price_tax_incl value=($order->getTotalProductsWithTaxes(false, false, Product::SELLING_PREFERENCE_HOTEL_STANDALONE) + $order->getTotalProductsWithTaxes(false, false, Product::SELLING_PREFERENCE_STANDALONE))}
|
||||
|
||||
{* Get total of extra services and extra demands prices(excluding convenience fee) *}
|
||||
{assign var=total_room_services_and_demands_tax_excl value=($order->getTotalProductsWithoutTaxes(false, false, Product::SELLING_PREFERENCE_WITH_ROOM_TYPE) + $totalDemandsPriceTE)}
|
||||
{assign var=total_room_services_and_demands_tax_incl value=($order->getTotalProductsWithTaxes(false, false, Product::SELLING_PREFERENCE_WITH_ROOM_TYPE) + $totalDemandsPriceTI)}
|
||||
{* Get total of extra services prices(excluding convenience fee) *}
|
||||
{assign var=total_room_services_tax_excl value=($order->getTotalProductsWithoutTaxes(false, false, Product::SELLING_PREFERENCE_WITH_ROOM_TYPE))}
|
||||
{assign var=total_room_services_tax_incl value=($order->getTotalProductsWithTaxes(false, false, Product::SELLING_PREFERENCE_WITH_ROOM_TYPE))}
|
||||
|
||||
{* Get total of only convenience fees prices *}
|
||||
{assign var=total_convenience_fee_tax_excl value=$order->getTotalProductsWithoutTaxes(false, false, Product::SELLING_PREFERENCE_WITH_ROOM_TYPE, 1, Product::PRICE_ADDITION_TYPE_INDEPENDENT)}
|
||||
{assign var=total_convenience_fee_tax_incl value=$order->getTotalProductsWithTaxes(false, false, Product::SELLING_PREFERENCE_WITH_ROOM_TYPE, 1, Product::PRICE_ADDITION_TYPE_INDEPENDENT)}
|
||||
|
||||
{assign var=order_total_price_tax_excl value=($total_rooms_price_tax_excl + $total_room_services_and_demands_tax_excl + $total_products_price_tax_excl)}
|
||||
{assign var=order_total_price_tax_incl value=($total_rooms_price_tax_incl + $total_room_services_and_demands_tax_incl + $total_products_price_tax_incl)}
|
||||
{assign var=order_total_price_tax_excl value=($total_rooms_price_tax_excl + $total_room_services_tax_excl + $total_products_price_tax_excl)}
|
||||
{assign var=order_total_price_tax_incl value=($total_rooms_price_tax_incl + $total_room_services_tax_incl + $total_products_price_tax_incl)}
|
||||
|
||||
{if $total_rooms_price_tax_excl}
|
||||
<tr id="total_products">
|
||||
@@ -966,11 +962,11 @@
|
||||
<td class="partial_refund_fields current-edit" style="display:none;"></td>
|
||||
</tr>
|
||||
{/if}
|
||||
{if isset($total_room_services_and_demands_tax_excl) && $total_room_services_and_demands_tax_excl > 0}
|
||||
{if isset($total_room_services_tax_excl) && $total_room_services_tax_excl > 0}
|
||||
<tr id="total_products">
|
||||
<td class="text-right">{l s='Total Extra services (Tax excl.)'}</td>
|
||||
<td class="amount text-right nowrap">
|
||||
{displayPrice price=($total_room_services_and_demands_tax_excl - $total_convenience_fee_tax_excl) currency=$currency->id}
|
||||
{displayPrice price=($total_room_services_tax_excl - $total_convenience_fee_tax_excl) currency=$currency->id}
|
||||
</td>
|
||||
<td class="partial_refund_fields current-edit" style="display:none;"></td>
|
||||
</tr>
|
||||
@@ -1030,11 +1026,11 @@
|
||||
</td>
|
||||
</tr>
|
||||
{/if}
|
||||
{if isset($total_room_services_and_demands_tax_incl) && (($total_room_services_and_demands_tax_incl - $total_room_services_and_demands_tax_excl) - ($total_convenience_fee_tax_incl - $total_convenience_fee_tax_excl)) > 0}
|
||||
{if isset($total_room_services_tax_incl) && (($total_room_services_tax_incl - $total_room_services_tax_excl) - ($total_convenience_fee_tax_incl - $total_convenience_fee_tax_excl)) > 0}
|
||||
<tr>
|
||||
<td class="text-left">{l s='Extra services Tax'}</td>
|
||||
<td class="text-right nowrap">
|
||||
{displayPrice price=(($total_room_services_and_demands_tax_incl - $total_room_services_and_demands_tax_excl) - ($total_convenience_fee_tax_incl - $total_convenience_fee_tax_excl)) currency=$currency->id}
|
||||
{displayPrice price=(($total_room_services_tax_incl - $total_room_services_tax_excl) - ($total_convenience_fee_tax_incl - $total_convenience_fee_tax_excl)) currency=$currency->id}
|
||||
</td>
|
||||
<td class="partial_refund_fields current-edit" style="display:none;"></td>
|
||||
</tr>
|
||||
@@ -1343,12 +1339,12 @@
|
||||
{addJsDefL name=no_swap_rm_avail_txt}{l s='No room available for swap.' js=1}{/addJsDefL}
|
||||
{addJsDefL name=slct_rm_type_err}{l s='Please select a room type first.' js=1}{/addJsDefL}
|
||||
{addJsDefL name=slct_rm_err}{l s='Please select a room first.' js=1}{/addJsDefL}
|
||||
{addJsDefL name=txtExtraDemandSucc}{l s='Updated Successfully' js=1}{/addJsDefL}
|
||||
{addJsDefL name=txtExtraServiceSucc}{l s='Updated Successfully' js=1}{/addJsDefL}
|
||||
{addJsDefL name=atleastSelectTxt}{l s='Select at least one facility to update.' js=1}{/addJsDefL}
|
||||
|
||||
{addJsDefL name=txtSomeErr}{l s='Some error occurred. Please try again.' js=1}{/addJsDefL}
|
||||
{addJsDefL name=txtDeleteSucc}{l s='Deleted successfully' js=1}{/addJsDefL}
|
||||
{addJsDefL name=txtInvalidDemandVal}{l s='Invalid demand value found' js=1}{/addJsDefL}
|
||||
{addJsDefL name=txtInvalidServiceVal}{l s='Invalid service value found' js=1}{/addJsDefL}
|
||||
{addJsDefL name='select_age_txt'}{l s='Select age' js=1}{/addJsDefL}
|
||||
{addJsDefL name='under_1_age'}{l s='Under 1' js=1}{/addJsDefL}
|
||||
{addJsDefL name='room_txt'}{l s='Room' js=1}{/addJsDefL}
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
* @license https://opensource.org/license/osl-3-0-php Open Software License version 3.0
|
||||
*}
|
||||
|
||||
<div id="room_type_service_product_desc" class="tab-pane{if !isset($selectedRoomDemands) || !$selectedRoomDemands} active{/if}">
|
||||
<div id="room_type_service_product_desc" class="tab-pane{if isset($serviceProducts) || $serviceProducts} active{/if}">
|
||||
{if $customServiceAllowed}
|
||||
<div class="row">
|
||||
<button id="btn_new_room_service" class="btn btn-success pull-right"><i class="icon-plus-circle"></i> {l s='Add a new service'}</button>
|
||||
@@ -31,8 +31,8 @@
|
||||
{if isset($serviceProducts) && $serviceProducts}
|
||||
<div id="room_type_services_desc">
|
||||
{assign var=roomCount value=1}
|
||||
<div class="row room_demands_container">
|
||||
<div class="col-sm-12 room_demand_detail">
|
||||
<div class="row room_service_container">
|
||||
<div class="col-sm-12 room_service_detail">
|
||||
{if isset($serviceProducts) && $serviceProducts}
|
||||
<form id="update_selected_room_services_form">
|
||||
<table class="table table-striped">
|
||||
@@ -54,7 +54,7 @@
|
||||
{else}
|
||||
{assign var='serviceSelected' value=false}
|
||||
{/if}
|
||||
<tr class="room_demand_block">
|
||||
<tr class="room_service_block">
|
||||
<td>
|
||||
<input data-id_cart_booking="{$selectedRoomServiceProduct['id']}" value="{$product['id_product']|escape:'html':'UTF-8'}" type="checkbox" class="change_room_type_service_product" {if $serviceSelected}checked{/if}/>
|
||||
|
||||
|
||||
@@ -26,9 +26,6 @@
|
||||
<li role="presentation" class="active">
|
||||
<a href="#edit_room_tab" role="tab" data-toggle="tab">{l s='Rooms'}</a>
|
||||
</li>
|
||||
<li role="presentation">
|
||||
<a href="#room_type_demands_desc" aria-controls="facilities" role="tab" data-toggle="tab">{l s='Facilities'}</a>
|
||||
</li>
|
||||
<li role="presentation">
|
||||
<a href="#room_type_service_product_desc" aria-controls="services" role="tab" data-toggle="tab">{l s='Services'}</a>
|
||||
</li>
|
||||
|
||||
@@ -22,8 +22,7 @@
|
||||
|
||||
<div class="extra-services-content modal-body">
|
||||
<ul class="nav nav-tabs" role="tablist">
|
||||
<li role="presentation" class="active"><a href="#room_type_demands_desc" aria-controls="facilities" role="tab" data-toggle="tab">{l s='Facilities'}</a></li>
|
||||
<li role="presentation"><a href="#room_type_service_product_desc" aria-controls="services" role="tab" data-toggle="tab">{l s='Services'}</a></li>
|
||||
<li role="presentation" class="active"><a href="#room_type_service_product_desc" aria-controls="services" role="tab" data-toggle="tab">{l s='Services'}</a></li>
|
||||
</ul>
|
||||
<div class="tab-content clearfix">
|
||||
{include file='controllers/orders/modals/_partials/_room_extra_services_content.tpl'}
|
||||
|
||||
@@ -1,181 +0,0 @@
|
||||
{*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License version 3.0
|
||||
* that is bundled with this package in the file LICENSE.md
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* https://opensource.org/license/osl-3-0-php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to support@qloapps.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade this module to a 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
|
||||
* @copyright Since 2010 Webkul
|
||||
* @license https://opensource.org/license/osl-3-0-php Open Software License version 3.0
|
||||
*}
|
||||
|
||||
<div id="room_type_demands_desc" class="tab-pane {if (isset($show_active) && $show_active) || (!isset($orderEdit) || !$orderEdit)}active{/if} extra-services-container">
|
||||
<input type="hidden" value="{$id_booking_detail}" id="id_htl_booking">
|
||||
{if isset($orderEdit) && $orderEdit}
|
||||
<p class="col-sm-12 facility_nav_btn">
|
||||
<button id="btn_new_room_demand" class="btn btn-success"><i class="icon-plus"></i> {l s='Add new facility'}</button>
|
||||
<button id="back_to_demands_btn" class="btn btn-default"><i class="icon-arrow-left"></i> {l s='Back'}</button>
|
||||
</p>
|
||||
|
||||
{* Already selected room demands *}
|
||||
<div class="col-sm-12 room_ordered_demands table-responsive">
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{l s='Name'}</th>
|
||||
<th>{l s='Unit Price (tax excl.)'}</th>
|
||||
<th>{l s='Total Price (tax excl.)'}</th>
|
||||
<th>{l s='Total Price (tax incl.)'}</th>
|
||||
<th class="text-right">{l s='Action'}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{if isset($extraDemands) && $extraDemands}
|
||||
{foreach $extraDemands as $roomDemand}
|
||||
{foreach $roomDemand['extra_demands'] as $demand}
|
||||
<tr data-id_booking_demand="{$demand['id_booking_demand']}">
|
||||
<td>{$demand['name']}</td>
|
||||
<td>
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon">{$currencySign}</span>
|
||||
<input type="text" class="form-control unit_price" value="{$demand['unit_price_tax_excl']}">
|
||||
{if $demand['price_calc_method'] == HotelRoomTypeGlobalDemand::WK_PRICE_CALC_METHOD_EACH_DAY}
|
||||
<span class="input-group-addon">{l s='/ night'}</span>
|
||||
{/if}
|
||||
</div>
|
||||
</td>
|
||||
<td>{displayPrice price=$demand['total_price_tax_excl'] currency=$orderCurrency}</td>
|
||||
<td>{displayPrice price=$demand['total_price_tax_incl'] currency=$orderCurrency}</td>
|
||||
<td class="text-right"><a class="btn btn-danger pull-right del-order-room-demand" href="#" id_booking_demand="{$demand['id_booking_demand']}"><i class="icon-trash"></i></a></td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
{/foreach}
|
||||
{else}
|
||||
<tr>
|
||||
<td colspan="4">
|
||||
<i class="icon-warning"></i> {l s='No facilities added yet.'}
|
||||
</td>
|
||||
</tr>
|
||||
{/if}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
{* Room demands available for the current editing room*}
|
||||
<div class="col-sm-12 room_demands_container">
|
||||
<div class="room_demand_detail">
|
||||
{if isset($roomTypeDemands) && $roomTypeDemands}
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th></th>
|
||||
<th>{l s='Name'}</th>
|
||||
<th>{l s='Option'}</th>
|
||||
<th>{l s='Unit Price (tax excl.)'}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{foreach $roomTypeDemands as $idGlobalDemand => $demand}
|
||||
<tr class="room_demand_block">
|
||||
<td>
|
||||
<input id_cart_booking="{$roomDemand['id']}" value="{$idGlobalDemand|escape:'html':'UTF-8'}" type="checkbox" class="id_room_type_demand" {if isset($roomDemand['selected_global_demands']) && $roomDemand['selected_global_demands'] && ($idGlobalDemand|in_array:$roomDemand['selected_global_demands'])}checked{/if} />
|
||||
</td>
|
||||
<td>
|
||||
{$demand['name']|escape:'html':'UTF-8'}
|
||||
</td>
|
||||
<td class="demand_adv_option_block">
|
||||
{if isset($demand['adv_option']) && $demand['adv_option']}
|
||||
<select class="id_option">
|
||||
{foreach $demand['adv_option'] as $idOption => $option}
|
||||
{assign var=demand_key value="`$idGlobalDemand`-`$idOption`"}
|
||||
<option optionPrice="{$option['price_tax_excl']|escape:'html':'UTF-8'}" value="{$idOption|escape:'html':'UTF-8'}" {if isset($roomDemand['extra_demands'][$demand_key])}selected{/if} key="{$demand_key}">{$option['name']}</option>
|
||||
{if isset($roomDemand['extra_demands'][$demand_key])}
|
||||
{assign var=selected_adv_option value="$idOption"}
|
||||
{/if}
|
||||
{/foreach}
|
||||
</select>
|
||||
{else}
|
||||
{l s='--'}
|
||||
<input type="hidden" class="id_option" value="0" />
|
||||
{/if}
|
||||
</td>
|
||||
<td>
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon">{$currencySign}</span>
|
||||
{if isset($selected_adv_option) && isset($demand['adv_option'][$selected_adv_option]['price_tax_excl'])}
|
||||
{assign var=demand_price value=$demand['adv_option'][$selected_adv_option]['price_tax_excl']}
|
||||
{else if isset($demand['adv_option']) && $demand['adv_option']}
|
||||
{assign var=demand_price value=$demand['adv_option'][$demand['adv_option']|@key]['price_tax_excl']}
|
||||
{else}
|
||||
{assign var=demand_price value=$demand['price_tax_excl']}
|
||||
{/if}
|
||||
<input type="text" class="form-control unit_price" value="{$demand_price}" data-id-product="{$product['id_product']}">
|
||||
{if $demand['price_calc_method'] == HotelRoomTypeGlobalDemand::WK_PRICE_CALC_METHOD_EACH_DAY}
|
||||
<span class="input-group-addon">{l s='/ night'}</span>
|
||||
{/if}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<div class="modal-footer">
|
||||
<button type="button" id="save_room_demands" class="btn btn-primary"><i class="icon icon-save"></i> {l s="Update Facilities"}</button>
|
||||
</div>
|
||||
{else}
|
||||
<i class="icon-warning"></i> {l s='No facilities available for this room.'}
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
{else}
|
||||
<div class="room_demand_detail">
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{l s='Name'}</th>
|
||||
<th>{l s='Unit Price (tax excl.)'}</th>
|
||||
<th>{l s='Total Price (tax excl.)'}</th>
|
||||
<th>{l s='Total Price (tax incl.)'}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{if isset($extraDemands) && $extraDemands}
|
||||
{foreach $extraDemands as $roomDemand}
|
||||
{foreach $roomDemand['extra_demands'] as $demand}
|
||||
<tr class="room_demand_block">
|
||||
<td>{$demand['name']}</td>
|
||||
<td>
|
||||
{displayPrice price=$demand['unit_price_tax_excl'] currency=$orderCurrency}
|
||||
{if $demand['price_calc_method'] == HotelRoomTypeGlobalDemand::WK_PRICE_CALC_METHOD_EACH_DAY}
|
||||
{l s='/ night'}
|
||||
{/if}
|
||||
</td>
|
||||
<td>{displayPrice price=$demand['total_price_tax_excl'] currency=$orderCurrency}</td>
|
||||
<td>{displayPrice price=$demand['total_price_tax_incl'] currency=$orderCurrency}</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
{/foreach}
|
||||
{else}
|
||||
<tr>
|
||||
<td colspan="3">
|
||||
<i class="icon-warning"></i> {l s='No facilities added yet.'}
|
||||
</td>
|
||||
</tr>
|
||||
{/if}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
@@ -20,7 +20,7 @@
|
||||
* @license https://opensource.org/license/osl-3-0-php Open Software License version 3.0
|
||||
*}
|
||||
|
||||
<div id="room_type_service_product_desc" class="tab-pane {if isset($show_active) && $show_active}active{/if} extra-services-container">
|
||||
<div id="room_type_service_product_desc" class="tab-pane {if isset($show_active) && $show_active}active{/if} extra-services-container">
|
||||
{if isset($orderEdit) && $orderEdit}
|
||||
|
||||
<div class="col-sm-12 facility_nav_btn">
|
||||
@@ -51,7 +51,7 @@
|
||||
<tbody>
|
||||
{if isset($additionalServices) && $additionalServices}
|
||||
{foreach $additionalServices['additional_services'] as $service}
|
||||
<tr class="room_demand_block" data-id_service_product_order_detail="{$service['id_service_product_order_detail']}">
|
||||
<tr class="room_service_block" data-id_service_product_order_detail="{$service['id_service_product_order_detail']}">
|
||||
<td>
|
||||
<div>{$service['name']|escape:'html':'UTF-8'}</div>
|
||||
<input value="{$service['id_service_product_order_detail']|escape:'html':'UTF-8'}" name="id_service_product_order_detail[]" type="hidden"/>
|
||||
@@ -110,7 +110,7 @@
|
||||
|
||||
{* add already available service interface *}
|
||||
<form id="add_existing_room_services_form" class="col-sm-12 room_services_container">
|
||||
<div class="room_demand_detail">
|
||||
<div class="room_service_detail">
|
||||
{if isset($serviceProducts) && $serviceProducts}
|
||||
<table class="table">
|
||||
<thead>
|
||||
@@ -124,7 +124,7 @@
|
||||
</thead>
|
||||
<tbody>
|
||||
{foreach $serviceProducts as $product}
|
||||
<tr class="room_demand_block">
|
||||
<tr class="room_service_block">
|
||||
<td>
|
||||
<input data-id_booking_detail="{$id_booking_detail}" value="{$product['id_product']|escape:'html':'UTF-8'}" name="selected_service[]" type="checkbox" class="id_room_type_service"/>
|
||||
</td>
|
||||
@@ -250,7 +250,7 @@
|
||||
{/if}
|
||||
|
||||
{elseif isset($additionalServices) && $additionalServices}
|
||||
<table class="table room_demand_detail">
|
||||
<table class="table room_service_detail">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{l s='ID'}</th>
|
||||
@@ -264,7 +264,7 @@
|
||||
</thead>
|
||||
</tbody>
|
||||
{foreach $additionalServices['additional_services'] as $service}
|
||||
<tr class="room_demand_block">
|
||||
<tr class="room_service_block">
|
||||
<td>
|
||||
{$service['id_product']|escape:'html':'UTF-8'}{if !$service['product_deleted']} <a target="blank" href="{$link->getAdminLink('AdminNormalProducts')|escape:'html':'UTF-8'}&id_product={$service['id_product']|escape:'html':'UTF-8'}&updateproduct"><i class="icon-external-link-sign"></i></a>{/if}
|
||||
</td>
|
||||
|
||||
@@ -20,17 +20,14 @@
|
||||
* @license https://opensource.org/license/osl-3-0-php Open Software License version 3.0
|
||||
*}
|
||||
|
||||
{include file='controllers/orders/modals/_extra_services_facilities_tab_content.tpl'}
|
||||
{include file='controllers/orders/modals/_extra_services_service_products_tab_content.tpl'}
|
||||
|
||||
{* Css for handling extra demands changes *}
|
||||
{* Css for handling extra services changes *}
|
||||
<style type="text/css">
|
||||
/*Extra demands CSS*/
|
||||
#edit_product .extra-services-container .room_demands_container,
|
||||
/*Extra services CSS*/
|
||||
#edit_product .extra-services-container .room_service_container,
|
||||
#edit_product .extra-services-container .room_services_container {
|
||||
display: none;}
|
||||
#edit_product .extra-services-container #save_room_demands,
|
||||
#edit_product .extra-services-container #back_to_demands_btn,
|
||||
#edit_product .extra-services-container #save_service_service,
|
||||
#edit_product .extra-services-container #back_to_service_btn {
|
||||
display: none;}
|
||||
|
||||
@@ -89,8 +89,8 @@
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="alert alert-warning col-sm-12 realloc_roomtype_change_message" style="display:none">
|
||||
<p>{l s="If room type is changed while room reallocation then all additional facilities and services will be assigned to the selected room of new room type."}</p>
|
||||
<p>{l s="If you want to change additional facilities or services, you can update by editing the room after reallocation."}</p>
|
||||
<p>{l s="If room type is changed while room reallocation then all additional services will be assigned to the selected room of new room type."}</p>
|
||||
<p>{l s="If you want to change additional services, you can update by editing the room after reallocation."}</p>
|
||||
</div>
|
||||
</div>
|
||||
<p class="error_text" id="realloc_sel_rm_err_p"></p>
|
||||
|
||||
@@ -1,156 +0,0 @@
|
||||
{**
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License version 3.0
|
||||
* that is bundled with this package in the file LICENSE.md
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* https://opensource.org/license/osl-3-0-php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to support@qloapps.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade this module to a 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
|
||||
* @copyright Since 2010 Webkul
|
||||
* @license https://opensource.org/license/osl-3-0-php Open Software License version 3.0
|
||||
*}
|
||||
|
||||
{if isset($product->id) && $product->id}
|
||||
<input type="hidden" name="submitted_tabs[]" value="AdditionalFacilities" />
|
||||
<div class="panel">
|
||||
<div class="panel-heading">
|
||||
<i class="icon-user"></i> {l s='Room Type Additional Facilities'}
|
||||
</div>
|
||||
<div class="alert alert-info">
|
||||
{l s='To create new additional facilities please visit'} <a target="_blank" href="{$link->getAdminLink('AdminRoomTypeGlobalDemand')}">{l s='Additional facilities'}</a> {l s='page.'}
|
||||
</div>
|
||||
{if isset($allDemands) && $allDemands}
|
||||
|
||||
<div class="from-group table-responsive-row clearfix">
|
||||
<table class="table" id="demands_table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th></th>
|
||||
<th>
|
||||
{l s='Name'}
|
||||
</th>
|
||||
<th>
|
||||
{l s='Option'}
|
||||
</th>
|
||||
<th class="fixed-width-xl">
|
||||
{l s='Price'}
|
||||
</th>
|
||||
<th>
|
||||
{l s='Tax rule'}
|
||||
</th>
|
||||
<th class="fixed-width-lg text-center">
|
||||
{l s='Per day price calculation'}
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{foreach $allDemands as $key => $demand}
|
||||
{assign var="rowcount" value=0}
|
||||
{if isset($demand['adv_option']) && $demand['adv_option']}
|
||||
{assign var="rowspan" value=$demand['adv_option']|count}
|
||||
{assign var="adv_option" value=$demand['adv_option']}
|
||||
{else}
|
||||
{assign var="rowspan" value=1}
|
||||
{assign var="adv_option" value=[]}
|
||||
{/if}
|
||||
{foreach $adv_option as $option}
|
||||
{assign var="rowcount" value=$rowcount + 1}
|
||||
<tr>
|
||||
{if $rowcount <= 1}
|
||||
<td rowspan="{$rowspan}">
|
||||
<input class="selected_demand" type="checkbox" name="selected_demand[]" value="{$demand['id_global_demand']|escape:'html':'UTF-8'}" {if isset($selectedDemands[$demand['id_global_demand']])}checked{/if} />
|
||||
<input type="hidden" name="demand_price_{$demand['id_global_demand']|escape:'html':'UTF-8'}" value="{if isset($selectedDemands[$demand['id_global_demand']]['price'])}{$selectedDemands[$demand['id_global_demand']]['price']|escape:'html':'UTF-8'}{elseif isset($demand['price'])}{$demand['price']|escape:'html':'UTF-8'}{/if}"/>
|
||||
</td>
|
||||
<td rowspan="{$rowspan}">
|
||||
<a target="blank" href="{$link->getAdminLink('AdminRoomTypeGlobalDemand')|escape:'html':'UTF-8'}&id_global_demand={$demand['id_global_demand']|escape:'html':'UTF-8'}&updatehtl_room_type_global_demand"><i class="icon-external-link-sign"></i></a> {$demand['name']|escape:'html':'UTF-8'}
|
||||
</td>
|
||||
{/if}
|
||||
<td>
|
||||
{$option['name']|escape:'html':'UTF-8'}
|
||||
</td>
|
||||
<td class="demand_price_{$demand['id_global_demand']}">
|
||||
<div class="input-group price_input" {if !isset($selectedDemands[$demand['id_global_demand']])}style="display:none"{/if}>
|
||||
<span class="input-group-addon">{$defaultcurrencySign|escape:'html':'UTF-8'}</span>
|
||||
<input type="text" name="option_price_{$option['id']|escape:'html':'UTF-8'}" value="{if isset($selectedDemands[$demand['id_global_demand']]['adv_option'][$option['id']]['price'])}{$selectedDemands[$demand['id_global_demand']]['adv_option'][$option['id']]['price']|escape:'html':'UTF-8'}{else}{$option['price']|escape:'html':'UTF-8'}{/if}"/>
|
||||
</div>
|
||||
<div class="price_display" {if isset($selectedDemands[$demand['id_global_demand']])}style="display:none"{/if}>
|
||||
{displayPrice price={$option['price']|escape:'html':'UTF-8'} currency=$idDefaultcurrency}
|
||||
</div>
|
||||
|
||||
</td>
|
||||
{if $rowcount == 1}
|
||||
<td rowspan="{$rowspan}">
|
||||
{$demand['default_tax_rules_group_name']}
|
||||
</td>
|
||||
<td class="text-center" rowspan="{$rowspan}">
|
||||
{if $demand['price_calc_method'] == 1}
|
||||
<span class="badge badge-success">{l s='Yes'}</span>
|
||||
{else}
|
||||
<span>{l s='No'}</span>
|
||||
{/if}
|
||||
</td>
|
||||
{/if}
|
||||
</tr>
|
||||
{foreachelse}
|
||||
<tr>
|
||||
<td>
|
||||
<input class="selected_demand" type="checkbox" name="selected_demand[]" value="{$demand['id_global_demand']|escape:'html':'UTF-8'}" {if isset($selectedDemands[$demand['id_global_demand']])}checked{/if} />
|
||||
</td>
|
||||
<td>
|
||||
<a target="blank" href="{$link->getAdminLink('AdminRoomTypeGlobalDemand')|escape:'html':'UTF-8'}&id_global_demand={$demand['id_global_demand']|escape:'html':'UTF-8'}&updatehtl_room_type_global_demand"><i class="icon-external-link-sign"></i></a> {$demand['name']|escape:'html':'UTF-8'}
|
||||
</td>
|
||||
|
||||
<td></td>
|
||||
<td class="demand_price_{$demand['id_global_demand']}">
|
||||
<div class="input-group price_input" {if !isset($selectedDemands[$demand['id_global_demand']])}style="display:none"{/if}>
|
||||
<span class="input-group-addon">{$defaultcurrencySign|escape:'html':'UTF-8'}</span>
|
||||
<input type="text" name="demand_price_{$demand['id_global_demand']|escape:'html':'UTF-8'}"
|
||||
value="{if isset($selectedDemands[$demand['id_global_demand']]['price'])}{$selectedDemands[$demand['id_global_demand']]['price']|escape:'html':'UTF-8'}{elseif isset($demand['price'])}{$demand['price']|escape:'html':'UTF-8'}{/if}"/>
|
||||
</div>
|
||||
<div class="price_display" {if isset($selectedDemands[$demand['id_global_demand']])}style="display:none"{/if}>
|
||||
{displayPrice price={$demand['price']|escape:'html':'UTF-8'} currency=$idDefaultcurrency}
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
{$demand['default_tax_rules_group_name']}
|
||||
</td>
|
||||
<td class="text-center">
|
||||
{if $demand['price_calc_method'] == 1}
|
||||
<span class="badge badge-success">{l s='Yes'}</span>
|
||||
{else}
|
||||
<span>{l s='No'}</span>
|
||||
{/if}
|
||||
</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
{/foreach}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="panel-footer">
|
||||
<a href="{$link->getAdminLink('AdminProducts')|escape:'html':'UTF-8'}{if isset($smarty.request.page) && $smarty.request.page > 1}&submitFilterproduct={$smarty.request.page|intval}{/if}" class="btn btn-default">
|
||||
<i class="process-icon-cancel"></i>
|
||||
{l s='Cancel'}
|
||||
</a>
|
||||
<button type="submit" name="submitAddproduct" class="btn btn-default pull-right" disabled="disabled">
|
||||
<i class="process-icon-loading"></i>
|
||||
{l s='Save'}
|
||||
</button>
|
||||
<button type="submit" name="submitAddproductAndStay" class="btn btn-default pull-right" disabled="disabled">
|
||||
<i class="process-icon-loading"></i>
|
||||
{l s='Save and stay'}
|
||||
</button>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
@@ -173,19 +173,6 @@ $(function() {
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
{if isset($num_global_demands) && $num_global_demands}
|
||||
<div class="panel">
|
||||
<h3>
|
||||
{if $num_global_demands == 1}
|
||||
{l s='1 global demand'}
|
||||
{else}
|
||||
{l s='%d global demands' sprintf=$num_global_demands}
|
||||
{/if}
|
||||
</h3>
|
||||
{$global_demands}
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
{if isset($num_refund_rules) && $num_refund_rules}
|
||||
<div class="panel">
|
||||
<h3>
|
||||
|
||||
@@ -186,7 +186,7 @@ class CartCore extends ObjectModel
|
||||
const ONLY_ROOM_SERVICES_WITH_AUTO_ADD_WITHOUT_CONVENIENCE_FEE = 17;
|
||||
const ONLY_CONVENIENCE_FEE = 18;
|
||||
|
||||
const ONLY_PRODUCTS_WITH_DEMANDS = 19;
|
||||
const ONLY_PRODUCTS_WITH_ADDITIONAL_SERVICE = 19;
|
||||
|
||||
public function __construct($id = null, $id_lang = null)
|
||||
{
|
||||
@@ -368,8 +368,8 @@ class CartCore extends ObjectModel
|
||||
*/
|
||||
public function getAverageProductsTaxRate(&$cart_amount_te = null, &$cart_amount_ti = null)
|
||||
{
|
||||
$cart_amount_ti = $this->getOrderTotal(true, Cart::ONLY_PRODUCTS_WITH_DEMANDS);
|
||||
$cart_amount_te = $this->getOrderTotal(false, Cart::ONLY_PRODUCTS_WITH_DEMANDS);
|
||||
$cart_amount_ti = $this->getOrderTotal(true, Cart::ONLY_PRODUCTS_WITH_ADDITIONAL_SERVICE);
|
||||
$cart_amount_te = $this->getOrderTotal(false, Cart::ONLY_PRODUCTS_WITH_ADDITIONAL_SERVICE);
|
||||
|
||||
$cart_vat_amount = $cart_amount_ti - $cart_amount_te;
|
||||
|
||||
@@ -1571,7 +1571,7 @@ class CartCore extends ObjectModel
|
||||
Cart::ONLY_PHYSICAL_PRODUCTS_WITHOUT_SHIPPING,
|
||||
Cart::ADVANCE_PAYMENT,
|
||||
Cart::ADVANCE_PAYMENT_ONLY_PRODUCTS,
|
||||
Cart::ONLY_PRODUCTS_WITH_DEMANDS,
|
||||
Cart::ONLY_PRODUCTS_WITH_ADDITIONAL_SERVICE,
|
||||
);
|
||||
|
||||
// Define virtual context to prevent case where the cart is not the in the global context
|
||||
@@ -1638,7 +1638,6 @@ class CartCore extends ObjectModel
|
||||
}
|
||||
$products_total = array();
|
||||
$ecotax_total = 0;
|
||||
$totalDemandsPrice = 0;
|
||||
$objCartBookingData = new HotelCartBookingData();
|
||||
$objServiceProductCartDetail = new ServiceProductCartDetail();
|
||||
$objAdvPayment = new HotelAdvancedPayment();
|
||||
@@ -1914,15 +1913,12 @@ class CartCore extends ObjectModel
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// price of extra demands on room type in the cart
|
||||
$totalDemandsPrice += $objCartBookingData->getCartExtraDemands($this->id, $product['id_product'], 0, 0, 0, 1, 0, (int)$with_taxes);
|
||||
}
|
||||
foreach ($products_total as $key => $price) {
|
||||
$order_total += $price;
|
||||
}
|
||||
|
||||
$order_total_products = $order_total + $totalDemandsPrice;
|
||||
$order_total_products = $order_total;
|
||||
|
||||
if ($type == Cart::ONLY_DISCOUNTS) {
|
||||
$order_total = 0;
|
||||
@@ -1941,15 +1937,6 @@ class CartCore extends ObjectModel
|
||||
return $wrapping_fees;
|
||||
}
|
||||
|
||||
// price of extra demands on room type in the cart
|
||||
if ($type == Cart::BOTH
|
||||
|| $type == Cart::BOTH_WITHOUT_SHIPPING
|
||||
|| $type == Cart::ADVANCE_PAYMENT
|
||||
|| $type == Cart::ONLY_PRODUCTS_WITH_DEMANDS
|
||||
) {
|
||||
$order_total += $totalDemandsPrice;
|
||||
}
|
||||
|
||||
$order_total_discount = 0;
|
||||
$order_shipping_discount = 0;
|
||||
$advance_payment_products_discount = 0;
|
||||
@@ -1964,7 +1951,7 @@ class CartCore extends ObjectModel
|
||||
Cart::ONLY_ROOM_SERVICES_WITHOUT_AUTO_ADD,
|
||||
Cart::ONLY_ROOM_SERVICES_WITHOUT_CONVENIENCE_FEE,
|
||||
Cart::ONLY_ROOM_SERVICES_WITH_AUTO_ADD_WITHOUT_CONVENIENCE_FEE,
|
||||
Cart::ONLY_PRODUCTS_WITH_DEMANDS)
|
||||
Cart::ONLY_PRODUCTS_WITH_ADDITIONAL_SERVICE)
|
||||
) && CartRule::isFeatureActive()
|
||||
) {
|
||||
// First, retrieve the cart rules associated to this "getOrderTotal"
|
||||
@@ -3827,26 +3814,6 @@ class CartCore extends ObjectModel
|
||||
$total_discounts = $this->getOrderTotal(true, Cart::ONLY_DISCOUNTS);
|
||||
$total_discounts_tax_exc = $this->getOrderTotal(false, Cart::ONLY_DISCOUNTS);
|
||||
$objCartBookingData = new HotelCartBookingData();
|
||||
$total_demands_wt = $objCartBookingData->getCartExtraDemands(
|
||||
$this->id,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
0,
|
||||
1
|
||||
);
|
||||
$total_demands = $objCartBookingData->getCartExtraDemands(
|
||||
$this->id,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
0,
|
||||
0
|
||||
);
|
||||
// The cart content is altered for display
|
||||
foreach ($cart_rules as &$cart_rule) {
|
||||
// If the cart rule is automatic (wihtout any code) and include free shipping, it should not be displayed as a cart rule but only set the shipping cost to 0
|
||||
@@ -3933,8 +3900,8 @@ class CartCore extends ObjectModel
|
||||
}
|
||||
|
||||
$objHotelAdvancedPayment = new HotelAdvancedPayment();
|
||||
$total_rooms_with_services_without_discount_te = $total_rooms + $total_demands + $total_additional_services + $total_additional_services_auto_add + $total_standalone_service_products;
|
||||
$total_rooms_with_services_without_discount_ti = $total_rooms_wt + $total_demands_wt + $total_additional_services_wt + $total_additional_services_auto_add_wt + $total_standalone_service_products_wt;
|
||||
$total_rooms_with_services_without_discount_te = $total_rooms + $total_additional_services + $total_additional_services_auto_add + $total_standalone_service_products;
|
||||
$total_rooms_with_services_without_discount_ti = $total_rooms_wt + $total_additional_services_wt + $total_additional_services_auto_add_wt + $total_standalone_service_products_wt;
|
||||
|
||||
$cart_total_without_discount_te = $total_rooms_with_services_without_discount_te + $convenience_fee;
|
||||
$cart_total_without_discount_ti = $total_rooms_with_services_without_discount_ti + $convenience_fee_wt;
|
||||
@@ -3972,8 +3939,6 @@ class CartCore extends ObjectModel
|
||||
'convenience_fee_tax' => $convenience_fee_tax,
|
||||
'total_standalone_service_products_wt' => $total_standalone_service_products_wt,
|
||||
'total_standalone_service_products' => $total_standalone_service_products,
|
||||
'total_extra_demands_wt' => $total_demands_wt,
|
||||
'total_extra_demands' => $total_demands,
|
||||
'total_price' => $base_total_tax_inc,
|
||||
'total_tax' => $total_tax,
|
||||
'total_price_without_tax' => $base_total_tax_exc,
|
||||
@@ -4907,20 +4872,11 @@ class CartCore extends ObjectModel
|
||||
$idCustomer = $objCart->id_customer;
|
||||
$idCurrency = $objCart->id_currency;
|
||||
|
||||
$extraDemands = null;
|
||||
|
||||
// We have to check the alreadt entered rooms for booking parameters with this variable as Also is sending all the rooms everytime
|
||||
// because id_guest is not managed in the API call
|
||||
$roomsAddedToCart = [];
|
||||
foreach ($bookingRows as $booking) {
|
||||
$booking = json_decode(json_encode($booking, true), true);
|
||||
if (isset($booking['extra_demands']['extra_demand'])) {
|
||||
$extraDemands = $booking['extra_demands']['extra_demand'];
|
||||
if (isset($extraDemands['id_global_demand'])) {
|
||||
$extraDemands = array($extraDemands);
|
||||
}
|
||||
$extraDemands = json_encode($extraDemands);
|
||||
}
|
||||
|
||||
// get room booking info
|
||||
$idProduct = $booking['id_product'];
|
||||
@@ -5027,7 +4983,6 @@ class CartCore extends ObjectModel
|
||||
$objCartBooking->id_hotel = $val_hotel_room_info['id_hotel'];
|
||||
$objCartBooking->booking_type = HotelBookingDetail::ALLOTMENT_AUTO;
|
||||
$objCartBooking->quantity = $numDays;
|
||||
$objCartBooking->extra_demands = $extraDemands;
|
||||
$objCartBooking->date_from = $dateFrom;
|
||||
$objCartBooking->date_to = $dateTo;
|
||||
$objCartBooking->save();
|
||||
|
||||
@@ -973,8 +973,8 @@ class CartRuleCore extends ObjectModel
|
||||
|
||||
$all_cart_rules_ids = $context->cart->getOrderedCartRulesIds();
|
||||
|
||||
$cart_amount_ti = $context->cart->getOrderTotal(true, Cart::ONLY_PRODUCTS_WITH_DEMANDS);
|
||||
$cart_amount_te = $context->cart->getOrderTotal(false, Cart::ONLY_PRODUCTS_WITH_DEMANDS);
|
||||
$cart_amount_ti = $context->cart->getOrderTotal(true, Cart::ONLY_PRODUCTS_WITH_ADDITIONAL_SERVICE);
|
||||
$cart_amount_te = $context->cart->getOrderTotal(false, Cart::ONLY_PRODUCTS_WITH_ADDITIONAL_SERVICE);
|
||||
|
||||
// Free shipping on selected carriers
|
||||
if ($this->free_shipping && in_array($filter, array(CartRule::FILTER_ACTION_ALL, CartRule::FILTER_ACTION_ALL_NOCAP, CartRule::FILTER_ACTION_SHIPPING))) {
|
||||
@@ -1000,7 +1000,7 @@ class CartRuleCore extends ObjectModel
|
||||
// Discount (%) on the whole order
|
||||
if ($this->reduction_percent && $this->reduction_product == 0) {
|
||||
// Do not give a reduction on free products!
|
||||
$order_total = $context->cart->getOrderTotal($use_tax, Cart::ONLY_PRODUCTS_WITH_DEMANDS, $package_products);
|
||||
$order_total = $context->cart->getOrderTotal($use_tax, Cart::ONLY_PRODUCTS_WITH_ADDITIONAL_SERVICE, $package_products);
|
||||
foreach ($context->cart->getCartRules(CartRule::FILTER_ACTION_GIFT) as $cart_rule) {
|
||||
$order_total -= Tools::ps_round($cart_rule['obj']->getContextualValue($use_tax, $context, CartRule::FILTER_ACTION_GIFT, $package), _PS_PRICE_COMPUTE_PRECISION_);
|
||||
}
|
||||
@@ -1073,9 +1073,9 @@ class CartRuleCore extends ObjectModel
|
||||
if ((float)$this->reduction_amount > 0) {
|
||||
$prorata = 1;
|
||||
if (!is_null($package) && count($all_products)) {
|
||||
$total_products = $context->cart->getOrderTotal($use_tax, Cart::ONLY_PRODUCTS_WITH_DEMANDS);
|
||||
$total_products = $context->cart->getOrderTotal($use_tax, Cart::ONLY_PRODUCTS_WITH_ADDITIONAL_SERVICE);
|
||||
if ($total_products) {
|
||||
$prorata = $context->cart->getOrderTotal($use_tax, Cart::ONLY_PRODUCTS_WITH_DEMANDS, $package['products']) / $total_products;
|
||||
$prorata = $context->cart->getOrderTotal($use_tax, Cart::ONLY_PRODUCTS_WITH_ADDITIONAL_SERVICE, $package['products']) / $total_products;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1124,7 +1124,7 @@ class CartRuleCore extends ObjectModel
|
||||
if ($this->reduction_tax == $use_tax) {
|
||||
// The reduction cannot exceed the products total, except when we do not want it to be limited (for the partial use calculation)
|
||||
if ($filter != CartRule::FILTER_ACTION_ALL_NOCAP) {
|
||||
$cart_amount = $context->cart->getOrderTotal($use_tax, Cart::ONLY_PRODUCTS_WITH_DEMANDS);
|
||||
$cart_amount = $context->cart->getOrderTotal($use_tax, Cart::ONLY_PRODUCTS_WITH_ADDITIONAL_SERVICE);
|
||||
$reduction_amount = min($reduction_amount, $cart_amount);
|
||||
}
|
||||
$reduction_value += $prorata * $reduction_amount;
|
||||
@@ -1379,7 +1379,7 @@ class CartRuleCore extends ObjectModel
|
||||
return array();
|
||||
}
|
||||
|
||||
$order_total = $context->cart->getOrderTotal(true, Cart::ONLY_PRODUCTS_WITH_DEMANDS, null, null, false);
|
||||
$order_total = $context->cart->getOrderTotal(true, Cart::ONLY_PRODUCTS_WITH_ADDITIONAL_SERVICE, null, null, false);
|
||||
static $errors = array();
|
||||
foreach ($context->cart->getCartRules() as $cart_rule) {
|
||||
if ($error = $cart_rule['obj']->checkValidity($context, true)) {
|
||||
|
||||
@@ -901,64 +901,9 @@ abstract class PaymentModuleCore extends Module
|
||||
);
|
||||
}
|
||||
}
|
||||
if ($objBookingDetail->save()) {
|
||||
// save extra demands info
|
||||
if ($objCartBookingData->extra_demands
|
||||
&& ($extraDemands = json_decode($objCartBookingData->extra_demands, true))
|
||||
) {
|
||||
$objRoomDemandPrice = new HotelRoomTypeDemandPrice();
|
||||
foreach ($extraDemands as $demand) {
|
||||
$idGlobalDemand = $demand['id_global_demand'];
|
||||
$idOption = $demand['id_option'];
|
||||
$objBookingDemand = new HotelBookingDemands();
|
||||
$objBookingDemand->id_htl_booking = $objBookingDetail->id;
|
||||
$objGlobalDemand = new HotelRoomTypeGlobalDemand($idGlobalDemand, $idLang);
|
||||
if ($idOption) {
|
||||
$objOption = new HotelRoomTypeGlobalDemandAdvanceOption($idOption, $idLang);
|
||||
$objBookingDemand->name = $objOption->name;
|
||||
} else {
|
||||
$idOption = 0;
|
||||
$objBookingDemand->name = $objGlobalDemand->name;
|
||||
}
|
||||
$objBookingDemand->unit_price_tax_excl = HotelRoomTypeDemand::getPriceStatic(
|
||||
$idProduct,
|
||||
$idGlobalDemand,
|
||||
$idOption,
|
||||
0
|
||||
);
|
||||
$objBookingDemand->unit_price_tax_incl = HotelRoomTypeDemand::getPriceStatic(
|
||||
$idProduct,
|
||||
$idGlobalDemand,
|
||||
$idOption,
|
||||
1
|
||||
);
|
||||
|
||||
$numDays = 1;
|
||||
if ($objGlobalDemand->price_calc_method == HotelRoomTypeGlobalDemand::WK_PRICE_CALC_METHOD_EACH_DAY) {
|
||||
$numDays = HotelHelper::getNumberOfDays(
|
||||
$objBookingDetail->date_from,
|
||||
$objBookingDetail->date_to
|
||||
);
|
||||
}
|
||||
|
||||
$objBookingDemand->total_price_tax_excl = Tools::processPriceRounding(($objBookingDemand->unit_price_tax_excl * $numDays));
|
||||
$objBookingDemand->total_price_tax_incl = Tools::processPriceRounding(($objBookingDemand->unit_price_tax_incl * $numDays));
|
||||
|
||||
$objBookingDemand->price_calc_method = $objGlobalDemand->price_calc_method;
|
||||
$objBookingDemand->id_tax_rules_group = $objGlobalDemand->id_tax_rules_group;
|
||||
$taxManager = TaxManagerFactory::getManager(
|
||||
$vatAddress,
|
||||
$objGlobalDemand->id_tax_rules_group
|
||||
);
|
||||
$taxCalc = $taxManager->getTaxCalculator();
|
||||
$objBookingDemand->tax_computation_method = (int)$taxCalc->computation_method;
|
||||
if ($objBookingDemand->save()) {
|
||||
$objBookingDemand->tax_calculator = $taxCalc;
|
||||
// Now save tax details of the extra demand
|
||||
$objBookingDemand->setBookingDemandTaxDetails();
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!$objBookingDetail->save()) {
|
||||
PrestaShopLogger::addLog('PaymentModule::validateOrder - Cannot save Booking Detail', 3, null, 'Cart', (int)$id_cart, true);
|
||||
throw new PrestaShopException('Can\'t save Booking Detail');
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -1225,8 +1170,8 @@ abstract class PaymentModuleCore extends Module
|
||||
$cart_booking_data_text = $this->getEmailTemplateContent('hotel_booking_cart_data_text.tpl', Mail::TYPE_TEXT, $cart_booking_data['cart_htl_data']);
|
||||
$cart_booking_data_html = $this->getEmailTemplateContent('hotel_booking_cart_data.tpl', Mail::TYPE_HTML, $cart_booking_data['cart_htl_data']);
|
||||
|
||||
$extra_demands_details_html = $this->getEmailTemplateContent('booking_extra_demands.tpl', Mail::TYPE_HTML, $cart_booking_data['cart_htl_data']);
|
||||
$extra_demands_details_text = $this->getEmailTemplateContent('booking_extra_demands_text.tpl', Mail::TYPE_TEXT, $cart_booking_data['cart_htl_data']);
|
||||
$extra_services_details_html = $this->getEmailTemplateContent('booking_extra_services.tpl', Mail::TYPE_HTML, $cart_booking_data['cart_htl_data']);
|
||||
$extra_services_details_text = $this->getEmailTemplateContent('booking_extra_services_text.tpl', Mail::TYPE_TEXT, $cart_booking_data['cart_htl_data']);
|
||||
|
||||
$normal_products_data_html = $this->getEmailTemplateContent('service_product_data.tpl', Mail::TYPE_HTML, $orderServiceProducts);
|
||||
$normal_products_data_txt = $this->getEmailTemplateContent('service_product_data_text.tpl', Mail::TYPE_TEXT, $orderServiceProducts);
|
||||
@@ -1238,8 +1183,8 @@ abstract class PaymentModuleCore extends Module
|
||||
$room_tax = ($room_price_tax_incl - $room_price_tax_excl);
|
||||
|
||||
// extra services
|
||||
$additional_service_price_tax_excl = ($order->getTotalProductsWithoutTaxes(false, false, Product::SELLING_PREFERENCE_WITH_ROOM_TYPE, 0) + $cart_booking_data['total_extra_demands_te']);
|
||||
$additional_service_price_tax_incl = ($order->getTotalProductsWithTaxes(false, false, Product::SELLING_PREFERENCE_WITH_ROOM_TYPE, 0) + $cart_booking_data['total_extra_demands_ti']);
|
||||
$additional_service_price_tax_excl = ($order->getTotalProductsWithoutTaxes(false, false, Product::SELLING_PREFERENCE_WITH_ROOM_TYPE, 0));
|
||||
$additional_service_price_tax_incl = ($order->getTotalProductsWithTaxes(false, false, Product::SELLING_PREFERENCE_WITH_ROOM_TYPE, 0));
|
||||
$additional_service_tax = ($additional_service_price_tax_incl - $additional_service_price_tax_excl);
|
||||
|
||||
// convenience fee price
|
||||
@@ -1299,22 +1244,12 @@ abstract class PaymentModuleCore extends Module
|
||||
$data = array(
|
||||
'{cart_booking_data_html}' => $cart_booking_data_html,
|
||||
'{cart_booking_data_text}' => $cart_booking_data_text,
|
||||
'{extra_demands_details_html}' => $extra_demands_details_html,
|
||||
'{extra_demands_details_text}' => $extra_demands_details_text,
|
||||
'{extra_services_details_html}' => $extra_services_details_html,
|
||||
'{extra_services_details_text}' => $extra_services_details_text,
|
||||
'{normal_products_data_html}' => $normal_products_data_html,
|
||||
'{normal_products_data_txt}' => $normal_products_data_txt,
|
||||
'{order_total_info_html}' => $order_total_info_html,
|
||||
'{order_total_info_txt}' => $order_total_info_txt,
|
||||
'{total_extra_demands_te}' => Tools::displayPrice(
|
||||
$cart_booking_data['total_extra_demands_te'],
|
||||
$this->context->currency,
|
||||
false
|
||||
),
|
||||
'{extra_demands_tax}' => Tools::displayPrice(
|
||||
($cart_booking_data['total_extra_demands_ti']-$cart_booking_data['total_extra_demands_te']),
|
||||
$this->context->currency,
|
||||
false
|
||||
),
|
||||
'{delivery_company}' => $delivery->company,
|
||||
'{delivery_firstname}' => $delivery->firstname,
|
||||
'{delivery_lastname}' => $delivery->lastname,
|
||||
@@ -1883,10 +1818,7 @@ abstract class PaymentModuleCore extends Module
|
||||
$obj_cart_bk_data = new HotelCartBookingData();
|
||||
$obj_htl_bk_dtl = new HotelBookingDetail();
|
||||
$obj_rm_type = new HotelRoomType();
|
||||
$objBookingDemand = new HotelBookingDemands();
|
||||
$objServiceProductOrderDetail = new ServiceProductOrderDetail();
|
||||
$result['total_extra_demands_te'] = 0;
|
||||
$result['total_extra_demands_ti'] = 0;
|
||||
$cart_htl_data = array();
|
||||
if (!empty($products)) {
|
||||
foreach ($products as $type_key => $type_value) {
|
||||
@@ -1960,35 +1892,6 @@ abstract class PaymentModuleCore extends Module
|
||||
$cart_htl_data[$type_key]['date_diff'][$date_join]['adults'] = $data_v['adults'];
|
||||
$cart_htl_data[$type_key]['date_diff'][$date_join]['children'] = $data_v['children'];
|
||||
|
||||
// extra demands prices
|
||||
$cart_htl_data[$type_key]['date_diff'][$date_join]['extra_demands'] = $objBookingDemand->getRoomTypeBookingExtraDemands(
|
||||
$order->id,
|
||||
$type_value['product_id'],
|
||||
0,
|
||||
$data_v['date_from'],
|
||||
$data_v['date_to']
|
||||
);
|
||||
$cart_htl_data[$type_key]['date_diff'][$date_join]['extra_demands_price_te'] = $objBookingDemand->getRoomTypeBookingExtraDemands(
|
||||
$order->id,
|
||||
$type_value['product_id'],
|
||||
0,
|
||||
$data_v['date_from'],
|
||||
$data_v['date_to'],
|
||||
0,
|
||||
1,
|
||||
0
|
||||
);
|
||||
$cart_htl_data[$type_key]['date_diff'][$date_join]['extra_demands_price_ti'] = $objBookingDemand->getRoomTypeBookingExtraDemands(
|
||||
$order->id,
|
||||
$type_value['product_id'],
|
||||
0,
|
||||
$data_v['date_from'],
|
||||
$data_v['date_to'],
|
||||
0,
|
||||
1,
|
||||
1
|
||||
);
|
||||
|
||||
$cart_htl_data[$type_key]['date_diff'][$date_join]['additional_services'] = $objServiceProductOrderDetail->getRoomTypeServiceProducts(
|
||||
$order->id,
|
||||
0,
|
||||
@@ -2034,9 +1937,6 @@ abstract class PaymentModuleCore extends Module
|
||||
$cart_htl_data[$type_key]['date_diff'][$date_join]['avg_paid_unit_price_tax_excl'] = ($cart_htl_data[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_excl'] + $cart_htl_data[$type_key]['date_diff'][$date_join]['additional_services_price_auto_add_te']);
|
||||
$cart_htl_data[$type_key]['date_diff'][$date_join]['amount_tax_incl'] = ($data_v['total_price_tax_incl'] + $cart_htl_data[$type_key]['date_diff'][$date_join]['additional_services_price_auto_add_ti']);
|
||||
$cart_htl_data[$type_key]['date_diff'][$date_join]['amount_tax_excl'] = ($data_v['total_price_tax_excl'] + $cart_htl_data[$type_key]['date_diff'][$date_join]['additional_services_price_auto_add_te']);
|
||||
|
||||
$result['total_extra_demands_te'] += $cart_htl_data[$type_key]['date_diff'][$date_join]['extra_demands_price_te'];
|
||||
$result['total_extra_demands_ti'] += $cart_htl_data[$type_key]['date_diff'][$date_join]['extra_demands_price_ti'];
|
||||
}
|
||||
}
|
||||
// calculate averages now
|
||||
|
||||
@@ -469,14 +469,6 @@ class ProductCore extends ObjectModel
|
||||
'id' => array('required' => true),
|
||||
)
|
||||
),
|
||||
'extra_demands' => array(
|
||||
'resource' => 'extra_demand',
|
||||
'fields' => array(
|
||||
'id' => array('required' => true),
|
||||
'id_option' => array(),
|
||||
'price' => array(),
|
||||
)
|
||||
),
|
||||
'services' => array(
|
||||
'resource' => 'service',
|
||||
'fields' => array(
|
||||
@@ -6613,35 +6605,6 @@ class ProductCore extends ObjectModel
|
||||
);
|
||||
}
|
||||
|
||||
public function getWsExtraDemands()
|
||||
{
|
||||
$objHotelRoomTypeDemand = new HotelRoomTypeDemand();
|
||||
$selectedDemands = Db::getInstance()->executeS(
|
||||
'SELECT `id_global_demand` as `id` FROM `'._DB_PREFIX_.'htl_room_type_demand`
|
||||
WHERE `id_product` = '.(int)$this->id
|
||||
);
|
||||
$res = array();
|
||||
$demands = $objHotelRoomTypeDemand->getRoomTypeDemands($this->id);
|
||||
if ($selectedDemands) {
|
||||
foreach ($selectedDemands as $id_demand => $demand) {
|
||||
$option['id'] = $demand['id'];
|
||||
if (isset($demands[$demand['id']]['adv_option']) && count($demands[$demand['id']]['adv_option'])) {
|
||||
foreach ($demands[$demand['id']]['adv_option'] as $id_option => $adv_option) {
|
||||
$option['id_option'] = $id_option;
|
||||
$option['price'] = $adv_option['price_tax_excl'];
|
||||
$res[] = $option;
|
||||
}
|
||||
} else {
|
||||
$option['id_option'] = false;
|
||||
$option['price'] = $demand['price_tax_excl'];
|
||||
$res[] = $option;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
public function getWsServices()
|
||||
{
|
||||
return Db::getInstance()->executeS(
|
||||
@@ -6704,59 +6667,6 @@ class ProductCore extends ObjectModel
|
||||
return $this->delete();
|
||||
}
|
||||
|
||||
public function setWsExtraDemands($demands)
|
||||
{
|
||||
Db::getInstance()->execute('
|
||||
DELETE FROM `'._DB_PREFIX_.'htl_room_type_demand`
|
||||
WHERE `id_product` = '.(int)$this->id
|
||||
);
|
||||
Db::getInstance()->execute('
|
||||
DELETE FROM `'._DB_PREFIX_.'htl_room_type_demand_price`
|
||||
WHERE `id_product` = '.(int)$this->id
|
||||
);
|
||||
$objAdvOption = new HotelRoomTypeGlobalDemandAdvanceOption();
|
||||
$savedDemands = array();
|
||||
foreach ($demands as $globalDemand) {
|
||||
if (Validate::isLoadedObject($objGlobalDemand = new HotelRoomTypeGlobalDemand($globalDemand['id']))) {
|
||||
if (!isset($savedDemands[$globalDemand['id']])) {
|
||||
$objRoomTypeDemand = new HotelRoomTypeDemand();
|
||||
$objRoomTypeDemand->id_product = $this->id;
|
||||
$objRoomTypeDemand->id_global_demand = $objGlobalDemand->id;
|
||||
$objRoomTypeDemand->save();
|
||||
$savedDemands[$globalDemand['id']] = $objRoomTypeDemand->id;
|
||||
}
|
||||
|
||||
if (isset($globalDemand['price'])) {
|
||||
if ($objAdvOption->getGlobalDemandAdvanceOptions($objGlobalDemand->id)
|
||||
&& isset($globalDemand['id_option'])
|
||||
&& Validate::isLoadedObject($objAdvOption = new HotelRoomTypeGlobalDemandAdvanceOption($globalDemand['id_option']))
|
||||
) {
|
||||
if ($globalDemand['price'] != $objAdvOption->price) {
|
||||
$objRoomTypeDemandPrice = new HotelRoomTypeDemandPrice();
|
||||
$objRoomTypeDemandPrice->id_product = $this->id;
|
||||
$objRoomTypeDemandPrice->id_global_demand = $objGlobalDemand->id;
|
||||
$objRoomTypeDemandPrice->id_option = $objAdvOption->id;
|
||||
$objRoomTypeDemandPrice->price = $globalDemand['price'];
|
||||
$objRoomTypeDemandPrice->save();
|
||||
}
|
||||
} else {
|
||||
// save selected demands prices for this room type
|
||||
if ($objGlobalDemand->price != $globalDemand['price']) {
|
||||
$objRoomTypeDemandPrice = new HotelRoomTypeDemandPrice();
|
||||
$objRoomTypeDemandPrice->id_product = $this->id;
|
||||
$objRoomTypeDemandPrice->id_global_demand = $objGlobalDemand->id;
|
||||
$objRoomTypeDemandPrice->id_option = 0;
|
||||
$objRoomTypeDemandPrice->price = $globalDemand['price'];
|
||||
$objRoomTypeDemandPrice->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public function setWsServices($services)
|
||||
{
|
||||
Db::getInstance()->execute('
|
||||
|
||||
@@ -3145,15 +3145,11 @@ class OrderCore extends ObjectModel
|
||||
$totalRoomsAndServices = $this->getTotalProductsWithoutTaxes();
|
||||
}
|
||||
|
||||
// Get total of extra demands
|
||||
$objBookingDemand = new HotelBookingDemands();
|
||||
$totalExtraDemands = $objBookingDemand->getRoomTypeBookingExtraDemands($this->id, 0, 0, 0, 0, 0, 1, $useTax);
|
||||
|
||||
// Get cart rules total
|
||||
$orderTotalDiscount = $this->getCartRulesTotal($useTax);
|
||||
|
||||
// Update order with new amounts after removing cart rule
|
||||
$totalOrder = ($totalExtraDemands + $totalRoomsAndServices) - $orderTotalDiscount;
|
||||
$totalOrder = $totalRoomsAndServices - $orderTotalDiscount;
|
||||
$totalOrder = $totalOrder > 0 ? $totalOrder : 0;
|
||||
|
||||
return $totalOrder;
|
||||
|
||||
@@ -662,71 +662,6 @@ class OrderInvoiceCore extends ObjectModel
|
||||
return $breakdown;
|
||||
}
|
||||
|
||||
public function getExtraDemandTaxesBreakdown($order = null)
|
||||
{
|
||||
if (!$order) {
|
||||
$order = $this->getOrder();
|
||||
}
|
||||
$breakdown = array();
|
||||
$order_details = $this->getProducts();
|
||||
$objBookingDemand = new HotelBookingDemands();
|
||||
$order_details = array_column($order_details, 'id_order_detail');
|
||||
$details = $objBookingDemand->getExtraDemandsTaxesDetails($order->id, $order_details);
|
||||
if (!$this->useOneAfterAnotherTaxComputationMethod()) {
|
||||
$grouped_details = array();
|
||||
foreach ($details as $row) {
|
||||
if (!isset($grouped_details[$row['id_htl_booking']][$row['id_booking_demand']])) {
|
||||
$grouped_details[$row['id_htl_booking']][$row['id_booking_demand']] = array(
|
||||
'tax_rate' => 0,
|
||||
'total_tax_base' => 0,
|
||||
'total_amount' => 0,
|
||||
'id_tax' => $row['id_tax'],
|
||||
);
|
||||
$grouped_details[$row['id_htl_booking']][$row['id_booking_demand']]['total_tax_base'] += $row['total_price_tax_excl'];
|
||||
}
|
||||
$grouped_details[$row['id_htl_booking']][$row['id_booking_demand']]['total_amount'] += $row['total_amount'];
|
||||
$grouped_details[$row['id_htl_booking']][$row['id_booking_demand']]['tax_rate'] += $row['rate'];
|
||||
}
|
||||
$details = $grouped_details;
|
||||
foreach ($details as $detail) {
|
||||
foreach ($detail as $row) {
|
||||
$rate = sprintf('%.3f', $row['tax_rate']);
|
||||
if (!isset($breakdown[$rate])) {
|
||||
$breakdown[$rate] = array(
|
||||
'total_price_tax_excl' => 0,
|
||||
'total_amount' => 0,
|
||||
'id_tax' => $row['id_tax'],
|
||||
'rate' =>$rate,
|
||||
);
|
||||
}
|
||||
$breakdown[$rate]['total_price_tax_excl'] += $row['total_tax_base'];
|
||||
$breakdown[$rate]['total_amount'] += $row['total_amount'];
|
||||
}
|
||||
}
|
||||
} else {
|
||||
foreach ($details as $row) {
|
||||
$key = $row['id_tax'];
|
||||
$rate = sprintf('%.3f', $row['rate']);
|
||||
if (!isset($breakdown[$key])) {
|
||||
$breakdown[$key] = array(
|
||||
'total_price_tax_excl' => 0,
|
||||
'total_amount' => 0,
|
||||
'id_tax' => $row['id_tax'],
|
||||
'rate' => $rate,
|
||||
);
|
||||
}
|
||||
$breakdown[$key]['total_price_tax_excl'] += $row['total_tax_base'];
|
||||
$breakdown[$key]['total_amount'] += $row['total_amount'];
|
||||
}
|
||||
}
|
||||
foreach ($breakdown as $rate => $data) {
|
||||
$breakdown[$rate]['total_price_tax_excl'] = Tools::ps_round($data['total_price_tax_excl'], _PS_PRICE_COMPUTE_PRECISION_, $order->round_mode);
|
||||
$breakdown[$rate]['total_amount'] = Tools::ps_round($data['total_amount'], _PS_PRICE_COMPUTE_PRECISION_, $order->round_mode);
|
||||
}
|
||||
|
||||
return $breakdown;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the shipping taxes breakdown
|
||||
*
|
||||
|
||||
@@ -203,7 +203,6 @@ class OrderReturnCore extends ObjectModel
|
||||
}
|
||||
|
||||
$objOrder = new Order($idOrder);
|
||||
$objBookingDemands = new HotelBookingDemands();
|
||||
$objServiceProductOrderDetail = new ServiceProductOrderDetail();
|
||||
|
||||
$calcServicePriceFirst = false;
|
||||
@@ -225,31 +224,6 @@ class OrderReturnCore extends ObjectModel
|
||||
$bookingRow['extra_service_total_price_tax_incl'] = 0;
|
||||
$bookingRow['room_paid_amount'] = 0;
|
||||
|
||||
$roomSelectedDemands = $objBookingDemands->getRoomTypeBookingExtraDemands(
|
||||
$idOrder,
|
||||
$bookingRow['id_product'],
|
||||
$bookingRow['id_room'],
|
||||
$bookingRow['date_from'],
|
||||
$bookingRow['date_to'],
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
$bookingRow['id']
|
||||
);
|
||||
if (count($roomSelectedDemands)) {
|
||||
foreach ($roomSelectedDemands as $demand) {
|
||||
if ($demand['total_price_tax_incl'] > 0) {
|
||||
if ($objOrder->total_paid_real > 0) {
|
||||
if ($calcServicePriceFirst) {
|
||||
$bookingRow['extra_service_total_paid_amount'] += $demand['total_price_tax_incl'];
|
||||
} else {
|
||||
$bookingRow['extra_service_total_paid_amount'] += ($objOrder->total_paid_real*$demand['total_price_tax_incl'])/($objOrder->total_paid_tax_incl + $objOrder->total_discounts_tax_incl);
|
||||
}
|
||||
}
|
||||
$bookingRow['extra_service_total_price_tax_incl'] += $demand['total_price_tax_incl'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($roomSelectedServices = $objServiceProductOrderDetail->getRoomTypeServiceProducts(
|
||||
0,
|
||||
|
||||
@@ -312,7 +312,6 @@ class HTMLTemplateInvoiceCore extends HTMLTemplate
|
||||
|
||||
$cart_htl_data = array();
|
||||
$service_product_data = array();
|
||||
$room_extra_demands = array();
|
||||
$room_additinal_services = array();
|
||||
$formattedHotelAddress = '';
|
||||
if (Module::isInstalled('hotelreservationsystem')) {
|
||||
@@ -335,8 +334,6 @@ class HTMLTemplateInvoiceCore extends HTMLTemplate
|
||||
}
|
||||
if (!empty($order_details)) {
|
||||
$processed_product = array();
|
||||
$totalDemandsPriceTE = 0;
|
||||
$totalDemandsPriceTI = 0;
|
||||
foreach ($order_details as $type_key => $type_value) {
|
||||
$processProductKey = $type_value['product_id'].'_'.$type_value['selling_preference_type'].'_'.$type_value['id_order_detail'];
|
||||
if (isset($processed_product[$processProductKey])) {
|
||||
@@ -360,7 +357,6 @@ class HTMLTemplateInvoiceCore extends HTMLTemplate
|
||||
|
||||
$order_bk_data = $obj_htl_bk_dtl->getOnlyOrderBookingData($this->order->id, 0, $type_value['product_id'], $idCustomer, $type_value['id_order_detail']);
|
||||
$cart_htl_data[$type_key]['id_product'] = $type_value['product_id'];
|
||||
$objBookingDemand = new HotelBookingDemands();
|
||||
foreach ($order_bk_data as $data_k => $data_v) {
|
||||
$date_join = strtotime($data_v['date_from']).strtotime($data_v['date_to']);
|
||||
|
||||
@@ -386,30 +382,6 @@ class HTMLTemplateInvoiceCore extends HTMLTemplate
|
||||
// For order refund
|
||||
$cart_htl_data[$type_key]['date_diff'][$date_join]['id_room'] = $data_v['id_room'];
|
||||
} else {
|
||||
$cart_htl_data[$type_key]['date_diff'][$date_join]['extra_demands_price_te'] = $objBookingDemand->getRoomTypeBookingExtraDemands(
|
||||
$order_obj->id,
|
||||
$type_value['product_id'],
|
||||
0,
|
||||
$data_v['date_from'],
|
||||
$data_v['date_to'],
|
||||
0,
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
$type_value['id_order_detail']
|
||||
);
|
||||
$cart_htl_data[$type_key]['date_diff'][$date_join]['extra_demands_price_ti'] = $objBookingDemand->getRoomTypeBookingExtraDemands(
|
||||
$order_obj->id,
|
||||
$type_value['product_id'],
|
||||
0,
|
||||
$data_v['date_from'],
|
||||
$data_v['date_to'],
|
||||
0,
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
$type_value['id_order_detail']
|
||||
);
|
||||
$cart_htl_data[$type_key]['date_diff'][$date_join]['additional_services'] = $objServiceProductOrderDetail->getRoomTypeServiceProducts(
|
||||
$order_obj->id,
|
||||
0,
|
||||
@@ -514,29 +486,6 @@ class HTMLTemplateInvoiceCore extends HTMLTemplate
|
||||
$cart_htl_data[$type_key]['date_diff'][$date_join]['id_room'] = $data_v['id_room'];
|
||||
}
|
||||
|
||||
$cart_htl_data[$type_key]['date_diff'][$date_join]['extra_demands_price_te'] = $objBookingDemand->getRoomTypeBookingExtraDemands(
|
||||
$order_obj->id,
|
||||
$type_value['product_id'],
|
||||
0,
|
||||
$data_v['date_from'],
|
||||
$data_v['date_to'],
|
||||
0,
|
||||
1,
|
||||
0,
|
||||
$data_v['id']
|
||||
);
|
||||
$cart_htl_data[$type_key]['date_diff'][$date_join]['extra_demands_price_ti'] = $objBookingDemand->getRoomTypeBookingExtraDemands(
|
||||
$order_obj->id,
|
||||
$type_value['product_id'],
|
||||
0,
|
||||
$data_v['date_from'],
|
||||
$data_v['date_to'],
|
||||
0,
|
||||
1,
|
||||
1,
|
||||
$data_v['id']
|
||||
);
|
||||
|
||||
$totalDemandsPriceTE += $cart_htl_data[$type_key]['date_diff'][$date_join]['extra_demands_price_te'];
|
||||
$totalDemandsPriceTI += $cart_htl_data[$type_key]['date_diff'][$date_join]['extra_demands_price_ti'];
|
||||
|
||||
@@ -569,25 +518,6 @@ class HTMLTemplateInvoiceCore extends HTMLTemplate
|
||||
Product::PRICE_ADDITION_TYPE_WITH_ROOM
|
||||
);
|
||||
|
||||
if ($extraDemands = $objBookingDemand->getRoomTypeBookingExtraDemands(
|
||||
$order_obj->id,
|
||||
$type_value['product_id'],
|
||||
$data_v['id_room'],
|
||||
$data_v['date_from'],
|
||||
$data_v['date_to'],
|
||||
1,
|
||||
0,
|
||||
1,
|
||||
$data_v['id']
|
||||
)) {
|
||||
$extraDemands = array_shift($extraDemands);
|
||||
$extraDemands['product_id'] = $type_value['product_id'];
|
||||
$extraDemands['room_type_name'] = $type_value['product_name'];
|
||||
$extraDemands['date_from'] = $data_v['date_from'];
|
||||
$extraDemands['date_to'] = $data_v['date_to'];
|
||||
$room_extra_demands[] = $extraDemands;
|
||||
}
|
||||
|
||||
if ($additionalServices = $objServiceProductOrderDetail->getRoomTypeServiceProducts(
|
||||
0,
|
||||
0,
|
||||
@@ -657,10 +587,6 @@ class HTMLTemplateInvoiceCore extends HTMLTemplate
|
||||
}
|
||||
}
|
||||
unset($tax_temp);
|
||||
|
||||
// enter extra demands price to the footer total details
|
||||
$footer['total_extra_demands_ti'] = $totalDemandsPriceTI;
|
||||
$footer['total_extra_demands_te'] = $totalDemandsPriceTE;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -677,8 +603,8 @@ class HTMLTemplateInvoiceCore extends HTMLTemplate
|
||||
$footer['room_price_tax_incl'] = $this->order->getTotalProductsWithTaxes(false, true, null, null, null, $idsOrderDetail) + $this->order->getTotalProductsWithTaxes(false, false, Product::SELLING_PREFERENCE_WITH_ROOM_TYPE, 1, Product::PRICE_ADDITION_TYPE_WITH_ROOM, $idsOrderDetail);
|
||||
$footer['service_products_price_tax_excl'] = $this->order->getTotalProductsWithoutTaxes(false, false, Product::SELLING_PREFERENCE_STANDALONE, false, false, $idsOrderDetail) + $this->order->getTotalProductsWithoutTaxes(false, false, Product::SELLING_PREFERENCE_HOTEL_STANDALONE, false, false, $idsOrderDetail);
|
||||
$footer['service_products_price_tax_incl'] = $this->order->getTotalProductsWithTaxes(false, false, Product::SELLING_PREFERENCE_STANDALONE, false, false, $idsOrderDetail) + $this->order->getTotalProductsWithTaxes(false, false, Product::SELLING_PREFERENCE_HOTEL_STANDALONE, false, false, $idsOrderDetail);
|
||||
$footer['additional_service_price_tax_excl'] = $this->order->getTotalProductsWithoutTaxes(false, false, Product::SELLING_PREFERENCE_WITH_ROOM_TYPE, 0, null, $idsOrderDetail) + $totalDemandsPriceTE;
|
||||
$footer['additional_service_price_tax_incl'] = $this->order->getTotalProductsWithTaxes(false, false, Product::SELLING_PREFERENCE_WITH_ROOM_TYPE, 0, null, $idsOrderDetail) + $totalDemandsPriceTI;
|
||||
$footer['additional_service_price_tax_excl'] = $this->order->getTotalProductsWithoutTaxes(false, false, Product::SELLING_PREFERENCE_WITH_ROOM_TYPE, 0, null, $idsOrderDetail);
|
||||
$footer['additional_service_price_tax_incl'] = $this->order->getTotalProductsWithTaxes(false, false, Product::SELLING_PREFERENCE_WITH_ROOM_TYPE, 0, null, $idsOrderDetail);
|
||||
$footer['total_convenience_fee_te'] = $this->order->getTotalProductsWithoutTaxes(false, false, Product::SELLING_PREFERENCE_WITH_ROOM_TYPE, 1, Product::PRICE_ADDITION_TYPE_INDEPENDENT, $idsOrderDetail);
|
||||
$footer['total_convenience_fee_ti'] = $this->order->getTotalProductsWithTaxes(false, false, Product::SELLING_PREFERENCE_WITH_ROOM_TYPE, 1, Product::PRICE_ADDITION_TYPE_INDEPENDENT, $idsOrderDetail);
|
||||
}
|
||||
@@ -696,7 +622,6 @@ class HTMLTemplateInvoiceCore extends HTMLTemplate
|
||||
'cart_htl_data' => $cart_htl_data,
|
||||
'is_hotel_order' => HotelBookingDetail::getIdHotelByIdOrder($this->order->id),
|
||||
'service_product_data' => $service_product_data,
|
||||
'room_extra_demands' => $room_extra_demands,
|
||||
'room_additinal_services' => $room_additinal_services,
|
||||
'order' => $this->order,
|
||||
'order_invoice' => $this->order_invoice,
|
||||
@@ -728,7 +653,7 @@ class HTMLTemplateInvoiceCore extends HTMLTemplate
|
||||
'summary_tab' => $this->smarty->fetch($this->getTemplate('invoice.summary-tab')),
|
||||
'product_tab' => $this->smarty->fetch($this->getTemplate('invoice.product-tab')),
|
||||
'service_product_tab' => $this->smarty->fetch($this->getTemplate('invoice.service-product-tab')),
|
||||
'extra_demands_tab' => $this->smarty->fetch($this->getTemplate('invoice.extra-demands-tab')),
|
||||
'additinal_services_tab' => $this->smarty->fetch($this->getTemplate('invoice.additinal-services-tab')),
|
||||
'tax_tab' => $this->getTaxTabContent(),
|
||||
'payment_tab' => $this->smarty->fetch($this->getTemplate('invoice.payment-tab')),
|
||||
'note_tab' => $this->smarty->fetch($this->getTemplate('invoice.note-tab')),
|
||||
@@ -807,7 +732,6 @@ class HTMLTemplateInvoiceCore extends HTMLTemplate
|
||||
'room_tax' => $this->order_invoice->getRoomsTaxesBreakdown($this->order),
|
||||
'additional_services_tax' => $this->order_invoice->getAdditionalServicesTaxesBreakdown($this->order),
|
||||
'convenience_fee_tax' => $this->order_invoice->getConvenienceFeeTaxesBreakdown($this->order),
|
||||
'extra_demands_tax' => $this->order_invoice->getExtraDemandTaxesBreakdown($this->order),
|
||||
'service_products_tax' => $this->order_invoice->getServiceProductsTaxesBreakdown($this->order),
|
||||
'shipping_tax' => $this->order_invoice->getShippingTaxesBreakdown($this->order),
|
||||
'ecotax_tax' => $this->order_invoice->getEcoTaxTaxesBreakdown(),
|
||||
@@ -842,12 +766,6 @@ class HTMLTemplateInvoiceCore extends HTMLTemplate
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($breakdowns['extra_demands_tax'])) {
|
||||
foreach ($breakdowns['extra_demands_tax'] as &$bd) {
|
||||
$bd['total_tax_excl'] = $bd['total_price_tax_excl'];
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($breakdowns['service_products_tax'])) {
|
||||
foreach ($breakdowns['service_products_tax'] as &$bd) {
|
||||
$bd['total_tax_excl'] = $bd['total_price_tax_excl'];
|
||||
|
||||
@@ -144,16 +144,6 @@ class WebserviceSpecificManagementBookingsCore Extends ObjectModel implements We
|
||||
'id_tax_rules_group' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt'),
|
||||
'total_tax' => array('type' => self::TYPE_FLOAT, 'validate' => 'isPrice')
|
||||
)
|
||||
),
|
||||
'facilities' => array(
|
||||
'resource' => 'facility',
|
||||
'fields' => array(
|
||||
'id_facility' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt'),
|
||||
'id_option' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt'),
|
||||
'name' => array('type' => self::TYPE_STRING, 'validate' => 'isString'),
|
||||
'unit_price_without_tax' => array('type' => self::TYPE_FLOAT, 'validate' => 'isPrice'),
|
||||
'id_tax_rules_group' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt'),
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
@@ -273,7 +263,6 @@ class WebserviceSpecificManagementBookingsCore Extends ObjectModel implements We
|
||||
$parentKeys = array(
|
||||
'room_types' => 'room_type',
|
||||
'rooms' => 'room',
|
||||
'facilities' => 'facility',
|
||||
'services' => 'service',
|
||||
'cart_rules' => 'cart_rule',
|
||||
'remarks' => 'remark',
|
||||
@@ -504,10 +493,8 @@ class WebserviceSpecificManagementBookingsCore Extends ObjectModel implements We
|
||||
if (count($rooms)) {
|
||||
$formattedRooms = array();
|
||||
foreach ($rooms as $roomKey => $room) {
|
||||
$selectedDemands = $this->formatDemandsInRequestData($room);
|
||||
$selectedServices = $this->formatServicesInRequestData($room);
|
||||
$occupancy = $this->formatOccupancyInRequestData($room, $data['id_room_type']);
|
||||
$rooms[$roomKey]['facilities'] = $selectedDemands;
|
||||
$rooms[$roomKey]['services'] = $selectedServices;
|
||||
$rooms[$roomKey]['occupancy'] = $occupancy;
|
||||
$key = $roomKey;
|
||||
@@ -516,7 +503,6 @@ class WebserviceSpecificManagementBookingsCore Extends ObjectModel implements We
|
||||
}
|
||||
|
||||
$formattedRooms[$key] = $room;
|
||||
$formattedRooms[$key]['facilities'] = $selectedDemands;
|
||||
$formattedRooms[$key]['services'] = $selectedServices;
|
||||
$formattedRooms[$key]['occupancy'] = $occupancy;
|
||||
if (isset($room['id_tax_rules_group'])) {
|
||||
@@ -609,36 +595,6 @@ class WebserviceSpecificManagementBookingsCore Extends ObjectModel implements We
|
||||
return $formattedServices;
|
||||
}
|
||||
|
||||
public function formatDemandsInRequestData($data)
|
||||
{
|
||||
$selectedDemands = array();
|
||||
if (isset($data['facilities']['facility'][0])) {
|
||||
$selectedDemands = $data['facilities']['facility'];
|
||||
} else if (isset($data['facilities'])
|
||||
&& !isset($data['facilities'][0])
|
||||
&& isset($data['facilities']['facility'])
|
||||
) {
|
||||
$selectedDemands[] = $data['facilities']['facility'];
|
||||
} else if (isset($data['facilities']) && isset($data['facilities'][0])) {
|
||||
$selectedDemands = $data['facilities'];
|
||||
}
|
||||
|
||||
$formattedDemands = array();
|
||||
foreach ($selectedDemands as $key => $demand) {
|
||||
$formattedDemands[$key]['id_global_demand'] = isset($demand['id_facility']) ? $demand['id_facility'] : 0;
|
||||
$formattedDemands[$key]['id_option'] = isset($demand['id_option']) ? $demand['id_option'] : 0;
|
||||
if (isset($demand['unit_price_without_tax'])) {
|
||||
$formattedDemands[$key]['unit_price_without_tax'] = $demand['unit_price_without_tax'];
|
||||
}
|
||||
|
||||
if (isset($demand['id_tax_rules_group'])) {
|
||||
$formattedDemands[$key]['id_tax_rules_group'] = $demand['id_tax_rules_group'];
|
||||
}
|
||||
}
|
||||
|
||||
return $formattedDemands;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validating the POST request.
|
||||
*/
|
||||
@@ -823,11 +779,6 @@ class WebserviceSpecificManagementBookingsCore Extends ObjectModel implements We
|
||||
return false;
|
||||
}
|
||||
|
||||
if (isset($room['facilities']) && $room['facilities']
|
||||
&& !$this->validateRequestedDemands($room['facilities'], $roomType['id_room_type'])
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -973,7 +924,7 @@ class WebserviceSpecificManagementBookingsCore Extends ObjectModel implements We
|
||||
null,
|
||||
false
|
||||
)) {
|
||||
$this->updateServicesAndDemandsInOrder($objPaymentModule->currentOrder);
|
||||
$this->updateServicesInOrder($objPaymentModule->currentOrder);
|
||||
if (!empty($this->wsRequestedRooms)) {
|
||||
$this->updateRoomTaxRulesGroupsInOrder($objPaymentModule->currentOrder);
|
||||
}
|
||||
@@ -1015,7 +966,6 @@ class WebserviceSpecificManagementBookingsCore Extends ObjectModel implements We
|
||||
$this->addCartRulesToOrder(array($cartRule), $objOrder->id);
|
||||
} else if ($params['price_details']['total_price_with_tax'] > $objOrder->total_paid_tax_incl) {
|
||||
$objHotelBookingDetail = new HotelBookingDetail();
|
||||
$objHotelBookingDemands = new HotelBookingDemands();
|
||||
if ($roomsInOrder = $objHotelBookingDetail->getOrderCurrentDataByOrderId($idOrder)) {
|
||||
$requestedPrice = $params['price_details']['total_price_with_tax'];
|
||||
$roomsToUpdate = array();
|
||||
@@ -1030,12 +980,6 @@ class WebserviceSpecificManagementBookingsCore Extends ObjectModel implements We
|
||||
}
|
||||
|
||||
$serviceProductPrice = $objOrder->getTotalProductsWithTaxes(false, false, Product::SELLING_PREFERENCE_WITH_ROOM_TYPE);
|
||||
if ($demands = $objHotelBookingDemands->getExtraDemandsTaxesDetails($objOrder->id)) {
|
||||
$demandsPrice = array_sum(array_column($demands, 'total_price_tax_excl'));
|
||||
// Adding the tax
|
||||
$demandsPrice += array_sum(array_column($demands, 'total_amount'));
|
||||
$serviceProductPrice += $demandsPrice;
|
||||
}
|
||||
|
||||
$requestedPrice -= $serviceProductPrice;
|
||||
// This empty means that all the rooms are sent with price in the request, so we will add a service to a room to manage the order total sent in the request.
|
||||
@@ -1165,7 +1109,7 @@ class WebserviceSpecificManagementBookingsCore Extends ObjectModel implements We
|
||||
/**
|
||||
* Updating the services and their prices.
|
||||
*/
|
||||
public function updateServicesAndDemandsInOrder($idOrder)
|
||||
public function updateServicesInOrder($idOrder)
|
||||
{
|
||||
$objOrder = new Order($idOrder);
|
||||
$objServiceProductOrderDetail = new ServiceProductOrderDetail();
|
||||
@@ -1302,21 +1246,11 @@ class WebserviceSpecificManagementBookingsCore Extends ObjectModel implements We
|
||||
}
|
||||
}
|
||||
|
||||
// To save the changes made till now, since we are again loading this order while adding demands if any.
|
||||
// To save the changes made till now, since we are again loading this order while adding if any.
|
||||
$objOrder->save();
|
||||
}
|
||||
|
||||
$objHotelBookingDetail = new HotelBookingDetail();
|
||||
if ($orderedRooms = $objHotelBookingDetail->getOrderCurrentDataByOrderId($objOrder->id)) {
|
||||
foreach ($orderedRooms as $orderedRoom) {
|
||||
$dateRoomJoinKey = strtotime($orderedRoom['date_from']).''.strtotime($orderedRoom['date_to']).$orderedRoom['id_room'];
|
||||
if (isset($this->wsRequestedRoomTypes[$dateRoomJoinKey]['demands']) && $this->wsRequestedRoomTypes[$dateRoomJoinKey]['demands']) {
|
||||
if ($demands = json_decode($this->wsRequestedRoomTypes[$dateRoomJoinKey]['demands'], true)) {
|
||||
$this->addDemandsInOrderedRoom($demands, $orderedRoom['id']);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1626,47 +1560,6 @@ class WebserviceSpecificManagementBookingsCore Extends ObjectModel implements We
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validating the demands related information.
|
||||
*/
|
||||
public function validateRequestedDemands($requestedDemands, $idRoomType)
|
||||
{
|
||||
$objHotelRoomTypeDemand = new HotelRoomTypeDemand();
|
||||
$objHotelDemandOptions = new HotelRoomTypeGlobalDemandAdvanceOption();
|
||||
// Incase the there is no demand for this room but demands are still sent in the request for this room type.
|
||||
if ($roomTypeDemands = $objHotelRoomTypeDemand->getRoomTypeDemands($idRoomType)) {
|
||||
foreach ($requestedDemands as $demandKey => $requestedDemand) {
|
||||
if (!isset($requestedDemand['id_global_demand'])
|
||||
|| !isset($roomTypeDemands[$requestedDemand['id_global_demand']])
|
||||
) {
|
||||
$this->error_msg = Tools::displayError('Invalid request for facilities.');
|
||||
return false;
|
||||
} else if (isset($roomTypeDemands[$requestedDemand['id_global_demand']]['adv_option'])
|
||||
&& (!isset($requestedDemand['id_option']))
|
||||
) {
|
||||
$this->error_msg = sprintf(Tools::displayError('Id option is required for the facility with ID %s.'), $requestedDemand['id_global_demand']);
|
||||
return false;
|
||||
} else if (isset($roomTypeDemands[$requestedDemand['id_global_demand']]['adv_option'])
|
||||
&& !isset($roomTypeDemands[$requestedDemand['id_global_demand']]['adv_option'][$requestedDemand['id_option']])
|
||||
) {
|
||||
$this->error_msg = sprintf(Tools::displayError('Invalid id option for the facility with ID %s.'), $requestedDemand['id_global_demand']);
|
||||
return false;
|
||||
} else if (isset($requestedDemand['id_tax_rules_group']) && !Validate::isLoadedObject(new TaxRulesGroup((int) $requestedDemand['id_tax_rules_group']))) {
|
||||
$this->error_msg = Tools::displayError('Invalid id_tax_rules_group for facilities.');
|
||||
return false;
|
||||
} else if (isset($requestedDemand['total_tax']) && !Validate::isPrice($requestedDemand['total_tax'])) {
|
||||
$this->error_msg = Tools::displayError('Invalid tax for facilities.');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$this->error_msg = Tools::displayError('Invalid request for facilities.');
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adding rooms in the cart.
|
||||
*/
|
||||
@@ -1719,7 +1612,6 @@ class WebserviceSpecificManagementBookingsCore Extends ObjectModel implements We
|
||||
}
|
||||
|
||||
// since we cannot update them after ordering them and will have to replace them if orderd here. So, we will not add them for now.
|
||||
$roomDemands = json_encode(array());
|
||||
|
||||
if (isset($room['occupancy']) && count($room['occupancy'])) {
|
||||
$occupancy = $room['occupancy'];
|
||||
@@ -1742,7 +1634,6 @@ class WebserviceSpecificManagementBookingsCore Extends ObjectModel implements We
|
||||
$idRoom,
|
||||
$dateFrom,
|
||||
$dateTo,
|
||||
$roomDemands,
|
||||
$roomServices,
|
||||
$this->context->cart->id,
|
||||
$this->context->cart->id_guest
|
||||
@@ -1750,14 +1641,8 @@ class WebserviceSpecificManagementBookingsCore Extends ObjectModel implements We
|
||||
$objCartBookingData = new HotelCartBookingData((int) $idHtlCartBookingData);
|
||||
$dateRoomJoinKey = strtotime($dateFrom).strtotime($dateTo).$objCartBookingData->id_room;
|
||||
// To update the price after valiate order is called.
|
||||
if (isset($room['facilities'])
|
||||
&& $room['facilities']
|
||||
) {
|
||||
$roomDemands = json_encode($room['facilities']);
|
||||
}
|
||||
|
||||
$this->wsRequestedRoomTypes[$dateRoomJoinKey]['services'] = $roomServices;
|
||||
$this->wsRequestedRoomTypes[$dateRoomJoinKey]['demands'] = $roomDemands;
|
||||
$this->wsRequestedRoomTypes[$dateRoomJoinKey]['room'] = $room;
|
||||
if (isset($room['id_tax_rules_group']) && Validate::isLoadedObject(new TaxRulesGroup((int) $room['id_tax_rules_group']))) {
|
||||
$this->wsRequestedRooms[$dateRoomJoinKey]['id_tax_rules_group'] = $room['id_tax_rules_group'];
|
||||
@@ -1795,7 +1680,6 @@ class WebserviceSpecificManagementBookingsCore Extends ObjectModel implements We
|
||||
$roomWiseOccupancy = count($roomWiseOccupancy);
|
||||
}
|
||||
|
||||
$roomDemands = json_encode(array());
|
||||
$roomServices = array();
|
||||
$objHotelCartBookingData->updateCartBooking(
|
||||
$roomType['id_room_type'],
|
||||
@@ -1805,7 +1689,6 @@ class WebserviceSpecificManagementBookingsCore Extends ObjectModel implements We
|
||||
0,
|
||||
$dateFrom,
|
||||
$dateTo,
|
||||
$roomDemands,
|
||||
$roomServices,
|
||||
$this->context->cart->id,
|
||||
$this->context->cart->id_guest
|
||||
@@ -2031,7 +1914,6 @@ class WebserviceSpecificManagementBookingsCore Extends ObjectModel implements We
|
||||
// Update the information for the services that were updated in the existing rooms
|
||||
if (count($roomsToUpdate)) {
|
||||
$objServiceProductOrderDetail = new ServiceProductOrderDetail();
|
||||
$objBookingDemand = new HotelBookingDemands();
|
||||
foreach ($roomsToUpdate as $roomsByDate) {
|
||||
if (isset($roomsByDate['requested'])
|
||||
&& $roomsByDate['requested']
|
||||
@@ -2080,18 +1962,6 @@ class WebserviceSpecificManagementBookingsCore Extends ObjectModel implements We
|
||||
}
|
||||
|
||||
$this->addServicesInOrderedRoom($room['services'], $idHotelBookingDetail);
|
||||
// Since we don't store the id_global_demand in the order, we will remove the previous ones and add the new ones.
|
||||
$requestedDemands = $room['facilities'];
|
||||
$roomExtraDemand = $objBookingDemand->getRoomTypeBookingExtraDemands(
|
||||
$idOrder,
|
||||
$idProduct,
|
||||
$idRoom,
|
||||
$dateFrom,
|
||||
$dateTo,
|
||||
0
|
||||
);
|
||||
$this->removeDemandsInOrderedRoom($roomExtraDemand);
|
||||
$this->addDemandsInOrderedRoom($requestedDemands, $idHotelBookingDetail);
|
||||
}
|
||||
} else if (isset($roomsByDate['order'])
|
||||
&& $roomsByDate['order']
|
||||
@@ -2441,12 +2311,6 @@ class WebserviceSpecificManagementBookingsCore Extends ObjectModel implements We
|
||||
|
||||
$objOrder->save();
|
||||
}
|
||||
|
||||
if (isset($this->wsRequestedRoomTypes[$dateRoomJoinKey]['demands']) && $this->wsRequestedRoomTypes[$dateRoomJoinKey]['demands']) {
|
||||
if ($demands = json_decode($this->wsRequestedRoomTypes[$dateRoomJoinKey]['demands'], true)) {
|
||||
$this->addDemandsInOrderedRoom($demands, $objBookingDetail->id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2580,7 +2444,6 @@ class WebserviceSpecificManagementBookingsCore Extends ObjectModel implements We
|
||||
public function removeRoomLineFromOrder($params, $roomsToRemove)
|
||||
{
|
||||
$objOrder = new Order((int) $params['id']);
|
||||
$objBookingDemand = new HotelBookingDemands();
|
||||
$objHotelBookingDetail = new HotelBookingDetail();
|
||||
$objServiceProductOrderDetail = new ServiceProductOrderDetail();
|
||||
foreach ($roomsToRemove as $roomType) {
|
||||
@@ -2592,26 +2455,6 @@ class WebserviceSpecificManagementBookingsCore Extends ObjectModel implements We
|
||||
$idHotel = $roomType['id_hotel'];
|
||||
$bookingPriceTaxIncl = $roomType['total_price_tax_incl'];
|
||||
$bookingPriceTaxExcl = $roomType['total_price_tax_excl'];
|
||||
$roomExtraDemandTI = $objBookingDemand->getRoomTypeBookingExtraDemands(
|
||||
$objOrder->id,
|
||||
$roomType['id_product'],
|
||||
$roomType['id_room'],
|
||||
$dateFrom,
|
||||
$dateTo,
|
||||
0,
|
||||
1,
|
||||
1
|
||||
);
|
||||
$roomExtraDemandTE = $objBookingDemand->getRoomTypeBookingExtraDemands(
|
||||
$objOrder->id,
|
||||
$roomType['id_product'],
|
||||
$roomType['id_room'],
|
||||
$dateFrom,
|
||||
$dateTo,
|
||||
0,
|
||||
1,
|
||||
0
|
||||
);
|
||||
$additionlServicesTI = $objServiceProductOrderDetail->getRoomTypeServiceProducts(
|
||||
0,
|
||||
0,
|
||||
@@ -2691,9 +2534,9 @@ class WebserviceSpecificManagementBookingsCore Extends ObjectModel implements We
|
||||
|
||||
// Update Order
|
||||
// values changes as values are calculated accoding to the quantity of the product by webkul
|
||||
$objOrder->total_paid = Tools::ps_round($objOrder->total_paid - ($diffProductsTaxIncl + $roomExtraDemandTI + $additionlServicesTI), _PS_PRICE_COMPUTE_PRECISION_);
|
||||
$objOrder->total_paid_tax_incl = Tools::ps_round($objOrder->total_paid_tax_incl - ($diffProductsTaxIncl + $roomExtraDemandTI + $additionlServicesTI), _PS_PRICE_COMPUTE_PRECISION_);
|
||||
$objOrder->total_paid_tax_excl = Tools::ps_round($objOrder->total_paid_tax_excl - ($diffProductsTaxExcl + $roomExtraDemandTE + $additionlServicesTE), _PS_PRICE_COMPUTE_PRECISION_);
|
||||
$objOrder->total_paid = Tools::ps_round($objOrder->total_paid - ($diffProductsTaxIncl + $additionlServicesTI), _PS_PRICE_COMPUTE_PRECISION_);
|
||||
$objOrder->total_paid_tax_incl = Tools::ps_round($objOrder->total_paid_tax_incl - ($diffProductsTaxIncl + $additionlServicesTI), _PS_PRICE_COMPUTE_PRECISION_);
|
||||
$objOrder->total_paid_tax_excl = Tools::ps_round($objOrder->total_paid_tax_excl - ($diffProductsTaxExcl + $additionlServicesTE), _PS_PRICE_COMPUTE_PRECISION_);
|
||||
$objOrder->total_products = Tools::ps_round($objOrder->total_products - ($diffProductsTaxExcl + $additionlServicesTE), _PS_PRICE_COMPUTE_PRECISION_);
|
||||
$objOrder->total_products_wt = Tools::ps_round($objOrder->total_products_wt - ($diffProductsTaxIncl + $additionlServicesTI), _PS_PRICE_COMPUTE_PRECISION_);
|
||||
|
||||
@@ -2725,8 +2568,6 @@ class WebserviceSpecificManagementBookingsCore Extends ObjectModel implements We
|
||||
}
|
||||
|
||||
$objOrder->update();
|
||||
// delete the demands of this booking
|
||||
$objBookingDemand->deleteBookingDemands($idHotelBooking);
|
||||
$objServiceProductOrderDetail->deleteSeviceProducts(0, $idHotelBooking);
|
||||
$objHotelCartBookingData = new HotelCartBookingData();
|
||||
$objHotelCartBookingData->deleteOrderedRoomFromCart(
|
||||
@@ -2967,12 +2808,6 @@ class WebserviceSpecificManagementBookingsCore Extends ObjectModel implements We
|
||||
return false;
|
||||
}
|
||||
|
||||
if (isset($room['facilities']) && $room['facilities']
|
||||
&& !$this->validateRequestedDemands($room['facilities'], $roomType['id_room_type'])
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (isset($room['id_tax_rules_group']) && !Validate::isLoadedObject(new TaxRulesGroup((int) $room['id_tax_rules_group']))) {
|
||||
$this->error_msg = Tools::displayError('Invalid id_tax_rules_group.');
|
||||
return false;
|
||||
@@ -3406,117 +3241,6 @@ class WebserviceSpecificManagementBookingsCore Extends ObjectModel implements We
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adding the demands into the order.
|
||||
*/
|
||||
public function addDemandsInOrderedRoom($demands, $idHotelBooking)
|
||||
{
|
||||
if (Validate::isLoadedObject($objBookingDetail = new HotelBookingDetail((int) $idHotelBooking))) {
|
||||
if ($demands) {
|
||||
$objOrder = new Order($objBookingDetail->id_order);
|
||||
// set context currency So that we can get prices in the order currency
|
||||
$this->context->currency = new Currency($objOrder->id_currency);
|
||||
|
||||
$objAddress = new Address((int) $objOrder->id_address_tax);
|
||||
$idLang = (int) $objOrder->id_lang;
|
||||
$idProduct = $objBookingDetail->id_product;
|
||||
$objHtlBkDtl = new HotelBookingDetail();
|
||||
$objRoomDemandPrice = new HotelRoomTypeDemandPrice();
|
||||
foreach ($demands as $demand) {
|
||||
$idGlobalDemand = $demand['id_global_demand'];
|
||||
$idOption = $demand['id_option'];
|
||||
$objBookingDemand = new HotelBookingDemands();
|
||||
$objBookingDemand->id_htl_booking = $idHotelBooking;
|
||||
$objGlobalDemand = new HotelRoomTypeGlobalDemand($idGlobalDemand, $idLang);
|
||||
if ($idOption) {
|
||||
$objOption = new HotelRoomTypeGlobalDemandAdvanceOption($idOption, $idLang);
|
||||
$objBookingDemand->name = $objOption->name;
|
||||
} else {
|
||||
$idOption = 0;
|
||||
$objBookingDemand->name = $objGlobalDemand->name;
|
||||
}
|
||||
|
||||
$unitPriceTaxExcl = HotelRoomTypeDemand::getPriceStatic($idProduct, $idGlobalDemand, $idOption, 0);
|
||||
$unitPriceTaxIncl = HotelRoomTypeDemand::getPriceStatic($idProduct, $idGlobalDemand, $idOption, 1);
|
||||
$taxMultiplier = 1;
|
||||
if ($unitPriceTaxExcl > 0) {
|
||||
$taxMultiplier = $unitPriceTaxIncl / $unitPriceTaxExcl;
|
||||
}
|
||||
|
||||
$qty = 1;
|
||||
if ($objGlobalDemand->price_calc_method == HotelRoomTypeGlobalDemand::WK_PRICE_CALC_METHOD_EACH_DAY) {
|
||||
$numDays = HotelHelper::getNumberOfDays(
|
||||
$objBookingDetail->date_from,
|
||||
$objBookingDetail->date_to
|
||||
);
|
||||
if ($numDays > 1) {
|
||||
$qty *= $numDays;
|
||||
}
|
||||
}
|
||||
|
||||
$totalPriceTaxExcl = $unitPriceTaxExcl * $qty;
|
||||
$totalPriceTaxIncl = $unitPriceTaxIncl * $qty;
|
||||
if (isset($demand['unit_price_without_tax'])) {
|
||||
$unitPriceTaxExcl = $demand['unit_price_without_tax'];
|
||||
$unitPriceTaxIncl = $demand['unit_price_without_tax'] * $taxMultiplier;
|
||||
$totalPriceTaxExcl = $unitPriceTaxExcl * $qty;
|
||||
$totalPriceTaxIncl = $unitPriceTaxIncl * $qty;
|
||||
}
|
||||
|
||||
if (isset($demand['id_tax_rules_group'])) {
|
||||
$objTaxManager = TaxManagerFactory::getManager(
|
||||
$objAddress,
|
||||
$demand['id_tax_rules_group']
|
||||
);
|
||||
$objTaxManager = TaxManagerFactory::getManager($objAddress, $demand['id_tax_rules_group']);
|
||||
$objTaxCalculator = $objTaxManager->getTaxCalculator();
|
||||
|
||||
$unitPriceTaxIncl = $objTaxCalculator->addTaxes($unitPriceTaxExcl);
|
||||
$totalPriceTaxIncl = $unitPriceTaxIncl * $qty;
|
||||
} else {
|
||||
$objTaxManager = TaxManagerFactory::getManager(
|
||||
$objAddress,
|
||||
$objGlobalDemand->id_tax_rules_group
|
||||
);
|
||||
$objTaxCalculator = $objTaxManager->getTaxCalculator();
|
||||
}
|
||||
|
||||
$objBookingDemand->unit_price_tax_excl = $unitPriceTaxExcl;
|
||||
$objBookingDemand->unit_price_tax_incl = $unitPriceTaxIncl;
|
||||
$objBookingDemand->total_price_tax_excl = $totalPriceTaxExcl;
|
||||
$objBookingDemand->total_price_tax_incl = $totalPriceTaxIncl;
|
||||
$objOrderDetail = new OrderDetail($objBookingDetail->id_order_detail);
|
||||
|
||||
// Update OrderInvoice of this OrderDetail
|
||||
if ($objOrderDetail->id_order_invoice != 0) {
|
||||
// values changes as values are calculated accoding to the quantity of the product by webkul
|
||||
$objOrderInvoice = new OrderInvoice($objOrderDetail->id_order_invoice);
|
||||
$objOrderInvoice->total_paid_tax_excl += $objBookingDemand->total_price_tax_excl;
|
||||
$objOrderInvoice->total_paid_tax_incl += $objBookingDemand->total_price_tax_incl;
|
||||
$objOrderInvoice->update();
|
||||
}
|
||||
|
||||
// change order total
|
||||
$objOrder->total_paid_tax_excl += $objBookingDemand->total_price_tax_excl;
|
||||
$objOrder->total_paid_tax_incl += $objBookingDemand->total_price_tax_incl;
|
||||
$objOrder->total_paid += $objBookingDemand->total_price_tax_incl;
|
||||
$objBookingDemand->price_calc_method = $objGlobalDemand->price_calc_method;
|
||||
$objBookingDemand->id_tax_rules_group = $objGlobalDemand->id_tax_rules_group;
|
||||
if ($objBookingDemand->save()
|
||||
&& Validate::isLoadedObject($objAddress)
|
||||
) {
|
||||
$objBookingDemand->tax_computation_method = (int)$objTaxCalculator->computation_method;
|
||||
$objBookingDemand->tax_calculator = $objTaxCalculator;
|
||||
// Now save tax details of the extra demand
|
||||
$objBookingDemand->setBookingDemandTaxDetails();
|
||||
}
|
||||
}
|
||||
|
||||
$objOrder->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Deleting the demands into the order.
|
||||
*/
|
||||
@@ -4072,7 +3796,6 @@ class WebserviceSpecificManagementBookingsCore Extends ObjectModel implements We
|
||||
} else {
|
||||
$objCurrency = new Currency($objOrder->id_currency);
|
||||
$objBookingDetail = new HotelBookingDetail();
|
||||
$objBookingDemand = new HotelBookingDemands();
|
||||
$objServiceProductOrderDetail = new ServiceProductOrderDetail();
|
||||
$objOrderReturn = new OrderReturn();
|
||||
$idHotel = HotelBookingDetail::getIdHotelByIdOrder($objOrder->id);
|
||||
@@ -4154,35 +3877,6 @@ class WebserviceSpecificManagementBookingsCore Extends ObjectModel implements We
|
||||
$roomInfo['child'] = (int) $orderData['children'];
|
||||
$roomInfo['unit_price_without_tax'] = Tools::ps_round($orderData['total_price_tax_excl'], _PS_PRICE_COMPUTE_PRECISION_);
|
||||
$roomInfo['total_tax'] = Tools::ps_round(($orderData['total_price_tax_incl'] - $orderData['total_price_tax_excl']), _PS_PRICE_COMPUTE_PRECISION_);
|
||||
if(isset($roomInfo['facilities'])) {
|
||||
unset($roomInfo['facilities']);
|
||||
}
|
||||
if ($extraDemands = $objBookingDemand->getRoomTypeBookingExtraDemands(
|
||||
$orderData['id_order'],
|
||||
$orderData['id_product'],
|
||||
$orderData['id_room'],
|
||||
$orderData['date_from'],
|
||||
$orderData['date_to'],
|
||||
0,
|
||||
0,
|
||||
$useTax
|
||||
)) {
|
||||
$roomInfo['facilities'] = array();
|
||||
foreach ($extraDemands as $extraDemand) {
|
||||
$demand = array();
|
||||
$demand['name'] = $extraDemand['name'];
|
||||
$demand['quantity'] = 1;
|
||||
$demand['unit_price_without_tax'] = Tools::ps_round($extraDemand['unit_price_tax_excl'], _PS_PRICE_COMPUTE_PRECISION_);
|
||||
$demand['total_tax'] = Tools::ps_round(($extraDemand['unit_price_tax_incl']- $extraDemand['unit_price_tax_excl']), _PS_PRICE_COMPUTE_PRECISION_);
|
||||
|
||||
$demand['per_night'] = 0;
|
||||
if ($extraDemand['price_calc_method'] == HotelRoomTypeGlobalDemand::WK_PRICE_CALC_METHOD_EACH_DAY) {
|
||||
$demand['per_night'] = 1;
|
||||
}
|
||||
|
||||
$roomInfo['facilities'][] = $demand;
|
||||
}
|
||||
}
|
||||
|
||||
if(isset($roomInfo['services'])) {
|
||||
unset($roomInfo['services']);
|
||||
|
||||
@@ -1056,7 +1056,7 @@ class AdminCartsControllerCore extends AdminController
|
||||
if ($bookingInfo['id'] == $id_booking_data) {
|
||||
$amt_with_qty = $bookingInfo['amt_with_qty'];
|
||||
$bookingInfo['amt_with_qty'] = Tools::displayPrice($amt_with_qty);
|
||||
$bookingInfo['total_price'] = Tools::displayPrice($amt_with_qty + $bookingInfo['demand_price'] + $bookingInfo['additional_service_price'] + $bookingInfo['additional_services_auto_add_price']);
|
||||
$bookingInfo['total_price'] = Tools::displayPrice($amt_with_qty + $bookingInfo['additional_service_price'] + $bookingInfo['additional_services_auto_add_price']);
|
||||
$response = array(
|
||||
'curr_booking_info' => $bookingInfo,
|
||||
'cart_info' => $this->ajaxReturnVars(),
|
||||
@@ -1129,7 +1129,7 @@ class AdminCartsControllerCore extends AdminController
|
||||
if ($bookingInfo['id'] == $idBookingData) {
|
||||
$amtWithQty = $bookingInfo['amt_with_qty'];
|
||||
$bookingInfo['amt_with_qty'] = Tools::displayPrice($amtWithQty);
|
||||
$bookingInfo['total_price'] = Tools::displayPrice($amtWithQty + $bookingInfo['demand_price'] + $bookingInfo['additional_service_price'] + $bookingInfo['additional_services_auto_add_price']);
|
||||
$bookingInfo['total_price'] = Tools::displayPrice($amtWithQty + $bookingInfo['additional_service_price'] + $bookingInfo['additional_services_auto_add_price']);
|
||||
$response = array(
|
||||
'curr_booking_info' => $bookingInfo,
|
||||
'cart_info' => $this->ajaxReturnVars(),
|
||||
@@ -1153,8 +1153,8 @@ class AdminCartsControllerCore extends AdminController
|
||||
}
|
||||
}
|
||||
|
||||
// Process to get extra demands of any room while order creation process form.tpl
|
||||
public function ajaxProcessGetRoomTypeCartDemands()
|
||||
// Process to get extra services of any room while order creation process form.tpl
|
||||
public function ajaxProcessGetRoomTypeCartServices()
|
||||
{
|
||||
$response['hasError'] = false;
|
||||
$response['errors'] = [];
|
||||
@@ -1166,38 +1166,6 @@ class AdminCartsControllerCore extends AdminController
|
||||
&& ($idHotelCartBooking = Tools::getValue('id_hotel_cart_booking'))
|
||||
) {
|
||||
$objCartBookingData = new HotelCartBookingData();
|
||||
if ($selectedRoomDemands = $objCartBookingData->getCartExtraDemands(
|
||||
$idCart,
|
||||
$idProduct,
|
||||
$idRoom,
|
||||
$dateFrom,
|
||||
$dateTo
|
||||
)) {
|
||||
// get room type additional demands
|
||||
$objRoomDemands = new HotelRoomTypeDemand();
|
||||
if ($roomTypeDemands = $objRoomDemands->getRoomTypeDemands($idProduct)) {
|
||||
foreach ($roomTypeDemands as &$demand) {
|
||||
// if demand has advance options then set demand price as first advance option price.
|
||||
if (isset($demand['adv_option']) && $demand['adv_option']) {
|
||||
$demand['price'] = current($demand['adv_option'])['price'];
|
||||
}
|
||||
}
|
||||
foreach ($selectedRoomDemands as &$selectedDemand) {
|
||||
$objRoom = new HotelRoomInformation($selectedDemand['id_room']);
|
||||
$selectedDemand['room_num'] = $objRoom->room_num;
|
||||
if (isset($selectedDemand['extra_demands']) && $selectedDemand['extra_demands']) {
|
||||
$extraDmd = array();
|
||||
foreach ($selectedDemand['extra_demands'] as $sDemand) {
|
||||
$selectedDemand['selected_global_demands'][] = $sDemand['id_global_demand'];
|
||||
$extraDmd[$sDemand['id_global_demand'].'-'.$sDemand['id_option']] = $sDemand;
|
||||
}
|
||||
$selectedDemand['extra_demands'] = $extraDmd;
|
||||
}
|
||||
}
|
||||
$this->context->smarty->assign('roomTypeDemands', $roomTypeDemands);
|
||||
$this->context->smarty->assign('selectedRoomDemands', $selectedRoomDemands);
|
||||
}
|
||||
}
|
||||
|
||||
$selectedRoomServiceProduct = array();
|
||||
if (Configuration::get('PS_ALLOW_ADD_ALL_SERVICES_IN_BOOKING')) {
|
||||
@@ -1268,8 +1236,8 @@ class AdminCartsControllerCore extends AdminController
|
||||
'loaderImg' => $this->context->link->getMediaLink(_PS_IMG_.'admin/ajax-loader.gif')
|
||||
));
|
||||
|
||||
$response['html_exta_demands'] = $this->context->smarty->fetch(
|
||||
_PS_ADMIN_DIR_.'/themes/default/template/controllers/orders/_cart_booking_demands.tpl'
|
||||
$response['html_exta_services'] = $this->context->smarty->fetch(
|
||||
_PS_ADMIN_DIR_.'/themes/default/template/controllers/orders/_cart_booking_services.tpl'
|
||||
);
|
||||
} else {
|
||||
$response['hasError'] = true;
|
||||
@@ -1279,26 +1247,6 @@ class AdminCartsControllerCore extends AdminController
|
||||
$this->ajaxDie(json_encode($response));
|
||||
}
|
||||
|
||||
// Process when admin changes extra demands of any room while order creation process form.tpl
|
||||
public function ajaxProcessChangeRoomDemands()
|
||||
{
|
||||
if ($this->tabAccess['edit'] === 1) {
|
||||
$response = array('status' => false);
|
||||
if ($idCartBooking = Tools::getValue('id_cart_booking')) {
|
||||
if (Validate::isLoadedObject($objCartbookingCata = new HotelCartBookingData($idCartBooking))) {
|
||||
$roomDemands = Tools::getValue('room_demands');
|
||||
$roomDemands = json_decode($roomDemands, true);
|
||||
$roomDemands = json_encode($roomDemands);
|
||||
$objCartbookingCata->extra_demands = $roomDemands;
|
||||
if ($objCartbookingCata->save()) {
|
||||
$response['status'] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->ajaxDie(json_encode($response));
|
||||
}
|
||||
}
|
||||
|
||||
public static function getOrderTotalUsingTaxCalculationMethod($id_cart)
|
||||
{
|
||||
$context = Context::getContext();
|
||||
|
||||
@@ -161,7 +161,6 @@ class AdminImportControllerCore extends AdminController
|
||||
$this->required_fields = array('id_hotel', 'name');
|
||||
|
||||
self::$validators['image'] = array('AdminImportController', 'split');
|
||||
self::$validators['id_additional_facilities'] = array('AdminImportController', 'split');
|
||||
self::$validators['id_service_products'] = array('AdminImportController', 'split');
|
||||
self::$validators['id_features'] = array('AdminImportController', 'split');
|
||||
$this->available_fields = array(
|
||||
@@ -194,7 +193,6 @@ class AdminImportControllerCore extends AdminController
|
||||
'max_children' => array('label' => $this->l('Maximum children')),
|
||||
'max_room_occupancy' => array('label' => $this->l('Maximum room occupancy')),
|
||||
'show_at_front' => array('label' => $this->l('Show at front (0/1)')),
|
||||
'id_additional_facilities' => array('label' => $this->l('Additional facilities IDs (x,y,z...)')),
|
||||
'id_service_products' => array('label' => $this->l('Service products IDs (x, y, z...)')),
|
||||
'id_features' => array('label' => $this->l('Feature IDs (x, y, z...)')),
|
||||
'description_short' => array('label' => $this->l('Short description')),
|
||||
@@ -285,7 +283,6 @@ class AdminImportControllerCore extends AdminController
|
||||
case $this->entities[$this->l('Bookings')]:
|
||||
$this->required_fields = array('id_customer', 'duration_dates', 'num_rooms', 'id_product');
|
||||
self::$validators['duration_dates'] = array('AdminImportController', 'split');
|
||||
self::$validators['id_additional_facilities'] = array('AdminImportController', 'split');
|
||||
self::$validators['id_service_products'] = array('AdminImportController', 'split');
|
||||
|
||||
$this->available_fields = array(
|
||||
@@ -312,10 +309,6 @@ class AdminImportControllerCore extends AdminController
|
||||
'label' => $this->l('Service Product IDs (x:n, y:n, z:n,..)'),
|
||||
'help' => $this->l('id_service_product:quantity')
|
||||
),
|
||||
'id_additional_facilities' => array(
|
||||
'label' => $this->l('Additional Facilities IDs (x:a, y:b, z:c,...)'),
|
||||
'help' => $this->l('id_additional_facility:id_option')
|
||||
),
|
||||
);
|
||||
break;
|
||||
case $this->entities[$this->l('Customers')]:
|
||||
@@ -1746,18 +1739,6 @@ class AdminImportControllerCore extends AdminController
|
||||
}
|
||||
|
||||
$objHotelAdvancePayment->save();
|
||||
if (isset($product->id_additional_facilities) && $product->id_additional_facilities) {
|
||||
$objRoomTypeDemand = new HotelRoomTypeDemand();
|
||||
$objRoomTypeDemand->deleteRoomTypeDemands($product->id);
|
||||
foreach ($product->id_additional_facilities as $idGlobalDemand) {
|
||||
if (Validate::isLoadedObject(new HotelRoomTypeGlobalDemand((int) $idGlobalDemand))) {
|
||||
$objRoomTypeDemand = new HotelRoomTypeDemand();
|
||||
$objRoomTypeDemand->id_product = $product->id;
|
||||
$objRoomTypeDemand->id_global_demand = $idGlobalDemand;
|
||||
$objRoomTypeDemand->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//delete existing images if "delete_existing_images" is set to 1
|
||||
if (isset($product->delete_existing_images)) {
|
||||
@@ -2558,7 +2539,6 @@ class AdminImportControllerCore extends AdminController
|
||||
}
|
||||
|
||||
$serviceProducts = array();
|
||||
$globalDemands = array();
|
||||
if (isset($orderProduct['id_service_products']) && count($orderProduct['id_service_products'])) {
|
||||
foreach ($orderProduct['id_service_products'] as $serviceProdKey => $serviceProd) {
|
||||
$serviceProd = explode(':', $serviceProd);
|
||||
@@ -2579,28 +2559,6 @@ class AdminImportControllerCore extends AdminController
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($orderProduct['id_additional_facilities']) && count($orderProduct['id_additional_facilities'])) {
|
||||
foreach ($orderProduct['id_additional_facilities'] as $globalDemandKey => $globalDemand) {
|
||||
$globalDemand = explode(':', $globalDemand);
|
||||
$objGlobalDemand = new HotelRoomTypeGlobalDemand($globalDemand[0], $this->context->language->id);
|
||||
if (Validate::isLoadedObject($objGlobalDemand)) {
|
||||
$objAdvOption = new HotelRoomTypeGlobalDemandAdvanceOption();
|
||||
// incase no option is provided or if the provided id is not valid or the id is not connected to the diffrent option, we will set the first option as default.
|
||||
if ((!isset($globalDemand[1])
|
||||
|| !Validate::isLoadedObject($objAdvOption = new HotelRoomTypeGlobalDemandAdvanceOption($globalDemand[1])
|
||||
|| $objAdvOption->id_global_demand != $globalDemand[0]))
|
||||
&& ($advOptions = $objAdvOption->getGlobalDemandAdvanceOptions($objGlobalDemand->id))
|
||||
) {
|
||||
$globalDemand[1] = $advOptions[0]['id'];
|
||||
}
|
||||
|
||||
$globalDemands[$globalDemandKey]['id_global_demand'] = $globalDemand[0];
|
||||
$globalDemands[$globalDemandKey]['id_option'] = isset($globalDemand[1]) ? $globalDemand[1] : 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$globalDemands = json_encode($globalDemands);
|
||||
$objCartBooking->updateCartBooking(
|
||||
$orderProduct['id_product'],
|
||||
$occupancy,
|
||||
@@ -2609,7 +2567,6 @@ class AdminImportControllerCore extends AdminController
|
||||
0,
|
||||
date('Y-m-d', strtotime($dateFrom)),
|
||||
date('Y-m-d', strtotime($dateTo)),
|
||||
$globalDemands,
|
||||
$serviceProducts,
|
||||
$this->context->cart->id,
|
||||
$this->context->cart->id_guest
|
||||
@@ -3364,12 +3321,6 @@ class AdminImportControllerCore extends AdminController
|
||||
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'htl_room_type_feature_pricing`');
|
||||
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'htl_room_type_feature_pricing_lang`');
|
||||
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'htl_room_type_feature_pricing_group`');
|
||||
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'htl_room_type_global_demand`');
|
||||
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'htl_room_type_global_demand_lang`');
|
||||
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'htl_room_type_global_demand_advance_option`');
|
||||
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'htl_room_type_global_demand_advance_option_lang`');
|
||||
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'htl_room_type_demand_price`');
|
||||
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'htl_room_type_demand`');
|
||||
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'htl_room_type_service_product_price`');
|
||||
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'service_product_cart_detail`');
|
||||
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'htl_room_type_restriction_date_range`');
|
||||
@@ -3472,8 +3423,6 @@ class AdminImportControllerCore extends AdminController
|
||||
'referrer_cache',
|
||||
'htl_cart_booking_data',
|
||||
'htl_booking_detail',
|
||||
'htl_booking_demands',
|
||||
'htl_booking_demands_tax',
|
||||
'service_product_order_detail',
|
||||
'service_product_cart_detail',
|
||||
);
|
||||
|
||||
@@ -686,6 +686,7 @@ class AdminOrdersControllerCore extends AdminController
|
||||
'current_index' => self::$currentIndex,
|
||||
'order' => $objOrder,
|
||||
'currencies' => $currencies,
|
||||
'currency' => new Currency($objOrder->id_currency),
|
||||
'payment_methods' => $payment_methods,
|
||||
'payment_types' => $objOrder->getPaymentsTypes(),
|
||||
'invoices_collection' => $objOrder->getInvoicesCollection(),
|
||||
@@ -943,37 +944,9 @@ class AdminOrdersControllerCore extends AdminController
|
||||
|
||||
$smartyVars['id_booking_detail'] = $productLineData['id'];
|
||||
|
||||
$objBookingDemand = new HotelBookingDemands();
|
||||
|
||||
// set context currency So that we can get prices in the order currency
|
||||
$this->context->currency = $objCurrency;
|
||||
|
||||
if ($extraDemands = $objBookingDemand->getRoomTypeBookingExtraDemands(
|
||||
$idOrder,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
0,
|
||||
1,
|
||||
$productLineData['id']
|
||||
)) {
|
||||
$smartyVars['extraDemands'] = $extraDemands;
|
||||
}
|
||||
|
||||
// get room type additional demands
|
||||
$objRoomDemands = new HotelRoomTypeDemand();
|
||||
if ($roomTypeDemands = $objRoomDemands->getRoomTypeDemands($idProduct)) {
|
||||
foreach ($roomTypeDemands as &$demand) {
|
||||
// if demand has advance options then set demand price as first advance option price.
|
||||
if (isset($demand['adv_option']) && $demand['adv_option']) {
|
||||
$demand['price'] = current($demand['adv_option'])['price'];
|
||||
}
|
||||
}
|
||||
$smartyVars['roomTypeDemands'] = $roomTypeDemands;
|
||||
}
|
||||
|
||||
$objServiceProductOrderDetail = new ServiceProductOrderDetail();
|
||||
if ($additionalServices = $objServiceProductOrderDetail->getRoomTypeServiceProducts(
|
||||
0,
|
||||
@@ -993,7 +966,7 @@ class AdminOrdersControllerCore extends AdminController
|
||||
$smartyVars['additionalServices'] = $additionalServices[$productLineData['id']];
|
||||
}
|
||||
|
||||
// get room type additional demands
|
||||
// get room type additional services
|
||||
if (Configuration::get('PS_ALLOW_ADD_ALL_SERVICES_IN_BOOKING')) {
|
||||
// get all services
|
||||
$objProduct = new Product();
|
||||
@@ -1065,33 +1038,10 @@ class AdminOrdersControllerCore extends AdminController
|
||||
$objOrderReturn = new OrderReturn();
|
||||
$refundReqBookings = $objOrderReturn->getOrderRefundRequestedBookings($objOrder->id, 0, 1, 0, 1);
|
||||
if ($bookingOrderInfo = $objBookingDetail->getBookingDataByOrderId($objOrder->id)) {
|
||||
$objBookingDemand = new HotelBookingDemands();
|
||||
foreach($bookingOrderInfo as $key => $booking) {
|
||||
if ((in_array($booking['id'], $refundReqBookings)) || $booking['is_refunded']) {
|
||||
unset($bookingOrderInfo[$key]);
|
||||
} else {
|
||||
$bookingOrderInfo[$key]['total_price_tax_incl'] += $objBookingDemand->getRoomTypeBookingExtraDemands(
|
||||
$objOrder->id,
|
||||
$booking['id_product'],
|
||||
$booking['id_room'],
|
||||
$booking['date_from'],
|
||||
$booking['date_to'],
|
||||
0,
|
||||
1,
|
||||
1,
|
||||
$booking['id']
|
||||
);
|
||||
$bookingOrderInfo[$key]['total_price_tax_excl'] += $objBookingDemand->getRoomTypeBookingExtraDemands(
|
||||
$objOrder->id,
|
||||
$booking['id_product'],
|
||||
$booking['id_room'],
|
||||
$booking['date_from'],
|
||||
$booking['date_to'],
|
||||
0,
|
||||
1,
|
||||
0,
|
||||
$booking['id']
|
||||
);
|
||||
$bookingOrderInfo[$key]['total_price_tax_incl'] += $objServiceProductOrderDetail->getRoomTypeServiceProducts(
|
||||
0,
|
||||
0,
|
||||
@@ -2423,44 +2373,6 @@ class AdminOrdersControllerCore extends AdminController
|
||||
}
|
||||
}
|
||||
|
||||
// update rooms bookings demands (htl_booking_demands)
|
||||
$objBookingDemand = new HotelBookingDemands();
|
||||
if ($orderBookingDemands = $objBookingDemand->getRoomTypeBookingExtraDemands($order->id, 0, 0, 0, 0, 0)) {
|
||||
$fields = array(
|
||||
'unit_price_tax_excl',
|
||||
'unit_price_tax_incl',
|
||||
'total_price_tax_excl',
|
||||
'total_price_tax_incl',
|
||||
);
|
||||
|
||||
$vatAddress = new Address((int)$order->id_address_tax);
|
||||
$idLang = (int) $order->id_lang;
|
||||
foreach ($orderBookingDemands as $bookingDemand) {
|
||||
$objBookingDemand = new HotelBookingDemands($bookingDemand['id_booking_demand']);
|
||||
foreach ($fields as $field) {
|
||||
$objBookingDemand->{$field} = Tools::convertPriceFull(
|
||||
$objBookingDemand->{$field},
|
||||
$old_currency,
|
||||
$currency
|
||||
);
|
||||
}
|
||||
|
||||
// update Tax of bookings demands
|
||||
if ($objBookingDemand->save()) {
|
||||
$taxManager = TaxManagerFactory::getManager(
|
||||
$vatAddress,
|
||||
$objBookingDemand->id_tax_rules_group
|
||||
);
|
||||
$taxCalculator = $taxManager->getTaxCalculator();
|
||||
$objBookingDemand->tax_computation_method = (int)$taxCalculator->computation_method;
|
||||
$objBookingDemand->tax_calculator = $taxCalculator;
|
||||
|
||||
// Now save tax details of the extra demand with replace = 1
|
||||
$objBookingDemand->setBookingDemandTaxDetails(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$fields = array(
|
||||
'unit_price_tax_excl',
|
||||
'unit_price_tax_incl',
|
||||
@@ -3396,53 +3308,14 @@ class AdminOrdersControllerCore extends AdminController
|
||||
|
||||
$total_room_tax = 0;
|
||||
$totalRoomsCostTE = 0;
|
||||
$totalDemandsPriceTE = 0;
|
||||
$totalDemandsPriceTI = 0;
|
||||
$totalRefundedRooms = 0;
|
||||
$orderConvenienceFeeServices = array();
|
||||
if ($order_detail_data = $objBookingDetail->getOrderFormatedBookinInfoByIdOrder($order->id)) {
|
||||
$objBookingDemand = new HotelBookingDemands();
|
||||
$objHotelRoomType = new HotelRoomType();
|
||||
foreach ($order_detail_data as $key => $value) {
|
||||
$order_detail_data[$key]['total_room_price_te'] = $value['total_price_tax_excl'];
|
||||
$order_detail_data[$key]['total_room_price_ti'] = $value['total_price_tax_incl'];
|
||||
|
||||
$order_detail_data[$key]['extra_demands'] = $objBookingDemand->getRoomTypeBookingExtraDemands(
|
||||
$order->id,
|
||||
$value['id_product'],
|
||||
$value['id_room'],
|
||||
$value['date_from'],
|
||||
$value['date_to'],
|
||||
1,
|
||||
0,
|
||||
1,
|
||||
$value['id']
|
||||
);
|
||||
$order_detail_data[$key]['total_room_price_ti'] += $order_detail_data[$key]['extra_demands_price_ti'] = $objBookingDemand->getRoomTypeBookingExtraDemands(
|
||||
$order->id,
|
||||
$value['id_product'],
|
||||
$value['id_room'],
|
||||
$value['date_from'],
|
||||
$value['date_to'],
|
||||
0,
|
||||
1,
|
||||
1,
|
||||
$value['id']
|
||||
);
|
||||
$totalDemandsPriceTI += $order_detail_data[$key]['extra_demands_price_ti'];
|
||||
$order_detail_data[$key]['total_room_price_te'] += $order_detail_data[$key]['extra_demands_price_te'] = $objBookingDemand->getRoomTypeBookingExtraDemands(
|
||||
$order->id,
|
||||
$value['id_product'],
|
||||
$value['id_room'],
|
||||
$value['date_from'],
|
||||
$value['date_to'],
|
||||
0,
|
||||
1,
|
||||
0,
|
||||
$value['id']
|
||||
);
|
||||
$totalDemandsPriceTE += $order_detail_data[$key]['extra_demands_price_te'];
|
||||
|
||||
$order_detail_data[$key]['additional_services'] = $objServiceProductOrderDetail->getRoomTypeServiceProducts(
|
||||
0,
|
||||
0,
|
||||
@@ -3719,8 +3592,6 @@ class AdminOrdersControllerCore extends AdminController
|
||||
'refundReqBookings' => $refundReqBookings,
|
||||
'refundReqProducts' => $refundReqProducts,
|
||||
'refundedAmount' => $refundedAmount,
|
||||
'totalDemandsPriceTI' => $totalDemandsPriceTI,
|
||||
'totalDemandsPriceTE' => $totalDemandsPriceTE,
|
||||
'totalRoomsCostTE' => $totalRoomsCostTE,
|
||||
'total_room_tax' => $total_room_tax,
|
||||
'htl_booking_order_data' => $bookingOrderInfo,
|
||||
@@ -6143,8 +6014,6 @@ class AdminOrdersControllerCore extends AdminController
|
||||
)));
|
||||
}
|
||||
|
||||
// get extra demands of the room before changing in the booking table
|
||||
$objBookingDemand = new HotelBookingDemands();
|
||||
$objServiceProductOrderDetail = new ServiceProductOrderDetail();
|
||||
$orderServiceProducts = $objServiceProductOrderDetail->getRoomTypeServiceProducts(
|
||||
$id_order,
|
||||
@@ -6162,18 +6031,6 @@ class AdminOrdersControllerCore extends AdminController
|
||||
$obj_booking_detail->id
|
||||
);
|
||||
|
||||
$extraDemands = $objBookingDemand->getRoomTypeBookingExtraDemands(
|
||||
$id_order,
|
||||
0,
|
||||
$id_room,
|
||||
$old_date_from,
|
||||
$old_date_to,
|
||||
1,
|
||||
0,
|
||||
1,
|
||||
$obj_booking_detail->id
|
||||
);
|
||||
|
||||
// set occupancy details
|
||||
$occupancy = array(
|
||||
'adults' => $adults,
|
||||
@@ -6198,46 +6055,6 @@ class AdminOrdersControllerCore extends AdminController
|
||||
$new_total_price,
|
||||
$obj_booking_detail->id
|
||||
)) {
|
||||
// update extra demands total prices if dates are changes (price calc method for each day)
|
||||
if ($extraDemands) {
|
||||
foreach ($extraDemands as $demand) {
|
||||
if (isset($demand['extra_demands']) && $demand['extra_demands']) {
|
||||
foreach ($demand['extra_demands'] as $rDemand) {
|
||||
if ($rDemand['price_calc_method'] == HotelRoomTypeGlobalDemand::WK_PRICE_CALC_METHOD_EACH_DAY) {
|
||||
$objBookingDemand = new HotelBookingDemands($rDemand['id_booking_demand']);
|
||||
|
||||
$numDays = HotelHelper::getNumberOfDays($new_date_from, $new_date_to);
|
||||
$demandPriceTE = Tools::processPriceRounding(
|
||||
($objBookingDemand->unit_price_tax_excl * $numDays),
|
||||
1,
|
||||
$order->round_type,
|
||||
$order->round_mode
|
||||
);
|
||||
$demandPriceTI = Tools::processPriceRounding(
|
||||
($objBookingDemand->unit_price_tax_incl * $numDays),
|
||||
1,
|
||||
$order->round_type,
|
||||
$order->round_mode
|
||||
);
|
||||
|
||||
$objBookingDemand->total_price_tax_excl = $demandPriceTE;
|
||||
$objBookingDemand->total_price_tax_incl = $demandPriceTI;
|
||||
|
||||
$objBookingDemand->save();
|
||||
|
||||
if (isset($order_invoice)) {
|
||||
$order_invoice->total_paid_tax_excl -= $rDemand['total_price_tax_excl'];
|
||||
$order_invoice->total_paid_tax_incl -= $rDemand['total_price_tax_incl'];
|
||||
|
||||
$order_invoice->total_paid_tax_excl += (float)$objBookingDemand->total_price_tax_excl;
|
||||
$order_invoice->total_paid_tax_incl += (float)$objBookingDemand->total_price_tax_incl;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (isset($orderServiceProducts)
|
||||
&& is_array($orderServiceProducts)
|
||||
@@ -6529,30 +6346,6 @@ class AdminOrdersControllerCore extends AdminController
|
||||
$bookingPriceTaxIncl = Tools::processPriceRounding($objBookingDetail->total_price_tax_incl, 1, $order->round_type, $order->round_mode);
|
||||
$bookingPriceTaxExcl = Tools::processPriceRounding($objBookingDetail->total_price_tax_excl, 1, $order->round_type, $order->round_mode);
|
||||
|
||||
$objBookingDemand = new HotelBookingDemands();
|
||||
$roomExtraDemandTI = $objBookingDemand->getRoomTypeBookingExtraDemands(
|
||||
$id_order,
|
||||
$objBookingDetail->id_product,
|
||||
$objBookingDetail->id_room,
|
||||
$objBookingDetail->date_from,
|
||||
$objBookingDetail->date_to,
|
||||
0,
|
||||
1,
|
||||
1,
|
||||
$objBookingDetail->id
|
||||
);
|
||||
$roomExtraDemandTE = $objBookingDemand->getRoomTypeBookingExtraDemands(
|
||||
$id_order,
|
||||
$objBookingDetail->id_product,
|
||||
$objBookingDetail->id_room,
|
||||
$objBookingDetail->date_from,
|
||||
$objBookingDetail->date_to,
|
||||
0,
|
||||
1,
|
||||
0,
|
||||
$objBookingDetail->id
|
||||
);
|
||||
|
||||
$objServiceProductOrderDetail = new ServiceProductOrderDetail();
|
||||
$additionlServicesTI = $objServiceProductOrderDetail->getRoomTypeServiceProducts(
|
||||
0,
|
||||
@@ -6693,10 +6486,8 @@ class AdminOrdersControllerCore extends AdminController
|
||||
if ($order_detail->id_order_invoice != 0) {
|
||||
// values changes as values are calculated accoding to the quantity of the product by webkul
|
||||
$order_invoice = new OrderInvoice($order_detail->id_order_invoice);
|
||||
$order_invoice->total_paid_tax_excl -= ($diff_products_tax_excl + $roomExtraDemandTE + $additionlServicesTE);
|
||||
$order_invoice->total_paid_tax_excl = $order_invoice->total_paid_tax_excl > 0 ? $order_invoice->total_paid_tax_excl : 0;
|
||||
|
||||
$order_invoice->total_paid_tax_incl -= ($diff_products_tax_incl + $roomExtraDemandTI + $additionlServicesTI);
|
||||
$order_invoice->total_paid_tax_incl -= ($diff_products_tax_incl + $additionlServicesTI);
|
||||
$order_invoice->total_paid_tax_incl = $order_invoice->total_paid_tax_incl > 0 ? $order_invoice->total_paid_tax_incl : 0;
|
||||
|
||||
$order_invoice->total_products -= $diff_products_tax_excl;
|
||||
@@ -6714,8 +6505,8 @@ class AdminOrdersControllerCore extends AdminController
|
||||
// Update Order
|
||||
// values changes as values are calculated accoding to the quantity of the product by webkul
|
||||
$order->total_paid = Tools::ps_round($order->getOrderTotal(), _PS_PRICE_COMPUTE_PRECISION_);
|
||||
$order->total_paid_tax_incl = Tools::ps_round($order->getOrderTotal() - $roomExtraDemandTI, _PS_PRICE_COMPUTE_PRECISION_);
|
||||
$order->total_paid_tax_excl = Tools::ps_round($order->getOrderTotal(false) - $roomExtraDemandTE, _PS_PRICE_COMPUTE_PRECISION_);
|
||||
$order->total_paid_tax_incl = Tools::ps_round($order->getOrderTotal(), _PS_PRICE_COMPUTE_PRECISION_);
|
||||
$order->total_paid_tax_excl = Tools::ps_round($order->getOrderTotal(false), _PS_PRICE_COMPUTE_PRECISION_);
|
||||
|
||||
$order->total_products -= ($diff_products_tax_excl + $additionlServicesTE);
|
||||
$order->total_products = $order->total_products > 0 ? $order->total_products : 0;
|
||||
@@ -6752,9 +6543,6 @@ class AdminOrdersControllerCore extends AdminController
|
||||
$invoice_array[] = $invoice;
|
||||
}
|
||||
|
||||
// delete the demands od this booking
|
||||
$objBookingDemand->deleteBookingDemands($idHotelBooking);
|
||||
|
||||
$objServiceProductOrderDetail->deleteSeviceProducts(0, $idHotelBooking);
|
||||
|
||||
/*By webkul to delete cart and order entries from cart and order tables of hotelreservationsystem when delete booking form the order line in order detaoil page*/
|
||||
@@ -7378,8 +7166,8 @@ class AdminOrdersControllerCore extends AdminController
|
||||
}
|
||||
}
|
||||
|
||||
// To show rooms extra demands in the modal box in order details view page
|
||||
public function ajaxProcessGetRoomTypeBookingDemands()
|
||||
// To show rooms extra services in the modal box in order details view page
|
||||
public function ajaxProcessgetRoomTypeBookingServices()
|
||||
{
|
||||
$orderEdit = Tools::getValue('orderEdit');
|
||||
if (($idProduct = Tools::getValue('id_product'))
|
||||
@@ -7398,25 +7186,9 @@ class AdminOrdersControllerCore extends AdminController
|
||||
|
||||
$smartyVars['id_booking_detail'] = $idHtlBooking;
|
||||
|
||||
$objBookingDemand = new HotelBookingDemands();
|
||||
|
||||
// set context currency So that we can get prices in the order currency
|
||||
$this->context->currency = $objCurrency;
|
||||
|
||||
if ($extraDemands = $objBookingDemand->getRoomTypeBookingExtraDemands(
|
||||
$idOrder,
|
||||
$idProduct,
|
||||
$idRoom,
|
||||
$dateFrom,
|
||||
$dateTo,
|
||||
1,
|
||||
0,
|
||||
1,
|
||||
$idHtlBooking
|
||||
)) {
|
||||
$smartyVars['extraDemands'] = $extraDemands;
|
||||
}
|
||||
|
||||
$objServiceProductOrderDetail = new ServiceProductOrderDetail();
|
||||
if ($additionalServices = $objServiceProductOrderDetail->getRoomTypeServiceProducts(
|
||||
0,
|
||||
@@ -7437,11 +7209,11 @@ class AdminOrdersControllerCore extends AdminController
|
||||
}
|
||||
|
||||
$smartyVars['orderEdit'] = $orderEdit;
|
||||
|
||||
$smartyVars['show_active'] = true;
|
||||
$this->context->smarty->assign($smartyVars);
|
||||
|
||||
$modal = array(
|
||||
'modal_id' => 'room-extra-demands',
|
||||
'modal_id' => 'room-extra-services',
|
||||
'modal_class' => 'modal-lg order_detail_modal',
|
||||
'modal_title' => '<i class="icon icon-file-text"></i>  '.$this->l('Extra Services'),
|
||||
'modal_content' => $this->context->smarty->fetch('controllers/orders/modals/_extra_services.tpl'),
|
||||
@@ -7541,61 +7313,6 @@ class AdminOrdersControllerCore extends AdminController
|
||||
return $servicesTpl;
|
||||
}
|
||||
|
||||
public function processRenderFacilitiesBlock($idOrder, $idProduct, $dateFrom, $dateTo, $idRoom, $idHtlBookingDetail, $orderEdit)
|
||||
{
|
||||
$smartyVars = array();
|
||||
$objOrder = new Order($idOrder);
|
||||
$objCurrency = new Currency($objOrder->id_currency);
|
||||
$smartyVars['orderCurrency'] = $objOrder->id_currency;
|
||||
$smartyVars['currencySign'] = $objCurrency->sign;
|
||||
$smartyVars['link'] = $this->context->link;
|
||||
$smartyVars['id_booking_detail'] = $idHtlBookingDetail;
|
||||
|
||||
// set context currency So that we can get prices in the order currency
|
||||
$this->context->currency = new Currency($objOrder->id_currency);
|
||||
|
||||
$objBookingDemand = new HotelBookingDemands();
|
||||
|
||||
if ($extraDemands = $objBookingDemand->getRoomTypeBookingExtraDemands(
|
||||
$idOrder,
|
||||
$idProduct,
|
||||
$idRoom,
|
||||
$dateFrom,
|
||||
$dateTo,
|
||||
1,
|
||||
0,
|
||||
1,
|
||||
$idHtlBookingDetail
|
||||
)) {
|
||||
$smartyVars['extraDemands'] = $extraDemands;
|
||||
}
|
||||
|
||||
// if admin is editing order
|
||||
if ($orderEdit) {
|
||||
$smartyVars['orderEdit'] = $orderEdit;
|
||||
|
||||
// get room type additional demands
|
||||
$objRoomDemands = new HotelRoomTypeDemand();
|
||||
if ($roomTypeDemands = $objRoomDemands->getRoomTypeDemands($idProduct)) {
|
||||
foreach ($roomTypeDemands as &$demand) {
|
||||
// if demand has advance options then set demand price as first advance option price.
|
||||
if (isset($demand['adv_option']) && $demand['adv_option']) {
|
||||
$demand['price'] = current($demand['adv_option'])['price'];
|
||||
}
|
||||
}
|
||||
$smartyVars['roomTypeDemands'] = $roomTypeDemands;
|
||||
}
|
||||
}
|
||||
|
||||
$smartyVars['show_active'] = true;
|
||||
$this->context->smarty->assign($smartyVars);
|
||||
|
||||
$servicesTpl = $this->context->smarty->fetch(
|
||||
_PS_ADMIN_DIR_.'/themes/default/template/controllers/orders/modals/_extra_services_facilities_tab_content.tpl'
|
||||
);
|
||||
return $servicesTpl;
|
||||
}
|
||||
|
||||
public function ajaxProcessUpdateSelectedRoomServices()
|
||||
{
|
||||
$response = array('hasError' => false);
|
||||
@@ -8453,295 +8170,6 @@ class AdminOrdersControllerCore extends AdminController
|
||||
$this->ajaxDie(json_encode($response));
|
||||
}
|
||||
|
||||
// Process when admin changes extra demands of any room while order creation process form.tpl
|
||||
public function ajaxProcessChangeRoomDemands()
|
||||
{
|
||||
if ($idCartBooking = Tools::getValue('id_cart_booking')) {
|
||||
if (Validate::isLoadedObject($objCartbookingCata = new HotelCartBookingData($idCartBooking))) {
|
||||
$roomDemands = Tools::getValue('room_demands');
|
||||
$roomDemands = json_decode($roomDemands, true);
|
||||
$roomDemands = json_encode($roomDemands);
|
||||
$objCartbookingCata->extra_demands = $roomDemands;
|
||||
if ($objCartbookingCata->save()) {
|
||||
die('1');
|
||||
}
|
||||
}
|
||||
}
|
||||
die('0');
|
||||
}
|
||||
|
||||
// Process when admin edit rooms and edit rooms additional facilities
|
||||
public function ajaxProcessAddRoomExtraDemands()
|
||||
{
|
||||
$response = array('success' => false, 'hasError' => false);
|
||||
if ($this->tabAccess['edit'] === 1) {
|
||||
if ($idHtlBooking = Tools::getValue('id_htl_booking')) {
|
||||
if (Validate::isLoadedObject($objBookingDetail = new HotelBookingDetail($idHtlBooking))) {
|
||||
$roomDemands = Tools::getValue('room_demands');
|
||||
if ($roomDemands = json_decode($roomDemands, true)) {
|
||||
$order = new Order($objBookingDetail->id_order);
|
||||
// set context currency So that we can get prices in the order currency
|
||||
$this->context->currency = new Currency($order->id_currency);
|
||||
|
||||
$vatAddress = new Address((int)$order->id_address_tax);
|
||||
$idLang = (int)$order->id_lang;
|
||||
$idProduct = $objBookingDetail->id_product;
|
||||
$objHtlBkDtl = new HotelBookingDetail();
|
||||
$objRoomDemandPrice = new HotelRoomTypeDemandPrice();
|
||||
foreach ($roomDemands as $demand) {
|
||||
if (!ValidateCore::isPrice($demand['unit_price'])) {
|
||||
$objGlobalDemand = new HotelRoomTypeGlobalDemand($demand['id_global_demand'], $idLang);
|
||||
$response['hasError'] = true;
|
||||
$response['errors'][] = sprintf($this->l('Invalid unit price for %s.'), $objGlobalDemand->name);
|
||||
}
|
||||
}
|
||||
if (!$response['hasError']) {
|
||||
foreach ($roomDemands as $demand) {
|
||||
$idGlobalDemand = $demand['id_global_demand'];
|
||||
$idOption = $demand['id_option'];
|
||||
$objBookingDemand = new HotelBookingDemands();
|
||||
$objBookingDemand->id_htl_booking = $idHtlBooking;
|
||||
$objGlobalDemand = new HotelRoomTypeGlobalDemand($idGlobalDemand, $idLang);
|
||||
if ($idOption) {
|
||||
$objOption = new HotelRoomTypeGlobalDemandAdvanceOption($idOption, $idLang);
|
||||
$objBookingDemand->name = $objOption->name;
|
||||
} else {
|
||||
$idOption = 0;
|
||||
$objBookingDemand->name = $objGlobalDemand->name;
|
||||
}
|
||||
$objBookingDemand->unit_price_tax_excl = $demand['unit_price'];
|
||||
$objBookingDemand->unit_price_tax_incl = HotelRoomTypeDemand::getPriceStatic(
|
||||
$idProduct,
|
||||
$idGlobalDemand,
|
||||
$idOption,
|
||||
1,
|
||||
6,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
$demand['unit_price']
|
||||
);
|
||||
$numDays = 1;
|
||||
if ($objGlobalDemand->price_calc_method == HotelRoomTypeGlobalDemand::WK_PRICE_CALC_METHOD_EACH_DAY) {
|
||||
$numDays = HotelHelper::getNumberOfDays(
|
||||
$objBookingDetail->date_from,
|
||||
$objBookingDetail->date_to
|
||||
);
|
||||
}
|
||||
$objBookingDemand->total_price_tax_excl = $totalPriceTaxIncl = Tools::processPriceRounding(
|
||||
($objBookingDemand->unit_price_tax_excl * $numDays),
|
||||
1,
|
||||
$order->round_type,
|
||||
$order->round_mode
|
||||
);
|
||||
$objBookingDemand->total_price_tax_incl = $totalPriceTaxIncl = Tools::processPriceRounding(
|
||||
($objBookingDemand->unit_price_tax_incl * $numDays),
|
||||
1,
|
||||
$order->round_type,
|
||||
$order->round_mode
|
||||
);
|
||||
|
||||
$order_detail = new OrderDetail($objBookingDetail->id_order_detail);
|
||||
// Update OrderInvoice of this OrderDetail
|
||||
if ($order_detail->id_order_invoice != 0) {
|
||||
// values changes as values are calculated accoding to the quantity of the product by webkul
|
||||
$order_invoice = new OrderInvoice($order_detail->id_order_invoice);
|
||||
$order_invoice->total_paid_tax_excl = Tools::ps_round((float)($order_invoice->total_paid_tax_excl + $objBookingDemand->total_price_tax_excl), _PS_PRICE_COMPUTE_PRECISION_);
|
||||
$order_invoice->total_paid_tax_incl = Tools::ps_round((float)($order_invoice->total_paid_tax_incl + $objBookingDemand->total_price_tax_incl), _PS_PRICE_COMPUTE_PRECISION_);
|
||||
$res &= $order_invoice->update();
|
||||
}
|
||||
|
||||
$objBookingDemand->price_calc_method = $objGlobalDemand->price_calc_method;
|
||||
$objBookingDemand->id_tax_rules_group = $objGlobalDemand->id_tax_rules_group;
|
||||
$taxManager = TaxManagerFactory::getManager(
|
||||
$vatAddress,
|
||||
$objGlobalDemand->id_tax_rules_group
|
||||
);
|
||||
$taxCalc = $taxManager->getTaxCalculator();
|
||||
$objBookingDemand->tax_computation_method = (int)$taxCalc->computation_method;
|
||||
if ($objBookingDemand->save()) {
|
||||
$objBookingDemand->tax_calculator = $taxCalc;
|
||||
// Now save tax details of the extra demand
|
||||
$objBookingDemand->setBookingDemandTaxDetails();
|
||||
}
|
||||
}
|
||||
|
||||
$order->total_paid = Tools::ps_round($order->getOrderTotal(), _PS_PRICE_COMPUTE_PRECISION_);
|
||||
$order->total_paid_tax_incl = Tools::ps_round($order->getOrderTotal(), _PS_PRICE_COMPUTE_PRECISION_);
|
||||
$order->total_paid_tax_excl = Tools::ps_round($order->getOrderTotal(false), _PS_PRICE_COMPUTE_PRECISION_);
|
||||
if ($order->save()) {
|
||||
$response['facilities_panel'] = $this->processRenderFacilitiesBlock(
|
||||
$order->id,
|
||||
$objBookingDetail->id_product,
|
||||
$objBookingDetail->date_from,
|
||||
$objBookingDetail->date_to,
|
||||
$objBookingDetail->id_room,
|
||||
$objBookingDetail->id,
|
||||
true
|
||||
);
|
||||
$response['success'] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$response['hasError'] = true;
|
||||
$response['errors'][] = Tools::displayError('You do not have permission to edit this order.');
|
||||
}
|
||||
die(json_encode($response));
|
||||
}
|
||||
|
||||
public function ajaxProcessUpdateRoomExtraDemands()
|
||||
{
|
||||
$response = array('success' => false);
|
||||
if ($this->tabAccess['edit'] === 1) {
|
||||
if ($idBookingDemand = Tools::getValue('id_booking_demand')) {
|
||||
if (Validate::isLoadedObject($objBookingDemand = new HotelBookingDemands($idBookingDemand))) {
|
||||
$unitPrice = Tools::getValue('unit_price');
|
||||
if (!$unitPrice || !ValidateCore::isPrice($unitPrice)) {
|
||||
$response['hasError'] = true;
|
||||
$response['errors'] = $this->l('Invalid unit price');
|
||||
}
|
||||
$oldPriceTaxExcl = $objBookingDemand->unit_price_tax_excl;
|
||||
$oldPriceTaxIncl = $objBookingDemand->unit_price_tax_incl;
|
||||
if ($oldPriceTaxExcl > 0) {
|
||||
$oldTaxMultiplier = $oldPriceTaxIncl / $oldPriceTaxExcl;
|
||||
} else {
|
||||
$oldTaxMultiplier = 1;
|
||||
}
|
||||
|
||||
$objBookingDemand->unit_price_tax_excl = $unitPrice;
|
||||
$objBookingDemand->unit_price_tax_incl = $unitPrice * $oldTaxMultiplier;
|
||||
|
||||
$objBookingDetail = new HotelBookingDetail($objBookingDemand->id_htl_booking);
|
||||
$order = new Order($objBookingDetail->id_order);
|
||||
if ($objBookingDemand->price_calc_method == HotelRoomTypeGlobalDemand::WK_PRICE_CALC_METHOD_EACH_DAY) {
|
||||
$numDays = HotelHelper::getNumberOfDays(
|
||||
$objBookingDetail->date_from,
|
||||
$objBookingDetail->date_to
|
||||
);
|
||||
|
||||
$objBookingDemand->total_price_tax_excl = Tools::processPriceRounding(
|
||||
($objBookingDemand->unit_price_tax_excl * $numDays),
|
||||
1,
|
||||
$order->round_type,
|
||||
$order->round_mode
|
||||
);
|
||||
$objBookingDemand->total_price_tax_excl = Tools::processPriceRounding(
|
||||
($objBookingDemand->unit_price_tax_incl * $numDays),
|
||||
1,
|
||||
$order->round_type,
|
||||
$order->round_mode
|
||||
);
|
||||
} else {
|
||||
$objBookingDemand->total_price_tax_excl = Tools::processPriceRounding(
|
||||
$objBookingDemand->unit_price_tax_excl,
|
||||
1,
|
||||
$order->round_type,
|
||||
$order->round_mode
|
||||
);
|
||||
$objBookingDemand->total_price_tax_incl = Tools::processPriceRounding(
|
||||
$objBookingDemand->unit_price_tax_incl,
|
||||
1,
|
||||
$order->round_type,
|
||||
$order->round_mode
|
||||
);
|
||||
}
|
||||
if ($objBookingDemand->save()) {
|
||||
$objBookingDemand->setBookingDemandTaxDetails(1);
|
||||
|
||||
$priceDiffTaxExcl = $objBookingDemand->total_price_tax_excl - $oldPriceTaxExcl;
|
||||
$priceDiffTaxIncl = $objBookingDemand->total_price_tax_incl - $oldPriceTaxIncl;
|
||||
|
||||
|
||||
$order_detail = new OrderDetail($objBookingDetail->id_order_detail);
|
||||
// Update OrderInvoice of this OrderDetail
|
||||
if ($order_detail->id_order_invoice != 0) {
|
||||
// values changes as values are calculated accoding to the quantity of the product by webkul
|
||||
$order_invoice = new OrderInvoice($order_detail->id_order_invoice);
|
||||
|
||||
$order_invoice->total_paid_tax_excl = Tools::ps_round((float)($order_invoice->total_paid_tax_excl + $priceDiffTaxExcl), _PS_PRICE_COMPUTE_PRECISION_);
|
||||
$order_invoice->total_paid_tax_incl = Tools::ps_round((float)($order_invoice->total_paid_tax_incl + $priceDiffTaxIncl), _PS_PRICE_COMPUTE_PRECISION_);
|
||||
$order_invoice->update();
|
||||
}
|
||||
|
||||
$order->total_paid_tax_excl = Tools::ps_round((float)($order->total_paid_tax_excl + $priceDiffTaxExcl), _PS_PRICE_COMPUTE_PRECISION_);
|
||||
$order->total_paid_tax_incl = Tools::ps_round((float)($order->total_paid_tax_incl + $priceDiffTaxIncl), _PS_PRICE_COMPUTE_PRECISION_);
|
||||
$order->total_paid = Tools::ps_round((float)($order->total_paid + $priceDiffTaxIncl), _PS_PRICE_COMPUTE_PRECISION_);
|
||||
if ($order->save()) {
|
||||
$response['facilities_panel'] = $this->processRenderFacilitiesBlock(
|
||||
$order->id,
|
||||
$objBookingDetail->id_product,
|
||||
$objBookingDetail->date_from,
|
||||
$objBookingDetail->date_to,
|
||||
$objBookingDetail->id_room,
|
||||
$objBookingDetail->id,
|
||||
true
|
||||
);
|
||||
$response['success'] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
die(json_encode($response));
|
||||
}
|
||||
|
||||
// delete room extra demand while order edit
|
||||
public function ajaxProcessDeleteRoomExtraDemand()
|
||||
{
|
||||
$response = array('success' => false);
|
||||
// Check tab access is allowed to edit
|
||||
if ($this->tabAccess['edit'] === 1) {
|
||||
$res = true;
|
||||
if ($idBookingDemand = Tools::getValue('id_booking_demand')) {
|
||||
if (Validate::isLoadedObject($objBookingDemand = new HotelBookingDemands($idBookingDemand))) {
|
||||
// first delete the tax details of the booking demand
|
||||
if ($objBookingDemand->deleteBookingDemandTaxDetails($idBookingDemand)) {
|
||||
if ($objBookingDemand->delete()) {
|
||||
if (Validate::isLoadedObject($objBookingDetail = new HotelBookingDetail($objBookingDemand->id_htl_booking))) {
|
||||
// change order total
|
||||
$order = new Order($objBookingDetail->id_order);
|
||||
|
||||
$order->total_paid = Tools::ps_round($order->getOrderTotal(), _PS_PRICE_COMPUTE_PRECISION_);
|
||||
$order->total_paid_tax_incl = Tools::ps_round($order->getOrderTotal(), _PS_PRICE_COMPUTE_PRECISION_);
|
||||
$order->total_paid_tax_excl = Tools::ps_round($order->getOrderTotal(false), _PS_PRICE_COMPUTE_PRECISION_);
|
||||
|
||||
$order->save();
|
||||
|
||||
$order_detail = new OrderDetail($objBookingDetail->id_order_detail);
|
||||
// Update OrderInvoice of this OrderDetail
|
||||
if ($order_detail->id_order_invoice != 0) {
|
||||
// values changes as values are calculated accoding to the quantity of the product by webkul
|
||||
$order_invoice = new OrderInvoice($order_detail->id_order_invoice);
|
||||
$order_invoice->total_paid_tax_excl = Tools::ps_round((float)($order_invoice->total_paid_tax_excl - $objBookingDemand->total_price_tax_excl), _PS_PRICE_COMPUTE_PRECISION_);
|
||||
$order_invoice->total_paid_tax_incl = Tools::ps_round((float)($order_invoice->total_paid_tax_incl - $objBookingDemand->total_price_tax_incl), _PS_PRICE_COMPUTE_PRECISION_);
|
||||
$res &= $order_invoice->update();
|
||||
}
|
||||
if ($res) {
|
||||
$response['facilities_panel'] = $this->processRenderFacilitiesBlock(
|
||||
$order->id,
|
||||
$objBookingDetail->id_product,
|
||||
$objBookingDetail->date_from,
|
||||
$objBookingDetail->date_to,
|
||||
$objBookingDetail->id_room,
|
||||
$objBookingDetail->id,
|
||||
true
|
||||
);
|
||||
$response['success'] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
die(json_encode($response));
|
||||
}
|
||||
|
||||
public function ajaxProcessUpdateServiceProduct()
|
||||
{
|
||||
$operator = Tools::getValue('operator', 'up');
|
||||
|
||||
@@ -111,7 +111,6 @@ class AdminProductsControllerCore extends AdminController
|
||||
'Configuration' => $this->l('Rooms'),
|
||||
'Occupancy' => $this->l('Occupancy'),
|
||||
'LengthOfStay' => $this->l('Length of Stay'),
|
||||
'AdditionalFacilities' => $this->l('Additional Facilities'),
|
||||
);
|
||||
|
||||
if ($this->context->shop->getContext() != Shop::CONTEXT_GROUP) {
|
||||
@@ -126,7 +125,6 @@ class AdminProductsControllerCore extends AdminController
|
||||
'Occupancy' => 7,
|
||||
'ServiceProduct' => 9,
|
||||
'LengthOfStay' => 10,
|
||||
'AdditionalFacilities' => 11,
|
||||
));
|
||||
}
|
||||
|
||||
@@ -230,7 +228,6 @@ class AdminProductsControllerCore extends AdminController
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_download` pd ON (pd.`id_product` = a.`id_product` AND pd.`active` = 1)
|
||||
LEFT JOIN `'._DB_PREFIX_.'address` aa ON (aa.`id_hotel` = hb.`id`)
|
||||
LEFT JOIN `'._DB_PREFIX_.'feature_product` fp ON (fp.`id_product` = a.`id_product`)
|
||||
LEFT JOIN `'._DB_PREFIX_.'htl_room_type_demand` hrtd ON (hrtd.`id_product` = a.`id_product`)
|
||||
LEFT JOIN (
|
||||
SELECT rsp.*, GROUP_CONCAT(pl.`name`) AS service_products
|
||||
FROM `'._DB_PREFIX_.'htl_room_type_service_product` rsp
|
||||
@@ -433,23 +430,6 @@ class AdminProductsControllerCore extends AdminController
|
||||
'displayed' => false,
|
||||
);
|
||||
|
||||
$additionalFacilities = array();
|
||||
$objHotelRoomTypeGlobalDemand = new HotelRoomTypeGlobalDemand();
|
||||
$demands = $objHotelRoomTypeGlobalDemand->getAllDemands();
|
||||
foreach ($demands as $demand) {
|
||||
$additionalFacilities[$demand['id_global_demand']] = $demand['name'];
|
||||
}
|
||||
$this->fields_list['id_global_demand'] = array(
|
||||
'title' => $this->l('Additional Facilities'),
|
||||
'align' => 'text-center',
|
||||
'type' => 'select',
|
||||
'multiple' => true,
|
||||
'operator' => 'and',
|
||||
'filter_key' => 'hrtd!id_global_demand',
|
||||
'list' => $additionalFacilities,
|
||||
'displayed' => false,
|
||||
);
|
||||
|
||||
$this->locationsAndHotels = array();
|
||||
$idLocationsCategory = Configuration::get('PS_LOCATIONS_CATEGORY');
|
||||
$this->objLocationsCategory = new Category($idLocationsCategory, $this->context->language->id);
|
||||
@@ -669,7 +649,7 @@ class AdminProductsControllerCore extends AdminController
|
||||
$orderWay = 'ASC';
|
||||
}
|
||||
if ($this->action == 'export' && empty($this->_listsql)) {
|
||||
$this->_select .= ' , trg.`name` AS `id_tax_rules_group`, `features`, hrtdl.`global_demands`';
|
||||
$this->_select .= ' , trg.`name` AS `id_tax_rules_group`, `features`';
|
||||
$this->_join .= ' LEFT JOIN `'._DB_PREFIX_.'tax_rules_group` trg
|
||||
ON trg.`id_tax_rules_group` = a.`id_tax_rules_group`
|
||||
LEFT JOIN (SELECT GROUP_CONCAT(fpl.`name`) AS features, fp.`id_product`
|
||||
@@ -680,14 +660,6 @@ class AdminProductsControllerCore extends AdminController
|
||||
GROUP BY fp.`id_product`
|
||||
) AS fpl ON (a.`id_product` = fpl.`id_product`)';
|
||||
|
||||
$this->_join .= ' LEFT JOIN (SELECT hrtgd.`id_product`, `id_lang`, GROUP_CONCAT(`name`) AS `global_demands`
|
||||
FROM `'._DB_PREFIX_.'htl_room_type_global_demand_lang` hrtgdl
|
||||
LEFT JOIN `'._DB_PREFIX_.'htl_room_type_demand` hrtgd
|
||||
ON hrtgd.`id_global_demand` = hrtgdl.`id_global_demand`
|
||||
WHERE `id_lang`='.(int) $this->context->language->id.'
|
||||
GROUP BY hrtgd.`id_product`
|
||||
) AS hrtdl ON (hrtdl.`id_product` = a.`id_product`)';
|
||||
|
||||
$this->fields_list = array_merge($this->fields_list, array(
|
||||
'id_tax_rules_group' => array(
|
||||
'title' => $this->l('Id Tax Rules group'),
|
||||
@@ -699,14 +671,10 @@ class AdminProductsControllerCore extends AdminController
|
||||
'service_products' => array(
|
||||
'title' => $this->l('Services Products'),
|
||||
),
|
||||
'global_demands' => array(
|
||||
'title' => $this->l('Additional Facilities'),
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
unset($this->fields_list['id_category_default']);
|
||||
unset($this->fields_list['id_global_demand']);
|
||||
unset($this->fields_list['id_feature']);
|
||||
unset($this->fields_list['id_service_product']);
|
||||
}
|
||||
@@ -971,11 +939,6 @@ class AdminProductsControllerCore extends AdminController
|
||||
)) {
|
||||
$this->errors[] = Tools::displayError('An error occurred while duplicating rooms.');
|
||||
}
|
||||
if (!HotelRoomTypeDemand::duplicateRoomTypeDemands($id_product_old, $product->id)) {
|
||||
$this->errors[] = Tools::displayError(
|
||||
'An error occurred while duplicating additional facilities.'
|
||||
);
|
||||
}
|
||||
} else {
|
||||
$this->errors[] = Tools::displayError('An error occurred while duplicating room type.');
|
||||
}
|
||||
@@ -2232,9 +2195,6 @@ class AdminProductsControllerCore extends AdminController
|
||||
if ($this->isTabSubmitted('Configuration')) {
|
||||
$this->processConfiguration();
|
||||
}
|
||||
if ($this->isTabSubmitted('AdditionalFacilities')) {
|
||||
$this->processAdditionalFacilities();
|
||||
}
|
||||
|
||||
// $this->updatePackItems($object);
|
||||
// Disallow avanced stock management if the product become a pack
|
||||
@@ -3802,136 +3762,6 @@ class AdminProductsControllerCore extends AdminController
|
||||
die(json_encode($response));
|
||||
}
|
||||
|
||||
public function initFormAdditionalFacilities($obj)
|
||||
{
|
||||
$data = $this->createTemplate($this->tpl_form);
|
||||
|
||||
if ($obj->id) {
|
||||
$objGlobalDemand = new HotelRoomTypeGlobalDemand();
|
||||
$allDemands = $objGlobalDemand->getAllDemands();
|
||||
foreach($allDemands as &$demand) {
|
||||
if ($demand['id_tax_rules_group'] == 0) {
|
||||
$demand['default_tax_rules_group_name'] = 'No tax';
|
||||
} else {
|
||||
$objTaxRuleGroup = new TaxRulesGroup(
|
||||
$demand['id_tax_rules_group'],
|
||||
$this->context->language->id
|
||||
);
|
||||
$demand['default_tax_rules_group_name'] = $objTaxRuleGroup->name;
|
||||
}
|
||||
}
|
||||
$objCurrency = new Currency(Configuration::get('PS_CURRENCY_DEFAULT'));
|
||||
|
||||
// get room type additional facilities
|
||||
$objRoomDemand = new HotelRoomTypeDemand();
|
||||
$selectedDemands = $objRoomDemand->getRoomTypeDemands($obj->id, 0, 0);
|
||||
|
||||
$data->assign(array(
|
||||
'product' => $obj,
|
||||
'selectedDemands' => $selectedDemands,
|
||||
'allDemands' => $allDemands,
|
||||
'defaultcurrencySign' => $objCurrency->sign,
|
||||
'idDefaultcurrency' => $objCurrency->id,
|
||||
));
|
||||
} else {
|
||||
$this->displayWarning($this->l('You must save this room type before managing additional facilities.'));
|
||||
}
|
||||
|
||||
$this->tpl_form_vars['custom_form'] = $data->fetch();
|
||||
}
|
||||
|
||||
public function processAdditionalFacilities()
|
||||
{
|
||||
if ($idProduct = Tools::getValue('id_product')) {
|
||||
$errors = array();
|
||||
$objRoomTypeDemand = new HotelRoomTypeDemand();
|
||||
$objRoomTypeDemandPrice = new HotelRoomTypeDemandPrice();
|
||||
// first delete all the previously saved prices and demands of this room type
|
||||
$objRoomTypeDemand->deleteRoomTypeDemands($idProduct);
|
||||
$objRoomTypeDemandPrice->deleteRoomTypeDemandPrices($idProduct);
|
||||
if ($selectedDemands = Tools::getValue('selected_demand')) {
|
||||
$objAdvOption = new HotelRoomTypeGlobalDemandAdvanceOption();
|
||||
foreach ($selectedDemands as $idGlobalDemand) {
|
||||
if (Validate::isLoadedObject($objGlobalDemand = new HotelRoomTypeGlobalDemand($idGlobalDemand))) {
|
||||
// save selected demands for this room type
|
||||
$objRoomTypeDemand = new HotelRoomTypeDemand();
|
||||
$objRoomTypeDemand->id_product = $idProduct;
|
||||
$objRoomTypeDemand->id_global_demand = $idGlobalDemand;
|
||||
$objRoomTypeDemand->save();
|
||||
|
||||
// save selected demands prices for this room type
|
||||
$demandPrice = Tools::getValue('demand_price_'.$idGlobalDemand);
|
||||
if (Validate::isPrice($demandPrice)) {
|
||||
if ($objGlobalDemand->price != $demandPrice) {
|
||||
$objRoomTypeDemandPrice = new HotelRoomTypeDemandPrice();
|
||||
$objRoomTypeDemandPrice->id_product = $idProduct;
|
||||
$objRoomTypeDemandPrice->id_global_demand = $idGlobalDemand;
|
||||
$objRoomTypeDemandPrice->id_option = 0;
|
||||
$objRoomTypeDemandPrice->price = $demandPrice;
|
||||
$objRoomTypeDemandPrice->save();
|
||||
}
|
||||
} else {
|
||||
$errors[] = Tools::displayError('Invalid demand price of facility.').
|
||||
' : '.$objGlobalDemand->name[$this->context->language->id];
|
||||
}
|
||||
if ($advOptions = $objAdvOption->getGlobalDemandAdvanceOptions($idGlobalDemand)) {
|
||||
foreach ($advOptions as $option) {
|
||||
if (Validate::isLoadedObject($objAdvOption = new HotelRoomTypeGlobalDemandAdvanceOption($option['id']))) {
|
||||
$optionPrice = Tools::getValue('option_price_'.$option['id']);
|
||||
if (Validate::isPrice($optionPrice)) {
|
||||
if ($optionPrice != $objAdvOption->price) {
|
||||
$objRoomTypeDemandPrice = new HotelRoomTypeDemandPrice();
|
||||
$objRoomTypeDemandPrice->id_product = $idProduct;
|
||||
$objRoomTypeDemandPrice->id_global_demand = $idGlobalDemand;
|
||||
$objRoomTypeDemandPrice->id_option = $option['id'];
|
||||
$objRoomTypeDemandPrice->price = $optionPrice;
|
||||
$objRoomTypeDemandPrice->save();
|
||||
}
|
||||
} else {
|
||||
$errors[] = Tools::displayError('Invalid price of advanced option: ').$objAdvOption->name[$this->context->language->id];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (count($errors)) {
|
||||
$this->warnings[] = Tools::displayError('Invalid price values for additional facilities were not saved. Please correct them and try again.');
|
||||
$this->errors = array_merge($this->errors, $errors);
|
||||
}
|
||||
|
||||
$objCartBookingData = new HotelCartBookingData();
|
||||
if ($cartExtraDemands = $objCartBookingData->getCartExtraDemands(0, $idProduct)) {
|
||||
// delete the demands from cart if not available in cart
|
||||
$objRoomDemand = new HotelRoomTypeDemand();
|
||||
$roomTypeDemandIds = array();
|
||||
if ($roomTypeDemands = $objRoomDemand->getRoomTypeDemands($idProduct)) {
|
||||
$roomTypeDemandIds = array_keys($roomTypeDemands);
|
||||
}
|
||||
foreach ($cartExtraDemands as &$demandInfo) {
|
||||
if (isset($demandInfo['extra_demands']) && $demandInfo['extra_demands']) {
|
||||
$cartChanged = 0;
|
||||
foreach ($demandInfo['extra_demands'] as $key => $demand) {
|
||||
if (!in_array($demand['id_global_demand'], $roomTypeDemandIds)) {
|
||||
$cartChanged = 1;
|
||||
unset($demandInfo['extra_demands'][$key]);
|
||||
}
|
||||
}
|
||||
if ($cartChanged) {
|
||||
if (Validate::isLoadedObject(
|
||||
$objCartBooking = new HotelCartBookingData($demandInfo['id'])
|
||||
)) {
|
||||
$objCartBooking->extra_demands = json_encode($demandInfo['extra_demands']);
|
||||
$objCartBooking->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Product $obj
|
||||
*
|
||||
|
||||
@@ -36,7 +36,6 @@ class AdminSearchControllerCore extends AdminController
|
||||
'AdminFeatures' => 1,
|
||||
'AdminOrders' => 1,
|
||||
'AdminOrderRefundRules' => 1,
|
||||
'AdminRoomTypeGlobalDemand' => 1,
|
||||
'AdminGroups' => 1,
|
||||
'AdminHotelFeatures' => 1,
|
||||
'AdminCustomers' => 1,
|
||||
@@ -191,7 +190,6 @@ class AdminSearchControllerCore extends AdminController
|
||||
if (!$searchType) {
|
||||
$this->searchAddress();
|
||||
$this->searchHotelFeatures();
|
||||
$this->searchAdditionalFacilities();
|
||||
$this->searchRefundRules();
|
||||
}
|
||||
}
|
||||
@@ -450,29 +448,6 @@ class AdminSearchControllerCore extends AdminController
|
||||
}
|
||||
}
|
||||
|
||||
public function searchAdditionalFacilities()
|
||||
{
|
||||
if (class_exists('HotelRoomTypeGlobalDemand')) {
|
||||
if (isset($this->controllerAccess['AdminRoomTypeGlobalDemand']) && $this->controllerAccess['AdminRoomTypeGlobalDemand']) {
|
||||
$objHotelRoomTypeGlobalDemands = new HotelRoomTypeGlobalDemand();
|
||||
if ($globalDemads = $objHotelRoomTypeGlobalDemands->searchByName($this->query, $this->context->language->id)) {
|
||||
foreach ($globalDemads as $key => $demand) {
|
||||
if (!(int) $globalDemads[$key]['price']) {
|
||||
$globalDemads[$key]['price'] = $globalDemads[$key]['option_price'];
|
||||
}
|
||||
|
||||
$globalDemads[$key]['per_day_price_calc'] = $this->l('No');
|
||||
if ($globalDemads[$key]['price_calc_method'] == HotelRoomTypeGlobalDemand::WK_PRICE_CALC_METHOD_EACH_DAY) {
|
||||
$globalDemads[$key]['per_day_price_calc'] = $this->l('Yes');
|
||||
}
|
||||
}
|
||||
|
||||
$this->_list['global_demands'] = $globalDemads;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function searchRefundRules()
|
||||
{
|
||||
if (class_exists('HotelOrderRefundRules')) {
|
||||
@@ -559,18 +534,6 @@ class AdminSearchControllerCore extends AdminController
|
||||
);
|
||||
}
|
||||
|
||||
protected function initGlobalDemandList()
|
||||
{
|
||||
$this->show_toolbar = false;
|
||||
$this->fields_list['global_demands'] = array(
|
||||
'id_global_demand' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25),
|
||||
'name' => array('title' => $this->l('Name')),
|
||||
'option_name' => array('title' => $this->l('Advance Option Name')),
|
||||
'price' => array('title' => $this->l('Price'), 'type' => 'price', 'currency' => true),
|
||||
'per_day_price_calc' => array('title' => $this->l('Per day price calculation'))
|
||||
);
|
||||
}
|
||||
|
||||
protected function initRefundRuleList()
|
||||
{
|
||||
$this->show_toolbar = false;
|
||||
@@ -980,27 +943,6 @@ class AdminSearchControllerCore extends AdminController
|
||||
$this->tpl_view_vars['groups'] = $view;
|
||||
}
|
||||
|
||||
if (isset($this->_list['global_demands']) && count($this->_list['global_demands'])) {
|
||||
$view = '';
|
||||
$this->initGlobalDemandList();
|
||||
$helper = new HelperList();
|
||||
$helper->shopLinkType = '';
|
||||
$helper->simple_header = true;
|
||||
$helper->identifier = 'id_global_demand';
|
||||
$helper->actions = array('edit');
|
||||
$helper->show_toolbar = false;
|
||||
$helper->table = 'htl_room_type_global_demand';
|
||||
$helper->currentIndex = $this->context->link->getAdminLink('AdminRoomTypeGlobalDemand', false);
|
||||
$helper->token = Tools::getAdminTokenLite('AdminRoomTypeGlobalDemand');
|
||||
|
||||
if ($this->_list['global_demands']) {
|
||||
$view = $helper->generateList($this->_list['global_demands'], $this->fields_list['global_demands']);
|
||||
}
|
||||
|
||||
$this->tpl_view_vars['num_global_demands'] = count($this->_list['global_demands']);
|
||||
$this->tpl_view_vars['global_demands'] = $view;
|
||||
}
|
||||
|
||||
if (isset($this->_list['refund_rules']) && count($this->_list['refund_rules'])) {
|
||||
$view = '';
|
||||
$this->initRefundRuleList();
|
||||
|
||||
@@ -1909,7 +1909,7 @@ class AdminStatsControllerCore extends AdminStatsTabController
|
||||
return $result;
|
||||
}
|
||||
|
||||
// Calculate total services revenue (services and demands)
|
||||
// Calculate total services revenue (services )
|
||||
public static function getServicesRevenueForDiscreteDates($dateFrom, $dateTo = null, $idHotel = null, $useCache = true)
|
||||
{
|
||||
$dateTo = !$dateTo ? date('Y-m-d', strtotime('+1 day', strtotime($dateFrom))) : $dateTo;
|
||||
@@ -1946,23 +1946,6 @@ class AdminStatsControllerCore extends AdminStatsTabController
|
||||
$totalServicesRevenue += $servicesRevenue;
|
||||
}
|
||||
|
||||
// Calculate demands revenue
|
||||
$demandsRevenueSql = 'SELECT SUM((hdmd.`total_price_tax_excl` / o.`conversion_rate`) / DATEDIFF(hbd.`date_to`, hbd.`date_from`))
|
||||
FROM `'._DB_PREFIX_.'htl_booking_demands` hdmd
|
||||
LEFT JOIN `'._DB_PREFIX_.'htl_booking_detail` hbd
|
||||
ON (hdmd.`id_htl_booking` = hbd.`id`)
|
||||
LEFT JOIN `'._DB_PREFIX_.'product` p ON (p.`id_product` = hbd.`id_product`)
|
||||
LEFT JOIN `'._DB_PREFIX_.'orders` o ON (o.`id_order` = hbd.`id_order`)
|
||||
WHERE p.`active` = 1
|
||||
AND o.`valid` = 1
|
||||
AND hbd.`is_refunded` = 0
|
||||
AND hbd.`date_from` < "'.pSQL($discreteDate['date_to']).' 00:00:00" AND hbd.`date_to` > "'.pSQL($discreteDate['date_from']).' 00:00:00"'.
|
||||
(!is_null($idHotel) ? HotelBranchInformation::addHotelRestriction($idHotel, 'hbd') : '');
|
||||
|
||||
if ($demandsRevenue = Db::getInstance()->getValue($demandsRevenueSql)) {
|
||||
$totalServicesRevenue += $demandsRevenue;
|
||||
}
|
||||
|
||||
$result[$discreteDate['timestamp_from']] = $totalServicesRevenue;
|
||||
}
|
||||
|
||||
|
||||
@@ -607,8 +607,6 @@ class CartControllerCore extends FrontController
|
||||
*/
|
||||
if ($product->booking_product) {
|
||||
$objHotelCartBookingData = new HotelCartBookingData();
|
||||
$roomDemand = json_decode(Tools::getValue('roomDemands'), true);
|
||||
$roomDemand = json_encode($roomDemand);
|
||||
$availQty = $total_available_rooms;
|
||||
$update_quantity = $objHotelCartBookingData->updateCartBooking(
|
||||
$this->id_product,
|
||||
@@ -618,7 +616,6 @@ class CartControllerCore extends FrontController
|
||||
0,
|
||||
$date_from,
|
||||
$date_to,
|
||||
$roomDemand,
|
||||
$serviceProducts,
|
||||
$id_cart,
|
||||
$id_guest
|
||||
@@ -630,7 +627,6 @@ class CartControllerCore extends FrontController
|
||||
'date_to' => $date_to,
|
||||
'id_product' => $this->id_product,
|
||||
'occupancy' => $occupancy,
|
||||
'room_demand' => $roomDemand,
|
||||
'req_rm' => $req_rm
|
||||
));
|
||||
} else {
|
||||
|
||||
@@ -106,35 +106,19 @@ class GuestTrackingControllerCore extends FrontController
|
||||
}
|
||||
}
|
||||
|
||||
public function displayAjaxGetRoomTypeBookingDemands()
|
||||
public function displayAjaxgetRoomTypeBookingServices()
|
||||
{
|
||||
$response = array('extra_demands' => false);
|
||||
$response = array('extra_services' => false);
|
||||
|
||||
if (($idProduct = Tools::getValue('id_product'))
|
||||
&& ($idOrder = Tools::getValue('id_order'))
|
||||
&& ($dateFrom = Tools::getValue('date_from'))
|
||||
&& ($dateTo = Tools::getValue('date_to'))
|
||||
) {
|
||||
$objHotelBookingDemands = new HotelBookingDemands();
|
||||
$useTax = 0;
|
||||
if (Group::getPriceDisplayMethod($this->context->customer->id_default_group) == PS_TAX_INC) {
|
||||
$useTax = 1;
|
||||
}
|
||||
if ($extraDemands = $objHotelBookingDemands->getRoomTypeBookingExtraDemands(
|
||||
$idOrder,
|
||||
$idProduct,
|
||||
0,
|
||||
$dateFrom,
|
||||
$dateTo,
|
||||
1,
|
||||
0,
|
||||
$useTax
|
||||
)) {
|
||||
$this->context->smarty->assign(array(
|
||||
'useTax' => $useTax,
|
||||
'extraDemands' => $extraDemands,
|
||||
));
|
||||
}
|
||||
$objServiceProductOrderDetail = new ServiceProductOrderDetail();
|
||||
if ($additionalServices = $objServiceProductOrderDetail->getRoomTypeServiceProducts(
|
||||
$idOrder,
|
||||
@@ -158,7 +142,7 @@ class GuestTrackingControllerCore extends FrontController
|
||||
'objOrder' => new Order($idOrder),
|
||||
));
|
||||
|
||||
$response['extra_demands'] = $this->context->smarty->fetch(_PS_THEME_DIR_.'_partials/order-extra-services.tpl');
|
||||
$response['extra_services'] = $this->context->smarty->fetch(_PS_THEME_DIR_.'_partials/order-extra-services.tpl');
|
||||
}
|
||||
|
||||
$this->ajaxDie(json_encode($response));
|
||||
@@ -257,8 +241,6 @@ class GuestTrackingControllerCore extends FrontController
|
||||
$hotelServiceProducts = array();
|
||||
if ($hotelresInstalled) {
|
||||
if ($orderProducts = $order->getProducts()) {
|
||||
$total_demands_price_te = 0;
|
||||
$total_demands_price_ti = 0;
|
||||
$total_convenience_fee_te = 0;
|
||||
$total_convenience_fee_ti = 0;
|
||||
|
||||
@@ -291,8 +273,6 @@ class GuestTrackingControllerCore extends FrontController
|
||||
$cartHotelData[$type_key]['id_product'] = $type_value['product_id'];
|
||||
$cartHotelData[$type_key]['cover_img'] = $cover_img;
|
||||
|
||||
|
||||
$objBookingDemand = new HotelBookingDemands();
|
||||
foreach ($order_bk_data as $data_k => $data_v) {
|
||||
$date_join = strtotime($data_v['date_from']).strtotime($data_v['date_to']);
|
||||
|
||||
@@ -366,41 +346,6 @@ class GuestTrackingControllerCore extends FrontController
|
||||
|
||||
$cartHotelData[$type_key]['date_diff'][$date_join]['ids_htl_booking_detail'][] = $data_v['id'];
|
||||
|
||||
$cartHotelData[$type_key]['date_diff'][$date_join]['extra_demands'] = $objBookingDemand->getRoomTypeBookingExtraDemands(
|
||||
$idOrder,
|
||||
$type_value['product_id'],
|
||||
0,
|
||||
$data_v['date_from'],
|
||||
$data_v['date_to']
|
||||
);
|
||||
if (empty($cartHotelData[$type_key]['date_diff'][$date_join]['extra_demands_price_ti'])) {
|
||||
$cartHotelData[$type_key]['date_diff'][$date_join]['extra_demands_price_ti'] = 0;
|
||||
}
|
||||
$cartHotelData[$type_key]['date_diff'][$date_join]['extra_demands_price_ti'] += $extraDemandPriceTI = $objBookingDemand->getRoomTypeBookingExtraDemands(
|
||||
$idOrder,
|
||||
$type_value['product_id'],
|
||||
$data_v['id_room'],
|
||||
$data_v['date_from'],
|
||||
$data_v['date_to'],
|
||||
0,
|
||||
1,
|
||||
1
|
||||
);
|
||||
if (empty($cartHotelData[$type_key]['date_diff'][$date_join]['extra_demands_price_te'])) {
|
||||
$cartHotelData[$type_key]['date_diff'][$date_join]['extra_demands_price_te'] = 0;
|
||||
}
|
||||
$cartHotelData[$type_key]['date_diff'][$date_join]['extra_demands_price_te'] += $extraDemandPriceTE = $objBookingDemand->getRoomTypeBookingExtraDemands(
|
||||
$idOrder,
|
||||
$type_value['product_id'],
|
||||
$data_v['id_room'],
|
||||
$data_v['date_from'],
|
||||
$data_v['date_to'],
|
||||
0,
|
||||
1,
|
||||
0
|
||||
);
|
||||
$total_demands_price_ti += $extraDemandPriceTI;
|
||||
$total_demands_price_te += $extraDemandPriceTE;
|
||||
$cartHotelData[$type_key]['date_diff'][$date_join]['product_price_tax_excl'] = $order_details_obj->unit_price_tax_excl;
|
||||
$cartHotelData[$type_key]['date_diff'][$date_join]['product_price_tax_incl'] = $order_details_obj->unit_price_tax_incl;
|
||||
$cartHotelData[$type_key]['date_diff'][$date_join]['product_price_without_reduction_tax_excl'] = $order_details_obj->unit_price_tax_excl + $order_details_obj->reduction_amount_tax_excl;
|
||||
@@ -575,8 +520,6 @@ class GuestTrackingControllerCore extends FrontController
|
||||
// set order specific values
|
||||
$order->total_convenience_fee_ti = $total_convenience_fee_ti;
|
||||
$order->total_convenience_fee_te = $total_convenience_fee_te;
|
||||
$order->total_demands_price_ti = $total_demands_price_ti;
|
||||
$order->total_demands_price_te = $total_demands_price_te;
|
||||
$order->any_back_order = $anyBackOrder;
|
||||
$order->shw_bo_msg = Configuration::get('WK_SHOW_MSG_ON_BO');
|
||||
$order->back_ord_msg = Configuration::get('WK_BO_MESSAGE');
|
||||
|
||||
@@ -114,8 +114,6 @@ class OrderConfirmationControllerCore extends FrontController
|
||||
$any_back_order = 0;
|
||||
$processed_product = array();
|
||||
$orderTotalInfo = array();
|
||||
$orderTotalInfo['total_demands_price_te'] = 0;
|
||||
$orderTotalInfo['total_demands_price_ti'] = 0;
|
||||
$orderTotalInfo['total_products_te'] = 0;
|
||||
$orderTotalInfo['total_products_ti'] = 0;
|
||||
$orderTotalInfo['total_rooms_te'] = 0;
|
||||
@@ -144,7 +142,6 @@ class OrderConfirmationControllerCore extends FrontController
|
||||
$obj_rm_type = new HotelRoomType();
|
||||
$orderTotalInfo['total_order_amount'] = 0;
|
||||
$hotelCartBookingData = new HotelCartBookingData();
|
||||
$objBookingDemand = new HotelBookingDemands();
|
||||
$objServiceProductOrderDetail = new ServiceProductOrderDetail();
|
||||
$cart_standalone_service_products = array();
|
||||
$cart_hotel_service_products = array();
|
||||
@@ -235,43 +232,6 @@ class OrderConfirmationControllerCore extends FrontController
|
||||
}
|
||||
// $orderTotalInfo['total_rooms_te'] += $data_v['total_price_tax_excl'];
|
||||
// $orderTotalInfo['total_rooms_ti'] += $data_v['total_price_tax_incl'];
|
||||
$cart_htl_data[$type_key]['date_diff'][$date_join]['extra_demands'] = $objBookingDemand->getRoomTypeBookingExtraDemands(
|
||||
$idOrder,
|
||||
$type_value['product_id'],
|
||||
0,
|
||||
$data_v['date_from'],
|
||||
$data_v['date_to']
|
||||
);
|
||||
if (empty($cart_htl_data[$type_key]['date_diff'][$date_join]['extra_demands_price_ti'])) {
|
||||
$cart_htl_data[$type_key]['date_diff'][$date_join]['extra_demands_price_ti'] = 0;
|
||||
}
|
||||
$extraDemandPriceTI = $objBookingDemand->getRoomTypeBookingExtraDemands(
|
||||
$idOrder,
|
||||
$type_value['product_id'],
|
||||
$data_v['id_room'],
|
||||
$data_v['date_from'],
|
||||
$data_v['date_to'],
|
||||
0,
|
||||
1,
|
||||
1
|
||||
);
|
||||
$cart_htl_data[$type_key]['date_diff'][$date_join]['extra_demands_price_ti'] += $extraDemandPriceTI;
|
||||
if (empty($cart_htl_data[$type_key]['date_diff'][$date_join]['extra_demands_price_te'])) {
|
||||
$cart_htl_data[$type_key]['date_diff'][$date_join]['extra_demands_price_te'] = 0;
|
||||
}
|
||||
$extraDemandPriceTE = $objBookingDemand->getRoomTypeBookingExtraDemands(
|
||||
$idOrder,
|
||||
$type_value['product_id'],
|
||||
$data_v['id_room'],
|
||||
$data_v['date_from'],
|
||||
$data_v['date_to'],
|
||||
0,
|
||||
1,
|
||||
0
|
||||
);
|
||||
$cart_htl_data[$type_key]['date_diff'][$date_join]['extra_demands_price_te'] += $extraDemandPriceTE;
|
||||
$orderTotalInfo['total_demands_price_ti'] += $extraDemandPriceTI;
|
||||
$orderTotalInfo['total_demands_price_te'] += $extraDemandPriceTE;
|
||||
$cart_htl_data[$type_key]['date_diff'][$date_join]['product_price_tax_excl'] = $order_details_obj->unit_price_tax_excl;
|
||||
$cart_htl_data[$type_key]['date_diff'][$date_join]['product_price_tax_incl'] = $order_details_obj->unit_price_tax_incl;
|
||||
$cart_htl_data[$type_key]['date_diff'][$date_join]['product_price_without_reduction_tax_excl'] = $order_details_obj->unit_price_tax_excl + $order_details_obj->reduction_amount_tax_excl;
|
||||
@@ -299,7 +259,7 @@ class OrderConfirmationControllerCore extends FrontController
|
||||
if (empty($cart_htl_data[$type_key]['date_diff'][$date_join]['additional_services_price_ti'])) {
|
||||
$cart_htl_data[$type_key]['date_diff'][$date_join]['additional_services_price_ti'] = 0;
|
||||
}
|
||||
$cart_htl_data[$type_key]['date_diff'][$date_join]['additional_services_price_ti'] += $extraDemandPriceTI = $objServiceProductOrderDetail->getRoomTypeServiceProducts(
|
||||
$cart_htl_data[$type_key]['date_diff'][$date_join]['additional_services_price_ti'] += $objServiceProductOrderDetail->getRoomTypeServiceProducts(
|
||||
$idOrder,
|
||||
0,
|
||||
0,
|
||||
@@ -314,7 +274,7 @@ class OrderConfirmationControllerCore extends FrontController
|
||||
if (empty($cart_htl_data[$type_key]['date_diff'][$date_join]['additional_services_price_te'])) {
|
||||
$cart_htl_data[$type_key]['date_diff'][$date_join]['additional_services_price_te'] = 0;
|
||||
}
|
||||
$cart_htl_data[$type_key]['date_diff'][$date_join]['additional_services_price_te'] += $extraDemandPriceTE = $objServiceProductOrderDetail->getRoomTypeServiceProducts(
|
||||
$cart_htl_data[$type_key]['date_diff'][$date_join]['additional_services_price_te'] += $objServiceProductOrderDetail->getRoomTypeServiceProducts(
|
||||
$idOrder,
|
||||
0,
|
||||
0,
|
||||
@@ -434,9 +394,9 @@ class OrderConfirmationControllerCore extends FrontController
|
||||
$orderTotalInfo['total_paid_real'] += $objCartOrder->total_paid_real;
|
||||
}
|
||||
|
||||
$totalTaxIncl = $orderTotalInfo['total_rooms_ti'] + $orderTotalInfo['total_services_ti'] + $orderTotalInfo['total_convenience_fee_ti'] + $orderTotalInfo['total_auto_add_services_ti'] + $orderTotalInfo['total_demands_price_ti'] + $orderTotalInfo['total_standalone_products_ti'];
|
||||
$totalTaxIncl = $orderTotalInfo['total_rooms_ti'] + $orderTotalInfo['total_services_ti'] + $orderTotalInfo['total_convenience_fee_ti'] + $orderTotalInfo['total_auto_add_services_ti'] + $orderTotalInfo['total_standalone_products_ti'];
|
||||
|
||||
$totalTaxExcl = $orderTotalInfo['total_rooms_te'] + $orderTotalInfo['total_services_te'] + $orderTotalInfo['total_convenience_fee_te'] + $orderTotalInfo['total_auto_add_services_te'] + $orderTotalInfo['total_demands_price_te'] + $orderTotalInfo['total_standalone_products_te'];
|
||||
$totalTaxExcl = $orderTotalInfo['total_rooms_te'] + $orderTotalInfo['total_services_te'] + $orderTotalInfo['total_convenience_fee_te'] + $orderTotalInfo['total_auto_add_services_te'] + $orderTotalInfo['total_standalone_products_te'];
|
||||
|
||||
$orderTotalInfo['total_tax_without_discount'] = $totalTaxIncl - $totalTaxExcl;
|
||||
}
|
||||
|
||||
@@ -87,7 +87,6 @@ class OrderDetailControllerCore extends FrontController
|
||||
//To show order details properly on order history page
|
||||
$objBookingDetail = new HotelBookingDetail();
|
||||
$objRoomType = new HotelRoomType();
|
||||
$objBookingDemand = new HotelBookingDemands();
|
||||
$objServiceProductOrderDetail = new ServiceProductOrderDetail();
|
||||
$anyBackOrder = 0;
|
||||
$processedProducts = array();
|
||||
@@ -96,8 +95,6 @@ class OrderDetailControllerCore extends FrontController
|
||||
$hotelServiceProducts = array();
|
||||
$standaloneServiceProducts = array();
|
||||
$serviceProductsFormatted = array();
|
||||
$total_demands_price_te = 0;
|
||||
$total_demands_price_ti = 0;
|
||||
$total_convenience_fee_te = 0;
|
||||
$total_convenience_fee_ti = 0;
|
||||
$roomTypes = array();
|
||||
@@ -132,8 +129,6 @@ class OrderDetailControllerCore extends FrontController
|
||||
$cartHotelData[$type_key]['id_product'] = $type_value['product_id'];
|
||||
$cartHotelData[$type_key]['cover_img'] = $type_value['cover_img'];
|
||||
|
||||
|
||||
$objBookingDemand = new HotelBookingDemands();
|
||||
foreach ($order_bk_data as $data_k => $data_v) {
|
||||
$date_join = strtotime($data_v['date_from']).strtotime($data_v['date_to']);
|
||||
|
||||
@@ -227,41 +222,6 @@ class OrderDetailControllerCore extends FrontController
|
||||
$cartHotelData[$type_key]['date_diff'][$date_join]['ids_htl_booking_detail'][] = $data_v['id'];
|
||||
$cartHotelData[$type_key]['date_diff'][$date_join]['ids_rooms'][] = $data_v['id_room'];
|
||||
|
||||
$cartHotelData[$type_key]['date_diff'][$date_join]['extra_demands'] = $objBookingDemand->getRoomTypeBookingExtraDemands(
|
||||
$id_order,
|
||||
$type_value['product_id'],
|
||||
0,
|
||||
$data_v['date_from'],
|
||||
$data_v['date_to']
|
||||
);
|
||||
if (empty($cartHotelData[$type_key]['date_diff'][$date_join]['extra_demands_price_ti'])) {
|
||||
$cartHotelData[$type_key]['date_diff'][$date_join]['extra_demands_price_ti'] = 0;
|
||||
}
|
||||
$cartHotelData[$type_key]['date_diff'][$date_join]['extra_demands_price_ti'] += $extraDemandPriceTI = $objBookingDemand->getRoomTypeBookingExtraDemands(
|
||||
$id_order,
|
||||
$type_value['product_id'],
|
||||
$data_v['id_room'],
|
||||
$data_v['date_from'],
|
||||
$data_v['date_to'],
|
||||
0,
|
||||
1,
|
||||
1
|
||||
);
|
||||
if (empty($cartHotelData[$type_key]['date_diff'][$date_join]['extra_demands_price_te'])) {
|
||||
$cartHotelData[$type_key]['date_diff'][$date_join]['extra_demands_price_te'] = 0;
|
||||
}
|
||||
$cartHotelData[$type_key]['date_diff'][$date_join]['extra_demands_price_te'] += $extraDemandPriceTE = $objBookingDemand->getRoomTypeBookingExtraDemands(
|
||||
$id_order,
|
||||
$type_value['product_id'],
|
||||
$data_v['id_room'],
|
||||
$data_v['date_from'],
|
||||
$data_v['date_to'],
|
||||
0,
|
||||
1,
|
||||
0
|
||||
);
|
||||
$total_demands_price_ti += $extraDemandPriceTI;
|
||||
$total_demands_price_te += $extraDemandPriceTE;
|
||||
$cartHotelData[$type_key]['date_diff'][$date_join]['product_price_tax_excl'] = $order_details_obj->unit_price_tax_excl;
|
||||
$cartHotelData[$type_key]['date_diff'][$date_join]['product_price_tax_incl'] = $order_details_obj->unit_price_tax_incl;
|
||||
$cartHotelData[$type_key]['date_diff'][$date_join]['product_price_without_reduction_tax_excl'] = $order_details_obj->unit_price_tax_excl + $order_details_obj->reduction_amount_tax_excl;
|
||||
@@ -429,8 +389,6 @@ class OrderDetailControllerCore extends FrontController
|
||||
'THEME_DIR' => _THEME_DIR_,
|
||||
'total_convenience_fee_ti' => $total_convenience_fee_ti,
|
||||
'total_convenience_fee_te' => $total_convenience_fee_te,
|
||||
'total_demands_price_ti' => $total_demands_price_ti,
|
||||
'total_demands_price_te' => $total_demands_price_te,
|
||||
'any_back_order' => $anyBackOrder,
|
||||
'shw_bo_msg' => Configuration::get('WK_SHOW_MSG_ON_BO'),
|
||||
'back_ord_msg' => Configuration::get('WK_BO_MESSAGE'),
|
||||
@@ -519,35 +477,20 @@ class OrderDetailControllerCore extends FrontController
|
||||
$this->setTemplate(_PS_THEME_DIR_.'order-detail.tpl');
|
||||
}
|
||||
|
||||
public function displayAjaxGetRoomTypeBookingDemands()
|
||||
public function displayAjaxgetRoomTypeBookingServices()
|
||||
{
|
||||
$response = array('extra_demands' => false);
|
||||
$response = array('extra_services' => false);
|
||||
|
||||
if (($idProduct = Tools::getValue('id_product'))
|
||||
&& ($idOrder = Tools::getValue('id_order'))
|
||||
&& ($dateFrom = Tools::getValue('date_from'))
|
||||
&& ($dateTo = Tools::getValue('date_to'))
|
||||
) {
|
||||
$objHotelBookingDemands = new HotelBookingDemands();
|
||||
$useTax = 0;
|
||||
if (Group::getPriceDisplayMethod($this->context->customer->id_default_group) == PS_TAX_INC) {
|
||||
$useTax = 1;
|
||||
}
|
||||
if ($extraDemands = $objHotelBookingDemands->getRoomTypeBookingExtraDemands(
|
||||
$idOrder,
|
||||
$idProduct,
|
||||
0,
|
||||
$dateFrom,
|
||||
$dateTo,
|
||||
1,
|
||||
0,
|
||||
$useTax
|
||||
)) {
|
||||
$this->context->smarty->assign(array(
|
||||
'useTax' => $useTax,
|
||||
'extraDemands' => $extraDemands,
|
||||
));
|
||||
}
|
||||
|
||||
$objServiceProductOrderDetail = new ServiceProductOrderDetail();
|
||||
if ($additionalServices = $objServiceProductOrderDetail->getRoomTypeServiceProducts(
|
||||
$idOrder,
|
||||
@@ -571,7 +514,7 @@ class OrderDetailControllerCore extends FrontController
|
||||
'objOrder' => new Order($idOrder),
|
||||
));
|
||||
|
||||
$response['extra_demands'] = $this->context->smarty->fetch(_PS_THEME_DIR_.'_partials/order-extra-services.tpl');
|
||||
$response['extra_services'] = $this->context->smarty->fetch(_PS_THEME_DIR_.'_partials/order-extra-services.tpl');
|
||||
}
|
||||
|
||||
$this->ajaxDie(json_encode($response));
|
||||
|
||||
@@ -376,14 +376,10 @@ class OrderOpcControllerCore extends ParentOrderController
|
||||
$this->context->cart->setNoMultishipping();
|
||||
$this->ajaxDie();
|
||||
break;
|
||||
case 'getRoomTypeBookingDemands':
|
||||
case 'getRoomTypeBookingServices':
|
||||
$this->ajaxDie($this->getRoomTypeBookingServices());
|
||||
exit;
|
||||
break;
|
||||
case 'changeRoomDemands':
|
||||
$this->ajaxDie($this->changeRoomDemands());
|
||||
exit;
|
||||
break;
|
||||
case 'getCustomerGuestDetail':
|
||||
$this->ajaxDie($this->getCustomerGuestDetail());
|
||||
exit;
|
||||
@@ -495,15 +491,9 @@ class OrderOpcControllerCore extends ParentOrderController
|
||||
|
||||
$this->context->smarty->assign('checkout_process_steps', $this->checkoutProcess->getSteps());
|
||||
|
||||
// set room type demands
|
||||
// $objGlobalDemand = new HotelRoomTypeGlobalDemand();
|
||||
// $allDemands = $objGlobalDemand->getAllDemands();
|
||||
// $objCurrency = new Currency(Configuration::get('PS_CURRENCY_DEFAULT'));
|
||||
$this->_assignCheckoutVars();
|
||||
$this->context->smarty->assign(
|
||||
array(
|
||||
// 'allDemands' => $allDemands,
|
||||
// 'defaultcurrencySign' => $objCurrency->sign,
|
||||
'PS_REGISTRATION_PROCESS_TYPE' => Configuration::get('PS_REGISTRATION_PROCESS_TYPE'),
|
||||
'free_shipping' => $free_shipping,
|
||||
'isGuest' => isset($this->context->cookie->is_guest) ? $this->context->cookie->is_guest : 0,
|
||||
@@ -950,37 +940,6 @@ class OrderOpcControllerCore extends ParentOrderController
|
||||
&& ($dateTo = Tools::getValue('date_to'))
|
||||
) {
|
||||
$objCartBookingData = new HotelCartBookingData();
|
||||
if ($selectedRoomDemands = $objCartBookingData->getCartExtraDemands(
|
||||
$this->context->cart->id,
|
||||
$idProduct,
|
||||
0,
|
||||
$dateFrom,
|
||||
$dateTo
|
||||
)) {
|
||||
// get room type additional demands
|
||||
$objRoomDemands = new HotelRoomTypeDemand();
|
||||
if ($roomTypeDemands = $objRoomDemands->getRoomTypeDemands($idProduct)) {
|
||||
foreach ($roomTypeDemands as &$demand) {
|
||||
// if demand has advance options then set demand price as first advance option price.
|
||||
if (isset($demand['adv_option']) && $demand['adv_option']) {
|
||||
$demand['price'] = current($demand['adv_option'])['price'];
|
||||
}
|
||||
}
|
||||
foreach ($selectedRoomDemands as &$selectedDemand) {
|
||||
if (isset($selectedDemand['extra_demands']) && $selectedDemand['extra_demands']) {
|
||||
$extraDmd = array();
|
||||
foreach ($selectedDemand['extra_demands'] as $sDemand) {
|
||||
$selectedDemand['selected_global_demands'][] = $sDemand['id_global_demand'];
|
||||
$extraDmd[$sDemand['id_global_demand'].'-'.$sDemand['id_option']] = $sDemand;
|
||||
}
|
||||
$selectedDemand['extra_demands'] = $extraDmd;
|
||||
}
|
||||
}
|
||||
$this->context->smarty->assign('roomTypeDemands', $roomTypeDemands);
|
||||
$this->context->smarty->assign('selectedRoomDemands', $selectedRoomDemands);
|
||||
|
||||
}
|
||||
}
|
||||
$objServiceProductCartDetail = new ServiceProductCartDetail();
|
||||
$objRoomTypeServiceProduct = new RoomTypeServiceProduct();
|
||||
$roomTypeServiceProducts = $objRoomTypeServiceProduct->getServiceProductsData($idProduct, 1, 0, true, 1);
|
||||
@@ -1007,29 +966,13 @@ class OrderOpcControllerCore extends ParentOrderController
|
||||
));
|
||||
}
|
||||
}
|
||||
$response['extra_demands'] = $this->context->smarty->fetch(
|
||||
_PS_THEME_DIR_.'_partials/cart_booking_demands.tpl'
|
||||
$response['extra_services'] = $this->context->smarty->fetch(
|
||||
_PS_THEME_DIR_.'_partials/cart_booking_services.tpl'
|
||||
);
|
||||
|
||||
return json_encode($response);
|
||||
}
|
||||
|
||||
public function changeRoomDemands()
|
||||
{
|
||||
if ($idCartBooking = Tools::getValue('id_cart_booking')) {
|
||||
if (Validate::isLoadedObject($objCartbookingCata = new HotelCartBookingData($idCartBooking))) {
|
||||
$roomDemands = Tools::getValue('room_demands');
|
||||
$roomDemands = json_decode($roomDemands, true);
|
||||
$roomDemands = json_encode($roomDemands);
|
||||
$objCartbookingCata->extra_demands = $roomDemands;
|
||||
if ($objCartbookingCata->save()) {
|
||||
die('1');
|
||||
}
|
||||
}
|
||||
}
|
||||
die('0');
|
||||
}
|
||||
|
||||
public function getCustomerGuestDetail()
|
||||
{
|
||||
$response = array('status' => false);
|
||||
|
||||
@@ -398,17 +398,6 @@ class ProductControllerCore extends FrontController
|
||||
);
|
||||
}
|
||||
|
||||
// get room type additional demands
|
||||
$objRoomDemands = new HotelRoomTypeDemand();
|
||||
if ($roomTypeDemands = $objRoomDemands->getRoomTypeDemands($this->product->id)) {
|
||||
foreach ($roomTypeDemands as &$demand) {
|
||||
// if demand has advance options then set demand price as first advance option price.
|
||||
if (isset($demand['adv_option']) && $demand['adv_option']) {
|
||||
$demand['price'] = current($demand['adv_option'])['price'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$objHotelBedType = new HotelBedType();
|
||||
if ($bedTypes = $objHotelBedType->getAllBedTypes($this->context->language->id)) {
|
||||
foreach ($bedTypes as $bedTypeKey => $bedType) {
|
||||
@@ -426,7 +415,6 @@ class ProductControllerCore extends FrontController
|
||||
$this->context->smarty->assign(
|
||||
array(
|
||||
'id_hotel' => $hotel_id,
|
||||
'room_type_demands' => $roomTypeDemands,
|
||||
'room_type_info' => $room_info_by_product_id,
|
||||
'isHotelRefundable' => $hotel_branch_obj->isRefundable(),
|
||||
'max_order_date' => $max_order_date,
|
||||
@@ -537,7 +525,6 @@ class ProductControllerCore extends FrontController
|
||||
array(
|
||||
'product_controller_url' => $this->context->link->getPageLink('product'),
|
||||
'ratting_img_path' => _MODULE_DIR_.'hotelreservationsystem/views/img/Slices/icons-sprite.png',
|
||||
'WK_PRICE_CALC_METHOD_EACH_DAY' => HotelRoomTypeGlobalDemand::WK_PRICE_CALC_METHOD_EACH_DAY,
|
||||
'stock_management' => Configuration::get('PS_STOCK_MANAGEMENT'),
|
||||
'customizationFields' => $customization_fields,
|
||||
'id_customization' => empty($customization_datas) ? null : $customization_datas[0]['id_customization'],
|
||||
@@ -630,7 +617,6 @@ class ProductControllerCore extends FrontController
|
||||
$dateFrom,
|
||||
$dateTo,
|
||||
$occupancy = array(),
|
||||
$jsonDemands = '',
|
||||
$roomServiceProducts = null
|
||||
) {
|
||||
$objProduct = new Product($idProduct, true, $this->context->language->id, $this->context->shop->id);
|
||||
@@ -643,8 +629,6 @@ class ProductControllerCore extends FrontController
|
||||
$objHotel = new HotelBranchInformation();
|
||||
$objHotelCartBookingData = new HotelCartBookingData();
|
||||
$objBookingDetail = new HotelBookingDetail();
|
||||
$objHRTDemand = new HotelRoomTypeDemand();
|
||||
$objHRTDemandPrice = new HotelRoomTypeDemandPrice();
|
||||
|
||||
$idCart = (int) $this->context->cart->id;
|
||||
$idGuest = (int) $this->context->cart->id_guest;
|
||||
@@ -788,51 +772,8 @@ class ProductControllerCore extends FrontController
|
||||
}
|
||||
|
||||
$totalRoomPrice = $roomTypeDateRangePrice;
|
||||
// calculate demand price now
|
||||
$demandsPricePerRoom = 0;
|
||||
$roomTypeDemands = $objHRTDemand->getRoomTypeDemands($idProduct);
|
||||
if ($jsonDemands !== '') {
|
||||
$cartDemands = json_decode($jsonDemands, true);
|
||||
$demandsPricePerRoom = $objHRTDemandPrice->getRoomTypeDemandsTotalPrice(
|
||||
$idProduct,
|
||||
$cartDemands,
|
||||
$useTax,
|
||||
$dateFrom,
|
||||
$dateTo
|
||||
);
|
||||
|
||||
// send demand info to booking form
|
||||
foreach($cartDemands as &$demand) {
|
||||
if (Validate::isLoadedObject(
|
||||
$objRoomTypeGlobalDemand = new HotelRoomTypeGlobalDemand($demand['id_global_demand'], $this->context->language->id)
|
||||
)) {
|
||||
$demand['name'] = $objRoomTypeGlobalDemand->name;
|
||||
if ($demand['id_option']) {
|
||||
if (Validate::isLoadedObject($objDemandAdvanceOption = new HotelRoomTypeGlobalDemandAdvanceOption($demand['id_option'], $this->context->language->id))) {
|
||||
if ($objDemandAdvanceOption->id_global_demand != $objRoomTypeGlobalDemand->id) {
|
||||
unset($demand);
|
||||
continue;
|
||||
}
|
||||
$demand['advance_option'] = array(
|
||||
'id_option' => $objDemandAdvanceOption->id,
|
||||
'name' => $objDemandAdvanceOption->name
|
||||
);
|
||||
} else {
|
||||
unset($demand);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
$demand['price'] = HotelRoomTypeDemand::getPriceStatic(
|
||||
$idProduct,
|
||||
$objRoomTypeGlobalDemand->id,
|
||||
$demand['id_option'],
|
||||
$useTax
|
||||
);
|
||||
}
|
||||
}
|
||||
$smartyVars['selected_demands'] = $cartDemands;
|
||||
}
|
||||
// calculate service product price now
|
||||
$serviceProductPricePerRoom = 0;
|
||||
|
||||
if ($roomServiceProducts) {
|
||||
$serviceProductsPrice = 0;
|
||||
@@ -870,13 +811,13 @@ class ProductControllerCore extends FrontController
|
||||
}
|
||||
$smartyVars['selected_service_product'] = $roomServiceProducts;
|
||||
}
|
||||
$demandsPricePerRoom += $serviceProductsPrice;
|
||||
$serviceProductPricePerRoom += $serviceProductsPrice;
|
||||
$totalPrice += $serviceProductsPrice;
|
||||
}
|
||||
// multiply price by number of room required
|
||||
$demandsPrice = $demandsPricePerRoom * $quantity;
|
||||
$serviceProductPrice = $serviceProductPricePerRoom * $quantity;
|
||||
// calculate total price
|
||||
$totalPrice = $totalRoomPrice + $demandsPrice;
|
||||
$totalPrice = $totalRoomPrice + $serviceProductPrice;
|
||||
// send occupancy information searched by the user
|
||||
if ($occupancy && is_array($occupancy)) {
|
||||
$smartyVars['occupancies'] = $occupancy;
|
||||
@@ -899,11 +840,10 @@ class ProductControllerCore extends FrontController
|
||||
$smartyVars['los_max_days'] = $losMaxDays;
|
||||
$smartyVars['los_min_failed'] = $losMinFailed;
|
||||
$smartyVars['los_max_failed'] = $losMaxFailed;
|
||||
$smartyVars['has_room_type_demands'] = $roomTypeDemands ? true : false; // whether to show price breakup
|
||||
$smartyVars['rooms_price'] = $totalRoomPrice;
|
||||
$smartyVars['demands_price_per_room'] = $demandsPricePerRoom;
|
||||
$smartyVars['total_price_without_discount'] = $totalPriceWithoutDiscount + $demandsPrice;
|
||||
$smartyVars['demands_price'] = $demandsPrice;
|
||||
$smartyVars['service_product_price_per_room'] = $serviceProductPricePerRoom;
|
||||
$smartyVars['total_price_without_discount'] = $totalPriceWithoutDiscount + $serviceProductPrice;
|
||||
$smartyVars['service_product_price'] = $serviceProductPrice;
|
||||
$smartyVars['total_price'] = $totalPrice;
|
||||
$this->context->smarty->assign($smartyVars);
|
||||
return true;
|
||||
@@ -1459,7 +1399,6 @@ class ProductControllerCore extends FrontController
|
||||
} else {
|
||||
$occupancy = Tools::getValue('qty', 1);
|
||||
}
|
||||
$roomTypeDemands = Tools::getValue('room_type_demands');
|
||||
$roomServiceProducts = Tools::getValue('room_service_products');
|
||||
$dateFrom = date('Y-m-d H:i:s', strtotime($dateFrom));
|
||||
$dateTo = date('Y-m-d H:i:s', strtotime($dateTo));
|
||||
@@ -1469,7 +1408,6 @@ class ProductControllerCore extends FrontController
|
||||
$dateFrom,
|
||||
$dateTo,
|
||||
$occupancy,
|
||||
$roomTypeDemands,
|
||||
$roomServiceProducts
|
||||
)) {
|
||||
}
|
||||
|
||||
@@ -1046,24 +1046,7 @@ $(document).ready(function() {
|
||||
actualizeRefundVoucher();
|
||||
});
|
||||
|
||||
// when choose to add new facilities while additional facilities edit
|
||||
$(document).on('click', '#btn_new_room_demand', function() {
|
||||
$('.room_demands_container').show();
|
||||
$('#save_room_demands').show();
|
||||
$('#back_to_demands_btn').show();
|
||||
$('.room_ordered_demands').hide();
|
||||
$('#btn_new_room_demand').hide();
|
||||
});
|
||||
// click on back button on created facilities while additional facilities edit
|
||||
$(document).on('click', '#back_to_demands_btn', function() {
|
||||
$('.room_ordered_demands').show();
|
||||
$('#btn_new_room_demand').show();
|
||||
$('.room_demands_container').hide();
|
||||
$('#save_room_demands').hide();
|
||||
$('#back_to_demands_btn').hide();
|
||||
});
|
||||
|
||||
// click on back button on created facilities while additional facilities edit
|
||||
// click on back button on created additional service edit
|
||||
$(document).on('click', '#back_to_service_btn', function() {
|
||||
$('.room_ordered_services').show();
|
||||
$('#btn_new_existing_room_service').show();
|
||||
@@ -1138,7 +1121,7 @@ $(document).ready(function() {
|
||||
if (jsonData.service_panel) {
|
||||
$('#room_type_service_product_desc').replaceWith(jsonData.service_panel);
|
||||
}
|
||||
showSuccessMessage(txtExtraDemandSucc);
|
||||
showSuccessMessage(txtExtraServiceSucc);
|
||||
} else {
|
||||
var errorHtml = error_found_txt + ':<br>';
|
||||
errorHtml += '<ol>';
|
||||
@@ -1199,7 +1182,7 @@ $(document).ready(function() {
|
||||
if (jsonData.service_panel) {
|
||||
$('#room_type_service_product_desc').replaceWith(jsonData.service_panel);
|
||||
}
|
||||
showSuccessMessage(txtExtraDemandSucc);
|
||||
showSuccessMessage(txtExtraServiceSucc);
|
||||
} else {
|
||||
showErrorMessage(jsonData.errors);
|
||||
|
||||
@@ -1234,7 +1217,7 @@ $(document).ready(function() {
|
||||
if (jsonData.service_panel) {
|
||||
$('#room_type_service_product_desc').replaceWith(jsonData.service_panel);
|
||||
}
|
||||
showSuccessMessage(txtExtraDemandSucc);
|
||||
showSuccessMessage(txtExtraServiceSucc);
|
||||
} else {
|
||||
if (jsonData.errors != 'undefined' && jsonData.errors.length) {
|
||||
var errorHtml = error_found_txt + ':<br>';
|
||||
@@ -1253,157 +1236,6 @@ $(document).ready(function() {
|
||||
});
|
||||
});
|
||||
|
||||
// save room extra demand to the order
|
||||
$(document).on('click', '#save_room_demands', function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
var idHtlBooking = parseInt($('#edit_product .extra-services-container #id_htl_booking').val());
|
||||
if (idHtlBooking) {
|
||||
var roomDemands = [];
|
||||
// get the selected extra demands by customer
|
||||
$(this).closest('#edit_product #room_type_demands_desc').find('input:checkbox.id_room_type_demand:checked').each(function () {
|
||||
roomDemands.push({
|
||||
'id_global_demand':$(this).val(),
|
||||
'id_option': $(this).closest('.room_demand_block').find('.id_option').val(),
|
||||
'unit_price': $(this).closest('.room_demand_block').find('.unit_price').val()
|
||||
});
|
||||
});
|
||||
|
||||
if (roomDemands.length) {
|
||||
$(".loading_overlay").show();
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
headers: {
|
||||
"cache-control": "no-cache"
|
||||
},
|
||||
url: admin_order_tab_link,
|
||||
dataType: 'JSON',
|
||||
cache: false,
|
||||
data: {
|
||||
id_htl_booking: idHtlBooking,
|
||||
room_demands: JSON.stringify(roomDemands),
|
||||
action: 'addRoomExtraDemands',
|
||||
ajax: true
|
||||
},
|
||||
success: function(jsonData) {
|
||||
if (!jsonData.hasError) {
|
||||
showSuccessMessage(txtExtraDemandSucc);
|
||||
if (jsonData.facilities_panel) {
|
||||
$('#room_type_demands_desc').replaceWith(jsonData.facilities_panel);
|
||||
}
|
||||
} else if (jsonData.errors) {
|
||||
showErrorMessage(jsonData.errors);
|
||||
} else {
|
||||
showErrorMessage(txtSomeErr);
|
||||
}
|
||||
},
|
||||
complete: function() {
|
||||
$(".loading_overlay").hide();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
showErrorMessage(atleastSelectTxt);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// edit room extra deman
|
||||
$(document).on('focusout', '#edit-room-booking-modal .room_ordered_demands .unit_price', function(e) {
|
||||
updateRoomDemand($(this).closest('tr'));
|
||||
});
|
||||
|
||||
// Delete ordered room booking demand
|
||||
$(document).on('click', '.del-order-room-demand', function(e) {
|
||||
e.preventDefault();
|
||||
if (confirm(txt_confirm)) {
|
||||
var idBookingDemand = $(this).attr('id_booking_demand');
|
||||
$currentItem = $(this);
|
||||
if (idBookingDemand) {
|
||||
$(".loading_overlay").show();
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
headers: {
|
||||
"cache-control": "no-cache"
|
||||
},
|
||||
url: admin_order_tab_link,
|
||||
dataType: 'JSON',
|
||||
cache: false,
|
||||
data: {
|
||||
id_booking_demand: idBookingDemand,
|
||||
action: 'DeleteRoomExtraDemand',
|
||||
ajax: true
|
||||
},
|
||||
success: function(jsonData) {
|
||||
if (jsonData.success) {
|
||||
showSuccessMessage(txtDeleteSucc);
|
||||
if (jsonData.facilities_panel) {
|
||||
$('#room_type_demands_desc').replaceWith(jsonData.facilities_panel);
|
||||
}
|
||||
} else {
|
||||
showErrorMessage(txtSomeErr);
|
||||
}
|
||||
},
|
||||
complete: function() {
|
||||
$(".loading_overlay").hide();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
showErrorMessage(txtInvalidDemandVal);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$(document).on('click', '.del_room_additional_service', function(e){
|
||||
e.preventDefault();
|
||||
if (confirm(txt_confirm)) {
|
||||
var idServiceProductOrderDetail = $(this).data('id_service_product_order_detail');
|
||||
$currentItem = $(this);
|
||||
if (idServiceProductOrderDetail) {
|
||||
$(".loading_overlay").show();
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
headers: {
|
||||
"cache-control": "no-cache"
|
||||
},
|
||||
url: admin_order_tab_link,
|
||||
dataType: 'JSON',
|
||||
cache: false,
|
||||
data: {
|
||||
id_service_product_order_detail: idServiceProductOrderDetail,
|
||||
action: 'DeleteRoomAdditionalService',
|
||||
ajax: true
|
||||
},
|
||||
success: function(jsonData) {
|
||||
if (!jsonData.hasError) {
|
||||
if (jsonData.service_panel) {
|
||||
$('#room_type_service_product_desc').replaceWith(jsonData.service_panel);
|
||||
}
|
||||
showSuccessMessage(txtExtraDemandSucc);
|
||||
} else {
|
||||
showErrorMessage(jsonData.errors);
|
||||
|
||||
}
|
||||
},
|
||||
complete: function() {
|
||||
$(".loading_overlay").hide();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
showErrorMessage(txtInvalidDemandVal);
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
// change advance option of extra demand
|
||||
$(document).on('change', '.demand_adv_option_block .id_option', function(e) {
|
||||
var option_selected = $(this).find('option:selected');
|
||||
var extra_demand_price = option_selected.attr("optionPrice")
|
||||
extra_demand_price = parseFloat(extra_demand_price);
|
||||
// extra_demand_price = formatCurrency(extra_demand_price, currency_format, currency_sign, currency_blank);
|
||||
$(this).closest('.room_demand_block').find('.unit_price').val(extra_demand_price);
|
||||
});
|
||||
|
||||
$(".textarea-autosize").autosize();
|
||||
|
||||
var date = new Date();
|
||||
@@ -1461,7 +1293,7 @@ $(document).ready(function() {
|
||||
showErrorMessage(txtSomeErr);
|
||||
} else {
|
||||
$('#footer').next('.bootstrap').append(result.modalHtml);
|
||||
$('#room-extra-demands').modal('show');
|
||||
$('#room-extra-services').modal('show');
|
||||
}
|
||||
},
|
||||
complete: function() {
|
||||
@@ -1470,8 +1302,8 @@ $(document).ready(function() {
|
||||
});
|
||||
});
|
||||
|
||||
// Empty extra-services-container when room-extra-demands modal is closed
|
||||
$(document).on('hidden.bs.modal', '#room-extra-demands', function(){
|
||||
// Empty extra-services-container when room-extra-services modal is closed
|
||||
$(document).on('hidden.bs.modal', '#room-extra-services', function(){
|
||||
$('#footer').next('.bootstrap').empty();
|
||||
});
|
||||
|
||||
@@ -2893,7 +2725,7 @@ function updateAdditionalServices(element)
|
||||
if (jsonData.service_panel) {
|
||||
$('#room_type_service_product_desc').replaceWith(jsonData.service_panel);
|
||||
}
|
||||
showSuccessMessage(txtExtraDemandSucc);
|
||||
showSuccessMessage(txtExtraServiceSucc);
|
||||
} else {
|
||||
showErrorMessage(jsonData.errors);
|
||||
|
||||
@@ -2907,42 +2739,6 @@ function updateAdditionalServices(element)
|
||||
|
||||
}
|
||||
|
||||
function updateRoomDemand(element)
|
||||
{
|
||||
var id_booking_demand = $(element).data('id_booking_demand');
|
||||
var unit_price = $(element).find('.unit_price').val();
|
||||
$(".loading_overlay").show();
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
headers: {
|
||||
"cache-control": "no-cache"
|
||||
},
|
||||
url: admin_order_tab_link,
|
||||
dataType: 'JSON',
|
||||
cache: false,
|
||||
data: {
|
||||
id_booking_demand: id_booking_demand,
|
||||
unit_price: unit_price,
|
||||
action: 'updateRoomExtraDemands',
|
||||
ajax: true
|
||||
},
|
||||
success: function(jsonData) {
|
||||
if (!jsonData.hasError) {
|
||||
if (jsonData.facilities_panel) {
|
||||
$('#room_type_demands_desc').replaceWith(jsonData.facilities_panel);
|
||||
}
|
||||
showSuccessMessage(txtExtraDemandSucc);
|
||||
} else {
|
||||
showErrorMessage(jsonData.errors);
|
||||
|
||||
}
|
||||
},
|
||||
complete: function() {
|
||||
$(".loading_overlay").hide();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function checkPartialRefundProductQuantity(it)
|
||||
{
|
||||
if (parseInt($(it).val()) > parseInt($(it).closest('td').find('.partialRefundProductQuantity').val()))
|
||||
|
||||
@@ -594,21 +594,6 @@ product_tabs['Features'] = new function(){
|
||||
displayFlags(languages, id_language, allowEmployeeFormLang);
|
||||
}
|
||||
}
|
||||
product_tabs['AdditionalFacilities'] = new function(){
|
||||
this.onReady = function(){
|
||||
$('#demands_table .selected_demand').on('click', function() {
|
||||
let input_block = $('#demands_table').find('.demand_price_'+$(this).val());
|
||||
if ($(this).is(':checked')) {
|
||||
$(input_block).find('.price_input').show();
|
||||
$(input_block).find('.price_display').hide();
|
||||
} else {
|
||||
$(input_block).find('.price_input');
|
||||
$(input_block).find('.price_input').hide();
|
||||
$(input_block).find('.price_display').show();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the product image list position buttons
|
||||
|
||||
@@ -1,166 +0,0 @@
|
||||
{if isset($list) && $list}
|
||||
<table class="table table-recap room-extra-demand-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="3" class="table-caption">{l s='Room Extra Demands Detail'}</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{l s='Room Type'}</th>
|
||||
<th>{l s='Name'}</th>
|
||||
<th>{l s='Total'} <br /> {l s='(Tax excl.)'}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{foreach from=$list key=data_k item=data_v}
|
||||
{foreach from=$data_v['date_diff'] key=rm_k item=rm_v}
|
||||
{if isset($rm_v['extra_demands']) && $rm_v['extra_demands']}
|
||||
{assign var=roomCount value=1}
|
||||
{foreach $rm_v['extra_demands'] as $roomDemand}
|
||||
{foreach name=demandRow from=$roomDemand['extra_demands'] item=demand}
|
||||
{if !isset($room_demand_exists)}
|
||||
{assign var=room_demand_exists value=1}
|
||||
{/if}
|
||||
<tr>
|
||||
{if $smarty.foreach.demandRow.first}
|
||||
<td rowspan="{$roomDemand['extra_demands']|count}">
|
||||
<span style="font-size:12px; font-family:Open-sans, sans-serif; color:#555454;">
|
||||
{$data_v['name']}<br>
|
||||
{$rm_v['data_form']|date_format:"%d-%m-%Y"} {l s='to'} {$rm_v['data_to']|date_format:"%d-%m-%Y"}<br>
|
||||
<strong>{l s='Room'} - {$roomCount}</strong>
|
||||
</span>
|
||||
</td>
|
||||
{/if}
|
||||
<td>
|
||||
<span style="font-size:12px; font-family:Open-sans, sans-serif; color:#555454;">
|
||||
{$demand['name']}
|
||||
</span>
|
||||
</td>
|
||||
<td>
|
||||
<span style="font-size:12px; font-family:Open-sans, sans-serif; color:#555454;">
|
||||
{convertPrice price=$demand['total_price_tax_excl']}
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
{assign var=roomCount value=$roomCount+1}
|
||||
{/foreach}
|
||||
{/if}
|
||||
{/foreach}
|
||||
{/foreach}
|
||||
|
||||
{if !isset($room_demand_exists)}
|
||||
<tr>
|
||||
<th colspan="3" class="table-caption">{l s='No room extra demands added.'}</th>
|
||||
</tr>
|
||||
{/if}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<table class="table table-recap room-extra-service-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="4" class="table-caption">{l s='Rooms Services Detail'}</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{l s='Room Type'}</th>
|
||||
<th>{l s='Name'}</th>
|
||||
<th>{l s='Qty'}</th>
|
||||
<th>{l s='Total'}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{foreach from=$list key=data_k item=data_v}
|
||||
{foreach from=$data_v['date_diff'] key=rm_k item=rm_v}
|
||||
{if isset($rm_v['additional_services']) && $rm_v['additional_services']}
|
||||
{assign var=roomCount value=1}
|
||||
{foreach $rm_v['additional_services'] as $roomService}
|
||||
{foreach name=serviceRow from=$roomService['additional_services'] item=service}
|
||||
{if !isset($room_additinal_services_exists)}
|
||||
{assign var=room_additinal_services_exists value=1}
|
||||
{/if}
|
||||
<tr>
|
||||
{if $smarty.foreach.serviceRow.first}
|
||||
<td rowspan="{$roomService['additional_services']|count}">
|
||||
<span style="font-size:12px; font-family:Open-sans, sans-serif; color:#555454;">
|
||||
{$data_v['name']}<br>
|
||||
{$rm_v['data_form']|date_format:"%d-%m-%Y"} {l s='to'} {$rm_v['data_to']|date_format:"%d-%m-%Y"}<br>
|
||||
<strong>{l s='Room'} - {$roomCount}</strong>
|
||||
</span>
|
||||
</td>
|
||||
{/if}
|
||||
<td>
|
||||
<span style="font-size:12px; font-family:Open-sans, sans-serif; color:#555454;">
|
||||
{$service['name']}
|
||||
</span>
|
||||
</td>
|
||||
<td>
|
||||
<span style="font-size:12px; font-family:Open-sans, sans-serif; color:#555454;">
|
||||
{if $service['allow_multiple_quantity']}
|
||||
{$service['quantity']}
|
||||
{else}
|
||||
{l s='--'}
|
||||
{/if}
|
||||
</span>
|
||||
</td>
|
||||
<td>
|
||||
<span style="font-size:12px; font-family:Open-sans, sans-serif; color:#555454;">
|
||||
{convertPrice price=$service['total_price_tax_excl']}
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
{assign var=roomCount value=$roomCount+1}
|
||||
{/foreach}
|
||||
{/if}
|
||||
{/foreach}
|
||||
{/foreach}
|
||||
|
||||
{if !isset($room_additinal_services_exists)}
|
||||
<tr>
|
||||
<th colspan="4" class="table-caption">{l s='No room services added.'}</th>
|
||||
</tr>
|
||||
{/if}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<style>
|
||||
{if !isset($room_demand_exists)}
|
||||
.room-extra-demand-table {
|
||||
display: none;
|
||||
}
|
||||
{/if}
|
||||
{if !isset($room_additinal_services_exists)}
|
||||
.room-extra-service-table {
|
||||
display: none;
|
||||
}
|
||||
{else}
|
||||
.room-extra-demand-table {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
{/if}
|
||||
.room-extra-demand-table, .room-extra-service-table {
|
||||
width:100%;
|
||||
border-collapse:collapse;
|
||||
padding:5px;
|
||||
}
|
||||
.room-extra-demand-table th, .room-extra-service-table th {
|
||||
border:1px solid #D6D4D4;
|
||||
background-color: #fbfbfb;
|
||||
color: #333;
|
||||
font-family: Arial;
|
||||
font-size: 13px;
|
||||
padding: 7px 7px 5px 10px;
|
||||
text-align:left;
|
||||
}
|
||||
.room-extra-demand-table th.table-caption, .room-extra-service-table th.table-caption {
|
||||
text-align: left;
|
||||
padding:10px;
|
||||
}
|
||||
.room-extra-demand-table td, .room-extra-service-table td {
|
||||
border:1px solid #D6D4D4;
|
||||
padding:5px;
|
||||
text-align:left;
|
||||
padding: 5px 5px 5px 10px;
|
||||
}
|
||||
</style>
|
||||
{/if}
|
||||
@@ -1,40 +0,0 @@
|
||||
{if isset($list)}
|
||||
{l s='Extra Demands Details'}
|
||||
{l s='Room Type'}
|
||||
{l s='Extra demand name'}
|
||||
{l s='Total'} {l s='(Tax excl.)'}
|
||||
|
||||
{if isset($list)}
|
||||
{foreach from=$list key=data_k item=data_v}
|
||||
{foreach from=$data_v['date_diff'] key=rm_k item=rm_v}
|
||||
{if isset($rm_v['extra_demands']) && $rm_v['extra_demands']}
|
||||
{assign var=roomCount value=1}
|
||||
{foreach $rm_v['extra_demands'] as $roomDemand}
|
||||
{foreach name=demandRow from=$roomDemand['extra_demands'] item=demand}
|
||||
{if $smarty.foreach.demandRow.first}
|
||||
<td class="text-center" rowspan="{$roomDemand['extra_demands']|count}">
|
||||
<span style="font-size:12px; font-family:Open-sans, sans-serif; color:#555454;">
|
||||
{$data_v['name']}<br>
|
||||
{$rm_v['data_form']|date_format:"%d-%m-%Y"} {l s='to'} {$rm_v['data_to']|date_format:"%d-%m-%Y"}<br>
|
||||
<strong>{l s='Room'} - {$roomCount}</strong>
|
||||
</span>
|
||||
</td>
|
||||
{/if}
|
||||
<td class="text-center">
|
||||
<span style="font-size:12px; font-family:Open-sans, sans-serif; color:#555454;">
|
||||
{$demand['name']}
|
||||
</span>
|
||||
</td>
|
||||
<td class="text-center">
|
||||
<span style="font-size:12px; font-family:Open-sans, sans-serif; color:#555454;">
|
||||
{convertPrice price=$demand['total_price_tax_excl']}
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
{assign var=roomCount value=$roomCount+1}
|
||||
{/foreach}
|
||||
{/if}
|
||||
{/foreach}
|
||||
{/foreach}
|
||||
{/if}
|
||||
89
mails/en/booking_extra_services.tpl
Normal file
89
mails/en/booking_extra_services.tpl
Normal file
@@ -0,0 +1,89 @@
|
||||
{if isset($list)}
|
||||
<table class="table table-recap additional-service-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="4">{l s='Additional services Details'}</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{l s='Room Type'}</th>
|
||||
<th>{l s='Name'}</th>
|
||||
<th>{l s='Qty'}</th>
|
||||
<th>{l s='Total'}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{if isset($list)}
|
||||
{foreach from=$list key=data_k item=data_v}
|
||||
{foreach from=$data_v['date_diff'] key=rm_k item=rm_v}
|
||||
{if isset($rm_v['additional_services']) && $rm_v['additional_services']}
|
||||
{assign var=roomCount value=1}
|
||||
{foreach $rm_v['additional_services'] as $roomService}
|
||||
{foreach name=serviceRow from=$roomService['additional_services'] item=service}
|
||||
{if !isset($room_additinal_services_exists)}
|
||||
{assign var=room_additinal_services_exists value=1}
|
||||
{/if}
|
||||
<tr>
|
||||
{if $smarty.foreach.serviceRow.first}
|
||||
<td class="text-center" rowspan="{$roomService['additional_services']|count}">
|
||||
<font size="2" face="Open-sans, sans-serif" color="#555454">
|
||||
{$data_v['name']}<br>
|
||||
{$rm_v['data_form']|date_format:"%d-%m-%Y"} {l s='to'} {$rm_v['data_to']|date_format:"%d-%m-%Y"}<br>
|
||||
<strong>{l s='Room'} - {$roomCount}</strong>
|
||||
</font>
|
||||
</td>
|
||||
{/if}
|
||||
<td class="text-center">
|
||||
<font size="2" face="Open-sans, sans-serif" color="#555454">
|
||||
{$service['name']}
|
||||
</font>
|
||||
</td>
|
||||
<td class="text-center">
|
||||
<font size="2" face="Open-sans, sans-serif" color="#555454">
|
||||
{if $service['allow_multiple_quantity']}
|
||||
{$service['quantity']}
|
||||
{else}
|
||||
{l s='--'}
|
||||
{/if}
|
||||
</font>
|
||||
</td>
|
||||
<td class="text-center">
|
||||
<font size="2" face="Open-sans, sans-serif" color="#555454">
|
||||
{convertPrice price=$service['total_price_tax_excl']}
|
||||
</font>
|
||||
</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
{assign var=roomCount value=$roomCount+1}
|
||||
{/foreach}
|
||||
{/if}
|
||||
{/foreach}
|
||||
{/foreach}
|
||||
{/if}
|
||||
{if !isset($room_additinal_services_exists)}
|
||||
<tr>
|
||||
<td colspan="4">{l s='No service requested'}</td>
|
||||
</tr>
|
||||
{/if}
|
||||
</tbody>
|
||||
</table>
|
||||
<style>
|
||||
.additional-service-table {
|
||||
width:100%;
|
||||
border-collapse:collapse;
|
||||
padding:5px;
|
||||
}
|
||||
.additional-service-table th {
|
||||
border:1px solid #D6D4D4;
|
||||
background-color: #fbfbfb;
|
||||
color: #333;
|
||||
font-family: Arial;
|
||||
font-size: 13px;
|
||||
padding: 7px 5px;
|
||||
text-align:left;
|
||||
}
|
||||
.additional-service-table td {
|
||||
border:1px solid #D6D4D4;
|
||||
padding:5px;
|
||||
}
|
||||
</style>
|
||||
{/if}
|
||||
@@ -108,7 +108,7 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="padding:7px 0">
|
||||
{extra_demands_details_html}
|
||||
{extra_services_details_html}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
||||
@@ -6,7 +6,7 @@ Order: {order_name} Placed on {date}
|
||||
|
||||
{cart_booking_data_text}
|
||||
|
||||
{extra_demands_details_text}
|
||||
{extra_services_details_text}
|
||||
|
||||
{normal_products_data_txt}
|
||||
|
||||
|
||||
@@ -129,7 +129,7 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="padding:7px 0">
|
||||
{extra_demands_details_html}
|
||||
{extra_services_details_html}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
||||
@@ -13,7 +13,7 @@ Payment: {payment}
|
||||
|
||||
{cart_booking_data_text}
|
||||
|
||||
{extra_demands_details_text}
|
||||
{extra_services_details_text}
|
||||
|
||||
{normal_products_data_txt}
|
||||
|
||||
|
||||
@@ -109,7 +109,7 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="padding:7px 0">
|
||||
{extra_demands_details_html}
|
||||
{extra_services_details_html}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
||||
@@ -11,7 +11,7 @@ Status: {order_status}
|
||||
|
||||
{cart_booking_data_text}
|
||||
|
||||
{extra_demands_details_text}
|
||||
{extra_services_details_text}
|
||||
|
||||
{normal_products_data_txt}
|
||||
|
||||
|
||||
@@ -132,7 +132,7 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="padding:7px 0">
|
||||
{extra_demands_details_html}
|
||||
{extra_services_details_html}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
||||
@@ -16,7 +16,7 @@ Status: {order_status}
|
||||
|
||||
{cart_booking_data_text}
|
||||
|
||||
{extra_demands_details_text}
|
||||
{extra_services_details_text}
|
||||
|
||||
{normal_products_data_txt}
|
||||
|
||||
|
||||
@@ -1,48 +1,4 @@
|
||||
{if isset($list) && $list}
|
||||
|
||||
{l s='Room Extra Demands Detail'}
|
||||
|
||||
{l s='Room Type'}
|
||||
{l s='Name'}
|
||||
{l s='Total'} {l s='(Tax excl.)'}
|
||||
|
||||
{foreach from=$list key=data_k item=data_v}
|
||||
{foreach from=$data_v['date_diff'] key=rm_k item=rm_v}
|
||||
|
||||
{if isset($rm_v['extra_demands']) && $rm_v['extra_demands']}
|
||||
{assign var=roomCount value=1}
|
||||
|
||||
{foreach $rm_v['extra_demands'] as $roomDemand}
|
||||
{foreach name=demandRow from=$roomDemand['extra_demands'] item=demand}
|
||||
|
||||
{if !isset($room_demand_exists)}
|
||||
{assign var=room_demand_exists value=1}
|
||||
{/if}
|
||||
|
||||
{if $smarty.foreach.demandRow.first}
|
||||
|
||||
{$data_v['name']}
|
||||
{$rm_v['data_form']|date_format:"%d-%m-%Y"} {l s='to'} {$rm_v['data_to']|date_format:"%d-%m-%Y"}
|
||||
{l s='Room'} - {$roomCount}
|
||||
|
||||
{/if}
|
||||
|
||||
{$demand['name']}
|
||||
|
||||
{convertPrice price=$demand['total_price_tax_excl']}
|
||||
|
||||
{/foreach}
|
||||
{assign var=roomCount value=$roomCount+1}
|
||||
{/foreach}
|
||||
{/if}
|
||||
{/foreach}
|
||||
{/foreach}
|
||||
|
||||
{if !isset($room_demand_exists)}
|
||||
{l s='No room extra demands added.'}
|
||||
{/if}
|
||||
|
||||
|
||||
{l s='Rooms Services Detail'}
|
||||
|
||||
{l s='Room Type'}
|
||||
@@ -89,4 +45,4 @@
|
||||
{if !isset($room_additinal_services_exists)}
|
||||
{l s='No room services added.'}
|
||||
{/if}
|
||||
{/if}
|
||||
{/if}
|
||||
@@ -392,7 +392,7 @@ var ajaxCart = {
|
||||
req.append('id_hotel', idHotel);
|
||||
|
||||
if (parseInt(booking_product)) {
|
||||
// get the selected extra demands by customer
|
||||
// get the selected extra services by customer
|
||||
if (typeof dateFrom != 'undefined')
|
||||
req.append('dateFrom', dateFrom);
|
||||
if (typeof dateTo != 'undefined')
|
||||
@@ -404,8 +404,6 @@ var ajaxCart = {
|
||||
req.append('qty', ((occupancy && occupancy != null) ? occupancy : '1'));
|
||||
}
|
||||
|
||||
var roomDemands = getRoomsExtraDemands();
|
||||
req.append('roomDemands', JSON.stringify(roomDemands) );
|
||||
req.append('serviceProducts', JSON.stringify(getRoomsServiceProducts()) );
|
||||
} else {
|
||||
req.append('qty', ((occupancy && occupancy != null) ? occupancy : '1'));
|
||||
@@ -426,9 +424,6 @@ var ajaxCart = {
|
||||
processData: false,
|
||||
success: function(jsonData, textStatus, jqXHR) {
|
||||
if (pagename == 'product') {
|
||||
if (jsonData.avail_rooms == 0) {
|
||||
disableRoomTypeDemands(1);
|
||||
}
|
||||
|
||||
resetRoomtypeServices();
|
||||
|
||||
@@ -565,9 +560,6 @@ var ajaxCart = {
|
||||
var product_page_id_product = $('#product_page_product_id').val();
|
||||
if (idProduct == product_page_id_product && dateFrom < date_checkOut && dateTo >= date_checkIn) {
|
||||
$(".max_avail_type_qty").val(jsonData.avail_rooms);
|
||||
if (jsonData.avail_rooms == 0) {
|
||||
disableRoomTypeDemands(1);
|
||||
}
|
||||
}
|
||||
BookingForm.refresh();
|
||||
}
|
||||
@@ -632,7 +624,6 @@ var ajaxCart = {
|
||||
data: 'controller=cart&delete=1&dateFrom=' + dateFrom + '&dateTo=' + dateTo + '&id_product=' + idProduct + '&id_hotel=' + idHotel + '&id_product_option=' + ((idCombination != null && parseInt(idCombination)) ? idCombination : '') + ((customizationId && customizationId != null) ? '&id_customization=' + customizationId : '') + '&id_address_delivery=' + idAddressDelivery + '&token=' + static_token + '&ajax=true',
|
||||
success: function(jsonData) {
|
||||
if (pagename == 'product') {
|
||||
disableRoomTypeDemands(0);
|
||||
BookingForm.refresh();
|
||||
}
|
||||
|
||||
@@ -953,7 +944,7 @@ var ajaxCart = {
|
||||
content += '<tr class="rooms_remove_container">';
|
||||
content += '<td>' + moment(new Date(date_diff_v.data_form)).format(dateFormatToUse) + ' - ' + moment(new Date(date_diff_v.data_to)).format(dateFormatToUse) + '</td>';
|
||||
content += '<td class="num_rooms_in_date">' + date_diff_v.num_rm + '</td>';
|
||||
content += '<td>' + formatCurrency(parseFloat(date_diff_v.amount) + parseFloat(date_diff_v.demand_price), currency_format, currency_sign, currency_blank) + '</td>';
|
||||
content += '<td>' + formatCurrency(parseFloat(date_diff_v.amount) + parseFloat(date_diff_v.additional_price), currency_format, currency_sign, currency_blank) + '</td>';
|
||||
content += '<td>';
|
||||
content += '<a class="remove_rooms_from_cart_link" href="#" rm_price=' + date_diff_v.amount + ' id_product=' + productId + ' date_from=' + date_diff_v.data_form + ' date_to=' + date_diff_v.data_to + ' num_rooms=' + date_diff_v.num_rm + ' title="' + remove_rm_title + '"></a>';
|
||||
content += '</td>';
|
||||
@@ -1031,7 +1022,7 @@ var ajaxCart = {
|
||||
booking_dates_content += '<tr class="rooms_remove_container">';
|
||||
booking_dates_content += '<td>' + moment(new Date(date_diff_v1.data_form)).format(dateFormatToUse) + ' - ' + moment(new Date(date_diff_v1.data_to)).format(dateFormatToUse) + '</td>';
|
||||
booking_dates_content += '<td class="num_rooms_in_date">' + date_diff_v1.num_rm + '</td>';
|
||||
booking_dates_content += '<td>' + formatCurrency(parseFloat(date_diff_v1.amount) + parseFloat(date_diff_v1.demand_price), currency_format, currency_sign, currency_blank) + '</td>';
|
||||
booking_dates_content += '<td>' + formatCurrency(parseFloat(date_diff_v1.amount) + parseFloat(date_diff_v1.additional_price), currency_format, currency_sign, currency_blank) + '</td>';
|
||||
booking_dates_content += '<td>';
|
||||
booking_dates_content += '<a class="remove_rooms_from_cart_link" href="#" rm_price=' + date_diff_v1.amount + ' id_product=' + productId + ' date_from=' + date_diff_v1.data_form + ' date_to=' + date_diff_v1.data_to + ' num_rooms=' + date_diff_v1.num_rm + ' title="' + remove_rm_title + '"></a>';
|
||||
booking_dates_content += '</td>';
|
||||
@@ -1389,7 +1380,6 @@ function crossselling_serialScroll() {
|
||||
}
|
||||
|
||||
function resetRoomtypeServices(refresh = true) {
|
||||
$('.room_demands_container').find('input.id_room_type_demand:checked').prop('checked', false).uniform();
|
||||
$('#additional_products').empty();
|
||||
$('#additional_products div')
|
||||
$('.remove_roomtype_product').text(select_txt).removeClass('btn-danger remove_roomtype_product').addClass('btn-success add_roomtype_product');
|
||||
@@ -1398,19 +1388,6 @@ function resetRoomtypeServices(refresh = true) {
|
||||
}
|
||||
}
|
||||
|
||||
function disableRoomTypeDemands(show) {
|
||||
if (show) {
|
||||
$('.room_demands_container_overlay').show();
|
||||
$('.room_demands_container').find('input:checkbox.id_room_type_demand').prop('checked', false);
|
||||
$('.room_demand_block').find('.id_room_type_demand').prop('checked', false).parent().removeClass('checked');
|
||||
$('.room_demands_container').find('input:checkbox.id_room_type_demand').attr('disabled', 'disabled');
|
||||
} else {
|
||||
$('.room_demands_container_overlay').hide();
|
||||
$('.room_demands_container').find('input:checkbox.id_room_type_demand').removeAttr('disabled');
|
||||
$('.room_demands_container').find('.checker').removeClass('disabled');
|
||||
}
|
||||
}
|
||||
|
||||
function disableRoomTypeServices(disable) {
|
||||
if (disable) {
|
||||
resetRoomtypeServices(false);
|
||||
@@ -1422,20 +1399,6 @@ function disableRoomTypeServices(disable) {
|
||||
}
|
||||
}
|
||||
|
||||
function getRoomsExtraDemands()
|
||||
{
|
||||
var roomDemands = [];
|
||||
|
||||
$('input:checkbox.id_room_type_demand:checked').each(function () {
|
||||
roomDemands.push({
|
||||
'id_global_demand':$(this).val(),
|
||||
'id_option': $(this).closest('.room_demand_block').find('.id_option').val()
|
||||
});
|
||||
});
|
||||
|
||||
return roomDemands;
|
||||
}
|
||||
|
||||
function getRoomsServiceProducts()
|
||||
{
|
||||
var serviceProducts = [];
|
||||
|
||||
@@ -265,14 +265,6 @@ class Blockcart extends Module
|
||||
}
|
||||
|
||||
$objCartBookingData = new HotelCartBookingData();
|
||||
$totalDemandsPrice = $objCartBookingData->getCartExtraDemands(
|
||||
$this->context->cart->id,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
1
|
||||
);
|
||||
|
||||
$addedProduct = false;
|
||||
// get currently added product if exists
|
||||
@@ -383,8 +375,8 @@ class Blockcart extends Module
|
||||
'tax_cost' => $tax_cost,
|
||||
'wrapping_cost' => Tools::displayPrice($wrappingCost, $currency),
|
||||
'product_total' => Tools::displayPrice($params['cart']->getOrderTotal($useTax, Cart::ONLY_PRODUCTS), $currency),
|
||||
'room_total' => ($totalRoomsPrice + $totalDemandsPrice + $totalAdditionalServicesWithAutoAddPrice),
|
||||
'room_total_format' => Tools::displayPrice($totalRoomsPrice + $totalDemandsPrice + $totalAdditionalServicesWithAutoAddPrice - $totalConvenienceFee),
|
||||
'room_total' => ($totalRoomsPrice + $totalAdditionalServicesWithAutoAddPrice),
|
||||
'room_total_format' => Tools::displayPrice($totalRoomsPrice + $totalAdditionalServicesWithAutoAddPrice - $totalConvenienceFee),
|
||||
'totalToPay' => $totalToPay,
|
||||
'total_convenience_fee' => $totalConvenienceFee,
|
||||
'total_convenience_fee_format' => Tools::displayPrice(($totalConvenienceFee), $currency),
|
||||
|
||||
@@ -88,7 +88,7 @@
|
||||
{dateFormat date=$data_v['data_form'] full=$is_full_date} - {dateFormat date=$data_v['data_to'] full=$is_full_date}
|
||||
</td>
|
||||
<td class="num_rooms_in_date">{$data_v['num_rm']}</td>
|
||||
<td>{convertPrice price=($data_v['amount'] + $data_v['demand_price'])}</td>
|
||||
<td>{convertPrice price=($data_v['amount'] + $data_v['additional_price'])}</td>
|
||||
<td><a class="remove_rooms_from_cart_link" href="#" rm_price="{$data_v['amount']}" id_product="{$product.id_product|intval}" date_from="{$data_v['data_form']}" date_to="{$data_v['data_to']}" num_rooms="{$data_v['num_rm']}" title="{l s='remove this room from my cart' mod='blockcart'}"></a></td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
|
||||
@@ -83,7 +83,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-6 col-lg-3">
|
||||
<div class="stat-box label-tooltip" data-toggle="tooltip" data-original-title="{l s='Total Revenue Per Available Room (TrevPAR) measures the total revenue being generated per available room including additional facilities and service products.' mod='dashperformance'}" data-placement="top" style="background-color: #EBCDFF;">
|
||||
<div class="stat-box label-tooltip" data-toggle="tooltip" data-original-title="{l s='Total Revenue Per Available Room (TrevPAR) measures the total revenue being generated per available room including service products.' mod='dashperformance'}" data-placement="top" style="background-color: #EBCDFF;">
|
||||
<div class="title-wrapper">
|
||||
<p>{l s='Total Revenue Per Available Room' mod='dashperformance'}</p>
|
||||
</div>
|
||||
@@ -93,7 +93,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-6 col-lg-3">
|
||||
<div class="stat-box label-tooltip" data-toggle="tooltip" data-original-title="{l s='Gross Operating Profit Per Available Room (GOPPAR) measures how much gross operating profit comes from each room including additional facilities and service products.' mod='dashperformance'}" data-placement="top" style="background-color: #B7F0FF;">
|
||||
<div class="stat-box label-tooltip" data-toggle="tooltip" data-original-title="{l s='Gross Operating Profit Per Available Room (GOPPAR) measures how much gross operating profit comes from each room including service products.' mod='dashperformance'}" data-placement="top" style="background-color: #B7F0FF;">
|
||||
<div class="title-wrapper">
|
||||
<p>{l s='Gross Operating Profit Per Available Room' mod='dashperformance'}</p>
|
||||
</div>
|
||||
|
||||
@@ -1,302 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License version 3.0
|
||||
* that is bundled with this package in the file LICENSE.md
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* https://opensource.org/license/osl-3-0-php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to support@qloapps.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade this module to a 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
|
||||
* @copyright Since 2010 Webkul
|
||||
* @license https://opensource.org/license/osl-3-0-php Open Software License version 3.0
|
||||
*/
|
||||
|
||||
class HotelBookingDemands extends ObjectModel
|
||||
{
|
||||
public $id_htl_booking;
|
||||
public $name;
|
||||
public $unit_price_tax_excl;
|
||||
public $unit_price_tax_incl;
|
||||
public $total_price_tax_excl;
|
||||
public $total_price_tax_incl;
|
||||
public $id_tax_rules_group;
|
||||
public $tax_computation_method;
|
||||
public $price_calc_method;
|
||||
public $date_add;
|
||||
public $date_upd;
|
||||
|
||||
/** @var TaxCalculator object */
|
||||
public $tax_calculator = null;
|
||||
|
||||
protected $documentsBaseDir;
|
||||
protected $sourceIndexFile;
|
||||
protected $documentFolder;
|
||||
|
||||
public static $definition = array(
|
||||
'table' => 'htl_booking_demands',
|
||||
'primary' => 'id_booking_demand',
|
||||
'fields' => array(
|
||||
'id_htl_booking' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
|
||||
'unit_price_tax_excl' => array('type' => self::TYPE_FLOAT),
|
||||
'unit_price_tax_incl' => array('type' => self::TYPE_FLOAT),
|
||||
'total_price_tax_excl' => array('type' => self::TYPE_FLOAT),
|
||||
'total_price_tax_incl' => array('type' => self::TYPE_FLOAT),
|
||||
'name' => array(
|
||||
'type' => self::TYPE_STRING, 'validate' => 'isCatalogName', 'required' => true, 'size' => 128
|
||||
),
|
||||
'price_calc_method' => array('type' => self::TYPE_INT),
|
||||
'id_tax_rules_group' => array('type' => self::TYPE_INT),
|
||||
'tax_computation_method' => array('type' => self::TYPE_INT),
|
||||
'date_add' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'),
|
||||
'date_upd' => array('type' => self::TYPE_DATE, 'validate' => 'isDate')
|
||||
));
|
||||
|
||||
protected $webserviceParameters = array(
|
||||
'objectsNodeName' => 'extra_demands',
|
||||
'objectNodeName' => 'extra_demand',
|
||||
'fields' => array(
|
||||
'id_htl_booking' => array(
|
||||
'xlink_resource' => array(
|
||||
'resourceName' => 'bookings',
|
||||
)
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
public function getRoomTypeBookingExtraDemands(
|
||||
$idOrder,
|
||||
$idProduct = 0,
|
||||
$idRoom = 0,
|
||||
$dateFrom = 0,
|
||||
$dateTo = 0,
|
||||
$groupByRoom = 1,
|
||||
$getTotalPrice = 0,
|
||||
$useTax = 1,
|
||||
$idHtlBookingDetail = 0,
|
||||
$idOrderDetail = 0
|
||||
) {
|
||||
$moduleObj = Module::getInstanceByName('hotelreservationsystem');
|
||||
$context = Context::getContext();
|
||||
if (isset($context->currency->id)
|
||||
&& Validate::isLoadedObject($context->currency)
|
||||
) {
|
||||
$idCurrency = (int)$context->currency->id;
|
||||
} else {
|
||||
$idCurrency = (int)Configuration::get('PS_CURRENCY_DEFAULT');
|
||||
}
|
||||
$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 hb.`id_order` ='.(int) $idOrder;
|
||||
|
||||
|
||||
if ($idOrderDetail) {
|
||||
$sql .= ' AND `id_order_detail`='.(int)$idOrderDetail;
|
||||
}
|
||||
if ($idProduct) {
|
||||
$sql .= ' AND hb.`id_product`='.(int)$idProduct;
|
||||
}
|
||||
if ($idRoom) {
|
||||
$sql .= ' AND hb.`id_room`='.(int)$idRoom;
|
||||
}
|
||||
if ($dateFrom && $dateTo) {
|
||||
$dateFrom = date('Y-m-d H:i:s', strtotime($dateFrom));
|
||||
$dateTo = date('Y-m-d H:i:s', strtotime($dateTo));
|
||||
$sql .= ' AND hb.`date_from`=\''.pSQL($dateFrom).'\' AND hb.`date_to`= \''.pSQL($dateTo).'\'';
|
||||
}
|
||||
|
||||
if ($idHtlBookingDetail) {
|
||||
$sql .= ' AND hb.`id` = '.(int)$idHtlBookingDetail;
|
||||
}
|
||||
|
||||
if ($getTotalPrice) {
|
||||
$totalDemandsPrice = 0;
|
||||
}
|
||||
if ($roomTypeDemands = Db::getInstance()->executeS($sql)) {
|
||||
if ($getTotalPrice) {
|
||||
foreach ($roomTypeDemands as $demand) {
|
||||
if ($useTax) {
|
||||
$totalDemandsPrice += Tools::processPriceRounding($demand['total_price_tax_incl']);
|
||||
} else {
|
||||
$totalDemandsPrice += Tools::processPriceRounding($demand['total_price_tax_excl']);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if ($groupByRoom) {
|
||||
$roomDemands = array();
|
||||
foreach ($roomTypeDemands as $demand) {
|
||||
// Set tax_code
|
||||
if ($taxes = static::getTaxListStatic($demand['id_booking_demand'])) {
|
||||
$taxTemp = array();
|
||||
foreach ($taxes as $tax) {
|
||||
$obj = new Tax($tax['id_tax']);
|
||||
$taxTemp[] = sprintf($moduleObj->l('%1$s%2$s%%'), ($obj->rate + 0), '');
|
||||
}
|
||||
$demand['extra_demands_tax_label'] = implode(', ', $taxTemp);
|
||||
|
||||
} else {
|
||||
$demand['extra_demands_tax_label'] = $moduleObj->l('No tax', 'HotelBookingDemands');
|
||||
}
|
||||
$roomDemands[$demand['id_room']]['id_room'] = $demand['id_room'];
|
||||
$roomDemands[$demand['id_room']]['adults'] = $demand['adults'];
|
||||
$roomDemands[$demand['id_room']]['children'] = $demand['children'];
|
||||
$roomDemands[$demand['id_room']]['extra_demands'][] = $demand;
|
||||
}
|
||||
unset($taxTemp);
|
||||
return $roomDemands;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($getTotalPrice) {
|
||||
return $totalDemandsPrice;
|
||||
} else {
|
||||
return $roomTypeDemands;
|
||||
}
|
||||
}
|
||||
|
||||
public static function getTaxListStatic($idBookingDemand)
|
||||
{
|
||||
return Db::getInstance()->executeS(
|
||||
'SELECT * FROM `'._DB_PREFIX_.'htl_booking_demands_tax` WHERE `id_booking_demand` = '.(int)$idBookingDemand
|
||||
);
|
||||
}
|
||||
|
||||
public static function getTaxCalculatorStatic($idBookingDemand)
|
||||
{
|
||||
$sql = 'SELECT t.*, d.`tax_computation_method`
|
||||
FROM `'._DB_PREFIX_.'htl_booking_demands_tax` t
|
||||
LEFT JOIN `'._DB_PREFIX_.'htl_booking_demands` d ON (d.`id_booking_demand` = t.`id_booking_demand`)
|
||||
WHERE d.`id_booking_demand` = '.(int)$idBookingDemand;
|
||||
|
||||
$computationMethod = 1;
|
||||
$taxes = array();
|
||||
if ($results = Db::getInstance()->executeS($sql)) {
|
||||
foreach ($results as $result) {
|
||||
$taxes[] = new Tax((int)$result['id_tax']);
|
||||
}
|
||||
|
||||
$computationMethod = $result['tax_computation_method'];
|
||||
}
|
||||
|
||||
return new TaxCalculator($taxes, $computationMethod);
|
||||
}
|
||||
|
||||
public function setBookingDemandTaxDetails($replace = 0)
|
||||
{
|
||||
if ($this->id) {
|
||||
if ($taxCalculator = $this->tax_calculator) {
|
||||
if (!($taxCalculator instanceof TaxCalculator)) {
|
||||
return false;
|
||||
}
|
||||
if (count($taxCalculator->taxes) == 0) {
|
||||
return true;
|
||||
}
|
||||
$values = '';
|
||||
$priceTaxExcl = $this->unit_price_tax_excl;
|
||||
foreach ($taxCalculator->getTaxesAmount($priceTaxExcl) as $idTax => $amount) {
|
||||
$quantity = 1;
|
||||
if ($this->price_calc_method == HotelRoomTypeGlobalDemand::WK_PRICE_CALC_METHOD_EACH_DAY) {
|
||||
$objBkDetail = new HotelBookingDetail($this->id_htl_booking);
|
||||
$quantity = HotelHelper::getNumberOfDays($objBkDetail->date_from, $objBkDetail->date_to);
|
||||
}
|
||||
|
||||
// Rounding as per configurations
|
||||
$totalAmount = Tools::processPriceRounding($amount, $quantity);
|
||||
|
||||
$values .= '('.(int)$this->id.','.(int)$idTax.','.(float)$amount.','.
|
||||
(float)$totalAmount.'),';
|
||||
}
|
||||
|
||||
// if delete previous details and save new details
|
||||
if ($replace) {
|
||||
Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'htl_booking_demands_tax` WHERE id_booking_demand='.(int)$this->id);
|
||||
}
|
||||
|
||||
$values = rtrim($values, ',');
|
||||
$sql = 'INSERT INTO `'._DB_PREFIX_.'htl_booking_demands_tax`
|
||||
(id_booking_demand, id_tax, unit_amount, total_amount)
|
||||
VALUES '.$values;
|
||||
|
||||
return Db::getInstance()->execute($sql);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method returns true if at least one booking demand uses One After Another tax computation method.
|
||||
* @return bool
|
||||
*/
|
||||
public function useOneAfterAnotherTaxComputationMethod()
|
||||
{
|
||||
// if one of the order details use the tax computation method the display will be different
|
||||
return Db::getInstance()->getValue('
|
||||
SELECT od.`tax_computation_method`
|
||||
FROM `' . _DB_PREFIX_ . 'order_detail_tax` odt
|
||||
LEFT JOIN `' . _DB_PREFIX_ . 'order_detail` od ON (od.`id_order_detail` = odt.`id_order_detail`)
|
||||
WHERE od.`id_order` = ' . (int) $this->id_order . '
|
||||
AND od.`id_order_invoice` = ' . (int) $this->id . '
|
||||
AND od.`tax_computation_method` = ' . (int) TaxCalculator::ONE_AFTER_ANOTHER_METHOD)
|
||||
|| Configuration::get('PS_INVOICE_TAXES_BREAKDOWN');
|
||||
}
|
||||
|
||||
public function getExtraDemandsTaxesDetails($idOrder, $idsOrderDetail = [])
|
||||
{
|
||||
$sql = 'SELECT hb.`id` as id_htl_booking, hbd.`unit_price_tax_excl`, hbd.`total_price_tax_excl`, hb.`id_order_detail`, hdt.*, t.* FROM '._DB_PREFIX_.'orders o '.
|
||||
'INNER JOIN '._DB_PREFIX_.'htl_booking_detail hb ON hb.id_order = o.id_order '.
|
||||
'INNER JOIN '._DB_PREFIX_.'htl_booking_demands hbd ON hbd.id_htl_booking = hb.id '.
|
||||
'INNER JOIN '._DB_PREFIX_.'htl_booking_demands_tax hdt ON hbd.id_booking_demand = hdt.id_booking_demand '.
|
||||
'INNER JOIN '._DB_PREFIX_.'tax t ON t.id_tax = hdt.id_tax '.
|
||||
'WHERE o.id_order = '.(int)$idOrder;
|
||||
|
||||
if ($idsOrderDetail) {
|
||||
$sql .= ' AND hb.`id_order_detail` IN ('.implode(',', $idsOrderDetail).')';
|
||||
}
|
||||
|
||||
$taxDetails = Db::getInstance()->executeS($sql);
|
||||
|
||||
if ($taxDetails) {
|
||||
foreach ($taxDetails as &$detail) {
|
||||
$priceTaxExcl = $detail['unit_price_tax_excl'];
|
||||
$numDays = 1;
|
||||
$objBkDemand = new HotelBookingDemands($detail['id_booking_demand']);
|
||||
if ($objBkDemand->price_calc_method == HotelRoomTypeGlobalDemand::WK_PRICE_CALC_METHOD_EACH_DAY) {
|
||||
$objBkDetail = new HotelBookingDetail($detail['id_htl_booking']);
|
||||
$numDays = HotelHelper::getNumberOfDays($objBkDetail->date_from, $objBkDetail->date_to);
|
||||
}
|
||||
|
||||
$totalTaxBase = $priceTaxExcl * $numDays;
|
||||
|
||||
$detail['total_tax_base'] = $totalTaxBase;
|
||||
}
|
||||
}
|
||||
return $taxDetails;
|
||||
}
|
||||
|
||||
public function deleteBookingDemands($idHotelBooking)
|
||||
{
|
||||
// first delete all tax details of this booking demands
|
||||
Db::getInstance()->delete(
|
||||
'htl_booking_demands_tax',
|
||||
'id_booking_demand IN (SELECT `id_booking_demand` FROM `'._DB_PREFIX_.'htl_booking_demands` WHERE `id_htl_booking` = '.(int)$idHotelBooking.')'
|
||||
);
|
||||
|
||||
// delete all the demands
|
||||
return Db::getInstance()->delete('htl_booking_demands', 'id_htl_booking = '.(int)$idHotelBooking);
|
||||
}
|
||||
|
||||
public function deleteBookingDemandTaxDetails($idBookingDemand)
|
||||
{
|
||||
return Db::getInstance()->delete('htl_booking_demands_tax', 'id_booking_demand = '.(int)$idBookingDemand);
|
||||
}
|
||||
}
|
||||
@@ -158,13 +158,6 @@ class HotelBookingDetail extends ObjectModel
|
||||
)
|
||||
),
|
||||
),
|
||||
'associations' => array(
|
||||
'booking_extra_demands' => array(
|
||||
'setter' => false,
|
||||
'resource' => 'extra_demand',
|
||||
'fields' => array('id' => array())
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
public function __construct($id = null, $id_lang = null, $id_shop = null)
|
||||
@@ -2125,23 +2118,6 @@ class HotelBookingDetail extends ObjectModel
|
||||
if ($result &= $objBookingDetail->save()) {
|
||||
$reallocatedBookingId = $objBookingDetail->id;
|
||||
$objectHotelBookingTo = $objBookingDetail;
|
||||
// Get Booking Demands of the old booking to add in the new booking creation
|
||||
$objBookingDemand = new HotelBookingDemands();
|
||||
if ($oldBookingDemands = $objBookingDemand->getRoomTypeBookingExtraDemands(
|
||||
$objOldHotelBooking->id_order,
|
||||
$objOldHotelBooking->id_product,
|
||||
$objOldHotelBooking->id_room,
|
||||
$objOldHotelBooking->date_from,
|
||||
$objOldHotelBooking->date_to
|
||||
)) {
|
||||
if (isset($oldBookingDemands[$objOldHotelBooking->id_room]['extra_demands']) && $oldBookingDemands[$objOldHotelBooking->id_room]['extra_demands']) {
|
||||
foreach ($oldBookingDemands[$objOldHotelBooking->id_room]['extra_demands'] as $bookingDemand) {
|
||||
$objBookingDemand = new HotelBookingDemands($bookingDemand['id_booking_demand']);
|
||||
$objBookingDemand->id_htl_booking = $objBookingDetail->id;
|
||||
$objBookingDemand->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Get Booking services of the old booking to add in the new booking creation
|
||||
$objServiceProductOrderDetail = new ServiceProductOrderDetail();
|
||||
@@ -3391,14 +3367,6 @@ class HotelBookingDetail extends ObjectModel
|
||||
return $allotments;
|
||||
}
|
||||
|
||||
// Webservice funcions
|
||||
public function getWsBookingExtraDemands()
|
||||
{
|
||||
return Db::getInstance()->executeS(
|
||||
'SELECT `id_booking_demand` as `id` FROM `'._DB_PREFIX_.'htl_booking_demands` WHERE `id_htl_booking` = '.(int)$this->id.' ORDER BY `id` ASC'
|
||||
);
|
||||
}
|
||||
|
||||
public function getOrderStatusToFreeBookedRoom()
|
||||
{
|
||||
return (array(
|
||||
@@ -3426,7 +3394,6 @@ class HotelBookingDetail extends ObjectModel
|
||||
|
||||
// things to do if order is not paid
|
||||
if (!$hasOrderDiscountOrPayment) {
|
||||
$objHotelBookingDemands = new HotelBookingDemands();
|
||||
$objServiceProductOrderDetail = new ServiceProductOrderDetail();
|
||||
|
||||
$reduction_amount['total_price_tax_excl'] = (float) $this->total_price_tax_excl;
|
||||
@@ -3434,28 +3401,6 @@ class HotelBookingDetail extends ObjectModel
|
||||
$reduction_amount['total_price_tax_incl'] = (float) $this->total_price_tax_incl;
|
||||
$reduction_amount['total_products_tax_incl'] = (float) $this->total_price_tax_incl;
|
||||
|
||||
// reduce facilities amount from order and services_detail
|
||||
if ($roomDemands = $objHotelBookingDemands->getRoomTypeBookingExtraDemands(
|
||||
$this->id_order,
|
||||
$this->id_product,
|
||||
$this->id_room,
|
||||
$this->date_from,
|
||||
$this->date_to,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
$this->id
|
||||
)) {
|
||||
foreach ($roomDemands as $roomDemand) {
|
||||
$objHotelBookingDemands = new HotelBookingDemands($roomDemand['id_booking_demand']);
|
||||
$reduction_amount['total_price_tax_excl'] += (float) $objHotelBookingDemands->total_price_tax_excl;
|
||||
$reduction_amount['total_price_tax_incl'] += (float) $objHotelBookingDemands->total_price_tax_incl;
|
||||
$objHotelBookingDemands->total_price_tax_excl = 0;
|
||||
$objHotelBookingDemands->total_price_tax_incl = 0;
|
||||
$objHotelBookingDemands->save();
|
||||
}
|
||||
}
|
||||
|
||||
// reduce services amount from order and services_detail
|
||||
if ($roomServices = $objServiceProductOrderDetail->getRoomTypeServiceProducts(
|
||||
0,
|
||||
|
||||
@@ -42,7 +42,6 @@ class HotelCartBookingData extends ObjectModel
|
||||
public $adults;
|
||||
public $children;
|
||||
public $child_ages;
|
||||
public $extra_demands;
|
||||
public $date_add;
|
||||
public $date_upd;
|
||||
|
||||
@@ -68,7 +67,6 @@ class HotelCartBookingData extends ObjectModel
|
||||
'adults' => array('type' => self::TYPE_INT, 'validate' => 'isInt'),
|
||||
'children' => array('type' => self::TYPE_INT, 'validate' => 'isInt'),
|
||||
'child_ages' => array('type' => self::TYPE_STRING),
|
||||
'extra_demands' => array('type' => self::TYPE_STRING),
|
||||
'date_add' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'),
|
||||
'date_upd' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'),
|
||||
),
|
||||
@@ -94,24 +92,6 @@ class HotelCartBookingData extends ObjectModel
|
||||
)
|
||||
),
|
||||
),
|
||||
'associations' => array(
|
||||
'extra_demands' => array(
|
||||
'setter' => false,
|
||||
'resource' => 'extra_demand',
|
||||
'fields' => array(
|
||||
'id_global_demand' => array(
|
||||
'xlink_resource' => array(
|
||||
'resourceName' => 'extra_demands',
|
||||
)
|
||||
),
|
||||
'id_option' => array(
|
||||
'xlink_resource' => array(
|
||||
'resourceName' => 'demand_advance_options',
|
||||
)
|
||||
)
|
||||
)
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -448,7 +428,6 @@ class HotelCartBookingData extends ObjectModel
|
||||
$id_hotel,
|
||||
$date_from,
|
||||
$date_to,
|
||||
$roomDemand,
|
||||
$serviceProducts,
|
||||
$roomsAvailableList,
|
||||
$id_cart,
|
||||
@@ -485,7 +464,6 @@ class HotelCartBookingData extends ObjectModel
|
||||
$obj_htl_cart_booking_data->id_room = $hotelRoomInfo['id_room'];
|
||||
$obj_htl_cart_booking_data->id_hotel = $id_hotel;
|
||||
$obj_htl_cart_booking_data->quantity = $num_days;
|
||||
$obj_htl_cart_booking_data->extra_demands = $roomDemand;
|
||||
$obj_htl_cart_booking_data->date_from = $date_from;
|
||||
$obj_htl_cart_booking_data->date_to = $date_to;
|
||||
$obj_htl_cart_booking_data->booking_type = $booking_type;
|
||||
@@ -553,7 +531,6 @@ class HotelCartBookingData extends ObjectModel
|
||||
$id_room = 0,
|
||||
$date_from = '',
|
||||
$date_to = '',
|
||||
$roomDemand = array(),
|
||||
$serviceProducts = array(),
|
||||
$id_cart = 0,
|
||||
$id_guest = 0,
|
||||
@@ -625,16 +602,12 @@ class HotelCartBookingData extends ObjectModel
|
||||
if ($totalAvailableRooms >= $roomsRequired) {
|
||||
// add rooms to cart
|
||||
$roomsAvailableList = $hotelRoomData['rm_data'][$id_product]['data']['available'];
|
||||
if (is_array($roomDemand)) {
|
||||
$roomDemand = json_encode($roomDemand);
|
||||
}
|
||||
return $this->addCartBookingData(
|
||||
$id_product,
|
||||
$occupancy,
|
||||
$id_hotel,
|
||||
$date_from,
|
||||
$date_to,
|
||||
$roomDemand,
|
||||
$serviceProducts,
|
||||
$roomsAvailableList,
|
||||
$id_cart,
|
||||
@@ -1159,7 +1132,6 @@ class HotelCartBookingData extends ObjectModel
|
||||
$context = Context::getContext();
|
||||
$cart_detail_data = $this->getCartCurrentDataByCartId((int) $id_cart);
|
||||
if ($cart_detail_data) {
|
||||
$objRoomDemands = new HotelRoomTypeDemand();
|
||||
$objServiceProductCartDetail = new ServiceProductCartDetail();
|
||||
$objRoomTypeServiceProduct = new RoomTypeServiceProduct();
|
||||
|
||||
@@ -1222,29 +1194,7 @@ class HotelCartBookingData extends ObjectModel
|
||||
$cart_detail_data[$key]['feature_price'] = $feature_price;
|
||||
$cart_detail_data[$key]['feature_price_tax_excl'] = $feature_price_tax_excl;
|
||||
$cart_detail_data[$key]['feature_price_diff'] = $feature_price_diff;
|
||||
// add extra demands
|
||||
$cart_detail_data[$key]['extra_demands'] = $objRoomDemands->getRoomTypeDemands(
|
||||
$value['id_product']
|
||||
);
|
||||
$cart_detail_data[$key]['selected_demands'] = $this->getCartExtraDemands(
|
||||
$id_cart,
|
||||
$value['id_product'],
|
||||
$value['id_room'],
|
||||
$value['date_from'],
|
||||
$value['date_to'],
|
||||
0,
|
||||
1
|
||||
);
|
||||
$cart_detail_data[$key]['demand_price'] = $this->getCartExtraDemands(
|
||||
$id_cart,
|
||||
$value['id_product'],
|
||||
$value['id_room'],
|
||||
$value['date_from'],
|
||||
$value['date_to'],
|
||||
1,
|
||||
0,
|
||||
false
|
||||
);
|
||||
|
||||
$cart_detail_data[$key]['additional_service'] = $objRoomTypeServiceProduct->getServiceProductsData(
|
||||
$value['id_product'],
|
||||
1,
|
||||
@@ -1537,7 +1487,6 @@ class HotelCartBookingData extends ObjectModel
|
||||
$objHotelBranch = new HotelBranchInformation();
|
||||
$objHtlFeatures = new HotelFeatures();
|
||||
$objCartBookingData = new HotelCartBookingData();
|
||||
$objRoomDemands = new HotelRoomTypeDemand();
|
||||
$objRoomTypeServiceProduct = new RoomTypeServiceProduct();
|
||||
$objServiceProductCartDetail = new ServiceProductCartDetail();
|
||||
|
||||
@@ -1586,8 +1535,6 @@ class HotelCartBookingData extends ObjectModel
|
||||
$cartHotelData[$prodKey]['cover_img'] = $coverImg;
|
||||
|
||||
if ($detailed) {
|
||||
// extra demands
|
||||
$cartHotelData[$prodKey]['extra_demands'] = $objRoomDemands->getRoomTypeDemands($product['id_product']);
|
||||
$cartHotelData[$prodKey]['service_products'] = $objRoomTypeServiceProduct->getServiceProductsData(
|
||||
$product['id_product'],
|
||||
1,
|
||||
@@ -1645,15 +1592,7 @@ class HotelCartBookingData extends ObjectModel
|
||||
if (isset($cartBookingDetails) && $cartBookingDetails) {
|
||||
foreach ($cartBookingDetails as $data_k => $data_v) {
|
||||
$dateJoin = strtotime($data_v['date_from']).strtotime($data_v['date_to']);
|
||||
$demandPrice = $objCartBookingData->getCartExtraDemands(
|
||||
$context->cart->id,
|
||||
$data_v['id_product'],
|
||||
$data_v['id_room'],
|
||||
$data_v['date_from'],
|
||||
$data_v['date_to'],
|
||||
1
|
||||
);
|
||||
$serviceProductPrice = $objServiceProductCartDetail->getServiceProductsInCart(
|
||||
$totalAdditionalServicePrice = $objServiceProductCartDetail->getServiceProductsInCart(
|
||||
$context->cart->id,
|
||||
[],
|
||||
null,
|
||||
@@ -1665,8 +1604,6 @@ class HotelCartBookingData extends ObjectModel
|
||||
1,
|
||||
0
|
||||
);
|
||||
|
||||
$totalAdditionalServicePrice = $demandPrice + $serviceProductPrice;
|
||||
$occupancy = array(
|
||||
array(
|
||||
'adults' => $data_v['adults'],
|
||||
@@ -1676,7 +1613,7 @@ class HotelCartBookingData extends ObjectModel
|
||||
);
|
||||
if (isset($cartHotelData[$prodKey]['date_diff'][$dateJoin])) {
|
||||
$numDays = HotelHelper::getNumberOfDays($data_v['date_from'], $data_v['date_to']);
|
||||
$cartHotelData[$prodKey]['date_diff'][$dateJoin]['demand_price'] += $totalAdditionalServicePrice;
|
||||
$cartHotelData[$prodKey]['date_diff'][$dateJoin]['additional_price'] += $totalAdditionalServicePrice;
|
||||
$cartHotelData[$prodKey]['date_diff'][$dateJoin]['num_rm'] += 1;
|
||||
$cartHotelData[$prodKey]['date_diff'][$dateJoin]['num_days'] = $numDays;
|
||||
$cartHotelData[$prodKey]['date_diff'][$dateJoin]['adults'] += $data_v['adults'];
|
||||
@@ -1731,7 +1668,7 @@ class HotelCartBookingData extends ObjectModel
|
||||
$cartHotelData[$prodKey]['date_diff'][$dateJoin]['total_price_without_discount'] += $totalPriceWithoutDiscount;
|
||||
$cartHotelData[$prodKey]['date_diff'][$dateJoin]['amount_without_auto_add'] += $amountWithoutAutoAdd;
|
||||
} else {
|
||||
$cartHotelData[$prodKey]['date_diff'][$dateJoin]['demand_price'] = $totalAdditionalServicePrice;
|
||||
$cartHotelData[$prodKey]['date_diff'][$dateJoin]['additional_price'] = $totalAdditionalServicePrice;
|
||||
$numDays = HotelHelper::getNumberOfDays($data_v['date_from'], $data_v['date_to']);
|
||||
$cartHotelData[$prodKey]['date_diff'][$dateJoin]['num_rm'] = 1;
|
||||
$cartHotelData[$prodKey]['date_diff'][$dateJoin]['data_form'] = date(
|
||||
@@ -1908,136 +1845,6 @@ class HotelCartBookingData extends ObjectModel
|
||||
);
|
||||
}
|
||||
|
||||
public function getCartExtraDemands(
|
||||
$idCart = 0,
|
||||
$idProduct = 0,
|
||||
$idRoom = 0,
|
||||
$dateFrom = 0,
|
||||
$dateTo = 0,
|
||||
$getTotalPrice = 0,
|
||||
$onlyRoomDemands = 0,
|
||||
$useTax = null
|
||||
) {
|
||||
if ($useTax === null) {
|
||||
$useTax = HotelBookingDetail::useTax();
|
||||
}
|
||||
$context = Context::getContext();
|
||||
if (isset($context->currency->id)
|
||||
&& Validate::isLoadedObject($context->currency)
|
||||
) {
|
||||
$idCurrency = (int)$context->currency->id;
|
||||
} else {
|
||||
$idCurrency = (int)Configuration::get('PS_CURRENCY_DEFAULT');
|
||||
}
|
||||
|
||||
if ($getTotalPrice) {
|
||||
$totalDemandsPrice = 0;
|
||||
}
|
||||
$sql = 'SELECT * FROM `'._DB_PREFIX_.'htl_cart_booking_data` WHERE 1';
|
||||
if ($idCart) {
|
||||
$sql .= ' AND `id_cart`='.(int) $idCart;
|
||||
}
|
||||
if ($idProduct) {
|
||||
$sql .= ' AND `id_product`='.(int) $idProduct;
|
||||
}
|
||||
if ($idRoom) {
|
||||
$sql .= ' AND `id_room`='.(int) $idRoom;
|
||||
}
|
||||
if ($dateFrom && $dateTo) {
|
||||
$sql .= ' AND `date_from` = \''.pSQL($dateFrom).'\' AND `date_to` = \''.pSQL($dateTo).'\'';
|
||||
}
|
||||
//if ($idCart && ($idRoom || ($idProduct && $dateFrom && $dateTo))) {
|
||||
if ($onlyRoomDemands) {
|
||||
if ($roomTypeDemands = Db::getInstance()->getRow($sql)) {
|
||||
$objRoomDemandPrice = new HotelRoomTypeDemandPrice();
|
||||
|
||||
if ($getTotalPrice) {
|
||||
if ($roomTypeDemands['extra_demands']
|
||||
&& ($extraDemand = json_decode($roomTypeDemands['extra_demands'], true))
|
||||
) {
|
||||
$totalDemandsPrice += $objRoomDemandPrice->getRoomTypeDemandsTotalPrice(
|
||||
$roomTypeDemands['id_product'],
|
||||
$extraDemand,
|
||||
$useTax,
|
||||
$roomTypeDemands['date_from'],
|
||||
$roomTypeDemands['date_to']
|
||||
);
|
||||
}
|
||||
} else {
|
||||
$roomTypeDemands['extra_demands'] = json_decode(
|
||||
$roomTypeDemands['extra_demands'],
|
||||
true
|
||||
);
|
||||
if (isset($roomTypeDemands['extra_demands']) && $roomTypeDemands['extra_demands']) {
|
||||
foreach ($roomTypeDemands['extra_demands'] as &$selDemand) {
|
||||
if ($selDemand['id_option']) {
|
||||
$objOption = new HotelRoomTypeGlobalDemandAdvanceOption(
|
||||
$selDemand['id_option'],
|
||||
$context->language->id
|
||||
);
|
||||
$selDemand['name'] = $objOption->name;
|
||||
} else {
|
||||
$objGlobalDemand = new HotelRoomTypeGlobalDemand(
|
||||
$selDemand['id_global_demand'],
|
||||
$context->language->id
|
||||
);
|
||||
$selDemand['name'] = $objGlobalDemand->name;
|
||||
}
|
||||
}
|
||||
}
|
||||
$roomTypeDemands = $roomTypeDemands['extra_demands'];
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if ($roomTypeDemands = Db::getInstance()->executeS($sql)) {
|
||||
$objRoomDemandPrice = new HotelRoomTypeDemandPrice();
|
||||
foreach ($roomTypeDemands as $key => &$demand) {
|
||||
if ($getTotalPrice) {
|
||||
if ($demand['extra_demands']
|
||||
&& ($extraDemand = json_decode($demand['extra_demands'], true))
|
||||
) {
|
||||
$totalDemandsPrice += $objRoomDemandPrice->getRoomTypeDemandsTotalPrice(
|
||||
$demand['id_product'],
|
||||
$extraDemand,
|
||||
$useTax,
|
||||
$demand['date_from'],
|
||||
$demand['date_to']
|
||||
);
|
||||
}
|
||||
} else {
|
||||
$demand['extra_demands'] = json_decode(
|
||||
$demand['extra_demands'],
|
||||
true
|
||||
);
|
||||
if (isset($demand['extra_demands']) && $demand['extra_demands']) {
|
||||
foreach ($demand['extra_demands'] as &$selDemand) {
|
||||
if ($selDemand['id_option']) {
|
||||
$objOption = new HotelRoomTypeGlobalDemandAdvanceOption(
|
||||
$selDemand['id_option'],
|
||||
$context->language->id
|
||||
);
|
||||
$selDemand['name'] = $objOption->name;
|
||||
} else {
|
||||
$objGlobalDemand = new HotelRoomTypeGlobalDemand(
|
||||
$selDemand['id_global_demand'],
|
||||
$context->language->id
|
||||
);
|
||||
$selDemand['name'] = $objGlobalDemand->name;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($getTotalPrice) {
|
||||
return $totalDemandsPrice;
|
||||
} else {
|
||||
return $roomTypeDemands;
|
||||
}
|
||||
}
|
||||
|
||||
public function save($null_values = false, $auto_date = true)
|
||||
{
|
||||
$return = parent::save($null_values = false, $auto_date = true);
|
||||
@@ -2049,31 +1856,11 @@ 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 ($extraDemands) {
|
||||
foreach ($extraDemands as &$demand) {
|
||||
$demand['id'] = $demand['id_global_demand'];
|
||||
}
|
||||
return $extraDemands;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -133,7 +133,6 @@ class HotelOrderRefundRules extends ObjectModel
|
||||
{
|
||||
$bookingCancellations = array();
|
||||
$objHtlRefundRules = new HotelBranchRefundRules();
|
||||
$objHotelBookingDemands = new HotelBookingDemands();
|
||||
$objServiceProductOrderDetail = new ServiceProductOrderDetail();
|
||||
|
||||
if ($bookingsToRefund = OrderReturn::getOrdersReturnDetail($idOrder, $idOrderReturn, $idHtlBooking)) {
|
||||
@@ -145,18 +144,6 @@ class HotelOrderRefundRules extends ObjectModel
|
||||
$adPaidAmount = 0;
|
||||
$refundValue = 0;
|
||||
|
||||
$totalDemandsPrice = $objHotelBookingDemands->getRoomTypeBookingExtraDemands(
|
||||
$objHtlBooking->id_order,
|
||||
$objHtlBooking->id_product,
|
||||
$objHtlBooking->id_room,
|
||||
$objHtlBooking->date_from,
|
||||
$objHtlBooking->date_to,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
$objHtlBooking->id
|
||||
);
|
||||
|
||||
$totalServicesPrice = $objServiceProductOrderDetail->getRoomTypeServiceProducts(
|
||||
0,
|
||||
0,
|
||||
@@ -172,7 +159,7 @@ class HotelOrderRefundRules extends ObjectModel
|
||||
0,
|
||||
$objHtlBooking->id
|
||||
);
|
||||
$totalAmount = $objHtlBooking->total_price_tax_incl + $totalDemandsPrice + $totalServicesPrice;
|
||||
$totalAmount = $objHtlBooking->total_price_tax_incl + $totalServicesPrice;
|
||||
|
||||
if ($refundRules = $objHtlRefundRules->getHotelRefundRules($objHtlBooking->id_hotel, 0, 1)) {
|
||||
$orderCurrency = $objOrder->id_currency;
|
||||
|
||||
@@ -131,7 +131,6 @@ class HotelReservationSystemDb
|
||||
`booking_type` tinyint(4) NOT NULL,
|
||||
`comment` text NOT NULL,
|
||||
`is_back_order` tinyint(4) NOT NULL,
|
||||
`extra_demands` text NOT NULL,
|
||||
`date_from` datetime NOT NULL,
|
||||
`date_to` datetime NOT NULL,
|
||||
`adults` smallint(6) NOT NULL,
|
||||
@@ -196,30 +195,6 @@ class HotelReservationSystemDb
|
||||
PRIMARY KEY (`id_htl_booking_document`)
|
||||
) ENGINE="._MYSQL_ENGINE_." DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;",
|
||||
|
||||
"CREATE TABLE IF NOT EXISTS `"._DB_PREFIX_."htl_booking_demands` (
|
||||
`id_booking_demand` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`id_htl_booking` int(11) NOT NULL,
|
||||
`name` varchar(255) character set utf8 NOT NULL,
|
||||
`unit_price_tax_excl` decimal(20,6) NOT NULL DEFAULT '0.000000',
|
||||
`unit_price_tax_incl` decimal(20,6) NOT NULL DEFAULT '0.000000',
|
||||
`total_price_tax_excl` decimal(20,6) NOT NULL DEFAULT '0.000000',
|
||||
`total_price_tax_incl` decimal(20,6) NOT NULL DEFAULT '0.000000',
|
||||
`price_calc_method` int(11) unsigned DEFAULT '0',
|
||||
`id_tax_rules_group` int(11) unsigned DEFAULT '0',
|
||||
`tax_computation_method` tinyint(1) unsigned NOT NULL DEFAULT '0',
|
||||
`date_add` datetime NOT NULL,
|
||||
`date_upd` datetime NOT NULL,
|
||||
PRIMARY KEY (`id_booking_demand`)
|
||||
) ENGINE="._MYSQL_ENGINE_." DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;",
|
||||
|
||||
"CREATE TABLE IF NOT EXISTS `"._DB_PREFIX_."htl_booking_demands_tax` (
|
||||
`id_booking_demand` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`id_tax` int(11) NOT NULL,
|
||||
`unit_amount` DECIMAL(16, 6) NOT NULL DEFAULT '0.00',
|
||||
`total_amount` DECIMAL(16, 6) NOT NULL DEFAULT '0.00',
|
||||
PRIMARY KEY (`id_booking_demand`, `id_tax`)
|
||||
) ENGINE="._MYSQL_ENGINE_." DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;",
|
||||
|
||||
"CREATE TABLE IF NOT EXISTS `"._DB_PREFIX_."htl_room_status` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`status` text NOT NULL,
|
||||
@@ -322,59 +297,6 @@ class HotelReservationSystemDb
|
||||
PRIMARY KEY (`id_feature_price`,`id_group`)
|
||||
) ENGINE="._MYSQL_ENGINE_." DEFAULT CHARSET=utf8;",
|
||||
|
||||
"CREATE TABLE IF NOT EXISTS `"._DB_PREFIX_."htl_room_type_global_demand` (
|
||||
`id_global_demand` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`price` decimal(20,6) NOT NULL DEFAULT '0.000000',
|
||||
`id_tax_rules_group` int(10) unsigned NOT NULL DEFAULT '0',
|
||||
`price_calc_method` tinyint(1) NOT NULL,
|
||||
`date_add` datetime NOT NULL,
|
||||
`date_upd` datetime NOT NULL,
|
||||
PRIMARY KEY (`id_global_demand`)
|
||||
) ENGINE="._MYSQL_ENGINE_." DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;",
|
||||
|
||||
"CREATE TABLE IF NOT EXISTS `"._DB_PREFIX_."htl_room_type_global_demand_lang` (
|
||||
`id_global_demand` int(10) unsigned NOT NULL,
|
||||
`id_lang` int(10) unsigned NOT NULL,
|
||||
`name` varchar(255) character set utf8 NOT NULL,
|
||||
PRIMARY KEY (`id_global_demand`, `id_lang`)
|
||||
) ENGINE="._MYSQL_ENGINE_." DEFAULT CHARSET=utf8;",
|
||||
|
||||
"CREATE TABLE IF NOT EXISTS `"._DB_PREFIX_."htl_room_type_global_demand_advance_option` (
|
||||
`id_option` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`id_global_demand` int(11) NOT NULL,
|
||||
`price` decimal(20,6) NOT NULL DEFAULT '0.000000',
|
||||
`date_add` datetime NOT NULL,
|
||||
`date_upd` datetime NOT NULL,
|
||||
PRIMARY KEY (`id_option`)
|
||||
) ENGINE="._MYSQL_ENGINE_." DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;",
|
||||
|
||||
"CREATE TABLE IF NOT EXISTS `"._DB_PREFIX_."htl_room_type_global_demand_advance_option_lang` (
|
||||
`id_option` int(10) unsigned NOT NULL,
|
||||
`id_lang` int(10) unsigned NOT NULL,
|
||||
`name` varchar(255) character set utf8 NOT NULL,
|
||||
PRIMARY KEY (`id_option`, `id_lang`)
|
||||
) ENGINE="._MYSQL_ENGINE_." DEFAULT CHARSET=utf8;",
|
||||
|
||||
"CREATE TABLE IF NOT EXISTS `"._DB_PREFIX_."htl_room_type_demand_price` (
|
||||
`id_room_type_demand_price` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`id_product` int(10) unsigned NOT NULL,
|
||||
`id_global_demand` int(10) unsigned NOT NULL,
|
||||
`id_option` int(10) unsigned NOT NULL,
|
||||
`price` decimal(20,6) NOT NULL DEFAULT '0.000000',
|
||||
`date_add` datetime NOT NULL,
|
||||
`date_upd` datetime NOT NULL,
|
||||
PRIMARY KEY (`id_room_type_demand_price`)
|
||||
) ENGINE="._MYSQL_ENGINE_." DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;",
|
||||
|
||||
"CREATE TABLE IF NOT EXISTS `"._DB_PREFIX_."htl_room_type_demand` (
|
||||
`id_room_type_demand` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`id_product` int(10) unsigned NOT NULL,
|
||||
`id_global_demand` int(10) unsigned NOT NULL,
|
||||
`date_add` datetime NOT NULL,
|
||||
`date_upd` datetime NOT NULL,
|
||||
PRIMARY KEY (`id_room_type_demand`)
|
||||
) ENGINE="._MYSQL_ENGINE_." DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;",
|
||||
|
||||
"CREATE TABLE IF NOT EXISTS `"._DB_PREFIX_."htl_room_type_service_product` (
|
||||
`id_room_type_service_product` int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`id_product` int(11) UNSIGNED NOT NULL,
|
||||
@@ -516,9 +438,8 @@ class HotelReservationSystemDb
|
||||
"INSERT INTO `"._DB_PREFIX_."htl_settings_link` (`id_settings_link`, `icon`, `link`, `new_window`, `position`, `unremovable`, `active`, `date_add`, `date_upd`) VALUES
|
||||
(1, 'icon-cogs', 'index.php?controller=AdminHotelGeneralSettings', 0, 0, 1, 1, NOW(), NOW()),
|
||||
(2, 'icon-dollar', 'index.php?controller=AdminHotelFeaturePricesSettings', 0, 2, 1, 1, NOW(), NOW()),
|
||||
(3, 'icon-plus-square', 'index.php?controller=AdminRoomTypeGlobalDemand', 0, 3, 1, 1, NOW(), NOW()),
|
||||
(4, 'icon-file-text', 'index.php?controller=AdminAboutHotelBlockSetting', 0, 4, 0, 1, NOW(), NOW()),
|
||||
(5, 'icon-th-list', 'index.php?controller=AdminFeaturesModuleSetting', 0, 5, 0, 1, NOW(), NOW());",
|
||||
(3, 'icon-file-text', 'index.php?controller=AdminAboutHotelBlockSetting', 0, 4, 0, 1, NOW(), NOW()),
|
||||
(4, 'icon-th-list', 'index.php?controller=AdminFeaturesModuleSetting', 0, 5, 0, 1, NOW(), NOW());",
|
||||
|
||||
"CREATE TABLE IF NOT EXISTS `"._DB_PREFIX_."htl_settings_link_lang` (
|
||||
`id_settings_link` int(10) unsigned NOT NULL,
|
||||
@@ -539,17 +460,12 @@ class HotelReservationSystemDb
|
||||
ORDER BY `id_lang`;",
|
||||
|
||||
"INSERT INTO `"._DB_PREFIX_."htl_settings_link_lang` (`id_settings_link`, `id_lang`, `name`, `hint`)
|
||||
SELECT 3, `id_lang`, 'Additional Facilities', 'Here create Additional facilities and their prices for room types.'
|
||||
SELECT 3, `id_lang`, 'Hotel Interior Block', 'Configure Hotel Interior block. You can display hotel interior images using this block. This block will be displayed on home page.'
|
||||
FROM `"._DB_PREFIX_."lang`
|
||||
ORDER BY `id_lang`;",
|
||||
|
||||
"INSERT INTO `"._DB_PREFIX_."htl_settings_link_lang` (`id_settings_link`, `id_lang`, `name`, `hint`)
|
||||
SELECT 4, `id_lang`, 'Hotel Interior Block', 'Configure Hotel Interior block. You can display hotel interior images using this block. This block will be displayed on home page.'
|
||||
FROM `"._DB_PREFIX_."lang`
|
||||
ORDER BY `id_lang`;",
|
||||
|
||||
"INSERT INTO `"._DB_PREFIX_."htl_settings_link_lang` (`id_settings_link`, `id_lang`, `name`, `hint`)
|
||||
SELECT 5, `id_lang`, 'Hotel Amenities Block', 'Configure Hotels Amenities settings. You can display hotel amenities images using this block. This block will be displayed on home page.'
|
||||
SELECT 4, `id_lang`, 'Hotel Amenities Block', 'Configure Hotels Amenities settings. You can display hotel amenities images using this block. This block will be displayed on home page.'
|
||||
FROM `"._DB_PREFIX_."lang`
|
||||
ORDER BY `id_lang`;",
|
||||
"CREATE TABLE IF NOT EXISTS `"._DB_PREFIX_."htl_connected_room` (
|
||||
@@ -595,8 +511,6 @@ class HotelReservationSystemDb
|
||||
`'._DB_PREFIX_.'htl_cart_booking_data`,
|
||||
`'._DB_PREFIX_.'htl_booking_detail`,
|
||||
`'._DB_PREFIX_.'htl_booking_document`,
|
||||
`'._DB_PREFIX_.'htl_booking_demands`,
|
||||
`'._DB_PREFIX_.'htl_booking_demands_tax`,
|
||||
`'._DB_PREFIX_.'htl_room_status`,
|
||||
`'._DB_PREFIX_.'htl_advance_payment`,
|
||||
`'._DB_PREFIX_.'htl_order_refund_rules`,
|
||||
@@ -607,12 +521,6 @@ class HotelReservationSystemDb
|
||||
`'._DB_PREFIX_.'htl_room_type_feature_pricing_lang`,
|
||||
`'._DB_PREFIX_.'htl_room_type_feature_pricing_group`,
|
||||
`'._DB_PREFIX_.'htl_room_type_feature_pricing_restriction`,
|
||||
`'._DB_PREFIX_.'htl_room_type_global_demand`,
|
||||
`'._DB_PREFIX_.'htl_room_type_global_demand_lang`,
|
||||
`'._DB_PREFIX_.'htl_room_type_global_demand_advance_option`,
|
||||
`'._DB_PREFIX_.'htl_room_type_global_demand_advance_option_lang`,
|
||||
`'._DB_PREFIX_.'htl_room_type_demand_price`,
|
||||
`'._DB_PREFIX_.'htl_room_type_demand`,
|
||||
`'._DB_PREFIX_.'htl_room_type_service_product`,
|
||||
`'._DB_PREFIX_.'htl_room_type_service_product_price`,
|
||||
`'._DB_PREFIX_.'product_option`,
|
||||
|
||||
@@ -1,387 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License version 3.0
|
||||
* that is bundled with this package in the file LICENSE.md
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* https://opensource.org/license/osl-3-0-php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to support@qloapps.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade this module to a 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
|
||||
* @copyright Since 2010 Webkul
|
||||
* @license https://opensource.org/license/osl-3-0-php Open Software License version 3.0
|
||||
*/
|
||||
|
||||
class HotelRoomTypeDemand extends ObjectModel
|
||||
{
|
||||
public $id_product;
|
||||
public $id_global_demand;
|
||||
public $date_add;
|
||||
public $date_upd;
|
||||
|
||||
protected static $_prices = array();
|
||||
|
||||
public static $definition = array(
|
||||
'table' => 'htl_room_type_demand',
|
||||
'primary' => 'id_room_type_demand',
|
||||
'fields' => array(
|
||||
'id_product' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
|
||||
'id_global_demand' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
|
||||
'date_add' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'),
|
||||
'date_upd' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'),
|
||||
)
|
||||
);
|
||||
|
||||
protected $webserviceParameters = array(
|
||||
'objectsNodeName' => 'room_type_demands',
|
||||
'objectNodeName' => 'room_type_demand',
|
||||
'fields' => array(
|
||||
'id_product' => array(
|
||||
'xlink_resource' => array(
|
||||
'resourceName' => 'room_types',
|
||||
)
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
public static function duplicateRoomTypeDemands($idProductOld, $idProductNew)
|
||||
{
|
||||
$idLang = Context::getContext()->language->id;
|
||||
$roomTypeDemands = Db::getInstance()->executeS(
|
||||
'SELECT * FROM `'._DB_PREFIX_.'htl_room_type_demand` rd
|
||||
LEFT JOIN `'._DB_PREFIX_.'htl_room_type_global_demand` rgd
|
||||
ON (rd.`id_global_demand` = rgd.`id_global_demand`)
|
||||
LEFT JOIN `'._DB_PREFIX_.'htl_room_type_global_demand_lang` rgdl
|
||||
ON (rgd.`id_global_demand` = rgdl.`id_global_demand` AND rgdl.`id_lang` = '.(int)$idLang.')
|
||||
WHERE rd.`id_product`='.(int)$idProductOld
|
||||
);
|
||||
|
||||
if (is_array($roomTypeDemands) && count($roomTypeDemands)) {
|
||||
$globalDemandOption = new HotelRoomTypeGlobalDemandAdvanceOption();
|
||||
foreach ($roomTypeDemands as $roomTypeDemand) {
|
||||
$idGlobalDemand = $roomTypeDemand['id_global_demand'];
|
||||
$objGlobalDemand = new HotelRoomTypeGlobalDemand($idGlobalDemand);
|
||||
$hotelRoomTypeDemandPrice = new HotelRoomTypeDemandPrice();
|
||||
|
||||
$objHRTDemand = new self();
|
||||
$objHRTDemand->id_product = $idProductNew;
|
||||
$objHRTDemand->id_global_demand = $idGlobalDemand;
|
||||
if (!$objHRTDemand->save()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$demandPrice = $roomTypeDemand['price'];
|
||||
if (Validate::isPrice($demandPrice)) {
|
||||
if ($objGlobalDemand->price != $demandPrice) {
|
||||
$objHRTDemandPrice = new HotelRoomTypeDemandPrice();
|
||||
$objHRTDemandPrice->id_product = $idProductNew;
|
||||
$objHRTDemandPrice->id_global_demand = $idGlobalDemand;
|
||||
$objHRTDemandPrice->id_option = 0;
|
||||
$objHRTDemandPrice->price = $demandPrice;
|
||||
if (!$objHRTDemandPrice->save()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$advOptions = $globalDemandOption->getGlobalDemandAdvanceOptions($idGlobalDemand, $idLang);
|
||||
if (is_array($advOptions) && count($advOptions)) {
|
||||
foreach ($advOptions as $option) {
|
||||
$objAdvOption = new HotelRoomTypeGlobalDemandAdvanceOption($option['id'], $idLang);
|
||||
$oldOptionPrice = $hotelRoomTypeDemandPrice->getRoomTypeDemandPrice(
|
||||
$idProductOld,
|
||||
$objAdvOption->id_global_demand,
|
||||
$option['id']
|
||||
);
|
||||
if (Validate::isPrice($oldOptionPrice)) {
|
||||
if ($oldOptionPrice != $objAdvOption->price) {
|
||||
$objHRTDemandPrice = new HotelRoomTypeDemandPrice();
|
||||
$objHRTDemandPrice->id_product = $idProductNew;
|
||||
$objHRTDemandPrice->id_global_demand = $idGlobalDemand;
|
||||
$objHRTDemandPrice->id_option = $option['id'];
|
||||
$objHRTDemandPrice->price = $oldOptionPrice;
|
||||
if (!$objHRTDemandPrice->save()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public function getRoomTypeDemands($idProduct, $idLang = 0, $useTax = null)
|
||||
{
|
||||
if (!$idLang) {
|
||||
$idLang = Context::getContext()->language->id;
|
||||
}
|
||||
$roomTypeDemandInfo = array();
|
||||
if ($roomTypeDemands = Db::getInstance()->executeS(
|
||||
'SELECT * FROM `'._DB_PREFIX_.'htl_room_type_demand` rd
|
||||
LEFT JOIN `'._DB_PREFIX_.'htl_room_type_global_demand` rgd
|
||||
ON (rd.`id_global_demand` = rgd.`id_global_demand`)
|
||||
LEFT JOIN `'._DB_PREFIX_.'htl_room_type_global_demand_lang` rgdl
|
||||
ON (rgd.`id_global_demand` = rgdl.`id_global_demand` AND rgdl.`id_lang` = '.(int)$idLang.')
|
||||
WHERE rd.`id_product`='.(int)$idProduct
|
||||
)) {
|
||||
$objAdvOption = new HotelRoomTypeGlobalDemandAdvanceOption();
|
||||
$objRoomDemandPrice = new HotelRoomTypeDemandPrice();
|
||||
$context = Context::getContext();
|
||||
if (isset($context->currency->id)
|
||||
&& Validate::isLoadedObject($context->currency)
|
||||
) {
|
||||
$idCurrency = (int)$context->currency->id;
|
||||
} else {
|
||||
$idCurrency = (int)Configuration::get('PS_CURRENCY_DEFAULT');
|
||||
}
|
||||
if ($useTax === null) {
|
||||
$useTax = HotelBookingDetail::useTax();
|
||||
}
|
||||
foreach ($roomTypeDemands as &$demand) {
|
||||
$idGlobalDemand = $demand['id_global_demand'];
|
||||
$roomTypeDemandInfo[$idGlobalDemand]['name'] = $demand['name'];
|
||||
$roomTypeDemandInfo[$idGlobalDemand]['price_calc_method'] = $demand['price_calc_method'];
|
||||
|
||||
$roomTypeDemandInfo[$idGlobalDemand]['price'] = HotelRoomTypeDemand::getPriceStatic(
|
||||
$idProduct,
|
||||
$idGlobalDemand,
|
||||
0,
|
||||
$useTax
|
||||
);
|
||||
$roomTypeDemandInfo[$idGlobalDemand]['price_tax_excl'] = HotelRoomTypeDemand::getPriceStatic(
|
||||
$idProduct,
|
||||
$idGlobalDemand,
|
||||
0,
|
||||
false
|
||||
);
|
||||
$roomTypeDemandInfo[$idGlobalDemand]['price_tax_incl'] = HotelRoomTypeDemand::getPriceStatic(
|
||||
$idProduct,
|
||||
$idGlobalDemand,
|
||||
0
|
||||
);
|
||||
if ($advOptions = $objAdvOption->getGlobalDemandAdvanceOptions($idGlobalDemand, $idLang)) {
|
||||
foreach ($advOptions as &$option) {
|
||||
$idOption = $option['id'];
|
||||
$roomTypeDemandInfo[$idGlobalDemand]['adv_option'][$idOption]['price'] = HotelRoomTypeDemand::getPriceStatic(
|
||||
$idProduct,
|
||||
$idGlobalDemand,
|
||||
$idOption,
|
||||
$useTax
|
||||
);
|
||||
$roomTypeDemandInfo[$idGlobalDemand]['adv_option'][$idOption]['price_tax_excl'] = HotelRoomTypeDemand::getPriceStatic(
|
||||
$idProduct,
|
||||
$idGlobalDemand,
|
||||
$idOption,
|
||||
false
|
||||
);
|
||||
$roomTypeDemandInfo[$idGlobalDemand]['adv_option'][$idOption]['price_tax_incl'] = HotelRoomTypeDemand::getPriceStatic(
|
||||
$idProduct,
|
||||
$idGlobalDemand,
|
||||
$idOption
|
||||
);
|
||||
$roomTypeDemandInfo[$idGlobalDemand]['adv_option'][$idOption]['name'] = $option['name'];
|
||||
}
|
||||
}
|
||||
}
|
||||
return $roomTypeDemandInfo;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static function getPriceStatic(
|
||||
$idProduct,
|
||||
$idGlobalDemand,
|
||||
$idOption = 0,
|
||||
$useTax = true,
|
||||
$decimals = 6,
|
||||
$idCustomer = null,
|
||||
$idCart = null,
|
||||
$id_address = null,
|
||||
?Context $context = null,
|
||||
$customPrice = null
|
||||
) {
|
||||
if (!$context) {
|
||||
$context = Context::getContext();
|
||||
}
|
||||
|
||||
$curCart = $context->cart;
|
||||
|
||||
if (!Validate::isBool($useTax) || !Validate::isUnsignedId($idProduct)) {
|
||||
die(Tools::displayError());
|
||||
}
|
||||
|
||||
// If there is cart in context or if the specified id_cart is different from the context cart id
|
||||
if (!is_object($curCart) || (Validate::isUnsignedInt($idCart) && $idCart && $curCart->id != $idCart)) {
|
||||
if (!$idCart && !isset($context->employee)) {
|
||||
die(Tools::displayError());
|
||||
}
|
||||
$curCart = new Cart($idCart);
|
||||
// Store cart in context to avoid multiple instantiations in BO
|
||||
if (!Validate::isLoadedObject($context->cart)) {
|
||||
$context->cart = $curCart;
|
||||
}
|
||||
}
|
||||
|
||||
$idCurrency = Validate::isLoadedObject($context->currency) ? (int)$context->currency->id : (int)Configuration::get('PS_CURRENCY_DEFAULT');
|
||||
|
||||
// retrieve address informations
|
||||
$idCountry = (int)$context->country->id;
|
||||
$idState = 0;
|
||||
$zipcode = 0;
|
||||
|
||||
if ($id_address) {
|
||||
$addressInfos = Address::getCountryAndState($id_address);
|
||||
} else {
|
||||
$addressInfos = Address::getCountryAndState(Cart::getIdAddressForTaxCalculation($idProduct));
|
||||
}
|
||||
if ($addressInfos['id_country']) {
|
||||
$idCountry = (int)$addressInfos['id_country'];
|
||||
$idState = (int)$addressInfos['id_state'];
|
||||
$zipcode = $addressInfos['postcode'];
|
||||
}
|
||||
if (Tax::excludeTaxeOption()) {
|
||||
$useTax = false;
|
||||
}
|
||||
|
||||
if (is_null($idCustomer) && Validate::isLoadedObject($context->customer)) {
|
||||
$idCustomer = $context->customer->id;
|
||||
}
|
||||
|
||||
return static::priceCalculation(
|
||||
$context->shop->id,
|
||||
$idProduct,
|
||||
$idGlobalDemand,
|
||||
$idOption,
|
||||
$idCountry,
|
||||
$idState,
|
||||
$zipcode,
|
||||
$idCurrency,
|
||||
$useTax,
|
||||
$decimals,
|
||||
$idCustomer,
|
||||
$idCart,
|
||||
$customPrice
|
||||
);
|
||||
}
|
||||
|
||||
public static function priceCalculation(
|
||||
$idShop,
|
||||
$idProduct,
|
||||
$idGlobalDemand,
|
||||
$idOption,
|
||||
$idCountry,
|
||||
$idState,
|
||||
$zipcode,
|
||||
$idCurrency,
|
||||
$useTax,
|
||||
$decimals,
|
||||
$idCustomer = 0,
|
||||
$idCart = 0,
|
||||
$customPrice = null
|
||||
) {
|
||||
static $address = null;
|
||||
static $context = null;
|
||||
|
||||
if ($address === null) {
|
||||
$address = new Address();
|
||||
}
|
||||
|
||||
if ($context == null) {
|
||||
$context = Context::getContext()->cloneContext();
|
||||
}
|
||||
|
||||
if ($idShop !== null && $context->shop->id != (int)$idShop) {
|
||||
$context->shop = new Shop((int)$idShop);
|
||||
}
|
||||
|
||||
$cacheId = (int)$idProduct.'-'.(int)$idGlobalDemand.'-'.(int)$idShop.'-'.(int)$idCurrency.'-'.
|
||||
(int)$idCountry.'-'.$idState.'-'.$zipcode.'-'.(int)$idOption.'-'.(int)$idCustomer.'-'.(int)$idCart.'-'.
|
||||
($useTax?'1':'0').'-'.(int)$decimals;
|
||||
|
||||
if (isset(self::$_prices[$cacheId])) {
|
||||
/* Affect reference before returning cache */
|
||||
return self::$_prices[$cacheId];
|
||||
}
|
||||
|
||||
// here get the price of global demand
|
||||
$objRoomDmdPrice = new HotelRoomTypeDemandPrice();
|
||||
if (!is_null($customPrice)) {
|
||||
$price = $customPrice;
|
||||
} else {
|
||||
if ($idOption) {
|
||||
$objOption = new HotelRoomTypeGlobalDemandAdvanceOption($idOption);
|
||||
$price = $objRoomDmdPrice->getRoomTypeDemandPrice(
|
||||
$idProduct,
|
||||
$idGlobalDemand,
|
||||
$idOption
|
||||
);
|
||||
if (!Validate::isPrice($price)) {
|
||||
$price = $objOption->price;
|
||||
}
|
||||
} else {
|
||||
$objGlobalDemand = new HotelRoomTypeGlobalDemand($idGlobalDemand);
|
||||
$price = $objRoomDmdPrice->getRoomTypeDemandPrice(
|
||||
$idProduct,
|
||||
$idGlobalDemand
|
||||
);
|
||||
if (!Validate::isPrice($price)) {
|
||||
$price = $objGlobalDemand->price;
|
||||
}
|
||||
}
|
||||
|
||||
$price = Tools::convertPrice($price, $idCurrency);
|
||||
}
|
||||
|
||||
// Tax calculation section
|
||||
$address->id_country = $idCountry;
|
||||
$address->id_state = $idState;
|
||||
$address->postcode = $zipcode;
|
||||
|
||||
$tax_manager = TaxManagerFactory::getManager(
|
||||
$address,
|
||||
HotelRoomTypeGlobalDemand::getIdTaxRulesGroupByIdGlobalDemanu((int)$idGlobalDemand)
|
||||
);
|
||||
$product_tax_calculator = $tax_manager->getTaxCalculator();
|
||||
|
||||
// Add Tax
|
||||
if ($useTax) {
|
||||
$price = $product_tax_calculator->addTaxes($price);
|
||||
}
|
||||
|
||||
$price = Tools::ps_round($price, $decimals);
|
||||
|
||||
if ($price < 0) {
|
||||
$price = 0;
|
||||
}
|
||||
|
||||
self::$_prices[$cacheId] = $price;
|
||||
return self::$_prices[$cacheId];
|
||||
}
|
||||
|
||||
public function deleteRoomTypeDemands($idProduct = 0, $idGlobalDemand = 0)
|
||||
{
|
||||
$where = '1';
|
||||
if ($idProduct) {
|
||||
$where .= ' AND `id_product`='.(int)$idProduct;
|
||||
}
|
||||
if ($idGlobalDemand) {
|
||||
$where .= ' AND `id_global_demand`='.(int)$idGlobalDemand;
|
||||
}
|
||||
return Db::getInstance()->delete(
|
||||
'htl_room_type_demand',
|
||||
$where
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,168 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License version 3.0
|
||||
* that is bundled with this package in the file LICENSE.md
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* https://opensource.org/license/osl-3-0-php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to support@qloapps.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade this module to a 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
|
||||
* @copyright Since 2010 Webkul
|
||||
* @license https://opensource.org/license/osl-3-0-php Open Software License version 3.0
|
||||
*/
|
||||
|
||||
class HotelRoomTypeDemandPrice extends ObjectModel
|
||||
{
|
||||
public $id_product;
|
||||
public $id_global_demand;
|
||||
public $id_option;
|
||||
public $price;
|
||||
public $date_add;
|
||||
public $date_upd;
|
||||
|
||||
public static $definition = array(
|
||||
'table' => 'htl_room_type_demand_price',
|
||||
'primary' => 'id_room_type_demand_price',
|
||||
'fields' => array(
|
||||
'id_product' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
|
||||
'id_global_demand' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
|
||||
'id_option' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
|
||||
'price' => array('type' => self::TYPE_FLOAT),
|
||||
'date_add' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'),
|
||||
'date_upd' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'),
|
||||
)
|
||||
);
|
||||
|
||||
public function getRoomTypeDemandPrice($idProduct, $idGlobalDemand, $idOption = 0)
|
||||
{
|
||||
return Db::getInstance()->getValue(
|
||||
'SELECT `price` FROM `'._DB_PREFIX_.'htl_room_type_demand_price` rdp
|
||||
WHERE `id_product`='.(int)$idProduct.
|
||||
' AND `id_global_demand`='.(int)$idGlobalDemand.
|
||||
' AND `id_option`='.(int)$idOption
|
||||
);
|
||||
}
|
||||
|
||||
public function getRoomTypeDemandsTotalPrice($idProduct, $roomDemands, $useTax = null, $dateFrom = 0, $dateTo = 0)
|
||||
{
|
||||
$totalDemandsPrice = 0;
|
||||
if ($roomDemands) {
|
||||
$context = Context::getContext();
|
||||
if (isset($context->currency->id)
|
||||
&& Validate::isLoadedObject($context->currency)
|
||||
) {
|
||||
$idCurrency = (int)$context->currency->id;
|
||||
} else {
|
||||
$idCurrency = (int)Configuration::get('PS_CURRENCY_DEFAULT');
|
||||
}
|
||||
$objRoomDmdPrice = new HotelRoomTypeDemandPrice();
|
||||
if ($useTax === null) {
|
||||
$useTax = HotelBookingDetail::useTax();
|
||||
}
|
||||
$objBookingDetail = new HotelBookingDetail();
|
||||
foreach ($roomDemands as $demand) {
|
||||
$idGlobalDemand = $demand['id_global_demand'];
|
||||
$idOption = $demand['id_option'];
|
||||
$objGlobalDemand = new HotelRoomTypeGlobalDemand($idGlobalDemand);
|
||||
if ($idOption) {
|
||||
$objOption = new HotelRoomTypeGlobalDemandAdvanceOption($idOption);
|
||||
$price = HotelRoomTypeDemand::getPriceStatic(
|
||||
$idProduct,
|
||||
$idGlobalDemand,
|
||||
$idOption,
|
||||
$useTax
|
||||
);
|
||||
} else {
|
||||
$price = HotelRoomTypeDemand::getPriceStatic(
|
||||
$idProduct,
|
||||
$idGlobalDemand,
|
||||
0,
|
||||
$useTax
|
||||
);
|
||||
}
|
||||
if ($objGlobalDemand->price_calc_method == HotelRoomTypeGlobalDemand::WK_PRICE_CALC_METHOD_EACH_DAY) {
|
||||
if ($dateFrom && $dateTo) {
|
||||
$numDays = HotelHelper::getNumberOfDays($dateFrom, $dateTo);
|
||||
if ($numDays > 1) {
|
||||
$price *= $numDays;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Rounding as per configurations
|
||||
$totalDemandsPrice += Tools::processPriceRounding($price);
|
||||
}
|
||||
}
|
||||
|
||||
return $totalDemandsPrice;
|
||||
}
|
||||
|
||||
public function deleteRoomTypeDemandPrices($idProduct = 0, $idGlobalDemand = 0, $idOption = 0)
|
||||
{
|
||||
$where = '1';
|
||||
if ($idProduct) {
|
||||
$where .= ' AND `id_product`='.(int)$idProduct;
|
||||
}
|
||||
if ($idGlobalDemand) {
|
||||
$where .= ' AND `id_global_demand`='.(int)$idGlobalDemand;
|
||||
}
|
||||
if ($idOption) {
|
||||
$where .= ' AND `id_option`='.(int)$idOption;
|
||||
}
|
||||
return Db::getInstance()->delete(
|
||||
'htl_room_type_demand_price',
|
||||
$where
|
||||
);
|
||||
}
|
||||
|
||||
public function delete()
|
||||
{
|
||||
// delete advance options of the global demands
|
||||
$objAdvOption = new HotelRoomTypeGlobalDemandAdvanceOption();
|
||||
if ($advOptions = $objAdvOption->getGlobalDemandAdvanceOptions($this->id)) {
|
||||
foreach ($advOptions as $option) {
|
||||
$objAdvOption = new HotelRoomTypeGlobalDemandAdvanceOption($option['id']);
|
||||
$objAdvOption->delete();
|
||||
}
|
||||
}
|
||||
// delete the global demands from cart
|
||||
$objCartBookingData = new HotelCartBookingData();
|
||||
if ($cartExtraDemands = $objCartBookingData->getCartExtraDemands()) {
|
||||
foreach ($cartExtraDemands as &$demandInfo) {
|
||||
if (isset($demandInfo['extra_demands']) && $demandInfo['extra_demands']) {
|
||||
$cartChanged = 0;
|
||||
foreach ($demandInfo['extra_demands'] as $key => $demand) {
|
||||
if ($this->id == $demand['id_global_demand']) {
|
||||
$cartChanged = 1;
|
||||
unset($demandInfo['extra_demands'][$key]);
|
||||
}
|
||||
}
|
||||
if ($cartChanged) {
|
||||
if (Validate::isLoadedObject($objCartBooking = new HotelCartBookingData($demandInfo['id']))) {
|
||||
$objCartBooking->extra_demands = json_encode($demandInfo['extra_demands']);
|
||||
$objCartBooking->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// delete the info from room type demands table
|
||||
$objRoomTypeDemand = new HotelRoomTypeDemand();
|
||||
$objRoomTypeDemand->deleteRoomTypeDemands(0, $this->id);
|
||||
$objRoomTypeDemandPrice = new HotelRoomTypeDemandPrice();
|
||||
$objRoomTypeDemandPrice->deleteRoomTypeDemandPrices(0, $this->id);
|
||||
return parent::delete();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,183 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License version 3.0
|
||||
* that is bundled with this package in the file LICENSE.md
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* https://opensource.org/license/osl-3-0-php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to support@qloapps.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade this module to a 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
|
||||
* @copyright Since 2010 Webkul
|
||||
* @license https://opensource.org/license/osl-3-0-php Open Software License version 3.0
|
||||
*/
|
||||
|
||||
class HotelRoomTypeGlobalDemand extends ObjectModel
|
||||
{
|
||||
public $name;
|
||||
public $price;
|
||||
public $id_tax_rules_group;
|
||||
public $price_calc_method;
|
||||
public $date_add;
|
||||
public $date_upd;
|
||||
|
||||
public static $definition = array(
|
||||
'table' => 'htl_room_type_global_demand',
|
||||
'primary' => 'id_global_demand',
|
||||
'multilang' => true,
|
||||
'fields' => array(
|
||||
'price' => array('type' => self::TYPE_FLOAT),
|
||||
'id_tax_rules_group' => array('type' => self::TYPE_INT),
|
||||
'price_calc_method' => array('type' => self::TYPE_INT),
|
||||
'date_add' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'),
|
||||
'date_upd' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'),
|
||||
//lang fields
|
||||
'name' => array(
|
||||
'type' => self::TYPE_STRING,
|
||||
'lang' => true,
|
||||
'validate' => 'isCatalogName',
|
||||
'required' => true,
|
||||
'size' => 128
|
||||
),
|
||||
));
|
||||
|
||||
protected $webserviceParameters = array(
|
||||
'objectsNodeName' => 'extra_demands',
|
||||
'objectNodeName' => 'extra_demand',
|
||||
'fields' => array(
|
||||
'id_tax_rules_group' => array(
|
||||
'xlink_resource' => array(
|
||||
'resourceName' => 'tax_rule_groups'
|
||||
)
|
||||
),
|
||||
),
|
||||
'associations' => array(
|
||||
'demand_advance_options' => array(
|
||||
'resource' => 'advance_option',
|
||||
'setter' => false,
|
||||
'fields' => array(
|
||||
'id' => array('required' => true),
|
||||
)
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
const WK_PRICE_CALC_METHOD_EACH_DAY = 1;
|
||||
const WK_PRICE_CALC_METHOD_RANGE = 0;
|
||||
|
||||
public function __construct($id = null, $id_lang = null, $id_shop = null)
|
||||
{
|
||||
parent::__construct($id, $id_lang, $id_shop);
|
||||
}
|
||||
|
||||
public function delete()
|
||||
{
|
||||
// delete advance options of the global demands
|
||||
$objAdvOption = new HotelRoomTypeGlobalDemandAdvanceOption();
|
||||
if ($advOptions = $objAdvOption->getGlobalDemandAdvanceOptions($this->id)) {
|
||||
foreach ($advOptions as $option) {
|
||||
$objAdvOption = new HotelRoomTypeGlobalDemandAdvanceOption($option['id']);
|
||||
$objAdvOption->delete();
|
||||
}
|
||||
}
|
||||
// delete the global demands from cart
|
||||
$objCartBookingData = new HotelCartBookingData();
|
||||
if ($cartExtraDemands = $objCartBookingData->getCartExtraDemands()) {
|
||||
foreach ($cartExtraDemands as &$demandInfo) {
|
||||
if (isset($demandInfo['extra_demands']) && $demandInfo['extra_demands']) {
|
||||
$cartChanged = 0;
|
||||
foreach ($demandInfo['extra_demands'] as $key => $demand) {
|
||||
if ($this->id == $demand['id_global_demand']) {
|
||||
$cartChanged = 1;
|
||||
unset($demandInfo['extra_demands'][$key]);
|
||||
}
|
||||
}
|
||||
if ($cartChanged) {
|
||||
if (Validate::isLoadedObject($objCartBooking = new HotelCartBookingData($demandInfo['id']))) {
|
||||
$objCartBooking->extra_demands = json_encode($demandInfo['extra_demands']);
|
||||
$objCartBooking->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// delete the info from room type demands table
|
||||
$objRoomTypeDemand = new HotelRoomTypeDemand();
|
||||
$objRoomTypeDemand->deleteRoomTypeDemands(0, $this->id);
|
||||
$objRoomTypeDemandPrice = new HotelRoomTypeDemandPrice();
|
||||
$objRoomTypeDemandPrice->deleteRoomTypeDemandPrices(0, $this->id);
|
||||
return parent::delete();
|
||||
}
|
||||
|
||||
public function getAllDemands($idLang = null)
|
||||
{
|
||||
if (!$idLang) {
|
||||
$idLang = Context::getContext()->language->id;
|
||||
}
|
||||
$sql = 'SELECT * FROM `'._DB_PREFIX_.'htl_room_type_global_demand` has
|
||||
LEFT JOIN `'._DB_PREFIX_.'htl_room_type_global_demand_lang` hasl
|
||||
ON (has.`id_global_demand` = hasl.`id_global_demand` AND hasl.`id_lang` = '.(int)$idLang.')';
|
||||
if ($demands = Db::getInstance()->executeS($sql)) {
|
||||
$objAdvOption = new HotelRoomTypeGlobalDemandAdvanceOption();
|
||||
foreach ($demands as &$demand) {
|
||||
$demand['adv_option'] = array();
|
||||
if ($advOptions = $objAdvOption->getGlobalDemandAdvanceOptions($demand['id_global_demand'], $idLang)) {
|
||||
$demand['adv_option'] = $advOptions;
|
||||
}
|
||||
}
|
||||
}
|
||||
return $demands;
|
||||
}
|
||||
|
||||
public static function getIdTaxRulesGroupByIdGlobalDemanu($idGlobalDemand)
|
||||
{
|
||||
$context = Context::getContext();
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue(
|
||||
'SELECT `id_tax_rules_group` FROM `'._DB_PREFIX_.'htl_room_type_global_demand`
|
||||
WHERE `id_global_demand` = '.(int)$idGlobalDemand
|
||||
);
|
||||
}
|
||||
|
||||
// Webservice :: get advance options of the global demand
|
||||
public function getWsDemandAdvanceOptions()
|
||||
{
|
||||
return Db::getInstance()->executeS(
|
||||
'SELECT `id_option` as `id` FROM `'._DB_PREFIX_.'htl_room_type_global_demand_advance_option` WHERE `id_global_demand` = '.(int)$this->id.' ORDER BY `id` ASC'
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
public function searchByName($query, $idLang = false)
|
||||
{
|
||||
if (!$idLang) {
|
||||
$idLang = Context::getContext()->language->id;
|
||||
}
|
||||
|
||||
return Db::getInstance()->executeS('
|
||||
SELECT rtgd.*, rtgdl.*, rtgdao.`price` AS `option_price`, rtgdaol.`name` AS `option_name`
|
||||
FROM `'._DB_PREFIX_.'htl_room_type_global_demand` rtgd
|
||||
LEFT JOIN `'._DB_PREFIX_.'htl_room_type_global_demand_lang` rtgdl
|
||||
ON rtgdl.`id_global_demand` = rtgd.`id_global_demand`
|
||||
LEFT JOIN `'._DB_PREFIX_.'htl_room_type_global_demand_advance_option` rtgdao
|
||||
ON rtgdao.`id_global_demand` = rtgd.`id_global_demand`
|
||||
LEFT JOIN `'._DB_PREFIX_.'htl_room_type_global_demand_advance_option_lang` rtgdaol
|
||||
ON (rtgdaol.`id_option` = rtgdao.`id_option` AND rtgdl.`id_lang` = rtgdaol.`id_lang`)
|
||||
WHERE (
|
||||
rtgdl.`name` LIKE \'%'.pSQL($query).'%\' OR
|
||||
rtgdaol.`name` LIKE \'%'.pSQL($query).'%\'
|
||||
)
|
||||
AND rtgdl.`id_lang`='.(int) $idLang
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,126 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License version 3.0
|
||||
* that is bundled with this package in the file LICENSE.md
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* https://opensource.org/license/osl-3-0-php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to support@qloapps.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade this module to a 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
|
||||
* @copyright Since 2010 Webkul
|
||||
* @license https://opensource.org/license/osl-3-0-php Open Software License version 3.0
|
||||
*/
|
||||
|
||||
class HotelRoomTypeGlobalDemandAdvanceOption extends ObjectModel
|
||||
{
|
||||
public $id_global_demand;
|
||||
public $name;
|
||||
public $price;
|
||||
public $date_add;
|
||||
public $date_upd;
|
||||
|
||||
public static $definition = array(
|
||||
'table' => 'htl_room_type_global_demand_advance_option',
|
||||
'primary' => 'id_option',
|
||||
'multilang' => true,
|
||||
'fields' => array(
|
||||
'id_global_demand' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
|
||||
'price' => array('type' => self::TYPE_FLOAT),
|
||||
'date_add' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'),
|
||||
'date_upd' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'),
|
||||
//lang fields
|
||||
'name' => array(
|
||||
'type' => self::TYPE_STRING,
|
||||
'lang' => true,
|
||||
'validate' => 'isCatalogName',
|
||||
'required' => true,
|
||||
'size' => 128
|
||||
),
|
||||
));
|
||||
|
||||
protected $webserviceParameters = array(
|
||||
'objectsNodeName' => 'advance_options',
|
||||
'objectNodeName' => 'advance_option',
|
||||
'fields' => array(
|
||||
'id_global_demand' => array(
|
||||
'xlink_resource' => array(
|
||||
'resourceName' => 'extra_demands'
|
||||
)
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
public function __construct($id = null, $id_lang = null, $id_shop = null)
|
||||
{
|
||||
parent::__construct($id, $id_lang, $id_shop);
|
||||
}
|
||||
|
||||
public function delete()
|
||||
{
|
||||
// delete the global demands from cart
|
||||
$objCartBookingData = new HotelCartBookingData();
|
||||
if ($cartExtraDemands = $objCartBookingData->getCartExtraDemands()) {
|
||||
foreach ($cartExtraDemands as &$demandInfo) {
|
||||
if (isset($demandInfo['extra_demands']) && $demandInfo['extra_demands']) {
|
||||
$cartChanged = 0;
|
||||
foreach ($demandInfo['extra_demands'] as $key => $demand) {
|
||||
if ($this->id == $demand['id_option']
|
||||
&& $this->id_global_demand == $demand['id_global_demand']
|
||||
) {
|
||||
$cartChanged = 1;
|
||||
unset($demandInfo['extra_demands'][$key]);
|
||||
}
|
||||
}
|
||||
if ($cartChanged) {
|
||||
if (Validate::isLoadedObject($objCartBooking = new HotelCartBookingData($demandInfo['id']))) {
|
||||
$objCartBooking->extra_demands = json_encode($demandInfo['extra_demands']);
|
||||
$objCartBooking->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// delete the info from room type demands table
|
||||
$objRoomTypeDemandPrice = new HotelRoomTypeDemandPrice();
|
||||
$objRoomTypeDemandPrice->deleteRoomTypeDemandPrices(0, $this->id_global_demand, $this->id);
|
||||
return parent::delete();
|
||||
}
|
||||
|
||||
public function getGlobalDemandAdvanceOptions($idGlobalDemand, $idLang = null)
|
||||
{
|
||||
$sql = 'SELECT * FROM `'._DB_PREFIX_.'htl_room_type_global_demand_advance_option`
|
||||
WHERE `id_global_demand` = '.(int)$idGlobalDemand;
|
||||
if ($advOptions = Db::getInstance()->executeS($sql)) {
|
||||
foreach ($advOptions as &$option) {
|
||||
$option = (array)(new HotelRoomTypeGlobalDemandAdvanceOption($option['id_option'], $idLang));
|
||||
}
|
||||
}
|
||||
return $advOptions;
|
||||
}
|
||||
|
||||
public function deleteGlobalDemandAdvanceOptions($idGlobalDemand, $skipIds = array())
|
||||
{
|
||||
$sql = 'SELECT * FROM `'._DB_PREFIX_.'htl_room_type_global_demand_advance_option`
|
||||
WHERE `id_global_demand` = '.(int)$idGlobalDemand;
|
||||
if (count($skipIds)) {
|
||||
$sql .= ' AND `id_option` NOT IN ('.pSQL(implode(',', $skipIds)).')' ;
|
||||
}
|
||||
if ($advOptions = Db::getInstance()->executeS($sql)) {
|
||||
foreach ($advOptions as &$option) {
|
||||
$objOption = new HotelRoomTypeGlobalDemandAdvanceOption($option['id_option']);
|
||||
$objOption->delete();
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -497,7 +497,6 @@ class ServiceProductOrderDetail extends ObjectModel
|
||||
|
||||
// things to do if order is not paid
|
||||
if (!$hasOrderDiscountOrPayment) {
|
||||
$objHotelBookingDemands = new HotelBookingDemands();
|
||||
$objServiceProductOrderDetail = new ServiceProductOrderDetail();
|
||||
|
||||
$reduction_amount['total_price_tax_excl'] = (float) $this->total_price_tax_excl;
|
||||
|
||||
@@ -753,7 +753,6 @@ class AdminHotelRoomsBookingController extends ModuleAdminController
|
||||
$date_from,
|
||||
$date_to,
|
||||
array(),
|
||||
array(),
|
||||
$id_cart,
|
||||
$id_guest,
|
||||
$booking_type,
|
||||
|
||||
@@ -1,345 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License version 3.0
|
||||
* that is bundled with this package in the file LICENSE.md
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* https://opensource.org/license/osl-3-0-php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to support@qloapps.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade this module to a 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
|
||||
* @copyright Since 2010 Webkul
|
||||
* @license https://opensource.org/license/osl-3-0-php Open Software License version 3.0
|
||||
*/
|
||||
|
||||
class AdminRoomTypeGlobalDemandController extends ModuleAdminController
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->table = 'htl_room_type_global_demand';
|
||||
$this->className = 'HotelRoomTypeGlobalDemand';
|
||||
$this->bootstrap = true;
|
||||
$this->identifier = 'id_global_demand';
|
||||
parent::__construct();
|
||||
|
||||
$this->toolbar_title = $this->l('Manage Additional Facilities');
|
||||
|
||||
$this->_join .= ' LEFT JOIN `'._DB_PREFIX_.'htl_room_type_global_demand_lang` asl
|
||||
ON (a.id_global_demand = asl.id_global_demand)';
|
||||
|
||||
$this->_join .= ' LEFT JOIN `'._DB_PREFIX_.'htl_room_type_global_demand_advance_option` dao
|
||||
ON (a.id_global_demand = dao.id_global_demand)';
|
||||
|
||||
$this->_select .= ' a.`price` as global_price, asl.`name` as global_name,';
|
||||
|
||||
$this->_select .= ' IF(SUM(dao.`id_option`), 1, 0) as adv_options,';
|
||||
$this->_select .= ' IF(SUM(dao.`id_option`), "'.$this->l('Yes').'", "'.$this->l('No').'") as has_adv_option,';
|
||||
$this->_select .= ' IF(SUM(dao.`id_option`), 1, 0) badge_success, IF(SUM(dao.`id_option`), 0, 1) badge_danger,' ;
|
||||
|
||||
$this->_where = ' AND asl.`id_lang` = '.(int) $this->context->language->id;
|
||||
$this->_group = ' GROUP BY a.`id_global_demand`';
|
||||
$advOptList = array(
|
||||
1 => $this->l('Yes'),
|
||||
0 => $this->l('No'),
|
||||
);
|
||||
|
||||
$priceCalcList = array(
|
||||
HotelRoomTypeGlobalDemand::WK_PRICE_CALC_METHOD_EACH_DAY => $this->l('Yes'),
|
||||
HotelRoomTypeGlobalDemand::WK_PRICE_CALC_METHOD_RANGE => $this->l('No'),
|
||||
);
|
||||
|
||||
$this->fields_list = array(
|
||||
'id_global_demand' => array(
|
||||
'title' => $this->l('Id'),
|
||||
'align' => 'center',
|
||||
),
|
||||
'global_name' => array(
|
||||
'title' => $this->l('Name'),
|
||||
'align' => 'center',
|
||||
'havingFilter' => true,
|
||||
'filter_key' => 'global_name',
|
||||
),
|
||||
'price_calc_method' => array(
|
||||
'title' => $this->l('Per day price calculation'),
|
||||
'hint' => $this->l('Yes, if price of the facility is charged for each day in the booking. No, If price of the facility is charged for entire date range of the booking.'),
|
||||
'align' => 'center',
|
||||
'type' => 'select',
|
||||
'callback' => 'getPriceCalculationMethod',
|
||||
'list' => $priceCalcList,
|
||||
'class' => 'fixed-width-xs',
|
||||
'havingFilter' => true,
|
||||
'filter_key' => 'price_calc_method',
|
||||
),
|
||||
'has_adv_option' => array(
|
||||
'title' => $this->l('Advance Options'),
|
||||
'hint' => $this->l('Yes, if this activity includes a price. No, if activity has no price'),
|
||||
'align' => 'center',
|
||||
'type' => 'bool',
|
||||
'type' => 'select',
|
||||
'list' => $advOptList,
|
||||
'badge_success' => true,
|
||||
'badge_danger' => true,
|
||||
'class' => 'fixed-width-xs',
|
||||
'havingFilter' => true,
|
||||
'filter_key' => 'adv_options',
|
||||
),
|
||||
'global_price' => array(
|
||||
'title' => $this->l('Price'),
|
||||
'hint' => $this->l('If demand have advance options then you need to go to edit page of the demand to see price information else price will be shown in the list.'),
|
||||
'align' => 'center',
|
||||
'havingFilter' => true,
|
||||
'callback' => 'getGlobalDemandPrice',
|
||||
'filter_key' => 'global_price',
|
||||
),
|
||||
);
|
||||
|
||||
$this->bulk_actions = array(
|
||||
'delete' => array(
|
||||
'text' => $this->l('Delete selected'),
|
||||
'icon' => 'icon-trash',
|
||||
'confirm' => $this->l('Delete selected items?'),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
// return the yes/no for the price calculation method of the demand
|
||||
public function getPriceCalculationMethod($priceCalcMethod, $row)
|
||||
{
|
||||
$this->context->smarty->assign('priceCalcMethod', $priceCalcMethod);
|
||||
return $this->context->smarty->fetch(
|
||||
_PS_MODULE_DIR_.$this->module->name.
|
||||
'/views/templates/admin/room_type_global_demand/_partials/price_calc_method_badge.tpl'
|
||||
);
|
||||
}
|
||||
|
||||
public function getGlobalDemandPrice($price, $row)
|
||||
{
|
||||
if (isset($row['adv_options']) && $row['adv_options']) {
|
||||
return '--';
|
||||
} else {
|
||||
return Tools::displayPrice($price);
|
||||
}
|
||||
}
|
||||
|
||||
public function initToolbar()
|
||||
{
|
||||
parent::initToolbar();
|
||||
if (empty($this->display)) {
|
||||
$this->page_header_toolbar_btn['new'] = array(
|
||||
'href' => self::$currentIndex.'&add'.$this->table.'&token='.$this->token,
|
||||
'desc' => $this->l('Add New Facility'),
|
||||
'imgclass' => 'new'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
public function renderList()
|
||||
{
|
||||
$this->addRowAction('edit');
|
||||
$this->addRowAction('delete');
|
||||
return parent::renderList();
|
||||
}
|
||||
|
||||
public function renderForm()
|
||||
{
|
||||
$smartyVars = array();
|
||||
$objCurrency = new Currency(Configuration::get('PS_CURRENCY_DEFAULT'));
|
||||
$smartyVars['defaultcurrencySign'] = $objCurrency->sign;
|
||||
$currentLangId = $this->default_form_language ? $this->default_form_language : Configuration::get('PS_LANG_DEFAULT');
|
||||
$languages = Language::getLanguages(false);
|
||||
$smartyVars['languages'] = $languages;
|
||||
$currentLang = Language::getLanguage((int) $currentLangId);
|
||||
$smartyVars['currentLang'] = $currentLang;
|
||||
if ($this->display == 'edit') {
|
||||
$idDemand = Tools::getValue('id_global_demand');
|
||||
if (Validate::isLoadedObject(
|
||||
$objGlobalDemand = new HotelRoomTypeGlobalDemand($idDemand)
|
||||
)) {
|
||||
$smartyVars['globalDemands'] = (array)$objGlobalDemand;
|
||||
$objAdvOption = new HotelRoomTypeGlobalDemandAdvanceOption();
|
||||
$smartyVars['globalDemands']['adv_option'] = array();
|
||||
if ($advOptions = $objAdvOption->getGlobalDemandAdvanceOptions($idDemand)) {
|
||||
$smartyVars['globalDemands']['adv_option'] = $advOptions;
|
||||
}
|
||||
$smartyVars['edit'] = 1;
|
||||
}
|
||||
}
|
||||
//show tax rule group
|
||||
if ($taxRuleGroups = TaxRulesGroup::getTaxRulesGroups(true)) {
|
||||
$smartyVars['taxRuleGroups'] = $taxRuleGroups;
|
||||
}
|
||||
Media::addJsDef(
|
||||
array(
|
||||
'globalDemandLink' => $this->context->link->getAdminLink('AdminRoomTypeGlobalDemand'),
|
||||
'currentLang' => $currentLang,
|
||||
'languages' => $languages,
|
||||
'defaultcurrencySign' => $objCurrency->sign,
|
||||
'img_dir_l' => _PS_IMG_.'l/',
|
||||
)
|
||||
);
|
||||
$smartyVars['ps_img_dir'] = _PS_IMG_.'l/';
|
||||
$this->context->smarty->assign($smartyVars);
|
||||
|
||||
$this->fields_form = array(
|
||||
'submit' => array(
|
||||
'title' => $this->l('Save'),
|
||||
),
|
||||
);
|
||||
return parent::renderForm();
|
||||
}
|
||||
|
||||
public function processSave()
|
||||
{
|
||||
$idDemand = Tools::getValue('id_global_demand');
|
||||
$price = Tools::getValue('price');
|
||||
$idTaxRulesGroup = Tools::getValue('id_tax_rules_group');
|
||||
$priceCalcMethod = Tools::getValue('price_calc_method');
|
||||
$activeAdvOpt = Tools::getValue('active_adv_option');
|
||||
$advOptPrices = Tools::getValue('option_price');
|
||||
$advOptIds = Tools::getValue('id_option');
|
||||
// check if field is atleast in default language. Not available in default prestashop
|
||||
$defaultLangId = Configuration::get('PS_LANG_DEFAULT');
|
||||
$objDefaultLanguage = Language::getLanguage((int) $defaultLangId);
|
||||
$languages = Language::getLanguages(false);
|
||||
|
||||
if (!trim(Tools::getValue('demand_name_'.$defaultLangId))) {
|
||||
$this->errors[] = $this->l('Facility name is required at least in ').
|
||||
$objDefaultLanguage['name'];
|
||||
} else {
|
||||
foreach ($languages as $lang) {
|
||||
// validate non required fields
|
||||
if (trim(Tools::getValue('demand_name_'.$lang['id_lang']))) {
|
||||
if (!Validate::isGenericName(Tools::getValue('demand_name_'.$lang['id_lang']))) {
|
||||
$this->errors[] = $this->l('Invalid facility name in ').$lang['name'];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!$activeAdvOpt) {
|
||||
if (!Validate::isPrice($price)) {
|
||||
$this->errors[] = $this->l('Please enter a valid price.');
|
||||
}
|
||||
} else {
|
||||
$price = 0;
|
||||
}
|
||||
if ($activeAdvOpt && !$advOptPrices) {
|
||||
$this->errors[] = $this->l('Please create at least one advance option for the service.');
|
||||
}
|
||||
// validate non advance options
|
||||
if ($activeAdvOpt && $advOptPrices) {
|
||||
foreach ($advOptPrices as $key => $advPrice) {
|
||||
if (!trim(Tools::getValue('option_name_'.$defaultLangId)[$key])) {
|
||||
$this->errors[] = $this->l('Advance option name is required at least in ').
|
||||
$objDefaultLanguage['name'];
|
||||
} else {
|
||||
foreach ($languages as $lang) {
|
||||
if (trim(Tools::getValue('option_name_'.$lang['id_lang'])[$key])) {
|
||||
if (!Validate::isGenericName(
|
||||
Tools::getValue('option_name_'.$lang['id_lang'])[$key]
|
||||
)) {
|
||||
$this->errors[] = $this->l('Invalid advance option name in ').$lang['name'];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!Validate::isPrice($advPrice)) {
|
||||
$this->errors[] = $this->l('Please enter a valid price for advance option.');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!count($this->errors)) {
|
||||
if ($idDemand) {
|
||||
$objGlobalDemand = new HotelRoomTypeGlobalDemand($idDemand);
|
||||
} else {
|
||||
$objGlobalDemand = new HotelRoomTypeGlobalDemand();
|
||||
}
|
||||
// lang fields
|
||||
foreach ($languages as $lang) {
|
||||
if (!trim(Tools::getValue('demand_name_'.$lang['id_lang']))) {
|
||||
$objGlobalDemand->name[$lang['id_lang']] = Tools::getValue(
|
||||
'demand_name_'.$defaultLangId
|
||||
);
|
||||
} else {
|
||||
$objGlobalDemand->name[$lang['id_lang']] = Tools::getValue(
|
||||
'demand_name_'.$lang['id_lang']
|
||||
);
|
||||
}
|
||||
}
|
||||
$objGlobalDemand->price = $price;
|
||||
$objGlobalDemand->id_tax_rules_group = $idTaxRulesGroup;
|
||||
$objGlobalDemand->price_calc_method = $priceCalcMethod;
|
||||
if ($objGlobalDemand->save()) {
|
||||
$objOption = new HotelRoomTypeGlobalDemandAdvanceOption();
|
||||
$skipIds = array();
|
||||
// if active advance payment then only add in skipIds else delete all
|
||||
if ($activeAdvOpt && $advOptIds) {
|
||||
foreach ($advOptIds as $idOpt) {
|
||||
if ($idOpt) {
|
||||
$skipIds[] = $idOpt;
|
||||
}
|
||||
}
|
||||
}
|
||||
$objOption->deleteGlobalDemandAdvanceOptions($objGlobalDemand->id, $skipIds);
|
||||
if ($activeAdvOpt && $advOptPrices) {
|
||||
foreach ($advOptPrices as $key => $advPrice) {
|
||||
if (isset($advOptIds[$key]) && $advOptIds[$key]) {
|
||||
$objAdvOption = new HotelRoomTypeGlobalDemandAdvanceOption($advOptIds[$key]);
|
||||
} else {
|
||||
$objAdvOption = new HotelRoomTypeGlobalDemandAdvanceOption();
|
||||
}
|
||||
$objAdvOption->id_global_demand = $objGlobalDemand->id;
|
||||
// advance options lang fields
|
||||
foreach ($languages as $lang) {
|
||||
if (!trim(Tools::getValue('option_name_'.$lang['id_lang'])[$key])) {
|
||||
$objAdvOption->name[$lang['id_lang']] = Tools::getValue(
|
||||
'option_name_'.$defaultLangId
|
||||
)[$key];
|
||||
} else {
|
||||
$objAdvOption->name[$lang['id_lang']] = Tools::getValue(
|
||||
'option_name_'.$lang['id_lang']
|
||||
)[$key];
|
||||
}
|
||||
}
|
||||
$objAdvOption->price = $advPrice;
|
||||
$objAdvOption->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!count($this->errors)) {
|
||||
if (Tools::isSubmit('submitAdd'.$this->table.'AndStay')) {
|
||||
Tools::redirectAdmin(
|
||||
self::$currentIndex.'&id_global_demand='.(int) $objGlobalDemand->id.'&update'.$this->table.
|
||||
'&conf=3&token='.$this->token
|
||||
);
|
||||
} else {
|
||||
Tools::redirectAdmin(self::$currentIndex.'&conf=4&token='.$this->token);
|
||||
}
|
||||
} else {
|
||||
// if product is saved but some errors are occurred while saving time slots information
|
||||
$this->warnings[] = $this->l('Facility is saved successfully. But advance options with invalid data are not saved. Please correct the invalid data.');
|
||||
}
|
||||
}
|
||||
if ($idDemand) {
|
||||
$this->display = 'edit';
|
||||
} else {
|
||||
$this->display = 'add';
|
||||
}
|
||||
}
|
||||
|
||||
public function setMedia()
|
||||
{
|
||||
parent::setMedia();
|
||||
$this->addJs(_MODULE_DIR_.'hotelreservationsystem/views/js/HotelReservationAdmin.js');
|
||||
$this->addJs(_MODULE_DIR_.'hotelreservationsystem/views/js/roomTypeGlobalDemand.js');
|
||||
}
|
||||
}
|
||||
@@ -38,11 +38,6 @@ require_once 'classes/HotelRoomTypeFeaturePricing.php';
|
||||
require_once 'classes/HotelRoomTypeFeaturePricingRestriction.php';
|
||||
require_once 'classes/ChannelOrderPayment.php';
|
||||
|
||||
require_once 'classes/HotelBookingDemands.php';
|
||||
require_once 'classes/HotelRoomTypeGlobalDemand.php';
|
||||
require_once 'classes/HotelRoomTypeGlobalDemandAdvanceOption.php';
|
||||
require_once 'classes/HotelRoomTypeDemandPrice.php';
|
||||
require_once 'classes/HotelRoomTypeDemand.php';
|
||||
require_once 'classes/HotelRoomTypeRestrictionDateRange.php';
|
||||
|
||||
require_once 'classes/HotelRoomDisableDates.php';
|
||||
|
||||
@@ -55,9 +55,6 @@ class HotelReservationSystem extends Module
|
||||
'advance_payments' => array('description' => 'Room type advance payment', 'class' => 'HotelAdvancedPayment'),
|
||||
'cart_bookings' => array('description' => 'Cart bookings', 'class' => 'HotelCartBookingData'),
|
||||
'room_bookings' => array('description' => 'Room bookings', 'class' => 'HotelBookingDetail'),
|
||||
'booking_extra_demands' => array('description' => 'Booking extra demands', 'class' => 'HotelBookingDemands'),
|
||||
'extra_demands' => array('description' => 'Extra demands', 'class' => 'HotelRoomTypeGlobalDemand'),
|
||||
'demand_advance_options' => array('description' => 'Extra demand advance options', 'class' => 'HotelRoomTypeGlobalDemandAdvanceOption'),
|
||||
'hotel_ari' => array('description' => 'Search availability, rates and inventory', 'specific_management' => true),
|
||||
);
|
||||
|
||||
@@ -119,10 +116,7 @@ class HotelReservationSystem extends Module
|
||||
$obj_cart_bk_data = new HotelCartBookingData();
|
||||
$obj_htl_bk_dtl = new HotelBookingDetail();
|
||||
$obj_rm_type = new HotelRoomType();
|
||||
$objBookingDemand = new HotelBookingDemands();
|
||||
$objServiceProductOrderDetail = new ServiceProductOrderDetail();
|
||||
$result['total_extra_demands_te'] = 0;
|
||||
$result['total_extra_demands_ti'] = 0;
|
||||
$cart_htl_data = array();
|
||||
if (!empty($products)) {
|
||||
foreach ($products as $type_key => $type_value) {
|
||||
@@ -171,34 +165,6 @@ class HotelReservationSystem extends Module
|
||||
|
||||
|
||||
$cart_htl_data[$type_key]['date_diff'][$date_join]['amount'] = $roomTypeDateRangePrice['total_price_tax_incl']*$vart_quant;
|
||||
// extra demands prices
|
||||
$cart_htl_data[$type_key]['date_diff'][$date_join]['extra_demands'] = $objBookingDemand->getRoomTypeBookingExtraDemands(
|
||||
$order->id,
|
||||
$type_value['product_id'],
|
||||
0,
|
||||
$data_v['date_from'],
|
||||
$data_v['date_to']
|
||||
);
|
||||
$cart_htl_data[$type_key]['date_diff'][$date_join]['extra_demands_price_te'] = $objBookingDemand->getRoomTypeBookingExtraDemands(
|
||||
$order->id,
|
||||
$type_value['product_id'],
|
||||
0,
|
||||
$data_v['date_from'],
|
||||
$data_v['date_to'],
|
||||
0,
|
||||
1,
|
||||
0
|
||||
);
|
||||
$cart_htl_data[$type_key]['date_diff'][$date_join]['extra_demands_price_ti'] = $objBookingDemand->getRoomTypeBookingExtraDemands(
|
||||
$order->id,
|
||||
$type_value['product_id'],
|
||||
0,
|
||||
$data_v['date_from'],
|
||||
$data_v['date_to'],
|
||||
0,
|
||||
1,
|
||||
1
|
||||
);
|
||||
} else {
|
||||
$num_days = HotelHelper::getNumberOfDays($data_v['date_from'], $data_v['date_to']);
|
||||
|
||||
@@ -212,34 +178,6 @@ class HotelReservationSystem extends Module
|
||||
$roomTypeDateRangePrice = HotelRoomTypeFeaturePricing::getRoomTypeTotalPrice($type_value['id_product'], $data_v['date_from'], $data_v['date_to']);
|
||||
|
||||
$cart_htl_data[$type_key]['date_diff'][$date_join]['amount'] = $roomTypeDateRangePrice['total_price_tax_incl'];
|
||||
// extra demands prices
|
||||
$cart_htl_data[$type_key]['date_diff'][$date_join]['extra_demands'] = $objBookingDemand->getRoomTypeBookingExtraDemands(
|
||||
$order->id,
|
||||
$type_value['product_id'],
|
||||
0,
|
||||
$data_v['date_from'],
|
||||
$data_v['date_to']
|
||||
);
|
||||
$cart_htl_data[$type_key]['date_diff'][$date_join]['extra_demands_price_te'] = $objBookingDemand->getRoomTypeBookingExtraDemands(
|
||||
$order->id,
|
||||
$type_value['product_id'],
|
||||
0,
|
||||
$data_v['date_from'],
|
||||
$data_v['date_to'],
|
||||
0,
|
||||
1,
|
||||
0
|
||||
);
|
||||
$cart_htl_data[$type_key]['date_diff'][$date_join]['extra_demands_price_ti'] = $objBookingDemand->getRoomTypeBookingExtraDemands(
|
||||
$order->id,
|
||||
$type_value['product_id'],
|
||||
0,
|
||||
$data_v['date_from'],
|
||||
$data_v['date_to'],
|
||||
0,
|
||||
1,
|
||||
1
|
||||
);
|
||||
|
||||
$cart_htl_data[$type_key]['date_diff'][$date_join]['additional_services'] = $objServiceProductOrderDetail->getRoomTypeServiceProducts(
|
||||
$order->id,
|
||||
@@ -271,8 +209,6 @@ class HotelReservationSystem extends Module
|
||||
1,
|
||||
0
|
||||
);
|
||||
$result['total_extra_demands_te'] += $cart_htl_data[$type_key]['date_diff'][$date_join]['extra_demands_price_te'];
|
||||
$result['total_extra_demands_ti'] += $cart_htl_data[$type_key]['date_diff'][$date_join]['extra_demands_price_ti'];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -408,12 +344,6 @@ class HotelReservationSystem extends Module
|
||||
// delete the disable dates (temporary inactive status) of the room type
|
||||
$objRoomDisableDates = new HotelRoomDisableDates();
|
||||
$objRoomDisableDates->deleteRoomDisableDatesByIdRoomType($idProduct);
|
||||
|
||||
// delete all the additional demand prices and demands of this room type
|
||||
$objRoomTypeDemandPrice = new HotelRoomTypeDemandPrice();
|
||||
$objRoomTypeDemandPrice->deleteRoomTypeDemandPrices($idProduct); // delete prices for room type
|
||||
$objRoomTypeDemand = new HotelRoomTypeDemand();
|
||||
$objRoomTypeDemand->deleteRoomTypeDemands($idProduct); // delete additional demands for room type
|
||||
}
|
||||
}
|
||||
|
||||
@@ -474,8 +404,6 @@ class HotelReservationSystem extends Module
|
||||
'htl_room_type_feature_pricing',
|
||||
'htl_branch_info',
|
||||
'htl_features',
|
||||
'htl_room_type_global_demand',
|
||||
'htl_room_type_global_demand_advance_option',
|
||||
'htl_order_refund_rules',
|
||||
'htl_settings_link',
|
||||
'htl_bed_type'
|
||||
@@ -504,14 +432,6 @@ class HotelReservationSystem extends Module
|
||||
|
||||
public function HookActionCartSummary($params)
|
||||
{
|
||||
// $objCartBookingData = new HotelCartBookingData();
|
||||
// $totalFacilityCostTI = $objCartBookingData->getCartExtraDemands($params['cart']->id, 0, 0, 0, 0, 1, 0, 1);
|
||||
// $totalFacilityCostTE = $objCartBookingData->getCartExtraDemands($params['cart']->id, 0, 0, 0, 0, 1, 0, 0);
|
||||
// return array(
|
||||
// 'additional_facilities_tax' => ($totalFacilityCostTI - $totalFacilityCostTE),
|
||||
// 'totalFacilityCostTE' => $totalFacilityCostTE,
|
||||
// 'totalFacilityCostTI' => $totalFacilityCostTI,
|
||||
// );
|
||||
return array();
|
||||
}
|
||||
|
||||
@@ -529,7 +449,6 @@ class HotelReservationSystem extends Module
|
||||
// Controllers without tabs
|
||||
$this->installTab('AdminHotelGeneralSettings', 'Hotel General Configuration', 'AdminHotelConfigurationSetting', false);
|
||||
$this->installTab('AdminHotelFeaturePricesSettings', 'Advanced Price Rules', 'AdminHotelConfigurationSetting', false);
|
||||
$this->installTab('AdminRoomTypeGlobalDemand', 'Additional Demand Configuration', 'AdminHotelConfigurationSetting', false);
|
||||
$this->installTab('AdminBookingDocument', 'Booking Documents', false, false);
|
||||
|
||||
return true;
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
<td class="text-center">{$cart_data['room_type']|escape:'htmlall':'UTF-8'}</td>
|
||||
{assign var="is_full_date" value=($show_full_date && ($cart_data['date_from']|date_format:'%D' == $cart_data['date_to']|date_format:'%D'))}
|
||||
<td class="text-center">{dateFormat date=$cart_data['date_from'] full=$is_full_date} - {dateFormat date=$cart_data['date_to'] full=$is_full_date}</td>
|
||||
<td class="text-center">{convertPrice price=($cart_data['amt_with_qty'] + $cart_data['additional_services_auto_add_with_room_price'] + $cart_data['additional_service_price'] + $cart_data['demand_price'])}</td>
|
||||
<td class="text-center">{convertPrice price=($cart_data['amt_with_qty'] + $cart_data['additional_services_auto_add_with_room_price'] + $cart_data['additional_service_price'])}</td>
|
||||
<td class="text-center"><button class="btn btn-default ajax_cart_delete_data" data-id-product="{$cart_data['id_product']|escape:'htmlall':'UTF-8'}" data-id-hotel="{$cart_data['id_hotel']|escape:'htmlall':'UTF-8'}" data-id-cart="{$cart_data['id_cart']|escape:'htmlall':'UTF-8'}" data-id-cart-book-data="{$cart_data['id']|escape:'htmlall':'UTF-8'}" data-date-from="{$cart_data['date_from']|escape:'htmlall':'UTF-8'}" data-date-to="{$cart_data['date_to']|escape:'htmlall':'UTF-8'}"><i class='icon-trash'></i></button></td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License version 3.0
|
||||
* that is bundled with this package in the file LICENSE.md
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* https://opensource.org/license/osl-3-0-php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to support@qloapps.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade this module to a 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
|
||||
* @copyright Since 2010 Webkul
|
||||
* @license https://opensource.org/license/osl-3-0-php Open Software License version 3.0
|
||||
*/
|
||||
|
||||
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;
|
||||
@@ -1,27 +0,0 @@
|
||||
{*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License version 3.0
|
||||
* that is bundled with this package in the file LICENSE.md
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* https://opensource.org/license/osl-3-0-php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to support@qloapps.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade this module to a 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
|
||||
* @copyright Since 2010 Webkul
|
||||
* @license https://opensource.org/license/osl-3-0-php Open Software License version 3.0
|
||||
*}
|
||||
|
||||
{if isset($priceCalcMethod) && $priceCalcMethod}
|
||||
<span class="badge badge-success">{l s='Yes' mod='hotelreservationsystem'}</span>
|
||||
{else}
|
||||
<span class="badge badge-danger">{l s='No' mod='hotelreservationsystem'}</span>
|
||||
{/if}
|
||||
@@ -1,287 +0,0 @@
|
||||
{*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License version 3.0
|
||||
* that is bundled with this package in the file LICENSE.md
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* https://opensource.org/license/osl-3-0-php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to support@qloapps.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade this module to a 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
|
||||
* @copyright Since 2010 Webkul
|
||||
* @license https://opensource.org/license/osl-3-0-php Open Software License version 3.0
|
||||
*}
|
||||
|
||||
<div class="panel">
|
||||
<div class="panel-heading">
|
||||
{if isset($edit)}
|
||||
<i class='icon-pencil'></i> {l s='Edit Facility' mod='hotelreservationsystem'}
|
||||
{else}
|
||||
<i class='icon-plus'></i> {l s='Add Facility' mod='hotelreservationsystem'}
|
||||
{/if}
|
||||
</div>
|
||||
<form id="{$table}_form" class="defaultForm form-horizontal" action="{$current}&{if !empty($submit_action)}{$submit_action}{/if}&token={$token}" method="post" enctype="multipart/form-data" {if isset($style)}style="{$style}"{/if}>
|
||||
{if isset($edit)}
|
||||
<input type="hidden" value="{$globalDemands['id']|escape:'html':'UTF-8'}" name="id_global_demand" />
|
||||
{/if}
|
||||
{if count($languages) > 1}
|
||||
<div class="col-sm-12">
|
||||
<label class="control-label">{l s='Choose Language' mod='hotelreservationsystem'}</label>
|
||||
<input type="hidden" name="choosedLangId" id="choosedLangId" value="{$currentLang.id_lang}">
|
||||
<button type="button" id="multi_lang_btn" class="btn btn-default dropdown-toggle wk_language_toggle" data-toggle="dropdown">
|
||||
{$currentLang.name}
|
||||
<span class="caret"></span>
|
||||
</button>
|
||||
<ul class="dropdown-menu wk_language_menu" style="left:14%;top:32px;">
|
||||
{foreach from=$languages item=language}
|
||||
<li>
|
||||
<a href="javascript:void(0)" onclick="showLangField('{$language.name}', {$language.id_lang});">
|
||||
{$language.name}
|
||||
</a>
|
||||
</li>
|
||||
{/foreach}
|
||||
</ul>
|
||||
<p class="help-block">{l s='Change language for updating information in multiple language.' mod='hotelreservationsystem'}</p>
|
||||
<hr>
|
||||
</div>
|
||||
{/if}
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label required" for="hotel_name" >
|
||||
{l s='Facility Name :' mod='hotelreservationsystem'}
|
||||
{include file="../../../_partials/htl-form-fields-flag.tpl"}
|
||||
</label>
|
||||
<div class="col-sm-6">
|
||||
{foreach from=$languages item=language}
|
||||
{assign var="demand_name" value="demand_name_`$language.id_lang`"}
|
||||
<input type="text"
|
||||
id="demand_name_{$language.id_lang}"
|
||||
name="demand_name_{$language.id_lang}"
|
||||
value="{if isset($smarty.post.$demand_name)}{$smarty.post.$demand_name|escape:'htmlall':'UTF-8'}{elseif isset($edit)}{$globalDemands.name[{$language.id_lang}]|escape:'htmlall':'UTF-8'}{/if}"
|
||||
class="form-control wk_text_field_all wk_text_field_{$language.id_lang}"
|
||||
maxlength="128"
|
||||
{if $currentLang.id_lang != $language.id_lang}style="display:none;"{/if} />
|
||||
{/foreach}
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">
|
||||
<span class="label-tooltip" data-toggle="tooltip" data-html="true" title="" data-original-title="{l s='Price of the facility will be calculated according to the price of the advance options.' mod='hotelreservationsystem'}">{l s='Create advance options' mod='hotelreservationsystem'}</span>
|
||||
</label>
|
||||
<div class="col-sm-6">
|
||||
<span class="switch prestashop-switch fixed-width-lg">
|
||||
<input type="radio" value="1" id="active_adv_option_on" name="active_adv_option"
|
||||
{if isset($smarty.post.active_adv_option)}
|
||||
{if $smarty.post.active_adv_option}
|
||||
checked="checked"
|
||||
{/if}
|
||||
{elseif isset($globalDemands) && $globalDemands['adv_option']|@count}
|
||||
checked="checked"
|
||||
{/if}>
|
||||
<label for="active_adv_option_on">{l s='Yes' mod='hotelreservationsystem'}</label>
|
||||
<input type="radio" value="0" id="active_adv_option_off" name="active_adv_option"
|
||||
{if isset($smarty.post.active_adv_option)}
|
||||
{if !$smarty.post.active_adv_option}
|
||||
checked="checked"
|
||||
{/if}
|
||||
{elseif !isset($globalDemands)}
|
||||
checked="checked"
|
||||
{elseif isset($globalDemands) && !$globalDemands['adv_option']|@count}
|
||||
checked="checked"
|
||||
{/if}>
|
||||
<label for="active_adv_option_off">{l s='No' mod='hotelreservationsystem'}</label>
|
||||
<a class="slide-button btn"></a>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="adv_options_dtl form-group" {if isset($smarty.post.active_adv_option)}{if !$smarty.post.active_adv_option}style="display:none;"{/if}{elseif !isset($globalDemands['adv_option']) || !$globalDemands['adv_option']|@count}style="display:none;"{/if}>
|
||||
<label class="col-sm-3 control-label">
|
||||
{* {l s='Advance options' mod='hotelreservationsystem'} *}
|
||||
</label>
|
||||
<div class="col-sm-9">
|
||||
<div class="table-responsive-row clearfix">
|
||||
<table class="table table-bordered adv_option_table">
|
||||
<tr class="nodrag nodrop">
|
||||
<th class="left">
|
||||
<span>{l s='Option Name' mod='hotelreservationsystem'}</span>
|
||||
</th>
|
||||
<th class="left">
|
||||
<span>{l s='Price' mod='hotelreservationsystem'}</span>
|
||||
</th>
|
||||
<th class="center">
|
||||
<span>{l s='action' mod='hotelreservationsystem'}</span>
|
||||
</th>
|
||||
</tr>
|
||||
{if isset($globalDemands['adv_option']) && $globalDemands['adv_option']}
|
||||
{foreach from=$globalDemands['adv_option'] key=key item=info}
|
||||
<tr>
|
||||
<td class="center">
|
||||
{if count($languages) > 1}
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon">{include file="../../../_partials/htl-form-fields-flag.tpl"}</span>
|
||||
{/if}
|
||||
{foreach from=$languages item=language}
|
||||
{assign var="option_name" value="option_name_`$language.id_lang`"}
|
||||
<input type="text"
|
||||
name="option_name_{$language.id_lang}[]"
|
||||
value="{if isset($smarty.post.$option_name[$key]) && $smarty.post.$option_name[$key]}{$smarty.post.$option_name[$key]|escape:'htmlall':'UTF-8'}{else}{$info['name'][$language.id_lang]}{/if}"
|
||||
class="form-control wk_text_field_all wk_text_field_{$language.id_lang}"
|
||||
maxlength="128"
|
||||
{if $currentLang.id_lang != $language.id_lang}style="display:none;"{/if} />
|
||||
{/foreach}
|
||||
{if count($languages) > 1}
|
||||
</div>
|
||||
{/if}
|
||||
</td>
|
||||
<td class="center">
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon">{$defaultcurrencySign}</span>
|
||||
<input type="text" name="option_price[]" value="{if isset($smarty.post.option_price[$key]) && $smarty.post.option_price[$key]}{$smarty.post.option_price[$key]|escape:'htmlall':'UTF-8'}{else}{$info['price']}{/if}"/>
|
||||
</div>
|
||||
<input type="hidden" name="id_option[]" value="{$info['id']}" />
|
||||
</td>
|
||||
<td class="center">
|
||||
<a href="#" class="remove_adv_option btn btn-default"><i class="icon-trash"></i></a>
|
||||
</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
{else}
|
||||
{for $k=0 to 1}
|
||||
<tr>
|
||||
<td class="center">
|
||||
{if count($languages) > 1}
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon">{include file="../../../_partials/htl-form-fields-flag.tpl"}</span>
|
||||
{/if}
|
||||
{foreach from=$languages item=language}
|
||||
{assign var="option_name" value="option_name_`$language.id_lang`"}
|
||||
<input type="text"
|
||||
name="option_name_{$language.id_lang}[]"
|
||||
value="{if isset($smarty.post.$option_name[$k]) && $smarty.post.$option_name[$k]}{$smarty.post.$option_name[$k]|escape:'htmlall':'UTF-8'}{/if}"
|
||||
class="form-control wk_text_field_all wk_text_field_{$language.id_lang}"
|
||||
maxlength="128"
|
||||
{if $currentLang.id_lang != $language.id_lang}style="display:none;"{/if} />
|
||||
{/foreach}
|
||||
{if count($languages) > 1}
|
||||
</div>
|
||||
{/if}
|
||||
</td>
|
||||
<td class="center">
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon">{$defaultcurrencySign}</span>
|
||||
<input type="text" name="option_price[]" value="{if isset($smarty.post.option_price[$k]) && $smarty.post.option_price[$k]}{$smarty.post.option_price[$k]|escape:'htmlall':'UTF-8'}{/if}"/>
|
||||
</div>
|
||||
<input type="hidden" name="id_option[]"/>
|
||||
</td>
|
||||
<td class="center">
|
||||
<a href="#" class="remove_adv_option btn btn-default"><i class="icon-trash"></i></a>
|
||||
</td>
|
||||
</tr>
|
||||
{/for}
|
||||
{/if}
|
||||
</table>
|
||||
<div class="form-group">
|
||||
<div class="col-sm-12">
|
||||
<button id="add_more_options_button" class="btn btn-default" type="button">
|
||||
<i class="icon-plus-circle"></i>
|
||||
{l s='Add More Options' mod='hotelreservationsystem'}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group" {if isset($smarty.post.active_adv_option)}{if $smarty.post.active_adv_option}style="display:none;"{/if}{elseif isset($globalDemands['adv_option']) && $globalDemands['adv_option']|@count}style="display:none;"{/if}>
|
||||
<label class="col-sm-3 control-label required" >
|
||||
{l s='Price' mod='hotelreservationsystem'}({l s='tax excl.' mod='hotelreservationsystem'})
|
||||
</label>
|
||||
<div class="col-sm-3">
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon">{$defaultcurrencySign}</span>
|
||||
<input type="text" id="price" name="price"
|
||||
value="{if isset($smarty.post.price)}{$smarty.post.price}{elseif isset($globalDemands['price'])}{$globalDemands['price']}{/if}"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{if isset($taxRuleGroups)}
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label required" >
|
||||
{l s='Tax Rule' mod='hotelreservationsystem'}
|
||||
</label>
|
||||
<div class="col-sm-3">
|
||||
<select name="id_tax_rules_group" id="id_tax_rules_group" class="form-control form-control-select" data-action="input_excl">
|
||||
<option value="0">{l s='No tax' mod='hotelreservationsystem'}</option>
|
||||
{foreach $taxRuleGroups as $tax_rule}
|
||||
<option value="{$tax_rule.id_tax_rules_group|escape:'html':'UTF-8'}" {if isset($smarty.post.id_tax_rules_group) && ($smarty.post.id_tax_rules_group == $tax_rule.id_tax_rules_group)}selected{elseif isset($globalDemands['id_tax_rules_group']) && ($globalDemands['id_tax_rules_group'] == $tax_rule.id_tax_rules_group)}selected{/if}>
|
||||
{$tax_rule.name|escape:'html':'UTF-8'}
|
||||
</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">
|
||||
<span class="label-tooltip" data-toggle="tooltip" data-html="true" data-original-title="{l s='Enable, if you want to add the price of this facility for each day in the booking. Disable, If you want to add price of the facility for entire date range of the booking.' mod='hotelreservationsystem'}">{l s='Per day price calculation' mod='hotelreservationsystem'}</span>
|
||||
</label>
|
||||
<div class="col-sm-6">
|
||||
<span class="switch prestashop-switch fixed-width-lg">
|
||||
<input type="radio" value="1" id="price_calc_method_on" name="price_calc_method"
|
||||
{if isset($smarty.post.price_calc_method)}
|
||||
{if $smarty.post.price_calc_method}
|
||||
checked="checked"
|
||||
{/if}
|
||||
{elseif isset($globalDemands['price_calc_method']) && $globalDemands['price_calc_method']}
|
||||
checked="checked"
|
||||
{/if}>
|
||||
<label for="price_calc_method_on">{l s='Yes' mod='hotelreservationsystem'}</label>
|
||||
<input type="radio" value="0" id="price_calc_method_off" name="price_calc_method"
|
||||
{if isset($smarty.post.price_calc_method)}
|
||||
{if !$smarty.post.price_calc_method}
|
||||
checked="checked"
|
||||
{/if}
|
||||
{elseif !isset($globalDemands['price_calc_method'])}
|
||||
checked="checked"
|
||||
{elseif isset($globalDemands['price_calc_method']) && !$globalDemands['price_calc_method']}
|
||||
checked="checked"
|
||||
{/if}>
|
||||
<label for="price_calc_method_off">{l s='No' mod='hotelreservationsystem'}</label>
|
||||
<a class="slide-button btn"></a>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-lg-9 col-lg-offset-3">
|
||||
<div class="alert alert-info">
|
||||
{l s='Enable ("Per day price calculation"), if you want to add the price of this facility for each day in the booking. Disable, If you want to add price of the facility for entire date range of the booking.' mod='hotelreservationsystem'}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="panel-footer">
|
||||
<a href="{$link->getAdminLink('AdminRoomTypeGlobalDemand')|escape:'html':'UTF-8'}" class="btn btn-default">
|
||||
<i class="process-icon-cancel"></i>{l s='Cancel' mod='hotelreservationsystem'}
|
||||
</a>
|
||||
<button type="submit" name="submitAdd{$table|escape:'html':'UTF-8'}" class="btn btn-default pull-right">
|
||||
<i class="process-icon-save"></i> {l s='Save' mod='hotelreservationsystem'}
|
||||
</button>
|
||||
<button type="submit" name="submitAdd{$table|escape:'html':'UTF-8'}AndStay" class="btn btn-default pull-right">
|
||||
<i class="process-icon-save"></i> {l s='Save and stay' mod='hotelreservationsystem'}
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
{block name=script}
|
||||
<script type="text/javascript">
|
||||
var id_language = {$defaultFormLanguage|intval};
|
||||
allowEmployeeFormLang = {$allowEmployeeFormLang|intval};
|
||||
</script>
|
||||
{/block}
|
||||
@@ -1,32 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License version 3.0
|
||||
* that is bundled with this package in the file LICENSE.md
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* https://opensource.org/license/osl-3-0-php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to support@qloapps.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade this module to a 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
|
||||
* @copyright Since 2010 Webkul
|
||||
* @license https://opensource.org/license/osl-3-0-php Open Software License version 3.0
|
||||
*/
|
||||
|
||||
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;
|
||||
@@ -1,32 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License version 3.0
|
||||
* that is bundled with this package in the file LICENSE.md
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* https://opensource.org/license/osl-3-0-php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to support@qloapps.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade this module to a 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
|
||||
* @copyright Since 2010 Webkul
|
||||
* @license https://opensource.org/license/osl-3-0-php Open Software License version 3.0
|
||||
*/
|
||||
|
||||
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;
|
||||
@@ -1,32 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License version 3.0
|
||||
* that is bundled with this package in the file LICENSE.md
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* https://opensource.org/license/osl-3-0-php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to support@qloapps.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade this module to a 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
|
||||
* @copyright Since 2010 Webkul
|
||||
* @license https://opensource.org/license/osl-3-0-php Open Software License version 3.0
|
||||
*/
|
||||
|
||||
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;
|
||||
@@ -684,24 +684,15 @@ class QloCleaner extends Module
|
||||
array('htl_features_block_data_lang', 'id_features_block', 'htl_features_block_data', 'id_features_block'),
|
||||
array('cart_rule', 'id_customer', 'customer', 'id_customer'),
|
||||
array('htl_testimonials_block_data_lang', 'id_testimonial_block', 'htl_testimonials_block_data', 'id_testimonial_block'),
|
||||
array('htl_room_type_global_demand_advance_option', 'id_global_demand', 'htl_room_type_global_demand', 'id_global_demand'),
|
||||
array('htl_room_type_global_demand_advance_option_lang', 'id_lang', 'lang', 'id_lang'),
|
||||
array('htl_room_type_global_demand_advance_option_lang', 'id_option', 'htl_room_type_global_demand_advance_option', 'id_option'),
|
||||
array('htl_room_type_global_demand_lang', 'id_global_demand', 'htl_room_type_global_demand', 'id_global_demand'),
|
||||
array('htl_branch_info_lang', 'id_lang', 'lang', 'id_lang'),
|
||||
array('htl_branch_info_lang', 'id', 'htl_branch_info', 'id'),
|
||||
array('htl_features_lang', 'id_lang', 'lang', 'id_lang'),
|
||||
array('htl_features_lang', 'id', 'htl_features', 'id'),
|
||||
array('htl_room_type_demand', 'id_global_demand', 'htl_room_type_global_demand', 'id_global_demand'),
|
||||
array('htl_room_type_demand', 'id_product', 'product', 'id_product'),
|
||||
array('htl_room_type_demand_price', 'id_product', 'product', 'id_product'),
|
||||
array('htl_room_type_feature_pricing', 'id_product', 'product', 'id_product'),
|
||||
array('htl_room_type_feature_pricing_restriction', 'id_feature_price', 'htl_room_type_feature_pricing', 'id_feature_price'),
|
||||
array('htl_room_type_feature_pricing_group', 'id_group', 'group', 'id_group'),
|
||||
array('htl_booking_demands_tax', 'id_tax', 'tax', 'id_tax'),
|
||||
array('htl_booking_detail', 'id_product', 'product', 'id_product'),
|
||||
array('htl_booking_detail', 'id_order', 'orders', 'id_order'),
|
||||
array('htl_booking_demands', 'id_htl_booking', 'htl_booking_detail', 'id_htl_booking'),
|
||||
array('htl_cart_booking_data', 'id_order', 'orders', 'id_order'),
|
||||
array('htl_cart_booking_data', 'id_customer', 'customer', 'id_customer'),
|
||||
array('htl_branch_features', 'id_hotel', 'htl_branch_info', 'id'),
|
||||
@@ -821,14 +812,11 @@ class QloCleaner extends Module
|
||||
'htl_room_type_feature_pricing_restriction',
|
||||
'htl_room_type_feature_pricing_lang',
|
||||
'htl_room_type_feature_pricing_group',
|
||||
'htl_room_type_demand_price',
|
||||
'htl_room_type_demand',
|
||||
'htl_room_disable_dates',
|
||||
'htl_interior_image',
|
||||
'htl_room_block_data',
|
||||
'htl_features_block_data',
|
||||
'htl_testimonials_block_data',
|
||||
'htl_room_type_global_demand',
|
||||
'htl_room_type_service_product',
|
||||
'htl_room_type_service_product_price',
|
||||
'htl_bed_type',
|
||||
@@ -879,8 +867,6 @@ class QloCleaner extends Module
|
||||
//Qlo modules order tables
|
||||
'htl_cart_booking_data',
|
||||
'htl_booking_detail',
|
||||
'htl_booking_demands',
|
||||
'htl_booking_demands_tax',
|
||||
'service_product_order_detail',
|
||||
'service_product_cart_detail',
|
||||
'order_customer_guest_detail',
|
||||
|
||||
@@ -415,30 +415,6 @@ class WkPaypalCommerceHelper
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$items = array_values($items);
|
||||
$itemKey = count($items);
|
||||
|
||||
if ($totalFacilityCostTE = $objCartBookingData->getCartExtraDemands($objCart->id, 0, 0, 0, 0, 1, 0, 0)) {
|
||||
$totalFacilityCostTI = $objCartBookingData->getCartExtraDemands($objCart->id, 0, 0, 0, 0, 1, 0, 1);
|
||||
$items[$itemKey]['name'] = 'Extra facilities';
|
||||
// $items[$itemKey]['sku'] = $product['reference'];
|
||||
$items[$itemKey]['category'] = 'DIGITAL_GOODS';
|
||||
|
||||
$items[$itemKey]['description'] = 'Price of all Extra facilities added to the bookings';
|
||||
|
||||
// unit amount
|
||||
$items[$itemKey]['unit_amount']['value'] = Tools::ps_round($totalFacilityCostTE, 2);
|
||||
$items[$itemKey]['unit_amount']['currency_code'] = $currency['iso_code'];
|
||||
|
||||
// tax values
|
||||
$tax = $totalFacilityCostTI - $totalFacilityCostTE;
|
||||
$items[$itemKey]['tax']['value'] = Tools::ps_round($tax, 2);
|
||||
$items[$itemKey]['tax']['currency_code'] = $currency['iso_code'];
|
||||
|
||||
// quantity
|
||||
$items[$itemKey]['quantity'] = 1;
|
||||
}
|
||||
}
|
||||
|
||||
return $items;
|
||||
|
||||
@@ -57,22 +57,17 @@ class QloStatsServiceProducts extends ModuleGrid
|
||||
public function hookAdminStatsModules($params)
|
||||
{
|
||||
$engineParamsServices = $this->getServicesParams();
|
||||
$engineParamsFacilities = $this->getFacilitiesParams();
|
||||
|
||||
if (Tools::getValue('export')) {
|
||||
if (Tools::getValue('option') == 'services') {
|
||||
$this->csvExport($engineParamsServices);
|
||||
} else if (Tools::getValue('option') == 'facilities') {
|
||||
$this->csvExport($engineParamsFacilities);
|
||||
}
|
||||
}
|
||||
|
||||
$this->context->smarty->assign(array(
|
||||
'module_name' => $this->displayName,
|
||||
'grid_table_services' => $this->engine($engineParamsServices),
|
||||
'grid_table_facilities' => $this->engine($engineParamsFacilities),
|
||||
'export_link_services' => Tools::safeOutput($_SERVER['REQUEST_URI']).'&export=1&option=services',
|
||||
'export_link_facilities' => Tools::safeOutput($_SERVER['REQUEST_URI']).'&export=1&option=facilities',
|
||||
));
|
||||
|
||||
return $this->display(__FILE__, 'services_content_block.tpl');
|
||||
@@ -127,43 +122,6 @@ class QloStatsServiceProducts extends ModuleGrid
|
||||
);
|
||||
}
|
||||
|
||||
public function getFacilitiesParams()
|
||||
{
|
||||
return array(
|
||||
'title' => $this->l('Facilities'),
|
||||
'columns' => array(
|
||||
array(
|
||||
'id' => 'display_name',
|
||||
'header' => $this->l('Name'),
|
||||
'dataIndex' => 'display_name',
|
||||
'align' => 'left'
|
||||
),
|
||||
array(
|
||||
'id' => 'totalQuantitySold',
|
||||
'header' => $this->l('Quantity sold'),
|
||||
'dataIndex' => 'totalQuantitySold',
|
||||
'align' => 'left'
|
||||
),
|
||||
array(
|
||||
'id' => 'avgPriceSold',
|
||||
'header' => $this->l('Average Price'),
|
||||
'dataIndex' => 'avgPriceSold',
|
||||
'align' => 'left'
|
||||
),
|
||||
array(
|
||||
'id' => 'totalPriceSold',
|
||||
'header' => $this->l('Sales'),
|
||||
'dataIndex' => 'totalPriceSold',
|
||||
'align' => 'left'
|
||||
),
|
||||
),
|
||||
'defaultSortColumn' => 'totalPriceSold',
|
||||
'defaultSortDirection' => 'DESC',
|
||||
'pagingMessage' => $this->paging_message,
|
||||
'option' => 'facilities'
|
||||
);
|
||||
}
|
||||
|
||||
public function setOption($option)
|
||||
{
|
||||
$dateBetween = $this->getDate();
|
||||
@@ -171,9 +129,6 @@ class QloStatsServiceProducts extends ModuleGrid
|
||||
case 'services' :
|
||||
$this->setQueryForServices($dateBetween);
|
||||
break;
|
||||
case 'facilities' :
|
||||
$this->setQueryForFacilities($dateBetween);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -262,80 +217,6 @@ class QloStatsServiceProducts extends ModuleGrid
|
||||
$this->option = 'services';
|
||||
}
|
||||
|
||||
public function setQueryForFacilities($dateBetween)
|
||||
{
|
||||
$this->query = '(SELECT bd.`name` as `display_name`,
|
||||
ROUND(IFNULL(SUM(bd.`total_price_tax_excl` / o.`conversion_rate`), 0), 2) / SUM(
|
||||
IF(bd.`price_calc_method` = '.(int)HotelRoomTypeGlobalDemand::WK_PRICE_CALC_METHOD_EACH_DAY.',
|
||||
DATEDIFF(hbd.`date_to`, hbd.`date_from`) * 1,
|
||||
1
|
||||
)
|
||||
) as avgPriceSold,
|
||||
IFNULL(SUM(
|
||||
IF(bd.`price_calc_method` = '.(int)HotelRoomTypeGlobalDemand::WK_PRICE_CALC_METHOD_EACH_DAY.',
|
||||
DATEDIFF(hbd.`date_to`, hbd.`date_from`) * 1,
|
||||
1
|
||||
)
|
||||
), 0) AS totalQuantitySold,
|
||||
ROUND(IFNULL(SUM(bd.`total_price_tax_excl` / o.`conversion_rate`), 0), 2) AS totalPriceSold
|
||||
FROM '._DB_PREFIX_.'htl_booking_demands bd
|
||||
INNER JOIN `'._DB_PREFIX_.'htl_booking_detail` hbd ON (bd.`id_htl_booking` = hbd.`id`)
|
||||
INNER JOIN '._DB_PREFIX_.'orders o ON (hbd.id_order = o.id_order)
|
||||
WHERE o.valid = 1 AND o.invoice_date BETWEEN '.$dateBetween.'
|
||||
AND (
|
||||
EXISTS (
|
||||
SELECT 1
|
||||
FROM `'._DB_PREFIX_.'htl_booking_detail` hbd
|
||||
WHERE hbd.`id_order` = o.`id_order`' . HotelBranchInformation::addHotelRestriction(false).'
|
||||
) OR EXISTS (
|
||||
SELECT 1
|
||||
FROM `'._DB_PREFIX_.'service_product_order_detail` spod
|
||||
WHERE spod.`id_order` = o.`id_order`' . HotelBranchInformation::addHotelRestriction(false, 'spod').'
|
||||
) OR EXISTS (
|
||||
SELECT 1
|
||||
FROM `'._DB_PREFIX_.'service_product_order_detail` spod
|
||||
WHERE spod.`id_order` = o.`id_order` AND spod.`id_hotel` = 0 AND spod.`id_htl_booking_detail` = 0
|
||||
)
|
||||
)
|
||||
GROUP BY bd.`name`)
|
||||
UNION
|
||||
(SELECT IFNULL(gdaol.`name`, gdl.`name`) as `display_name`,
|
||||
0 as avgPriceSold,
|
||||
0 AS totalQuantitySold,
|
||||
0 AS totalPriceSold
|
||||
FROM '._DB_PREFIX_.'htl_room_type_global_demand gd
|
||||
LEFT JOIN '._DB_PREFIX_.'htl_room_type_global_demand_lang gdl
|
||||
ON (gd.id_global_demand = gdl.id_global_demand AND gdl.id_lang = '.(int)$this->getLang().')
|
||||
LEFT JOIN `'._DB_PREFIX_.'htl_room_type_global_demand_advance_option` gdao
|
||||
ON (gd.id_global_demand = gdao.id_global_demand)
|
||||
LEFT JOIN `'._DB_PREFIX_.'htl_room_type_global_demand_advance_option_lang` gdaol
|
||||
ON (gdao.id_option = gdaol.id_option AND gdaol.id_lang = '.(int)$this->getLang().')
|
||||
WHERE 1
|
||||
GROUP BY gdaol.`name`, gdl.`name`
|
||||
HAVING `display_name` NOT IN (SELECT bd.`name` FROM '._DB_PREFIX_.'htl_booking_demands bd
|
||||
INNER JOIN `'._DB_PREFIX_.'htl_booking_detail` hbd ON (bd.`id_htl_booking` = hbd.`id`)
|
||||
INNER JOIN '._DB_PREFIX_.'orders o ON (hbd.id_order = o.id_order)
|
||||
WHERE o.valid = 1 AND o.invoice_date BETWEEN '.$dateBetween.'
|
||||
AND (
|
||||
EXISTS (
|
||||
SELECT 1
|
||||
FROM `'._DB_PREFIX_.'htl_booking_detail` hbd
|
||||
WHERE hbd.`id_order` = o.`id_order`' . HotelBranchInformation::addHotelRestriction(false).'
|
||||
) OR EXISTS (
|
||||
SELECT 1
|
||||
FROM `'._DB_PREFIX_.'service_product_order_detail` spod
|
||||
WHERE spod.`id_order` = o.`id_order`' . HotelBranchInformation::addHotelRestriction(false, 'spod').'
|
||||
) OR EXISTS (
|
||||
SELECT 1
|
||||
FROM `'._DB_PREFIX_.'service_product_order_detail` spod
|
||||
WHERE spod.`id_order` = o.`id_order` AND spod.`id_hotel` = 0 AND spod.`id_htl_booking_detail` = 0
|
||||
)
|
||||
)
|
||||
))';
|
||||
|
||||
$this->option = 'facilities';
|
||||
}
|
||||
|
||||
public function getData()
|
||||
{
|
||||
$currency = new Currency(Configuration::get('PS_CURRENCY_DEFAULT'));
|
||||
|
||||
@@ -27,13 +27,4 @@
|
||||
<a class="btn btn-default export-csv" href="{$export_link_services}">
|
||||
<i class="icon-cloud-download"></i> {l s='CSV Export' mod='qlostatsserviceproducts'}
|
||||
</a>
|
||||
</div>
|
||||
<div class="panel">
|
||||
<div class="panel-heading">
|
||||
{l s='Facilities' mod='qlostatsserviceproducts'}
|
||||
</div>
|
||||
|
||||
{$grid_table_facilities}
|
||||
<a class="btn btn-default export-csv" href="{$export_link_facilities}">
|
||||
<i class="icon-cloud-download"></i> {l s='CSV Export' mod='qlostatsserviceproducts'}
|
||||
</a>
|
||||
</div>
|
||||
@@ -23,53 +23,8 @@
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*}
|
||||
|
||||
{if isset($room_extra_demands) && $room_extra_demands}
|
||||
<table id="demands-table" class="bordered-table" width="100%" cellpadding="4" cellspacing="0">
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="4" class="header">{l s='Room Additional Facilities Detail' pdf='true'}</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="header-left small">{l s='Room Type' pdf='true'}</th>
|
||||
<th class="header-left small">{l s='Name' pdf='true'}</th>
|
||||
<th class="header-left small">{l s='Tax rate(s)' pdf='true'}</th>
|
||||
<th class="header-left small">{l s='Total' pdf='true'} <br /> {l s='(Tax excl.)' pdf='true'}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{assign var=roomCount value=1}
|
||||
{foreach $room_extra_demands as $roomDemand}
|
||||
{foreach name=demandRow from=$roomDemand['extra_demands'] item=demand}
|
||||
<tr class="header small">
|
||||
{if $smarty.foreach.demandRow.first}
|
||||
<td rowspan="{$roomDemand['extra_demands']|count}">
|
||||
{$roomDemand['room_type_name']}<br>
|
||||
{dateFormat date=$roomDemand['date_from']} {l s='to' pdf='true'} {dateFormat date=$roomDemand['date_to']}<br>
|
||||
<strong>{l s='Room' pdf='true'} - {$roomCount}</strong>
|
||||
</td>
|
||||
{/if}
|
||||
<td>
|
||||
{$demand['name']}
|
||||
</td>
|
||||
<td class="center">
|
||||
{$demand['extra_demands_tax_label']}
|
||||
</td>
|
||||
<td>
|
||||
{displayPrice currency=$order->id_currency price=$demand['total_price_tax_excl']}
|
||||
</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
{assign var=roomCount value=$roomCount+1}
|
||||
{/foreach}
|
||||
</tbody>
|
||||
</table>
|
||||
<tr>
|
||||
<td colspan="12" height="20"></td>
|
||||
</tr>
|
||||
{/if}
|
||||
|
||||
{if isset($room_additinal_services) && $room_additinal_services}
|
||||
<table id="demands-table" class="bordered-table" width="100%" cellpadding="4" cellspacing="0">
|
||||
<table id="additional-services-table" class="bordered-table" width="100%" cellpadding="4" cellspacing="0">
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="5" class="header">{l s='Room Extra Services Detail' pdf='true'}</th>
|
||||
@@ -113,8 +68,8 @@
|
||||
</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
{assign var=roomCount value=$roomCount+1}
|
||||
{/if}
|
||||
{assign var=roomCount value=$roomCount+1}
|
||||
{/foreach}
|
||||
</tbody>
|
||||
</table>
|
||||
@@ -69,8 +69,6 @@
|
||||
{l s='Services' pdf='true'}
|
||||
{elseif $label == 'room_tax'}
|
||||
{l s='Rooms' pdf='true'}
|
||||
{elseif $label == 'extra_demands_tax'}
|
||||
{l s='Facilities' pdf='true'}
|
||||
{elseif $label == 'convenience_fee_tax'}
|
||||
{l s='Convenience Fees' pdf='true'}
|
||||
{elseif $label == 'service_products_tax'}
|
||||
|
||||
@@ -55,10 +55,10 @@
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<!-- Extra demands -->
|
||||
<!-- Additional Services -->
|
||||
<tr>
|
||||
<td colspan="12">
|
||||
{$extra_demands_tab}
|
||||
{$additinal_services_tab}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
@@ -75,7 +75,7 @@
|
||||
</div>
|
||||
{/block}
|
||||
{block name='booking_form_price_information'}
|
||||
{if (isset($has_room_type_demands) && $has_room_type_demands) || (isset($service_products_exists) && $service_products_exists)}
|
||||
{if isset($service_products_exists) && $service_products_exists}
|
||||
<hr class="separator-hr-mg-10">
|
||||
<div class="row price_desc_block">
|
||||
<div class="col-sm-6">
|
||||
@@ -87,15 +87,15 @@
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
<label class="control-label">{l s='Extra Services'}</label>
|
||||
<p class="extra_demands_price_block">
|
||||
{if isset($demands_price)}{convertPrice price=$demands_price}{else}{convertPrice price=0}{/if}
|
||||
{if (isset($selected_demands) && $selected_demands) || (isset($selected_service_product) && $selected_service_product)}
|
||||
<p class="extra_services_price_block">
|
||||
{if isset($service_product_price)}{convertPrice price=$service_product_price}{else}{convertPrice price=0}{/if}
|
||||
{if isset($selected_service_product) && $selected_service_product}
|
||||
<span class="services-info">
|
||||
<img src="{$img_dir}icon/icon-info.svg" />
|
||||
</span>
|
||||
{/if}
|
||||
</p>
|
||||
{if (isset($selected_demands) && $selected_demands) || (isset($selected_service_product) && $selected_service_product)}
|
||||
{if isset($selected_service_product) && $selected_service_product}
|
||||
<div class="services-info-container" style="display: none;">
|
||||
<div class="services-info-tooltip-cont">
|
||||
{if isset($selected_service_product) && $selected_service_product}
|
||||
@@ -119,36 +119,15 @@
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
{if isset($selected_demands) && $selected_demands}
|
||||
<div class="extra-service-panel">
|
||||
<p class="panel_title">{l s='Selected facilities'} <span>{l s='(Per room)'}</span></p>
|
||||
<div class="services-list">
|
||||
{foreach $selected_demands as $product}
|
||||
<div class="services-list-row">
|
||||
<div>
|
||||
{$product['name']}
|
||||
{if isset($product['advance_option']) && $product['advance_option']}
|
||||
<p>{l s='Option:'} {$product['advance_option']['name']}</p>
|
||||
{/if}
|
||||
</div>
|
||||
<div class="text-right">
|
||||
<p>{displayPrice price=$product['price']}</p>
|
||||
<a class="btn btn-sm btn-default remove_roomtype_demand" data-id_global_demand="{$product['id_global_demand']}"><i class="icon-trash"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
{/foreach}
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
<hr>
|
||||
<div class="extra-service-panel">
|
||||
<div class="summary-row">
|
||||
<div>{l s='Total price per room'}</div>
|
||||
<div><p class="service_price">{displayPrice price=$demands_price_per_room}</p></div>
|
||||
<div><p class="service_price">{displayPrice price=$service_product_price_per_room}</p></div>
|
||||
</div>
|
||||
<div class="summary-row">
|
||||
<div>{l s='Total price:'}</div>
|
||||
<div><p class="service_price">{displayPrice price=$demands_price}</p></div>
|
||||
<div><p class="service_price">{displayPrice price=$service_product_price}</p></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,191 +0,0 @@
|
||||
{**
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License version 3.0
|
||||
* that is bundled with this package in the file LICENSE.md
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* https://opensource.org/license/osl-3-0-php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to support@qloapps.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade this module to a 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
|
||||
* @copyright Since 2010 Webkul
|
||||
* @license https://opensource.org/license/osl-3-0-php Open Software License version 3.0
|
||||
*}
|
||||
|
||||
{block name='cart_booking_demands'}
|
||||
<section>
|
||||
{if (isset($selectedRoomDemands) && $selectedRoomDemands) || (isset($roomTypeServiceProducts) && $roomTypeServiceProducts)}
|
||||
{block name='cart_booking_demands_tabs'}
|
||||
<ul class="nav nav-tabs">
|
||||
{if isset($selectedRoomDemands) && $selectedRoomDemands}
|
||||
<li class="active"><a href="#room_type_demands_desc" data-toggle="tab">{l s='Facilities'}</a></li>
|
||||
{/if}
|
||||
{if isset($roomTypeServiceProducts) && $roomTypeServiceProducts}
|
||||
<li {if !isset($selectedRoomDemands) || !$selectedRoomDemands} class="active"{/if}><a href="#room_type_service_product_desc" data-toggle="tab">{l s='Services'}</a></li>
|
||||
{/if}
|
||||
</ul>
|
||||
{/block}
|
||||
{block name='cart_booking_demands_tabs_content'}
|
||||
<div class="tab-content">
|
||||
{block name='cart_booking_demands_tab_content'}
|
||||
{if isset($selectedRoomDemands) && $selectedRoomDemands}
|
||||
<div id="room_type_demands_desc" class="tab-pane active">
|
||||
<div class="rooms_extra_demands_head">
|
||||
<p class="rooms_extra_demands_text">{l s='Add below facilities to the rooms for better hotel experience'}</p>
|
||||
</div>
|
||||
{assign var=roomCount value=1}
|
||||
{foreach $selectedRoomDemands as $key => $roomDemand}
|
||||
<div class="card accordion">
|
||||
<div class="row accordion-section">
|
||||
<div class="col-sm-12 demand_header">
|
||||
<a class="accordion-section-title {if $roomCount == 1}active{/if}" href="#accordion_demand_{$key|escape:'html':'UTF-8'}">
|
||||
{l s='Room'} {$roomCount|escape:'html':'UTF-8'}
|
||||
<span>({if {$roomDemand['adults']} <= 9}0{$roomDemand['adults']}{else}{$roomDemand['adults']}{/if} {if $roomDemand['adults'] > 1}{l s='Adults'}{else}{l s='Adult'}{/if}, {if {$roomDemand['children']} <= 9}0{$roomDemand['children']}{else}{$roomDemand['children']}{/if} {if $roomDemand['children'] > 1}{l s='Children'}{else}{l s='Child'}{/if})</span>
|
||||
</a>
|
||||
</div>
|
||||
<div id="accordion_demand_{$key|escape:'html':'UTF-8'}" class="room_demand_detail col-sm-12 accordion-section-content {if $roomCount == 1}open{/if}" {if $roomCount == 1}style="display: block;"{/if}>
|
||||
{if isset($roomTypeDemands) && $roomTypeDemands}
|
||||
{foreach $roomTypeDemands as $idGlobalDemand => $demand}
|
||||
<div class="row room_demand_block">
|
||||
<div class="col-xs-8">
|
||||
<div class="row">
|
||||
<div class="col-xs-2">
|
||||
<p class="checkbox">
|
||||
<input id_cart_booking="{$roomDemand['id']}" value="{$idGlobalDemand|escape:'html':'UTF-8'}" type="checkbox" class="id_room_type_demand" {if isset($roomDemand['selected_global_demands']) && $roomDemand['selected_global_demands'] && ($idGlobalDemand|in_array:$roomDemand['selected_global_demands'])}checked{/if} />
|
||||
</p>
|
||||
</div>
|
||||
<div class="col-xs-10 demand_adv_option_block">
|
||||
<p>{$demand['name']|escape:'html':'UTF-8'}</p>
|
||||
{if isset($demand['adv_option']) && $demand['adv_option']}
|
||||
<select class="id_option">
|
||||
{foreach $demand['adv_option'] as $idOption => $option}
|
||||
{assign var=demand_key value="`$idGlobalDemand`-`$idOption`"}
|
||||
<option optionPrice="{$option['price']|escape:'html':'UTF-8'}" value="{$idOption|escape:'html':'UTF-8'}" {if isset($roomDemand['extra_demands'][$demand_key])}selected{/if} key="{$demand_key}">{$option['name']}</option>
|
||||
{if isset($roomDemand['extra_demands'][$demand_key])}
|
||||
{assign var=selected_adv_option value="$idOption"}
|
||||
{/if}
|
||||
{/foreach}
|
||||
</select>
|
||||
{else}
|
||||
<input type="hidden" class="id_option" value="0" />
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-4">
|
||||
<p class="pull-right">
|
||||
<span class="extra_demand_option_price">{if isset($selected_adv_option) && isset($demand['adv_option'][$selected_adv_option]['price'])}{convertPrice price = $demand['adv_option'][$selected_adv_option]['price']|escape:'html':'UTF-8'}{else}{convertPrice price = $demand['price']|escape:'html':'UTF-8'}{/if}</span>{if $demand['price_calc_method'] == HotelRoomTypeGlobalDemand::WK_PRICE_CALC_METHOD_EACH_DAY}{l s='/Night'}{/if}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
{/foreach}
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{assign var=roomCount value=$roomCount+1}
|
||||
{/foreach}
|
||||
</div>
|
||||
{/if}
|
||||
{/block}
|
||||
|
||||
{block name='cart_booking_services_tab_content'}
|
||||
{if isset($roomTypeServiceProducts) && $roomTypeServiceProducts}
|
||||
<div id="room_type_service_product_desc" class="tab-pane{if !isset($selectedRoomDemands) || !$selectedRoomDemands} active{/if}">
|
||||
<div class="rooms_extra_demands_head">
|
||||
<p class="rooms_extra_demands_text">{l s='Add below services to the rooms for better hotel experience'}</p>
|
||||
</div>
|
||||
{assign var=roomCount value=1}
|
||||
{foreach $cartRooms as $key => $cartRoom}
|
||||
<div class="card accordion">
|
||||
<div class="row accordion-section">
|
||||
<div class="col-sm-12 demand_header">
|
||||
<a class="accordion-section-title {if $roomCount == 1}active{/if}" href="#accordion_service_{$key|escape:'html':'UTF-8'}">
|
||||
{l s='Room'} {$roomCount|escape:'html':'UTF-8'}
|
||||
<span>({if {$cartRoom['adults']} <= 9}0{$cartRoom['adults']}{else}{$cartRoom['adults']}{/if} {if $cartRoom['adults'] > 1}{l s='Adults'}{else}{l s='Adult'}{/if}, {if {$cartRoom['children']} <= 9}0{$cartRoom['children']}{else}{$cartRoom['children']}{/if} {if $cartRoom['children'] > 1}{l s='Children'}{else}{l s='Child'}{/if})</span>
|
||||
</a>
|
||||
</div>
|
||||
<div id="accordion_service_{$key|escape:'html':'UTF-8'}" class=" col-sm-12 room_demand_detail accordion-section-content {if $roomCount == 1}open{/if}" {if $roomCount == 1}style="display: block;"{/if}>
|
||||
{if isset($roomTypeServiceProducts) && $roomTypeServiceProducts}
|
||||
{foreach $roomTypeServiceProducts as $product}
|
||||
{if isset($cartRoom['selected_service']) && $cartRoom['selected_service'] && ($product['id_product']|array_key_exists:$cartRoom['selected_service'])}
|
||||
{assign var='serviceSelected' value=true}
|
||||
{$product.price_tax_incl = $cartRoom['selected_service'][$product['id_product']]['unit_price_tax_incl']}
|
||||
{$product.price_tax_exc = $cartRoom['selected_service'][$product['id_product']]['unit_price_tax_excl']}
|
||||
{else}
|
||||
{assign var='serviceSelected' value=false}
|
||||
{/if}
|
||||
<div class="row room_demand_block">
|
||||
<div class="col-xs-8">
|
||||
<div class="row">
|
||||
<div class="col-xs-2">
|
||||
{if $product.available_for_order}
|
||||
<p class="checkbox">
|
||||
<input data-id_cart_booking="{$cartRoom['id']}" value="{$product['id_product']|escape:'html':'UTF-8'}" type="checkbox" class="change_room_type_service_product" {if $serviceSelected}checked{/if} />
|
||||
</p>
|
||||
{/if}
|
||||
</div>
|
||||
<div class="col-xs-10">
|
||||
<div>{$product['name']|escape:'html':'UTF-8'}</div>
|
||||
{if $product.price_calculation_method == Product::PRICE_CALCULATION_METHOD_PER_DAY}
|
||||
<div class="price-per-night">
|
||||
{if ($product.show_price && !isset($restricted_country_mode)) || isset($groups)}{if !$priceDisplay}{convertPrice price=$product.price_tax_incl}{else}{convertPrice price=$product.price_tax_exc}{/if}{/if}{l s='/night'}
|
||||
</div>
|
||||
{/if}
|
||||
{if $product.allow_multiple_quantity}
|
||||
<div class="qty_container">
|
||||
<input type="text" class="form-control qty" id="qty_{$product.id_product}" name="room_service_product_qty_{$product.id_product}" data-id-product="{$product.id_product}" data-max_quantity="{$product.max_quantity}" value="{if $serviceSelected}{$cartRoom['selected_service'][$product['id_product']]['quantity']}{else}1{/if}">
|
||||
<input type="hidden" class="qty_hidden" id="qty_{$product.id_product}_hidden" value="{if $serviceSelected}{$cartRoom['selected_service'][$product['id_product']]['quantity']}{else}0{/if}">
|
||||
<div class="qty_controls">
|
||||
<a href="#" class="qty_up"><span><i class="icon-plus"></i></span></a>
|
||||
<a href="#" class="qty_down"><span><i class="icon-minus"></i></span></a>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-4">
|
||||
{if ($product.show_price && !isset($restricted_country_mode)) || isset($groups)}
|
||||
<span class="room-service-product-value pull-right" data-unit_price="{if !$priceDisplay}{$product.price_tax_incl}{else}{$product.price_tax_exc}{/if}" data-currency_sign="{$currency->sign}">
|
||||
{if !$priceDisplay}
|
||||
{if $serviceSelected}
|
||||
{convertPrice price=$cartRoom['selected_service'][$product['id_product']]['total_price_tax_incl']}
|
||||
{else}
|
||||
{convertPrice price=$product.price_tax_incl}
|
||||
{/if}
|
||||
{else}
|
||||
{if $serviceSelected}
|
||||
{convertPrice price=$cartRoom['selected_service'][$product['id_product']]['total_price_tax_excl']}
|
||||
{else}
|
||||
{convertPrice price=$product.price_tax_exc}
|
||||
{/if}
|
||||
{/if}
|
||||
</span>
|
||||
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
{/foreach}
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{assign var=roomCount value=$roomCount+1}
|
||||
{/foreach}
|
||||
<div>
|
||||
{/if}
|
||||
{/block}
|
||||
</div>
|
||||
{/block}
|
||||
{/if}
|
||||
</section>
|
||||
{/block}
|
||||
@@ -0,0 +1,105 @@
|
||||
{**
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License version 3.0
|
||||
* that is bundled with this package in the file LICENSE.md
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* https://opensource.org/license/osl-3-0-php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to support@qloapps.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade this module to a 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
|
||||
* @copyright Since 2010 Webkul
|
||||
* @license https://opensource.org/license/osl-3-0-php Open Software License version 3.0
|
||||
*}
|
||||
|
||||
{block name='cart_booking_services'}
|
||||
<section>
|
||||
{if isset($roomTypeServiceProducts) && $roomTypeServiceProducts}
|
||||
{block name='cart_booking_services_tabs'}
|
||||
<ul class="nav nav-tabs">
|
||||
<li class="active"><a href="#room_type_service_product_desc" data-toggle="tab">{l s='Services'}</a></li>
|
||||
</ul>
|
||||
{/block}
|
||||
{block name='cart_booking_services_tabs_content'}
|
||||
<div class="tab-content">
|
||||
{block name='cart_booking_services_tab_content'}
|
||||
{if isset($roomTypeServiceProducts) && $roomTypeServiceProducts}
|
||||
<div id="room_type_service_product_desc" class="tab-pane active">
|
||||
<div class="rooms_extra_services_head">
|
||||
<p class="rooms_extra_services_text">{l s='Add below services to the rooms for better hotel experience'}</p>
|
||||
</div>
|
||||
{assign var=roomCount value=1}
|
||||
{foreach $cartRooms as $key => $cartRoom}
|
||||
<div class="card accordion">
|
||||
<div class="row accordion-section">
|
||||
<div class="col-sm-12 additional_service_header">
|
||||
<a class="accordion-section-title {if $roomCount == 1}active{/if}" href="#accordion_service_{$key|escape:'html':'UTF-8'}">
|
||||
{l s='Room'} {$roomCount|escape:'html':'UTF-8'}
|
||||
<span>({if {$cartRoom['adults']} <= 9}0{$cartRoom['adults']}{else}{$cartRoom['adults']}{/if} {if $cartRoom['adults'] > 1}{l s='Adults'}{else}{l s='Adult'}{/if}, {if {$cartRoom['children']} <= 9}0{$cartRoom['children']}{else}{$cartRoom['children']}{/if} {if $cartRoom['children'] > 1}{l s='Children'}{else}{l s='Child'}{/if})</span>
|
||||
</a>
|
||||
</div>
|
||||
<div id="accordion_service_{$key|escape:'html':'UTF-8'}" class=" col-sm-12 room_service_detail accordion-section-content {if $roomCount == 1}open{/if}" {if $roomCount == 1}style="display: block;"{/if}>
|
||||
{if isset($roomTypeServiceProducts) && $roomTypeServiceProducts}
|
||||
{foreach $roomTypeServiceProducts as $product}
|
||||
{if isset($cartRoom['selected_service']) && $cartRoom['selected_service'] && ($product['id_product']|array_key_exists:$cartRoom['selected_service'])}
|
||||
{assign var='serviceSelected' value=true}
|
||||
{$product.price_tax_incl = $cartRoom['selected_service'][$product['id_product']]['unit_price_tax_incl']}
|
||||
{$product.price_tax_exc = $cartRoom['selected_service'][$product['id_product']]['unit_price_tax_excl']}
|
||||
{else}
|
||||
{assign var='serviceSelected' value=false}
|
||||
{/if}
|
||||
<div class="row room_service_block">
|
||||
<div class="col-xs-8">
|
||||
<div class="row">
|
||||
<div class="col-xs-2">
|
||||
{if $product.available_for_order}
|
||||
<p class="checkbox">
|
||||
<input data-id_cart_booking="{$cartRoom['id']}" value="{$product['id_product']|escape:'html':'UTF-8'}" type="checkbox" class="change_room_type_service_product" {if $serviceSelected}checked{/if} />
|
||||
</p>
|
||||
{/if}
|
||||
</div>
|
||||
<div class="col-xs-10">
|
||||
<p>{$product['name']|escape:'html':'UTF-8'}</p>
|
||||
{if $product.allow_multiple_quantity}
|
||||
<div class="qty_container">
|
||||
<input type="text" class="form-control qty" id="qty_{$product.id_product}" name="room_service_product_qty_{$product.id_product}" data-id-product="{$product.id_product}" data-max_quantity="{$product.max_quantity}" value="{if $serviceSelected}{$cartRoom['selected_service'][$product['id_product']]['quantity']}{else}1{/if}">
|
||||
<input type="hidden" class="qty_hidden" id="qty_{$product.id_product}_hidden" value="{if $serviceSelected}{$cartRoom['selected_service'][$product['id_product']]['quantity']}{else}0{/if}">
|
||||
<div class="qty_controls">
|
||||
<a href="#" class="qty_up"><span><i class="icon-plus"></i></span></a>
|
||||
<a href="#" class="qty_down"><span><i class="icon-minus"></i></span></a>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-4">
|
||||
{if ($product.show_price && !isset($restricted_country_mode)) || isset($groups)}
|
||||
<span class="pull-right">{if !$priceDisplay}{convertPrice price=$product.price_tax_incl}{else}{convertPrice price=$product.price_tax_exc}{/if}{if $product.price_calculation_method == Product::PRICE_CALCULATION_METHOD_PER_DAY}{l s='/Night'}{/if}</span>
|
||||
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
{/foreach}
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{assign var=roomCount value=$roomCount+1}
|
||||
{/foreach}
|
||||
<div>
|
||||
{/if}
|
||||
{/block}
|
||||
</div>
|
||||
{/block}
|
||||
{/if}
|
||||
</section>
|
||||
{/block}
|
||||
@@ -26,15 +26,10 @@
|
||||
{l s='Extra Services'}
|
||||
</div>
|
||||
<div class="card-body">
|
||||
{if (isset($extraDemands) && $extraDemands) || (isset($additionalServices) && $additionalServices)}
|
||||
{if (isset($additionalServices) && $additionalServices)}
|
||||
{block name='order_extra_services_tabs'}
|
||||
<ul class="nav nav-tabs">
|
||||
{if isset($additionalServices) && $additionalServices}
|
||||
<li class="active"><a href="#room_type_service_product_desc" data-toggle="tab">{l s='Services'}</a></li>
|
||||
{/if}
|
||||
{if isset($extraDemands) && $extraDemands}
|
||||
<li {if !isset($additionalServices) || !$additionalServices} class="active" {/if}><a href="#room_type_demands_desc" data-toggle="tab">{l s='Facilities'}</a></li>
|
||||
{/if}
|
||||
<li class="active"><a href="#room_type_service_product_desc" data-toggle="tab">{l s='Services'}</a></li>
|
||||
</ul>
|
||||
{/block}
|
||||
{block name='order_extra_services_tabs_content'}
|
||||
@@ -44,14 +39,14 @@
|
||||
<div id="room_type_service_product_desc" class="tab-pane {if isset($additionalServices) && $additionalServices}active{/if}">
|
||||
{assign var=roomCount value=1}
|
||||
{foreach $additionalServices as $key => $roomAdditionalService}
|
||||
<div class="room_demands">
|
||||
<div class="demand_header">
|
||||
<div class="room_additional_services">
|
||||
<div class="additional_service_header">
|
||||
{l s='Room'} {$roomCount|string_format:'%02d'}
|
||||
<span>({if {$roomAdditionalService['adults']} <= 9}0{$roomAdditionalService['adults']}{else}{$roomAdditionalService['adults']}{/if} {if $roomAdditionalService['adults'] > 1}{l s='Adults'}{else}{l s='Adult'}{/if}{if $roomAdditionalService['children'] > 0}, {if {$roomAdditionalService['children']} <= 9}0{$roomAdditionalService['children']}{else}{$roomAdditionalService['children']}{/if} {if $roomAdditionalService['children'] > 1}{l s='Children'}{else}{l s='Child'}{/if}{/if})</span>
|
||||
</div>
|
||||
<div class="room_demand_detail">
|
||||
<div class="room_service_detail">
|
||||
{foreach $roomAdditionalService['additional_services'] as $additionalService}
|
||||
<div class="room_demand_block">
|
||||
<div class="room_service_block">
|
||||
<div class="">
|
||||
<div class="">
|
||||
{$additionalService['name']|escape:'html':'UTF-8'}
|
||||
@@ -78,40 +73,6 @@
|
||||
</div>
|
||||
{/if}
|
||||
{/block}
|
||||
|
||||
{block name='order_extra_demands_tab_content'}
|
||||
{if isset($extraDemands) && $extraDemands}
|
||||
<div id="room_type_demands_desc" class="tab-pane {if !isset($additionalServices) || !$additionalServices}active{/if}">
|
||||
{assign var=roomCount value=1}
|
||||
{foreach $extraDemands as $roomDemand}
|
||||
<div class="room_demands">
|
||||
<div class="demand_header">
|
||||
{l s='Room'} {$roomCount|string_format:'%02d'}
|
||||
<span>({if {$roomDemand['adults']} <= 9}0{$roomDemand['adults']}{else}{$roomDemand['adults']}{/if} {if $roomDemand['adults'] > 1}{l s='Adults'}{else}{l s='Adult'}{/if}{if $roomDemand['children'] > 0}, {if {$roomDemand['children']} <= 9}0{$roomDemand['children']}{else}{$roomDemand['children']}{/if} {if $roomDemand['children'] > 1}{l s='Children'}{else}{l s='Child'}{/if}{/if})</span>
|
||||
</div>
|
||||
<div class="room_demand_detail">
|
||||
{foreach $roomDemand['extra_demands'] as $demand}
|
||||
<div class="room_demand_block">
|
||||
<div class="">{$demand['name']|escape:'html':'UTF-8'}</div>
|
||||
<div class="">
|
||||
<span>
|
||||
{if $useTax}
|
||||
{displayPrice price="{$demand['total_price_tax_incl']|escape:'html':'UTF-8'}" currency=$objOrder->id_currency}
|
||||
{else}
|
||||
{displayPrice price="{$demand['total_price_tax_excl']|escape:'html':'UTF-8'}" currency=$objOrder->id_currency}
|
||||
{/if}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
{/foreach}
|
||||
</div>
|
||||
</div>
|
||||
{assign var=roomCount value=$roomCount+1}
|
||||
{/foreach}
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
{/block}
|
||||
</div>
|
||||
{/block}
|
||||
{/if}
|
||||
|
||||
@@ -101,13 +101,13 @@
|
||||
<div class="row">
|
||||
<dt class="col-xs-5">{l s='Extra Services'}</dt>
|
||||
<dd class="col-xs-7">
|
||||
{if (isset($rm_v.extra_demands) && $rm_v.extra_demands) || isset($rm_v.additional_services) && $rm_v.additional_services}
|
||||
{if isset($rm_v.additional_services) && $rm_v.additional_services}
|
||||
<a data-date_from="{$rm_v.data_form}" data-date_to="{$rm_v.data_to}" data-id_product="{$data_v.id_product}" data-id_order="{$order->id}" data-action="{$link->getPageLink({$page_name})}" class="btn-view-extra-services" href="#rooms_type_extra_services_form">
|
||||
{/if}
|
||||
{if $group_use_tax}
|
||||
{displayWtPriceWithCurrency price=($rm_v.extra_demands_price_ti + $rm_v.additional_services_price_ti) currency=$currency}
|
||||
{displayWtPriceWithCurrency price=$rm_v.additional_services_price_ti currency=$currency}
|
||||
{else}
|
||||
{displayWtPriceWithCurrency price=($rm_v.extra_demands_price_te + $rm_v.additional_services_price_te) currency=$currency}
|
||||
{displayWtPriceWithCurrency price=$rm_v.additional_services_price_te currency=$currency}
|
||||
{/if}
|
||||
{if (isset($rm_v.extra_demands) && $rm_v.extra_demands) || isset($rm_v.additional_services) && $rm_v.additional_services}
|
||||
</a>
|
||||
@@ -120,11 +120,11 @@
|
||||
<dt class="col-xs-5">{l s='Total Price'}</dt>
|
||||
<dd class="col-xs-7">
|
||||
{if $group_use_tax}
|
||||
{displayWtPriceWithCurrency price=($rm_v.amount_tax_incl + $rm_v.extra_demands_price_ti + $rm_v.additional_services_price_ti + $rm_v.additional_services_price_auto_add_ti) currency=$currency}
|
||||
{displayWtPriceWithCurrency price=($rm_v.amount_tax_incl + $rm_v.additional_services_price_ti + $rm_v.additional_services_price_auto_add_ti) currency=$currency}
|
||||
{else}
|
||||
{displayWtPriceWithCurrency price=($rm_v.amount_tax_excl + $rm_v.extra_demands_price_te + $rm_v.additional_services_price_te + $rm_v.additional_services_price_auto_add_te) currency=$currency}
|
||||
{displayWtPriceWithCurrency price=($rm_v.amount_tax_excl + $rm_v.additional_services_price_te + $rm_v.additional_services_price_auto_add_te) currency=$currency}
|
||||
{/if}
|
||||
{if (isset($rm_v.extra_demands) && $rm_v.extra_demands) || isset($rm_v.additional_services) && $rm_v.additional_services}
|
||||
{if isset($rm_v.additional_services) && $rm_v.additional_services}
|
||||
<span class="order-price-info">
|
||||
<img src="{$img_dir}icon/icon-info.svg" />
|
||||
</span>
|
||||
@@ -151,9 +151,9 @@
|
||||
<div class="text-right">
|
||||
<p>
|
||||
{if $group_use_tax}
|
||||
{displayWtPriceWithCurrency price=($rm_v.extra_demands_price_ti + $rm_v.additional_services_price_ti) currency=$currency}
|
||||
{displayWtPriceWithCurrency price=$rm_v.additional_services_price_ti currency=$currency}
|
||||
{else}
|
||||
{displayWtPriceWithCurrency price=($rm_v.extra_demands_price_te + $rm_v.additional_services_price_te) currency=$currency}
|
||||
{displayWtPriceWithCurrency price=$rm_v.additional_services_price_te currency=$currency}
|
||||
{/if}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
|
||||
<div class="col-sm-12 card cart_total_detail_block">
|
||||
{if $total_rooms_wt + $total_extra_demands_wt + $total_additional_services_wt + $total_additional_services_auto_add_wt}
|
||||
{if $total_rooms_wt + $total_additional_services_wt + $total_additional_services_auto_add_wt}
|
||||
<p>
|
||||
<span>
|
||||
{l s='Total rooms cost'}
|
||||
@@ -36,9 +36,9 @@
|
||||
</span>
|
||||
<span class="cart_total_values">
|
||||
{if $use_taxes && $priceDisplay == 0}
|
||||
{assign var='total_rooms_cost' value=($total_rooms_wt + $total_extra_demands_wt + $total_additional_services_wt + $total_additional_services_auto_add_wt)}
|
||||
{assign var='total_rooms_cost' value=($total_rooms_wt + $total_additional_services_wt + $total_additional_services_auto_add_wt)}
|
||||
{else}
|
||||
{assign var='total_rooms_cost' value=($total_rooms + $total_extra_demands + $total_additional_services + $total_additional_services_auto_add)}
|
||||
{assign var='total_rooms_cost' value=($total_rooms + $total_additional_services + $total_additional_services_auto_add)}
|
||||
{/if}
|
||||
{displayPrice price=$total_rooms_cost}
|
||||
</span>
|
||||
|
||||
@@ -9002,21 +9002,15 @@ a.open_rooms_extra_services_panel {
|
||||
#rooms_extra_services .tab-content {
|
||||
padding: 0 15px;
|
||||
}
|
||||
#rooms_extra_services .demand_header a {
|
||||
rooms_extra_services .additional_service_header a {
|
||||
text-decoration: none;
|
||||
color: #444444;}
|
||||
#rooms_extra_services .room_demand_detail {
|
||||
#rooms_extra_services .room_service_detail {
|
||||
margin-top: 15px;
|
||||
padding-top: 15px;
|
||||
border-top: 1px solid #eeeeee;}
|
||||
/* #rooms_extra_services .room_demand_detail .demand_detail_price_block {
|
||||
margin-bottom: 9px;
|
||||
font-size: 14px;
|
||||
margin-bottom: 15px;} */
|
||||
/* #rooms_extra_services .rooms_extra_services_head {
|
||||
margin-bottom: 18px;} */
|
||||
|
||||
#rooms_extra_services .room_demand_block {
|
||||
#rooms_extra_services .room_service_block {
|
||||
margin-bottom: 10px;
|
||||
color: #333;
|
||||
font-size: 14px;}
|
||||
|
||||
@@ -192,28 +192,28 @@
|
||||
padding-bottom: 15px;
|
||||
}
|
||||
|
||||
#rooms_extra_services .tab-content .rooms_extra_demands_head {
|
||||
#rooms_extra_services .tab-content .rooms_extra_services_head {
|
||||
padding: 10px 18px;
|
||||
border-bottom: 1px solid #F0F0F0;
|
||||
}
|
||||
|
||||
#rooms_extra_services .tab-content .rooms_extra_demands_text {
|
||||
#rooms_extra_services .tab-content .rooms_extra_services_text {
|
||||
font-size: 12px;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
#rooms_extra_services .tab-content .room_demands {
|
||||
#rooms_extra_services .tab-content .room_additional_services {
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
#rooms_extra_services .tab-content .demand_header {
|
||||
#rooms_extra_services .tab-content .additional_service_header {
|
||||
font-size: 16px;
|
||||
font-weight: bold;
|
||||
line-height: 24px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
#rooms_extra_services .tab-content .room_demand_detail {
|
||||
#rooms_extra_services .tab-content .room_service_detail {
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
margin-top: 0;
|
||||
@@ -221,12 +221,12 @@
|
||||
border-top: unset;
|
||||
}
|
||||
|
||||
#rooms_extra_services .tab-content .room_demand_block {
|
||||
#rooms_extra_services .tab-content .room_service_block {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
#rooms_extra_services .tab-content .room_demand_block:not(:last-of-type) {
|
||||
#rooms_extra_services .tab-content .room_service_block:not(:last-of-type) {
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
|
||||
@@ -1044,38 +1044,38 @@
|
||||
padding-bottom: 15px;
|
||||
}
|
||||
|
||||
#popup-view-extra-services .tab-content .rooms_extra_demands_head {
|
||||
#popup-view-extra-services .tab-content .rooms_extra_services_head {
|
||||
padding: 10px 18px;
|
||||
border-bottom: 1px solid #F0F0F0;
|
||||
}
|
||||
|
||||
#popup-view-extra-services .tab-content .rooms_extra_demands_text {
|
||||
#popup-view-extra-services .tab-content .rooms_extra_services_text {
|
||||
font-size: 12px;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
#popup-view-extra-services .tab-content .room_demands {
|
||||
#popup-view-extra-services .tab-content .room_additional_services {
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
#popup-view-extra-services .tab-content .demand_header {
|
||||
#popup-view-extra-services .tab-content .additional_service_header {
|
||||
font-size: 16px;
|
||||
font-weight: bold;
|
||||
line-height: 24px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
#popup-view-extra-services .tab-content .room_demand_detail {
|
||||
#popup-view-extra-services .tab-content .room_service_detail {
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
#popup-view-extra-services .tab-content .room_demand_block {
|
||||
#popup-view-extra-services .tab-content .room_service_block {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
#popup-view-extra-services .tab-content .room_demand_block:not(:last-of-type) {
|
||||
#popup-view-extra-services .tab-content .room_service_block:not(:last-of-type) {
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
.payment-summary tr, .guest-details tr {
|
||||
|
||||
@@ -241,7 +241,7 @@
|
||||
color: #777;
|
||||
content: '+';
|
||||
}
|
||||
.room_price_detail_block .demand_total_price, .room_price_detail_block .total_price {
|
||||
.room_price_detail_block .extra_service_total_price, .room_price_detail_block .total_price {
|
||||
line-height: 28px;
|
||||
}
|
||||
|
||||
@@ -255,7 +255,7 @@
|
||||
transform: translate(15px, 0px);
|
||||
}
|
||||
}
|
||||
.room_price_detail_block .price_block .total_price, .room_price_detail_block .demand_price_block .demand_total_price{
|
||||
.room_price_detail_block .price_block .total_price, .room_price_detail_block .extra_service_price_block .extra_service_total_price{
|
||||
word-break: break-word;
|
||||
}
|
||||
.order-detail-content .room_price_detail_block .plus-sign{
|
||||
@@ -652,8 +652,8 @@
|
||||
text-align: center;}
|
||||
|
||||
|
||||
/* Fancy-box for extra demands Css */
|
||||
.room_extra_demands .open_rooms_extra_services_panel {
|
||||
/* Fancy-box for extra services Css */
|
||||
.room_extra_services .open_rooms_extra_services_panel {
|
||||
font-size:12px;
|
||||
font-weight: 600;
|
||||
color: #0000FF;}
|
||||
|
||||
@@ -1352,8 +1352,8 @@ Quick View Styles
|
||||
#booking_action_loader.active {
|
||||
display: block;
|
||||
}
|
||||
/* room type extra demands container */
|
||||
.room_demands_container_overlay {
|
||||
/* room type extra service container */
|
||||
.room_service_container_overlay {
|
||||
display: none;
|
||||
position: absolute;
|
||||
left: 0;
|
||||
@@ -1392,15 +1392,15 @@ Quick View Styles
|
||||
top: 0;
|
||||
}
|
||||
|
||||
.room_demands_container .room_demand_block {
|
||||
.room_service_container .room_service_block {
|
||||
margin-bottom: 15px;
|
||||
color: #333;
|
||||
font-size: 14px;
|
||||
}
|
||||
.room_demands_container .checkbox {
|
||||
.room_service_container .checkbox {
|
||||
margin-top: 2px;
|
||||
}
|
||||
.room_demands_container label {
|
||||
.room_service_container label {
|
||||
opacity: 0.5;
|
||||
margin-bottom: 15px;
|
||||
text-transform: uppercase;
|
||||
@@ -1415,7 +1415,7 @@ Quick View Styles
|
||||
.price_desc_block .total_price_block {
|
||||
color: #333;
|
||||
}
|
||||
.price_desc_block .extra_demands_price_block {
|
||||
.price_desc_block .extra_services_price_block {
|
||||
color: #299DFF;
|
||||
}
|
||||
.price_desc_block .plus-sign {
|
||||
@@ -1469,49 +1469,46 @@ Quick View Styles
|
||||
/* end */
|
||||
|
||||
|
||||
/* extra demands Css */
|
||||
#rooms_extra_demands {
|
||||
/* extra services Css */
|
||||
#rooms_extra_services {
|
||||
position: relative;
|
||||
font-size: 16px;}
|
||||
.room_extra_demands .open_rooms_extra_demands {
|
||||
.rooms_extra_services .open_rooms_extra_services {
|
||||
font-size:12px;
|
||||
font-weight: 600;
|
||||
color: #0000FF;}
|
||||
#rooms_extra_demands .demand_header {
|
||||
#rooms_extra_services .additional_service_header {
|
||||
padding-bottom: 15px;}
|
||||
#rooms_extra_demands .room_demand_detail .demand_detail_price_block {
|
||||
font-size: 14px;
|
||||
margin-bottom: 15px;}
|
||||
#rooms_extra_demands .rooms_extra_demands_head {
|
||||
#rooms_extra_services .rooms_extra_services_head {
|
||||
margin-bottom: 18px;}
|
||||
#rooms_extra_demands .card {
|
||||
#rooms_extra_services .card {
|
||||
padding-bottom: 0px;}
|
||||
#rooms_extra_demands .room_demand_block {
|
||||
#rooms_extra_services .room_service_block {
|
||||
margin-bottom: 15px;
|
||||
color: #333;
|
||||
font-size: 14px;}
|
||||
#rooms_extra_demands .checkbox {
|
||||
#rooms_extra_services .checkbox {
|
||||
margin-top: 3px;}
|
||||
#rooms_extra_demands label {
|
||||
#rooms_extra_services label {
|
||||
opacity: 0.5;
|
||||
margin-bottom: 15px;
|
||||
text-transform: uppercase;}
|
||||
|
||||
/* fancybox accordian css */
|
||||
/* #rooms_extra_demands .accordion, #rooms_extra_demands .accordion * {
|
||||
/* #rooms_extra_services .accordion, #rooms_extra_services .accordion * {
|
||||
-webkit-box-sizing:border-box;
|
||||
-moz-box-sizing:border-box;
|
||||
box-sizing:border-box;}
|
||||
#rooms_extra_demands .accordion {
|
||||
#rooms_extra_services .accordion {
|
||||
overflow:hidden;
|
||||
border-bottom: 1px solid #CCCCCC;}
|
||||
#rooms_extra_demands .accordion-section-title {
|
||||
#rooms_extra_services .accordion-section-title {
|
||||
width:100%;
|
||||
display:inline-block;
|
||||
transition:all linear 0.15s;
|
||||
color:#252525 !important;
|
||||
text-decoration:none !important;}
|
||||
#rooms_extra_demands .accordion-section-content {
|
||||
#rooms_extra_services .accordion-section-content {
|
||||
display:none;
|
||||
border-top: 1px solid #eee;
|
||||
padding-top: 15px;} */
|
||||
|
||||
@@ -52,8 +52,6 @@
|
||||
{assign var=HOOK_ORDERDETAILDISPLAYED value=$order->hook_orderdetaildisplayed}
|
||||
{assign var=total_convenience_fee_ti value=$order->total_convenience_fee_ti}
|
||||
{assign var=total_convenience_fee_te value=$order->total_convenience_fee_te}
|
||||
{assign var=total_demands_price_ti value=$order->total_demands_price_ti}
|
||||
{assign var=total_demands_price_te value=$order->total_demands_price_te}
|
||||
{assign var=any_back_order value=$order->any_back_order}
|
||||
{assign var=shw_bo_msg value=$order->shw_bo_msg}
|
||||
{assign var=back_ord_msg value=$order->back_ord_msg}
|
||||
|
||||
@@ -392,7 +392,7 @@ var ajaxCart = {
|
||||
req.append('id_hotel', idHotel);
|
||||
|
||||
if (parseInt(booking_product)) {
|
||||
// get the selected extra demands by customer
|
||||
// get the selected extra services by customer
|
||||
if (typeof dateFrom != 'undefined')
|
||||
req.append('dateFrom', dateFrom);
|
||||
if (typeof dateTo != 'undefined')
|
||||
@@ -403,9 +403,6 @@ var ajaxCart = {
|
||||
} else {
|
||||
req.append('qty', ((occupancy && occupancy != null) ? occupancy : '1'));
|
||||
}
|
||||
|
||||
var roomDemands = getRoomsExtraDemands();
|
||||
req.append('roomDemands', JSON.stringify(roomDemands) );
|
||||
req.append('serviceProducts', JSON.stringify(getRoomsServiceProducts()) );
|
||||
} else {
|
||||
req.append('qty', ((occupancy && occupancy != null) ? occupancy : '1'));
|
||||
@@ -426,11 +423,6 @@ var ajaxCart = {
|
||||
processData: false,
|
||||
success: function(jsonData, textStatus, jqXHR) {
|
||||
if (pagename == 'product') {
|
||||
if (jsonData.avail_rooms == 0) {
|
||||
disableRoomTypeDemands(1);
|
||||
}
|
||||
|
||||
resetRoomtypeServices();
|
||||
|
||||
if (parseInt($('#product_page_booking_product').val()) == 0) {
|
||||
$('#service_product_qty').val(1);
|
||||
@@ -565,9 +557,6 @@ var ajaxCart = {
|
||||
var product_page_id_product = $('#product_page_product_id').val();
|
||||
if (idProduct == product_page_id_product && dateFrom < date_checkOut && dateTo >= date_checkIn) {
|
||||
$(".max_avail_type_qty").val(jsonData.avail_rooms);
|
||||
if (jsonData.avail_rooms == 0) {
|
||||
disableRoomTypeDemands(1);
|
||||
}
|
||||
}
|
||||
BookingForm.refresh();
|
||||
}
|
||||
@@ -632,7 +621,6 @@ var ajaxCart = {
|
||||
data: 'controller=cart&delete=1&dateFrom=' + dateFrom + '&dateTo=' + dateTo + '&id_product=' + idProduct + '&id_hotel=' + idHotel + '&id_product_option=' + ((idCombination != null && parseInt(idCombination)) ? idCombination : '') + ((customizationId && customizationId != null) ? '&id_customization=' + customizationId : '') + '&id_address_delivery=' + idAddressDelivery + '&token=' + static_token + '&ajax=true',
|
||||
success: function(jsonData) {
|
||||
if (pagename == 'product') {
|
||||
disableRoomTypeDemands(0);
|
||||
BookingForm.refresh();
|
||||
}
|
||||
|
||||
@@ -953,7 +941,7 @@ var ajaxCart = {
|
||||
content += '<tr class="rooms_remove_container">';
|
||||
content += '<td>' + moment(new Date(date_diff_v.data_form)).format(dateFormatToUse) + ' - ' + moment(new Date(date_diff_v.data_to)).format(dateFormatToUse) + '</td>';
|
||||
content += '<td class="num_rooms_in_date">' + date_diff_v.num_rm + '</td>';
|
||||
content += '<td>' + formatCurrency(parseFloat(date_diff_v.amount) + parseFloat(date_diff_v.demand_price), currency_format, currency_sign, currency_blank) + '</td>';
|
||||
content += '<td>' + formatCurrency(parseFloat(date_diff_v.amount) + parseFloat(date_diff_v.additional_price), currency_format, currency_sign, currency_blank) + '</td>';
|
||||
content += '<td>';
|
||||
content += '<a class="remove_rooms_from_cart_link" href="#" rm_price=' + date_diff_v.amount + ' id_product=' + productId + ' date_from=' + date_diff_v.data_form + ' date_to=' + date_diff_v.data_to + ' num_rooms=' + date_diff_v.num_rm + ' title="' + remove_rm_title + '"></a>';
|
||||
content += '</td>';
|
||||
@@ -1031,7 +1019,7 @@ var ajaxCart = {
|
||||
booking_dates_content += '<tr class="rooms_remove_container">';
|
||||
booking_dates_content += '<td>' + moment(new Date(date_diff_v1.data_form)).format(dateFormatToUse) + ' - ' + moment(new Date(date_diff_v1.data_to)).format(dateFormatToUse) + '</td>';
|
||||
booking_dates_content += '<td class="num_rooms_in_date">' + date_diff_v1.num_rm + '</td>';
|
||||
booking_dates_content += '<td>' + formatCurrency(parseFloat(date_diff_v1.amount) + parseFloat(date_diff_v1.demand_price), currency_format, currency_sign, currency_blank) + '</td>';
|
||||
booking_dates_content += '<td>' + formatCurrency(parseFloat(date_diff_v1.amount) + parseFloat(date_diff_v1.additional_price), currency_format, currency_sign, currency_blank) + '</td>';
|
||||
booking_dates_content += '<td>';
|
||||
booking_dates_content += '<a class="remove_rooms_from_cart_link" href="#" rm_price=' + date_diff_v1.amount + ' id_product=' + productId + ' date_from=' + date_diff_v1.data_form + ' date_to=' + date_diff_v1.data_to + ' num_rooms=' + date_diff_v1.num_rm + ' title="' + remove_rm_title + '"></a>';
|
||||
booking_dates_content += '</td>';
|
||||
@@ -1389,7 +1377,6 @@ function crossselling_serialScroll() {
|
||||
}
|
||||
|
||||
function resetRoomtypeServices(refresh = true) {
|
||||
$('.room_demands_container').find('input.id_room_type_demand:checked').prop('checked', false).uniform();
|
||||
$('#additional_products').empty();
|
||||
$('#additional_products div')
|
||||
$('.remove_roomtype_product').text(select_txt).removeClass('btn-danger remove_roomtype_product').addClass('btn-success add_roomtype_product');
|
||||
@@ -1398,19 +1385,6 @@ function resetRoomtypeServices(refresh = true) {
|
||||
}
|
||||
}
|
||||
|
||||
function disableRoomTypeDemands(show) {
|
||||
if (show) {
|
||||
$('.room_demands_container_overlay').show();
|
||||
$('.room_demands_container').find('input:checkbox.id_room_type_demand').prop('checked', false);
|
||||
$('.room_demand_block').find('.id_room_type_demand').prop('checked', false).parent().removeClass('checked');
|
||||
$('.room_demands_container').find('input:checkbox.id_room_type_demand').attr('disabled', 'disabled');
|
||||
} else {
|
||||
$('.room_demands_container_overlay').hide();
|
||||
$('.room_demands_container').find('input:checkbox.id_room_type_demand').removeAttr('disabled');
|
||||
$('.room_demands_container').find('.checker').removeClass('disabled');
|
||||
}
|
||||
}
|
||||
|
||||
function disableRoomTypeServices(disable) {
|
||||
if (disable) {
|
||||
resetRoomtypeServices(false);
|
||||
@@ -1422,20 +1396,6 @@ function disableRoomTypeServices(disable) {
|
||||
}
|
||||
}
|
||||
|
||||
function getRoomsExtraDemands()
|
||||
{
|
||||
var roomDemands = [];
|
||||
|
||||
$('input:checkbox.id_room_type_demand:checked').each(function () {
|
||||
roomDemands.push({
|
||||
'id_global_demand':$(this).val(),
|
||||
'id_option': $(this).closest('.room_demand_block').find('.id_option').val()
|
||||
});
|
||||
});
|
||||
|
||||
return roomDemands;
|
||||
}
|
||||
|
||||
function getRoomsServiceProducts()
|
||||
{
|
||||
var serviceProducts = [];
|
||||
|
||||
@@ -40,15 +40,15 @@ $(document).ready(function(){
|
||||
date_to: dateTo,
|
||||
id_product: idProduct,
|
||||
id_order: idOrder,
|
||||
action: 'getRoomTypeBookingDemands',
|
||||
method: 'getRoomTypeBookingDemands',
|
||||
action: 'getRoomTypeBookingServices',
|
||||
method: 'getRoomTypeBookingServices',
|
||||
ajax: true,
|
||||
token: static_token
|
||||
},
|
||||
success: function(result) {
|
||||
if (result.extra_demands) {
|
||||
if (result.extra_services) {
|
||||
$('#rooms_extra_services').html('');
|
||||
$('#rooms_extra_services').append(result.extra_demands);
|
||||
$('#rooms_extra_services').append(result.extra_services);
|
||||
}
|
||||
$.fancybox({
|
||||
href: "#rooms_extra_services",
|
||||
|
||||
@@ -354,14 +354,14 @@ $(document).on('click', '.btn-view-extra-services', function(e) {
|
||||
date_to: dateTo,
|
||||
id_product: idProduct,
|
||||
id_order: idOrder,
|
||||
action: 'getRoomTypeBookingDemands',
|
||||
action: 'getRoomTypeBookingServices',
|
||||
ajax: true,
|
||||
token: static_token,
|
||||
},
|
||||
success: function(result) {
|
||||
if (result.extra_demands) {
|
||||
if (result.extra_services) {
|
||||
$('#popup-view-extra-services').html('');
|
||||
$('#popup-view-extra-services').append(result.extra_demands);
|
||||
$('#popup-view-extra-services').append(result.extra_services);
|
||||
|
||||
$.fancybox.open({
|
||||
href: '#popup-view-extra-services',
|
||||
|
||||
@@ -558,79 +558,6 @@ $(document).ready(function()
|
||||
e.preventDefault();
|
||||
});
|
||||
|
||||
$(document).on('click', '.id_room_type_demand', function() {
|
||||
var roomDemands = [];
|
||||
// get the selected extra demands by customer
|
||||
$(this).closest('.room_demand_detail').find('input:checkbox.id_room_type_demand:checked').each(function () {
|
||||
roomDemands.push({
|
||||
'id_global_demand':$(this).val(),
|
||||
'id_option': $(this).closest('.room_demand_block').find('.id_option').val()
|
||||
});
|
||||
});
|
||||
var idBookingCart = $(this).attr('id_cart_booking');
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
headers: {
|
||||
"cache-control": "no-cache"
|
||||
},
|
||||
url: orderOpcUrl,
|
||||
dataType: 'JSON',
|
||||
cache: false,
|
||||
data: {
|
||||
id_cart_booking: idBookingCart,
|
||||
room_demands: JSON.stringify(roomDemands),
|
||||
method: 'changeRoomDemands',
|
||||
ajax: true
|
||||
},
|
||||
success: function(result) {
|
||||
if (result == 1) {
|
||||
showSuccessMessage(txtExtraDemandSucc);
|
||||
} else {
|
||||
showErrorMessage(txtExtraDemandErr);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$(document).on('change', '.demand_adv_option_block .id_option', function(e) {
|
||||
var option_selected = $(this).find('option:selected');
|
||||
var extra_demand_price = option_selected.attr("optionPrice")
|
||||
extra_demand_price = parseFloat(extra_demand_price);
|
||||
extra_demand_price = formatCurrency(extra_demand_price, currency_format, currency_sign, currency_blank);
|
||||
$(this).closest('.room_demand_block').find('.extra_demand_option_price').text(extra_demand_price);
|
||||
var roomDemands = [];
|
||||
// get the selected extra demands by customer
|
||||
$(this).closest('.room_demand_detail').find('input:checkbox.id_room_type_demand:checked').each(function () {
|
||||
roomDemands.push({
|
||||
'id_global_demand':$(this).val(),
|
||||
'id_option': $(this).closest('.room_demand_block').find('.id_option').val()
|
||||
});
|
||||
});
|
||||
var idBookingCart = $(this).closest('.room_demand_block').find('.id_room_type_demand').attr('id_cart_booking');
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
headers: {
|
||||
"cache-control": "no-cache"
|
||||
},
|
||||
url: orderOpcUrl,
|
||||
dataType: 'JSON',
|
||||
cache: false,
|
||||
data: {
|
||||
id_cart_booking: idBookingCart,
|
||||
room_demands: JSON.stringify(roomDemands),
|
||||
method: 'changeRoomDemands',
|
||||
ajax: true
|
||||
},
|
||||
success: function(result) {
|
||||
if (result == 1) {
|
||||
showSuccessMessage(txtExtraDemandSucc);
|
||||
} else {
|
||||
showErrorMessage(txtExtraDemandErr);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$(document).on('click', '.change_room_type_service_product', function() {
|
||||
updateServiceProducts(this);
|
||||
});
|
||||
@@ -692,8 +619,8 @@ $(document).ready(function()
|
||||
roomServiceProductTotalPriceQty = $(this).val()*roomServiceProductUnitPrice;
|
||||
roomServiceProductValue.text(roomServiceProductCurrencySign + roomServiceProductTotalPriceQty.toFixed(priceDisplayPrecision))
|
||||
|
||||
if ($(this).closest('.room_demand_block').find('.change_room_type_service_product').is(':checked')) {
|
||||
updateServiceProducts($(this).closest('.room_demand_block').find('.change_room_type_service_product'));
|
||||
if ($(this).closest('.room_service_block').find('.change_room_type_service_product').is(':checked')) {
|
||||
updateServiceProducts($(this).closest('.room_service_block').find('.change_room_type_service_product'));
|
||||
}
|
||||
});
|
||||
|
||||
@@ -716,14 +643,14 @@ $(document).ready(function()
|
||||
date_to: dateTo,
|
||||
id_product: idProduct,
|
||||
id_order: idOrder,
|
||||
method: 'getRoomTypeBookingDemands',
|
||||
method: 'getRoomTypeBookingServices',
|
||||
ajax: true,
|
||||
token: static_token
|
||||
},
|
||||
success: function(result) {
|
||||
if (result.extra_demands) {
|
||||
if (result.extra_services) {
|
||||
$('#rooms_extra_services').html('');
|
||||
$('#rooms_extra_services').append(result.extra_demands);
|
||||
$('#rooms_extra_services').append(result.extra_services);
|
||||
}
|
||||
$.fancybox({
|
||||
href: "#rooms_extra_services",
|
||||
@@ -747,12 +674,12 @@ $(document).ready(function()
|
||||
{
|
||||
var id_product = $(element).val();
|
||||
var id_cart_booking = $(element).data('id_cart_booking');
|
||||
var qty = $(element).closest('.room_demand_block').find('input.qty');
|
||||
var qty = $(element).closest('.room_service_block').find('input.qty');
|
||||
|
||||
if (qty.length == 0) {
|
||||
update_qty = 1;
|
||||
} else {
|
||||
var qty_hidden = $(element).closest('.room_demand_block').find('input.qty_hidden');
|
||||
var qty_hidden = $(element).closest('.room_service_block').find('input.qty_hidden');
|
||||
var update_qty = parseInt($(qty).val()) - parseInt($(qty_hidden).val());
|
||||
}
|
||||
var checked = $(element).is(':checked');
|
||||
@@ -789,7 +716,7 @@ $(document).ready(function()
|
||||
},
|
||||
success: function(jsonData) {
|
||||
if (!jsonData.hasError) {
|
||||
showSuccessMessage(txtExtraDemandSucc);
|
||||
showSuccessMessage(txtExtraServiceSucc);
|
||||
} else {
|
||||
showErrorMessage(jsonData.errors);
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user