Merge branch 'develop' into gli-3051

This commit is contained in:
azhar bhat
2026-09-03 15:26:55 +05:30
135 changed files with 1352 additions and 6493 deletions

View File

@@ -127,4 +127,4 @@ if (Tools::isSubmit('getZones')) {
if (Tools::isSubmit('getEmailHTML') && $email = Tools::getValue('email')) {
$email_html = AdminTranslationsController::getEmailHTML($email);
die($email_html);
}
}

View File

@@ -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(),

View File

@@ -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">&times;</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">

View File

@@ -72,6 +72,12 @@
</p>
</div>
</div>
<div class="row">
<label class="control-label col-lg-3">{l s='Nationality'}</label>
<div class="col-lg-9">
<p class="form-control-static">{if $nationality}{$nationality}{else}--{/if}</p>
</div>
</div>
<div class="row">
<label class="control-label col-lg-3">{l s='Registration Date'}</label>
<div class="col-lg-9">

View File

@@ -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> &nbsp;{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>

View File

@@ -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> &nbsp;{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>

View File

@@ -137,13 +137,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}
@@ -153,7 +153,7 @@
<i class="icon-trash"></i>&nbsp;{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>&nbsp;{l s='Services'}
</a>
</td>
@@ -168,31 +168,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 {

View File

@@ -96,8 +96,8 @@
</td>
<td class="center">
{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>

View File

@@ -1572,10 +1572,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');
@@ -1600,7 +1600,7 @@
id_product: idProduct,
id_customer: id_customer,
id_hotel_cart_booking: idHotelCartBooking,
action: 'getRoomTypeCartDemands',
action: 'getRoomTypeCartServices',
ajax: true
},
success: function(response) {
@@ -1613,10 +1613,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() {
@@ -1624,98 +1622,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();
@@ -1776,7 +1687,7 @@
}
});
// click on back button on created facilities while additional facilities edit
// click on back button on created extra service edit
$(document).on('click', '#back_to_service_btn', function() {
$('#room_type_services_desc').show();
$('#add_new_room_services_block').hide();
@@ -1830,7 +1741,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>';
@@ -1878,7 +1789,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>';
@@ -2503,6 +2414,7 @@
{addJsDefL name='no_children_allowed_txt'}{l s='Only adults can be accommodated' js=1}{/addJsDefL}
{addJsDefL name='invalid_occupancy_txt'}{l s='Invalid occupancy(adults/children) found.' js=1}{/addJsDefL}
{addJsDefL name='error_found_txt'}{l s='Errors found' js=1}{/addJsDefL}
{addJsDefL name='txtExtraServiceSucc'}{l s='Updated Successfully' js=1}{/addJsDefL}
{/strip}
<div id="loader_container">

View File

@@ -843,10 +843,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)}
@@ -855,16 +851,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">
@@ -884,11 +880,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>
@@ -948,11 +944,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>
@@ -1261,12 +1257,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}

View File

@@ -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}/>

View File

@@ -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>

View File

@@ -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'}

View File

@@ -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> &nbsp;{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>

View File

@@ -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'}&amp;id_product={$service['id_product']|escape:'html':'UTF-8'}&amp;updateproduct"><i class="icon-external-link-sign"></i></a>{/if}
</td>

View File

@@ -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;}

View File

@@ -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 extra services will be assigned to the selected room of new room type."}</p>
<p>{l s="If you want to change extra services, you can update by editing the room after reallocation."}</p>
</div>
</div>
<p class="error_text" id="realloc_sel_rm_err_p"></p>

View File

@@ -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'}&amp;id_global_demand={$demand['id_global_demand']|escape:'html':'UTF-8'}&amp;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'}&amp;id_global_demand={$demand['id_global_demand']|escape:'html':'UTF-8'}&amp;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}&amp;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}

View File

@@ -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>

View File

@@ -54,14 +54,10 @@
<input type="hidden" name="lang" value="{$lang}" />
<input type="hidden" name="type" value="{$type}" />
<input type="hidden" name="theme" value="{$theme}" />
<script type="text/javascript">
$(document).ready(function(){
$('a.useSpecialSyntax').click(function(){
var syntax = $(this).find('img').attr('alt');
$('#BoxUseSpecialSyntax .syntax span').html(syntax+".");
});
});
</script>
<input type="hidden" name="reset_mail_name" id="reset_mail_name" value="" />
<input type="hidden" name="reset_template_type" id="reset_template_type" value="" />
<input type="hidden" name="reset_module_name" id="reset_module_name" value="" />
<input type="hidden" name="token" id="translation_mails_token" value="{$token}" />
<div id="BoxUseSpecialSyntax">
<div class="alert alert-warning">
<p>
@@ -80,6 +76,10 @@
<a name="submitTranslations{$type|ucfirst}" href="{$cancel_url}" class="btn btn-default">
<i class="process-icon-cancel"></i> {l s='Cancel'}
</a>
<button type="button" id="{$table}_form_reset_btn" class="btn btn-default mail-template-reset-btn label-tooltip" disabled="disabled" data-toggle="tooltip" title="">
<i class="process-icon-refresh"></i>
{l s='Reset'}
</button>
{*$toggle_button*}
<button type="submit" id="{$table}_form_submit_btn" name="submitTranslations{$type|ucfirst}" class="btn btn-default pull-right">
<i class="process-icon-save"></i>
@@ -101,56 +101,6 @@
</span>
</h3>
{$mail_content}
{literal}
<script type="text/javascript">
//<![CDATA[
$(document).ready(function () {
$('.mails_field').on('shown.bs.collapse', function () {
// get active email
var active_email = $(this).find('.email-collapse.in');
// get iframe container for active email
var frame = active_email.find('.email-html-frame');
// get source url for active email
var src = frame.data('email-src');
// get rte container for active email
var rte_mail_selector = active_email.find('textarea.rte-mail').data('rte');
// create special config
var rte_mail_config = {};
rte_mail_config['editor_selector'] = 'rte-mail-' + rte_mail_selector;
rte_mail_config['height'] = '500px';
// We want the default plugins + 'fullpage' plugin for HTML emails
rte_mail_config['plugins'] = "colorpicker link image paste pagebreak table contextmenu filemanager table code media autoresize textcolor anchor fullpage";
// move controls to active panel
$('#translation_mails-control-actions').appendTo($(this).find('.panel-collapse.in'));
// when user first open email
if (frame.find('iframe.email-frame').length == 0) {
// load iframe
frame.append('<iframe class="email-frame" />');
$.ajax({
url:'ajax.php',
type: 'POST',
dataType: 'html',
data: {
getEmailHTML : true,
email : src
},
success: function(result)
{
var doc = frame.find('iframe')[0].contentWindow.document;
doc.open();
doc.write(result);
doc.close();
tinySetup(rte_mail_config);
// init tinyMCE with special config
}
});
}
});
})
//]]>
</script>
{/literal}
</div>
<div class="panel">
<h3>

View File

@@ -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;
@@ -1570,7 +1570,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
@@ -1637,7 +1637,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
@@ -3965,8 +3932,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;
@@ -4004,8 +3971,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,
@@ -4940,20 +4905,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'];
@@ -5060,7 +5016,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();

View File

@@ -1018,8 +1018,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))) {
@@ -1045,7 +1045,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_);
}
@@ -1118,9 +1118,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;
}
}
@@ -1169,7 +1169,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;
@@ -1467,7 +1467,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)) {

View File

@@ -41,6 +41,9 @@ class CustomerCore extends ObjectModel
/** @var int Gender ID */
public $id_gender = 0;
/** @var int Nationality, stored as a country ID */
public $id_country = 0;
/** @var int Default group ID */
public $id_default_group;
@@ -170,6 +173,7 @@ class CustomerCore extends ObjectModel
'passwd' => array('type' => self::TYPE_STRING, 'validate' => 'isPasswd', 'required' => true, 'size' => 60),
'last_passwd_gen' => array('type' => self::TYPE_STRING, 'copy_post' => false),
'id_gender' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
'id_country' => array('type' => self::TYPE_INT, 'validate' => 'isInt'),
'birthday' => array('type' => self::TYPE_DATE, 'validate' => 'isBirthDate'),
'newsletter' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
'newsletter_date_add' => array('type' => self::TYPE_DATE,'copy_post' => false),
@@ -209,6 +213,10 @@ class CustomerCore extends ObjectModel
if (Configuration::get('PS_ONE_PHONE_AT_LEAST')) {
self::$definition['fields']['phone']['required'] = true;
}
if (Configuration::get('PS_CUSTOMER_NATIONALITY') && Configuration::get('PS_CUSTOMER_NATIONALITY_MANDATORY')) {
self::$definition['fields']['id_country']['required'] = true;
}
}
public function validateFields($die = true, $error_return = false)
@@ -830,6 +838,16 @@ class CustomerCore extends ObjectModel
return (int) Configuration::get('PS_COUNTRY_DEFAULT');
}
public static function getNationalities($id_lang)
{
$nationalities = Country::getCountries((int) $id_lang);
$nationalities[-1] = array(
'id_country' => -1,
'name' => Translate::getAdminTranslation('Other', 'AdminCustomers'),
);
return $nationalities;
}
public function toggleStatus()
{

View File

@@ -26,6 +26,9 @@
class LanguageCore extends ObjectModel
{
const EMAIL_TEMPLATE_TYPE_CORE = 1;
const EMAIL_TEMPLATE_TYPE_MODULE = 2;
public $id;
/** @var string Name */
@@ -1065,4 +1068,69 @@ class LanguageCore extends ObjectModel
}
}
}
}
public static function resetEmailTemplate($mail_template_name, $iso, $template_type, $module_name = false, $theme = '')
{
$is_module_template = ($template_type === self::EMAIL_TEMPLATE_TYPE_MODULE);
if ($theme) {
$dest_dir = $is_module_template
? _PS_ROOT_DIR_.'/themes/'.$theme.'/modules/'.$module_name.'/mails/'.$iso.'/'
: _PS_ROOT_DIR_.'/themes/'.$theme.'/mails/'.$iso.'/';
} else {
$dest_dir = $is_module_template
? rtrim(_PS_MODULE_DIR_, '/').'/'.$module_name.'/mails/'.$iso.'/'
: _PS_MAIL_DIR_.$iso.'/';
}
// Reuse the already-downloaded language pack if we have one, only hit the API when it's missing
$gzip_file = _PS_TRANSLATIONS_DIR_.$iso.'.gzip';
if (!file_exists($gzip_file)) {
Language::downloadAndInstallLanguagePack($iso, null, null, false);
}
if (!file_exists($gzip_file)) {
return array('hasError' => true, 'error' => Tools::displayError('Could not download the language pack from the QloApps API. Please check your internet connection and try again.'));
}
require_once(_PS_TOOL_DIR_.'tar/Tar.php');
$gz = new Archive_Tar($gzip_file, true);
if ($gz->error_object) {
return array('hasError' => true, 'error' => Tools::displayError('The downloaded language pack is corrupted. Please try again.'));
}
$archive_dir = $is_module_template
? 'modules/'.$module_name.'/mails/'.$iso.'/'
: 'mails/'.$iso.'/';
$mail_dir = $is_module_template
? rtrim(_PS_MODULE_DIR_, '/').'/'.$module_name.'/mails/'
: _PS_MAIL_DIR_;
$content = array('html' => null, 'txt' => null);
foreach (array_keys($content) as $ext) {
$file_content = $gz->extractInString($archive_dir.$mail_template_name.'.'.$ext);
if ($file_content === null) {
if (file_exists($mail_dir.$iso.'/'.$mail_template_name.'.'.$ext)) {
$file_content = file_get_contents($mail_dir.$iso.'/'.$mail_template_name.'.'.$ext);
} elseif (file_exists($mail_dir.'en/'.$mail_template_name.'.'.$ext)) {
$file_content = file_get_contents($mail_dir.'en/'.$mail_template_name.'.'.$ext);
}
}
if ($file_content !== null) {
if (file_put_contents($dest_dir.$mail_template_name.'.'.$ext, $file_content) === false) {
return array('hasError' => true, 'error' => sprintf(Tools::displayError('Could not write file "%s".'), $dest_dir.$mail_template_name.'.'.$ext));
}
$content[$ext] = $file_content;
}
}
if ($content['html'] === null && $content['txt'] === null) {
return array('hasError' => true, 'error' => Tools::displayError('This template was not found in the downloaded language pack.'));
}
return array(
'hasError' => false,
'html' => $content['html'],
'txt' => $content['txt'],
);
}
}

View File

@@ -913,64 +913,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 = $objBookingDemand->unit_price_tax_excl * $numDays;
$objBookingDemand->total_price_tax_incl = $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 {
@@ -1237,8 +1182,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);
@@ -1250,8 +1195,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
@@ -1311,22 +1256,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,
@@ -1895,10 +1830,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) {
@@ -1972,35 +1904,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,
@@ -2046,9 +1949,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

View File

@@ -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(
@@ -6627,35 +6619,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(
@@ -6718,59 +6681,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('

View File

@@ -255,8 +255,10 @@ class TranslateCore
$i18n_file = $override_i18n_file;
}
if (!include($i18n_file)) {
Tools::displayError(sprintf('Cannot include PDF translation language file : %s', $i18n_file));
if (file_exists($i18n_file)) {
if (!include($i18n_file)) {
Tools::displayError(sprintf('Cannot include PDF translation language file : %s', $i18n_file));
}
}
if (!isset($_LANGPDF) || !is_array($_LANGPDF)) {

View File

@@ -3157,15 +3157,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;

View File

@@ -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
*

View File

@@ -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,

View File

@@ -159,17 +159,6 @@ class HTMLTemplateBookingVoucherCore extends HTMLTemplate
// Services for this booking
$bookingServices = array();
$objBookingDemand = new HotelBookingDemands();
$extraDemands = $objBookingDemand->getRoomTypeBookingExtraDemands(
(int)$this->order->id, 0, 0, 0, 0, 0, 0, 0,
(int)$booking['id'], (int)$booking['id_order_detail']
);
if (is_array($extraDemands)) {
foreach ($extraDemands as $demand) {
$bookingServices[] = array('name' => $demand['name'], 'quantity' => 1);
}
}
// Auto-added services bundled with room price (for cost calculation only)
$objServiceProductOrderDetail = new ServiceProductOrderDetail();
$autoAddedWithRoomPriceTaxExcl = (float)$objServiceProductOrderDetail->getRoomTypeServiceProducts(
@@ -181,7 +170,7 @@ class HTMLTemplateBookingVoucherCore extends HTMLTemplate
1, 0, 1, Product::PRICE_ADDITION_TYPE_WITH_ROOM
);
// Additional services chosen by guest
// Extra services chosen by guest
$additionalServices = $objServiceProductOrderDetail->getRoomTypeServiceProducts(
0, 0, 0, 0, 0, 0, 0, 0, 1, 0, null, 0, (int)$booking['id']
);
@@ -274,13 +263,10 @@ class HTMLTemplateBookingVoucherCore extends HTMLTemplate
}
}
// --- Totals ---
$objBookingDemand = new HotelBookingDemands();
$totalDemandsPriceTE = (float)$objBookingDemand->getRoomTypeBookingExtraDemands(
(int)$this->order->id, 0, 0, 0, 0, 1, 1, 0
);
$totalDemandsPriceTI = (float)$objBookingDemand->getRoomTypeBookingExtraDemands(
(int)$this->order->id, 0, 0, 0, 0, 1, 1, 1
);
// Extra demands feature was removed from the system; kept as 0 so the
// additive totals below stay correct without the deleted HotelBookingDemands class.
$totalDemandsPriceTE = 0;
$totalDemandsPriceTI = 0;
$orderDetails = OrderDetail::getList((int)$this->order->id);
$idsOrderDetail = is_array($orderDetails)

View File

@@ -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,32 +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'];
$cart_htl_data[$type_key]['date_diff'][$date_join]['total_price_tax_excl'] += $data_v['total_price_tax_excl'];
$cart_htl_data[$type_key]['date_diff'][$date_join]['total_price_tax_incl'] += $data_v['total_price_tax_incl'];
$cart_htl_data[$type_key]['date_diff'][$date_join]['additional_services_price_auto_add_ti'] += $objServiceProductOrderDetail->getroomTypeServiceProducts(
@@ -569,25 +515,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 +584,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 +600,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 +619,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 +650,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 +729,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 +763,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'];

View File

@@ -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']);

View File

@@ -1057,7 +1057,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(),
@@ -1130,7 +1130,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(),
@@ -1154,8 +1154,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'] = [];
@@ -1167,38 +1167,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')) {
@@ -1270,8 +1238,8 @@ class AdminCartsControllerCore extends AdminController
'can_edit' => $this->tabAccess['edit'],
));
$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;
@@ -1281,26 +1249,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();

View File

@@ -107,6 +107,20 @@ class AdminCustomerPreferencesControllerCore extends AdminController
'cast' => 'intval',
'type' => 'bool'
),
'PS_CUSTOMER_NATIONALITY' => array(
'title' => $this->l('Enable nationality'),
'hint' => $this->l('Display or not the nationality field.'),
'validation' => 'isBool',
'cast' => 'intval',
'type' => 'bool'
),
'PS_CUSTOMER_NATIONALITY_MANDATORY' => array(
'title' => $this->l('Nationality is mandatory'),
'hint' => $this->l('If you choose yes, your customer will have to select their nationality.'),
'validation' => 'isBool',
'cast' => 'intval',
'type' => 'bool'
),
'PS_CUSTOMER_NWSL' => array(
'title' => $this->l('Enable newsletter registration'),
'hint' => $this->l('Display or not the newsletter registration tick box.'),

View File

@@ -77,12 +77,39 @@ class AdminCustomersControllerCore extends AdminController
$groups_array[$group['id_group']] = $group['name'];
}
$selected_nationalities = array();
$nationalities_result = Db::getInstance()->executeS('
SELECT DISTINCT cl.id_country, cl.name
FROM '._DB_PREFIX_.'customer c
INNER JOIN '._DB_PREFIX_.'country_lang cl ON (cl.id_country = c.id_country AND cl.id_lang = '.(int)$this->context->language->id.')
WHERE c.id_country != 0 AND c.deleted = 0
ORDER BY cl.name ASC
');
foreach ($nationalities_result as $row) {
$selected_nationalities[$row['id_country']] = $row['name'];
}
$selected_nationalities[-1] = $this->l('Other');
$selected_nationalities[0] = $this->l('None');
$selected_countries = array();
$countries_result = Db::getInstance()->executeS('
SELECT DISTINCT cl.id_country, cl.name
FROM '._DB_PREFIX_.'address ad
INNER JOIN '._DB_PREFIX_.'country_lang cl ON (cl.id_country = ad.id_country AND cl.id_lang = '.(int)$this->context->language->id.')
WHERE ad.deleted = 0
ORDER BY cl.name ASC
');
foreach ($countries_result as $row) {
$selected_countries[$row['id_country']] = $row['name'];
}
$this->_join = 'LEFT JOIN '._DB_PREFIX_.'gender_lang gl ON (a.id_gender = gl.id_gender AND gl.id_lang = '.(int)$this->context->language->id.')';
$this->_join .= ' LEFT JOIN '._DB_PREFIX_.'group_lang grl ON (a.id_default_group = grl.id_group AND grl.id_lang = '.(int)$this->context->language->id.')';
$this->_join .= ' LEFT JOIN '._DB_PREFIX_.'orders o ON (a.id_customer = o.id_customer)';
$this->_join .= ' LEFT JOIN '._DB_PREFIX_.'address ad ON (ad.id_customer = a.id_customer AND ad.deleted = 0)';
$this->_join .= ' LEFT JOIN '._DB_PREFIX_.'state adstate ON (adstate.id_state = ad.id_state)';
$this->_join .= ' LEFT JOIN '._DB_PREFIX_.'country_lang adcountry ON (adcountry.id_country = ad.id_country AND adcountry.id_lang = '.(int)$this->context->language->id.')';
$this->_join .= ' LEFT JOIN '._DB_PREFIX_.'country_lang natcountry ON (natcountry.id_country = a.id_country AND natcountry.id_lang = '.(int)$this->context->language->id.')';
$this->_group = 'GROUP BY a.`id_customer`';
$this->fields_list = array(
@@ -134,6 +161,16 @@ class AdminCustomersControllerCore extends AdminController
'list' => $groups_array,
'filter_key' => 'a!id_default_group',
),
'nationality' => array(
'title' => $this->l('Nationality'),
'optional' => true,
'visible_default' => false,
'type' => 'select',
'list' => $selected_nationalities,
'filter_key' => 'a!id_country',
'filter_type' => 'int',
'orderby' => false,
),
'total_orders' => array(
'title' => $this->l('Number of orders'),
'type' => 'range',
@@ -205,7 +242,10 @@ class AdminCustomersControllerCore extends AdminController
'title' => $this->l('Country'),
'optional' => true,
'visible_default' => false,
'havingFilter' => true,
'type' => 'select',
'list' => $selected_countries,
'filter_key' => 'ad!id_country',
'filter_type' => 'int',
'orderby' => false,
),
'address_phone' => array(
@@ -299,7 +339,8 @@ class AdminCustomersControllerCore extends AdminController
ad.company as address_company, ad.vat_number,
ad.address1, ad.address2, ad.city, adstate.name as state,
ad.postcode, adcountry.name as country, ad.phone as address_phone,
ad.phone_mobile, ad.dni';
ad.phone_mobile, ad.dni,
(CASE WHEN a.id_country = -1 THEN \''.pSQL($this->l('Other')).'\' ELSE natcountry.name END) as nationality';
// Check if we can add a customer
if (Shop::isFeatureActive() && (Shop::getContext() == Shop::CONTEXT_ALL || Shop::getContext() == Shop::CONTEXT_GROUP)) {
@@ -585,6 +626,22 @@ class AdminCustomersControllerCore extends AdminController
'years' => $years
)
),
array(
'type' => 'select',
'label' => $this->l('Nationality'),
'name' => 'id_country',
'required' => (bool)(Configuration::get('PS_CUSTOMER_NATIONALITY') && Configuration::get('PS_CUSTOMER_NATIONALITY_MANDATORY')),
'col' => '4',
'options' => array(
'query' => Customer::getNationalities($this->context->language->id),
'id' => 'id_country',
'name' => 'name',
'default' => array(
'value' => '',
'label' => $this->l('-- Choose --')
)
),
),
array(
'type' => 'switch',
'label' => $this->l('Enabled'),
@@ -942,6 +999,16 @@ class AdminCustomersControllerCore extends AdminController
$gender = new Gender($customer->id_gender, $this->context->language->id);
$gender_image = $gender->getImage();
$nationality = '';
if ($customer->id_country == -1) {
$nationality = Translate::getAdminTranslation('Other', 'AdminCustomers');
} elseif ($customer->id_country) {
$nationalityCountry = new Country($customer->id_country, $this->context->language->id);
if (Validate::isLoadedObject($nationalityCountry)) {
$nationality = $nationalityCountry->name;
}
}
$customer_stats = $customer->getStats();
$sql = 'SELECT SUM(total_paid_real) FROM '._DB_PREFIX_.'orders WHERE id_customer = %d AND valid = 1';
if ($total_customer = Db::getInstance()->getValue(sprintf($sql, $customer->id))) {
@@ -1091,6 +1158,7 @@ class AdminCustomersControllerCore extends AdminController
'shop_is_feature_active' => Shop::isFeatureActive(),
'name_shop' => $shop->name,
'customer_birthday' => Tools::displayDate($customer->birthday),
'nationality' => $nationality,
'last_update' => Tools::displayDate($customer->date_upd, null, true),
'customer_exists' => Customer::customerExists($customer->email),
'id_lang' => $customer->id_lang,
@@ -1326,6 +1394,10 @@ class AdminCustomersControllerCore extends AdminController
}
}
if (Configuration::get('PS_CUSTOMER_NATIONALITY') && Configuration::get('PS_CUSTOMER_NATIONALITY_MANDATORY') && !Tools::getValue('id_country')) {
$this->errors[] = Tools::displayError('Nationality is required.');
}
$customer = new Customer();
$this->errors = array_merge($this->errors, $customer->validateFieldsRequiredDatabase());

View File

@@ -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',
);

View File

@@ -754,6 +754,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(),
@@ -1011,37 +1012,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,
@@ -1061,7 +1034,7 @@ class AdminOrdersControllerCore extends AdminController
$smartyVars['additionalServices'] = $additionalServices[$productLineData['id']];
}
// get room type additional demands
// get room type extra services
if (Configuration::get('PS_ALLOW_ADD_ALL_SERVICES_IN_BOOKING')) {
// get all services
$objProduct = new Product();
@@ -1104,7 +1077,7 @@ class AdminOrdersControllerCore extends AdminController
}
}
$smartyVars['serviceProducts'] = $serviceProducts;
$objOrderReturn = new OrderReturn();
$refundReqBookings = $objOrderReturn->getOrderRefundRequestedBookings($objOrder->id, 0, 1);
@@ -1157,33 +1130,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,
@@ -2516,44 +2466,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',
@@ -3489,53 +3401,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,
@@ -3815,8 +3688,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,
@@ -6247,8 +6118,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,
@@ -6266,18 +6135,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,
@@ -6302,46 +6159,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)
@@ -6633,30 +6450,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,
@@ -6797,10 +6590,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;
@@ -6818,8 +6609,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;
@@ -6856,9 +6647,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*/
@@ -7482,8 +7270,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'))
@@ -7502,25 +7290,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,
@@ -7541,11 +7313,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> &nbsp'.$this->l('Extra Services'),
'modal_content' => $this->context->smarty->fetch('controllers/orders/modals/_extra_services.tpl'),
@@ -7645,61 +7417,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);
@@ -8551,7 +8268,7 @@ class AdminOrdersControllerCore extends AdminController
}
} else {
$response['hasError'] = true;
$response['errors'] = $this->l('Additional service not found');
$response['errors'] = $this->l('Extra service not found');
}
} else {
$response['hasError'] = true;
@@ -8561,295 +8278,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 = $totalPriceTaxExcl = 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_incl = 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');

View File

@@ -112,7 +112,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) {
@@ -128,7 +127,6 @@ class AdminProductsControllerCore extends AdminController
'Occupancy' => 8,
'ServiceProduct' => 9,
'LengthOfStay' => 10,
'AdditionalFacilities' => 11,
));
}
@@ -232,7 +230,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
@@ -435,23 +432,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);
@@ -671,7 +651,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`
@@ -682,14 +662,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'),
@@ -701,14 +673,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']);
}
@@ -967,11 +935,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.');
}
@@ -2261,9 +2224,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
@@ -3834,136 +3794,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
*

View File

@@ -36,7 +36,6 @@ class AdminSearchControllerCore extends AdminController
'AdminFeatures' => 1,
'AdminOrders' => 1,
'AdminOrderRefundRules' => 1,
'AdminRoomTypeGlobalDemand' => 1,
'AdminGroups' => 1,
'AdminHotelAmenities' => 1,
'AdminCustomers' => 1,
@@ -190,8 +189,8 @@ class AdminSearchControllerCore extends AdminController
if (!$searchType) {
$this->searchAddress();
$this->searchHotelFeatures();
$this->searchHotelAmenities();
$this->searchAdditionalFacilities();
$this->searchRefundRules();
}
}
@@ -450,29 +449,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 +535,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 +944,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();

View File

@@ -560,29 +560,11 @@ public function initPageHeaderToolbar()
$objHotelBookingDetail = new HotelBookingDetail();
$bookingDetails = $objHotelBookingDetail->getBookingDataByOrderId($idOrder);
$objBookingDemands = new HotelBookingDemands();
$objServiceProductOrderDetail = new ServiceProductOrderDetail();
foreach ($bookingDetails as &$booking) {
$booking['extra_service_total_price_tax_incl'] = 0;
$extraDemands = $objBookingDemands->getRoomTypeBookingExtraDemands(
$idOrder,
$booking['id_product'],
$booking['id_room'],
$booking['date_from'],
$booking['date_to'],
0,
0,
1,
$booking['id']
);
if ($extraDemands) {
foreach ($extraDemands as $demand) {
$booking['extra_service_total_price_tax_incl'] += (float) $demand['total_price_tax_incl'];
}
}
$roomServices = $objServiceProductOrderDetail->getRoomTypeServiceProducts(
0, 0, 0, 0, 0, 0, 0, 0, null, null, null, 0, $booking['id']
);

View File

@@ -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;
}

View File

@@ -110,6 +110,23 @@ class AdminTranslationsControllerCore extends AdminController
'page_header_toolbar_title' => $this->page_header_toolbar_title,
'page_header_toolbar_btn' => $this->page_header_toolbar_btn));
}
public function setMedia()
{
parent::setMedia();
if (Tools::getValue('type') == 'mails') {
Media::addJsDef(array(
'mailResetSuccessMsg' => $this->l('The template is reset to its original content.'),
'mailResetErrorMsg' => $this->l('An error occurred while resetting the template.'),
'mailResetTooltipCore' => $this->l('On reset, the template will be reset to the default mail template.'),
'mailResetTooltipModule' => $this->l('On reset, the template will be reset using modules/{module}/mails/{iso}/'),
'admin_translations_link' => $this->context->link->getAdminLink('AdminTranslations'),
'EMAIL_TEMPLATE_TYPE_CORE' => Language::EMAIL_TEMPLATE_TYPE_CORE,
'EMAIL_TEMPLATE_TYPE_MODULE' => Language::EMAIL_TEMPLATE_TYPE_MODULE,
));
$this->addJS(_PS_JS_DIR_.'admin/translations.js');
}
}
/**
* This function create vars by default and call the good method for generate form
@@ -1429,6 +1446,9 @@ class AdminTranslationsControllerCore extends AdminController
*/
public function postProcess()
{
if ($this->ajax) {
return parent::postProcess();
}
$this->getInformations();
/* PrestaShop demo mode */
@@ -1663,6 +1683,50 @@ class AdminTranslationsControllerCore extends AdminController
}
}
public function ajaxProcessResetMailTemplate()
{
if (empty($this->tabAccess['edit'])) {
die(json_encode(array('hasError' => true, 'error' => Tools::displayError('You do not have permission to edit this.'))));
}
$iso_code = Tools::getValue('iso_code') ? Tools::getValue('iso_code') : null;
$theme = Tools::getValue('theme');
$mail_template_name = Tools::getValue('mail_name');
$template_type = (int)Tools::getValue('template_type');
$module_name = Tools::getValue('module_name') ? Tools::getValue('module_name') : false;
if (!Validate::isLanguageIsoCode($iso_code)) {
die(json_encode(array('hasError' => true, 'error' => Tools::displayError('Invalid iso code.'))));
}
if (!Validate::isTplName($mail_template_name)) {
die(json_encode(array('hasError' => true, 'error' => Tools::displayError('Invalid mail template to reset.'))));
}
if ($template_type === Language::EMAIL_TEMPLATE_TYPE_MODULE) {
if (!$module_name || !Validate::isModuleName($module_name)) {
die(json_encode(array('hasError' => true, 'error' => Tools::displayError('Invalid module name.'))));
}
} elseif ($template_type === Language::EMAIL_TEMPLATE_TYPE_CORE) {
$module_name = false;
} else {
die(json_encode(array('hasError' => true, 'error' => Tools::displayError('Invalid template type.'))));
}
if ($theme) {
$themes_base_dir = realpath(_PS_ALL_THEMES_DIR_);
$theme_real_path = realpath(_PS_ALL_THEMES_DIR_.$theme);
if ($themes_base_dir === false
|| $theme_real_path === false
|| strncmp($theme_real_path, $themes_base_dir.DIRECTORY_SEPARATOR, strlen($themes_base_dir) + 1) !== 0
) {
die(json_encode(array('hasError' => true, 'error' => Tools::displayError('Invalid theme.'))));
}
}
die(json_encode(Language::resetEmailTemplate($mail_template_name, $iso_code, $template_type, $module_name, $theme)));
}
/**
* Include file $dir/$file and return the var $var declared in it.
* This create the file if not exists
@@ -2362,9 +2426,12 @@ class AdminTranslationsControllerCore extends AdminController
$str_return .= '</div>';
}
$mail_available_variables = $this->displayMailAvailableVariables($mail_files);
if (array_key_exists('txt', $mail_files)) {
$str_return .= '<div class="tab-pane" id="'.$mail_name.'-text">';
$str_return .= $this->displayMailBlockTxt($mail_files['txt'], $obj_lang->iso_code, $mail_name, $group_name, $name_for_module);
$str_return .= $mail_available_variables;
$str_return .= '</div>';
}
@@ -2372,6 +2439,7 @@ class AdminTranslationsControllerCore extends AdminController
if (isset($mail_files['html'])) {
$str_return .= $this->displayMailEditor($mail_files['html'], $obj_lang->iso_code, $url_mail, $mail_name, $group_name, $name_for_module);
}
$str_return .= $mail_available_variables;
$str_return .= '</div>';
$str_return .= '</div>';
@@ -2389,6 +2457,46 @@ class AdminTranslationsControllerCore extends AdminController
$str_return .= '</div><!-- #'.$id_html.' --></div><!-- end .mails_field -->';
return $str_return;
}
protected function displayMailAvailableVariables($mail_files)
{
$variables = $this->getMailTemplateVariables($mail_files);
if (empty($variables)) {
return '';
}
$str_return = '<div class="mail-available-variables" style="margin-top:10px;">';
foreach ($variables as $variable) {
$tag = '{'.$variable.'}';
$str_return .= '<span class="label label-default pointer mail-variable-tag" style="display:inline-block;margin:0 4px 6px 0;" data-variable="'.Tools::htmlentitiesUTF8($tag).'">'.Tools::htmlentitiesUTF8($tag).'</span> ';
}
$str_return .= '</div>';
return $str_return;
}
protected function getMailTemplateVariables($mail_files)
{
$content = '';
foreach (array('html', 'txt') as $type) {
if (empty($mail_files[$type]) || !is_array($mail_files[$type])) {
continue;
}
if (isset($mail_files[$type]['en'])) {
$content .= ' '.$mail_files[$type]['en'];
} else {
$content .= ' '.reset($mail_files[$type]);
}
}
$variables = array();
if ($content !== '' && preg_match_all('/\{([a-zA-Z0-9_]+)\}/', $content, $matches)) {
$variables = array_unique($matches[1]);
sort($variables);
}
return $variables;
}
/**
* Just build the html structure for display txt mails
* @since 1.4.0.14
@@ -3070,12 +3178,31 @@ class AdminTranslationsControllerCore extends AdminController
}
$sanitizedFilePath = realpath($email_file);
$permittedMailDir = realpath(_PS_MAIL_DIR_) . DIRECTORY_SEPARATOR;
if ($sanitizedFilePath === false) {
return false;
}
if ($sanitizedFilePath === false || $permittedMailDir === false || strpos($sanitizedFilePath, $permittedMailDir) !== 0) {
$permitted_roots = array(
realpath(_PS_MAIL_DIR_),
realpath(_PS_ROOT_DIR_.'/themes/'),
realpath(_PS_ROOT_DIR_.'/modules/'),
);
$is_permitted = false;
foreach ($permitted_roots as $permitted_root) {
if ($permitted_root !== false
&& strpos($sanitizedFilePath, $permitted_root.DIRECTORY_SEPARATOR) === 0
&& strpos($sanitizedFilePath, DIRECTORY_SEPARATOR.'mails'.DIRECTORY_SEPARATOR) !== false
) {
$is_permitted = true;
break;
}
}
if (!$is_permitted) {
return false;
}
return file_get_contents($sanitizedFilePath);
}
}
}

View File

@@ -106,6 +106,9 @@ class AuthControllerCore extends FrontController
$newsletter = Configuration::get('PS_CUSTOMER_NWSL') || (Module::isInstalled('blocknewsletter') && Module::getInstanceByName('blocknewsletter')->active);
$this->context->smarty->assign('birthday', (bool) Configuration::get('PS_CUSTOMER_BIRTHDATE'));
$this->context->smarty->assign('nationality', (bool) Configuration::get('PS_CUSTOMER_NATIONALITY'));
$this->context->smarty->assign('nationality_mandatory', (bool) Configuration::get('PS_CUSTOMER_NATIONALITY_MANDATORY'));
$this->context->smarty->assign('nationality_countries', Customer::getNationalities($this->context->language->id));
$this->context->smarty->assign('newsletter', $newsletter);
$this->context->smarty->assign('optin', (bool)Configuration::get('PS_CUSTOMER_OPTIN'));
@@ -429,6 +432,10 @@ class AuthControllerCore extends FrontController
$this->errors[] = Tools::displayError('Phone number is required.');
}
if (Configuration::get('PS_CUSTOMER_NATIONALITY') && Configuration::get('PS_CUSTOMER_NATIONALITY_MANDATORY') && !Tools::getValue('id_nationality')) {
$this->errors[] = Tools::displayError('Nationality is required.');
}
if (!Tools::getValue('is_new_customer', 1)) {
if (Validate::isEmail($email = Tools::getValue('email'))
&& $idCustomer = Customer::customerExists(Tools::getValue('email'), true, false)
@@ -461,6 +468,7 @@ class AuthControllerCore extends FrontController
if (!count($this->errors)) {
$customer->phone = Tools::getValue('phone');
$customer->id_country = (int)Tools::getValue('id_nationality');
if ($customer->add()) {
if (!$customer->is_guest) {
if (!$this->sendConfirmationMail($customer)) {
@@ -607,6 +615,7 @@ class AuthControllerCore extends FrontController
$customer->is_guest = 0;
}
$customer->phone = Tools::getValue('phone');
$customer->id_country = (int)Tools::getValue('id_nationality');
if (!$customer->save()) {
$this->errors[] = Tools::displayError('An error occurred while creating your account.');
} else {

View File

@@ -629,8 +629,6 @@ class CartControllerCore extends FrontController
*/
if ($product->booking_product) {
$objHotelCartBookingData = new HotelCartBookingData();
$roomDemand = json_decode(Tools::getValue('room_demands'), true);
$roomDemand = json_encode($roomDemand);
$availQty = $total_available_rooms;
$update_quantity = $objHotelCartBookingData->updateCartBooking(
$this->id_product,
@@ -640,7 +638,6 @@ class CartControllerCore extends FrontController
0,
$date_from,
$date_to,
$roomDemand,
$serviceProducts,
$id_cart,
$id_guest
@@ -652,7 +649,6 @@ class CartControllerCore extends FrontController
'date_to' => $date_to,
'id_product' => $this->id_product,
'occupancy' => $occupancy,
'room_demand' => $roomDemand,
'req_rm' => $req_rm
));
} else {

View File

@@ -106,9 +106,9 @@ class GuestTrackingControllerCore extends FrontController
}
}
public function displayAjaxGetRoomTypeBookingDemands()
public function displayAjaxgetRoomTypeBookingServices()
{
$response = array('extra_demands' => false);
$response = array('extra_services' => false);
$order = new Order((int) Tools::getValue('id_order'));
@@ -121,26 +121,10 @@ class GuestTrackingControllerCore extends FrontController
&& ($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,
@@ -164,7 +148,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));
@@ -263,8 +247,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;
@@ -297,8 +279,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']);
@@ -372,41 +352,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;
@@ -416,7 +361,7 @@ class GuestTrackingControllerCore extends FrontController
$cartHotelData[$type_key]['date_diff'][$date_join]['feature_price_diff'] = $feature_price_diff;
$cartHotelData[$type_key]['hotel_name'] = $data_v['hotel_name'];
// add additional services products in hotel detail.
// add extra services products in hotel detail.
$cartHotelData[$type_key]['date_diff'][$date_join]['additional_services'] = $objServiceProductOrderDetail->getRoomTypeServiceProducts(
$idOrder,
0,
@@ -581,8 +526,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');

View File

@@ -63,6 +63,10 @@ class IdentityControllerCore extends FrontController
}
}
if (Configuration::get('PS_CUSTOMER_NATIONALITY') && Configuration::get('PS_CUSTOMER_NATIONALITY_MANDATORY') && !Tools::getValue('id_nationality')) {
$this->errors[] = Tools::displayError('Nationality is required.');
}
if (Tools::getIsset('old_passwd')) {
$old_passwd = trim(Tools::getValue('old_passwd'));
}
@@ -91,6 +95,7 @@ class IdentityControllerCore extends FrontController
if (!count($this->errors)) {
$this->customer->phone = $phone;
$this->customer->id_country = (int)Tools::getValue('id_nationality');
$this->customer->id_default_group = (int)$prev_id_default_group;
$this->customer->firstname = Tools::ucwords($this->customer->firstname);
@@ -127,6 +132,7 @@ class IdentityControllerCore extends FrontController
} else {
$_POST = array_map('stripslashes', $this->customer->getFields());
$_POST['phone'] = $this->customer->phone;
$_POST['id_nationality'] = $this->customer->id_country;
}
return $this->customer;
@@ -167,6 +173,9 @@ class IdentityControllerCore extends FrontController
$newsletter = Configuration::get('PS_CUSTOMER_NWSL') || (Module::isInstalled('blocknewsletter') && Module::getInstanceByName('blocknewsletter')->active);
$this->context->smarty->assign('birthday', (bool) Configuration::get('PS_CUSTOMER_BIRTHDATE'));
$this->context->smarty->assign('nationality', (bool) Configuration::get('PS_CUSTOMER_NATIONALITY'));
$this->context->smarty->assign('nationality_mandatory', (bool) Configuration::get('PS_CUSTOMER_NATIONALITY_MANDATORY'));
$this->context->smarty->assign('nationality_countries', Customer::getNationalities($this->context->language->id));
$this->context->smarty->assign('newsletter', $newsletter);
$this->context->smarty->assign('optin', (bool)Configuration::get('PS_CUSTOMER_OPTIN'));

View File

@@ -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;
@@ -283,7 +243,7 @@ class OrderConfirmationControllerCore extends FrontController
//enter hotel name
$cart_htl_data[$type_key]['hotel_name'] = $data_v['hotel_name'];
// add additional services products in hotel detail.
// add extra services products in hotel detail.
$cart_htl_data[$type_key]['date_diff'][$date_join]['additional_services'] = $objServiceProductOrderDetail->getRoomTypeServiceProducts(
$idOrder,
0,
@@ -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;
}

View File

@@ -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;
@@ -271,7 +231,7 @@ class OrderDetailControllerCore extends FrontController
$cartHotelData[$type_key]['date_diff'][$date_join]['feature_price_diff'] = $feature_price_diff;
$cartHotelData[$type_key]['hotel_name'] = $data_v['hotel_name'];
// add additional services products in hotel detail.
// add extra services products in hotel detail.
$cartHotelData[$type_key]['date_diff'][$date_join]['additional_services'] = $objServiceProductOrderDetail->getRoomTypeServiceProducts(
$id_order,
0,
@@ -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,9 +477,9 @@ 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);
$idOrder = (int) Tools::getValue('id_order');
$order = new Order($idOrder);
@@ -538,26 +496,11 @@ class OrderDetailControllerCore extends FrontController
&& ($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,
@@ -581,7 +524,7 @@ class OrderDetailControllerCore extends FrontController
'objOrder' => $order,
));
$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));

View File

@@ -126,6 +126,7 @@ class OrderOpcControllerCore extends ParentOrderController
}
$this->context->customer->phone = $phone;
$this->context->customer->id_country = (int)Tools::getValue('id_nationality');
$_POST['lastname'] = $_POST['customer_lastname'];
$_POST['firstname'] = $_POST['customer_firstname'];
$this->errors = array_merge($this->errors, $this->context->customer->validateController());
@@ -376,14 +377,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 +492,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,
@@ -559,6 +550,9 @@ class OrderOpcControllerCore extends ParentOrderController
$newsletter = Module::isInstalled('blocknewsletter') && Module::getInstanceByName('blocknewsletter')->active && Configuration::get('PS_CUSTOMER_NWSL');
$this->context->smarty->assign('birthday', (bool) Configuration::get('PS_CUSTOMER_BIRTHDATE'));
$this->context->smarty->assign('nationality', (bool) Configuration::get('PS_CUSTOMER_NATIONALITY'));
$this->context->smarty->assign('nationality_mandatory', (bool) Configuration::get('PS_CUSTOMER_NATIONALITY_MANDATORY'));
$this->context->smarty->assign('nationality_countries', Customer::getNationalities($this->context->language->id));
$this->context->smarty->assign('newsletter', $newsletter);
$this->context->smarty->assign('optin', (bool)Configuration::get('PS_CUSTOMER_OPTIN'));
$this->context->smarty->assign('field_required', $this->context->customer->validateFieldsRequiredDatabase());
@@ -645,6 +639,7 @@ class OrderOpcControllerCore extends ParentOrderController
'id_country' => (int)$address_delivery->id_country,
'id_state' => (int)$address_delivery->id_state,
'id_gender' => (int)$customer->id_gender,
'id_nationality' => (int)$customer->id_country,
'phone' => $customer->phone,
'sl_year' => $birthday[0],
'sl_month' => $birthday[1],
@@ -950,37 +945,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 +971,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);

View File

@@ -403,17 +403,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'];
}
}
}
$roomFeatures = $this->product->getFrontFeatures($this->context->language->id);
$roomAmenities = HotelRoomTypeAmenities::getAmenities($this->product->id, $this->context->language->id);
$hotelAmenities = HotelBranchAmenities::getAmenities($hotel_id, $this->context->language->id);
@@ -421,7 +410,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,
@@ -532,7 +520,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'],
@@ -625,7 +612,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);
@@ -638,8 +624,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;
@@ -783,51 +767,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;
@@ -865,13 +806,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;
@@ -894,11 +835,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;
@@ -1454,7 +1394,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));
@@ -1464,7 +1403,6 @@ class ProductControllerCore extends FrontController
$dateFrom,
$dateTo,
$occupancy,
$roomTypeDemands,
$roomServiceProducts
)) {
}

View File

@@ -594,6 +594,7 @@ CREATE TABLE `PREFIX_customer` (
`id_gender` int(10) unsigned NOT NULL,
`id_default_group` int(10) unsigned NOT NULL DEFAULT '1',
`id_lang` int(10) unsigned NULL,
`id_country` int(10) NOT NULL DEFAULT '0',
`id_risk` int(10) unsigned NOT NULL DEFAULT '1',
`company` varchar(64),
`siret` varchar(14),

View File

@@ -911,6 +911,12 @@
<configuration id="PS_CUSTOMER_BIRTHDATE" name="PS_CUSTOMER_BIRTHDATE">
<value>1</value>
</configuration>
<configuration id="PS_CUSTOMER_NATIONALITY" name="PS_CUSTOMER_NATIONALITY">
<value>0</value>
</configuration>
<configuration id="PS_CUSTOMER_NATIONALITY_MANDATORY" name="PS_CUSTOMER_NATIONALITY_MANDATORY">
<value>0</value>
</configuration>
<configuration id="PS_CUSTOMER_NWSL" name="PS_CUSTOMER_NWSL">
<value>1</value>
</configuration>

View File

@@ -504,6 +504,14 @@ function changeCMSActivationAuthorization()
getE('PS_CONDITIONS_CMS_ID').disabled = 'disabled';
}
function toggleNationalityMandatoryField()
{
if ($('#PS_CUSTOMER_NATIONALITY_on').prop('checked'))
$('#conf_id_PS_CUSTOMER_NATIONALITY_MANDATORY').closest('.form-group').show();
else
$('#conf_id_PS_CUSTOMER_NATIONALITY_MANDATORY').closest('.form-group').hide();
}
function changeOverbookingOrderAction()
{
if (getE('PS_OVERBOOKING_ORDER_ACTION').value == $("input[name='OVERBOOKING_ORDER_CANCEL_ACTION']").val())
@@ -998,6 +1006,10 @@ $(document).ready(function()
if ($('.kpi-container').length) {
refresh_kpis();
}
if ($('#PS_CUSTOMER_NATIONALITY_on').length) {
toggleNationalityMandatoryField();
$('input[name="PS_CUSTOMER_NATIONALITY"]').on('change', toggleNationalityMandatoryField);
}
});
function bindSwapSave()

View File

@@ -1048,24 +1048,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 extra service edit
$(document).on('click', '#back_to_service_btn', function() {
$('.room_ordered_services').show();
$('#btn_new_existing_room_service').show();
@@ -1140,7 +1123,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>';
@@ -1201,7 +1184,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);
@@ -1236,7 +1219,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>';
@@ -1255,157 +1238,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();
@@ -1455,7 +1287,7 @@ $(document).ready(function() {
date_to: dateTo,
id_htl_booking: idHtlBooking,
orderEdit: orderEdit,
action: 'getRoomTypeBookingDemands',
action: 'getRoomTypeBookingServices',
ajax: true
},
success: function(result) {
@@ -1463,7 +1295,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() {
@@ -1472,8 +1304,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();
});
@@ -2895,7 +2727,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);
@@ -2909,42 +2741,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()))

View File

@@ -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

208
js/admin/translations.js Normal file
View File

@@ -0,0 +1,208 @@
/*
* 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
*/
$(document).ready(function () {
$('a.useSpecialSyntax').click(function () {
var syntax = $(this).find('img').attr('alt');
$('#BoxUseSpecialSyntax .syntax span').html(syntax + ".");
});
$('.mails_field').on('shown.bs.collapse', function () {
// get active email
var active_email = $(this).find('.email-collapse.in');
// get iframe container for active email
var frame = active_email.find('.email-html-frame');
// get source url for active email
var src = frame.data('email-src');
// get rte container for active email
var rte_textarea = active_email.find('textarea.rte-mail');
var rte_mail_selector = rte_textarea.data('rte');
var rte_name_match = (rte_textarea.attr('name') || '').match(/\[html\]\[(.+)\]$/);
if (!rte_name_match) {
// this template has no .html file (txt-only) - fall back to the txt textarea's name
var txt_textarea = active_email.find('textarea.rte.noEditor');
rte_name_match = (txt_textarea.attr('name') || '').match(/\[txt\]\[(.+)\]$/);
}
var $resetBtn = $('.mail-template-reset-btn');
if (rte_name_match) {
var name_parts = rte_name_match[1].split('|');
var has_module = name_parts.length > 1;
$('#reset_mail_name').val(has_module ? name_parts[1] : name_parts[0]);
$('#reset_template_type').val(has_module ? EMAIL_TEMPLATE_TYPE_MODULE : EMAIL_TEMPLATE_TYPE_CORE);
$('#reset_module_name').val(has_module ? name_parts[0] : '');
$resetBtn.prop('disabled', false);
var reset_tooltip = has_module
? mailResetTooltipModule.replace('{module}', name_parts[0]).replace('{iso}', $('input[name="lang"]').val())
: mailResetTooltipCore;
$resetBtn.attr('title', reset_tooltip).attr('data-original-title', reset_tooltip).tooltip('fixTitle');
rte_textarea
} else {
$('#reset_mail_name').val('');
$('#reset_template_type').val('');
$('#reset_module_name').val('');
$resetBtn.prop('disabled', true);
$resetBtn.attr('title', '').attr('data-original-title', '').tooltip('fixTitle');
}
var rte_mail_config = {};
rte_mail_config['editor_selector'] = 'rte-mail-' + rte_mail_selector;
rte_mail_config['plugins'] = "colorpicker link image paste pagebreak table contextmenu filemanager table code media autoresize textcolor anchor fullpage";
$('#translation_mails-control-actions').appendTo($(this).find('.panel-collapse.in'));
if (frame.find('iframe.email-frame').length == 0) {
// load iframe
frame.append('<iframe class="email-frame" />');
$.ajax({
url: 'ajax.php',
type: 'POST',
dataType: 'html',
data: {
getEmailHTML: true,
email: src
},
success: function (result) {
var doc = frame.find('iframe')[0].contentWindow.document;
doc.open();
doc.write(result);
doc.close();
tinySetup(rte_mail_config);
}
});
}
});
$('.mail-variable-tag').on('click', function () {
var textarea = $(this).closest('.email-collapse').find('> .tab-content > .tab-pane.active textarea').get(0);
if (textarea) {
insertVariable(textarea, $(this).data('variable'));
}
});
$('.mail-template-reset-btn').on('click', function () {
var $btn = $(this);
if ($btn.prop('disabled')) {
return;
}
var mailName = $('#reset_mail_name').val();
if (!mailName) {
return;
}
var templateType = $('#reset_template_type').val();
var moduleName = $('#reset_module_name').val();
var $panel = $btn.closest('.email-collapse.in');
var $htmlTextarea = $panel.find('textarea.rte-mail');
var $txtTextarea = $panel.find('textarea.rte.noEditor');
var $titleInput = $panel.find('input[name^="title_"]');
var $frame = $panel.find('.email-html-frame');
var $icon = $btn.find('.process-icon-refresh');
$btn.prop('disabled', true);
$icon.addClass('icon-spin');
$.ajax({
url: admin_translations_link,
type: 'POST',
dataType: 'json',
data: {
ajax: true,
action: 'ResetMailTemplate',
iso_code: $('input[name="lang"]').val(),
theme: $('input[name="theme"]').val(),
mail_name: mailName,
template_type: templateType,
module_name: moduleName,
token: $('#translation_mails_token').val()
},
success: function (result) {
$btn.prop('disabled', false);
$icon.removeClass('icon-spin');
if (!result || result.hasError) {
showErrorMessage((result && result.error) || mailResetErrorMsg);
return;
}
if (result.html !== null && $htmlTextarea.length) {
var editor = (typeof tinymce !== 'undefined' && $htmlTextarea.attr('id')) ? tinymce.get($htmlTextarea.attr('id')) : null;
if (editor) {
editor.setContent(result.html);
} else {
$htmlTextarea.val(result.html);
}
var titleMatch = result.html.match(/<title>([^<]*)<\/title>/i);
if (titleMatch) {
$titleInput.val(titleMatch[1]);
}
}
if (result.txt !== null && $txtTextarea.length) {
$txtTextarea.val(result.txt);
}
if ($frame.length) {
$frame.empty().append('<iframe class="email-frame" />');
$.ajax({
url: 'ajax.php',
type: 'POST',
dataType: 'html',
data: {
getEmailHTML: true,
email: $frame.data('email-src')
},
success: function (htmlResult) {
var doc = $frame.find('iframe')[0].contentWindow.document;
doc.open();
doc.write(htmlResult);
doc.close();
}
});
}
showSuccessMessage(mailResetSuccessMsg);
},
error: function () {
$btn.prop('disabled', false);
$icon.removeClass('icon-spin');
showErrorMessage(mailResetErrorMsg);
}
});
});
});
function insertVariable(field, text) {
var editor = (typeof tinymce !== 'undefined' && field.id) ? tinymce.get(field.id) : null;
if (editor) {
editor.execCommand('mceInsertContent', false, text);
editor.focus();
return;
}
field.focus();
var startPos = field.selectionStart;
var endPos = field.selectionEnd;
field.value = field.value.substring(0, startPos) + text + field.value.substring(endPos, field.value.length);
field.selectionStart = field.selectionEnd = startPos + text.length;
}

View File

@@ -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}

View File

@@ -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}

View File

@@ -0,0 +1,89 @@
{if isset($list)}
<table class="table table-recap additional-service-table">
<thead>
<tr>
<th colspan="4">{l s='Extra 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}

View File

@@ -108,7 +108,7 @@
</tr>
<tr>
<td style="padding:7px 0">
{extra_demands_details_html}
{extra_services_details_html}
</td>
</tr>
<tr>

View File

@@ -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}

View File

@@ -129,7 +129,7 @@
</tr>
<tr>
<td style="padding:7px 0">
{extra_demands_details_html}
{extra_services_details_html}
</td>
</tr>
<tr>

View File

@@ -13,7 +13,7 @@ Payment: {payment}
{cart_booking_data_text}
{extra_demands_details_text}
{extra_services_details_text}
{normal_products_data_txt}

View File

@@ -109,7 +109,7 @@
</tr>
<tr>
<td style="padding:7px 0">
{extra_demands_details_html}
{extra_services_details_html}
</td>
</tr>
<tr>

View File

@@ -11,7 +11,7 @@ Status: {order_status}
{cart_booking_data_text}
{extra_demands_details_text}
{extra_services_details_text}
{normal_products_data_txt}

View File

@@ -132,7 +132,7 @@
</tr>
<tr>
<td style="padding:7px 0">
{extra_demands_details_html}
{extra_services_details_html}
</td>
</tr>
<tr>

View File

@@ -16,7 +16,7 @@ Status: {order_status}
{cart_booking_data_text}
{extra_demands_details_text}
{extra_services_details_text}
{normal_products_data_txt}

View File

@@ -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}

View File

@@ -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('date_from', dateFrom);
if (typeof dateTo != 'undefined')
@@ -412,8 +412,6 @@ var ajaxCart = {
req.append('qty', ((occupancy && occupancy != null) ? occupancy : '1'));
}
var roomDemands = getRoomsExtraDemands();
req.append('room_demands', JSON.stringify(roomDemands) );
getRoomsServiceProducts().forEach(function(product) {
req.append('service_product['+product.id_product+'][quantity]', product.quantity);
});
@@ -436,9 +434,6 @@ var ajaxCart = {
processData: false,
success: function(jsonData, textStatus, jqXHR) {
if (pagename == 'product') {
if (jsonData.avail_rooms == 0) {
disableRoomTypeDemands(1);
}
resetRoomtypeServices();
@@ -575,9 +570,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();
}
@@ -642,7 +634,6 @@ var ajaxCart = {
data: 'controller=cart&delete=1&date_from=' + dateFrom + '&date_to=' + 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();
}
@@ -963,7 +954,7 @@ var ajaxCart = {
content += '<tr class="rooms_remove_container">';
content += '<td>' + moment(new Date(date_diff_v.data_form)).format(dateFormatToUse) + '&nbsp;-&nbsp;' + 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>';
@@ -1041,7 +1032,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) + '&nbsp;-&nbsp;' + 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>';
@@ -1397,3 +1388,84 @@ function crossselling_serialScroll() {
pager: false
});
}
function resetRoomtypeServices(refresh = true) {
$('#additional_products').empty();
$('#additional_products div')
$('.remove_roomtype_product').text(select_txt).removeClass('btn-danger remove_roomtype_product').addClass('btn-success add_roomtype_product');
if (refresh) {
BookingForm.refresh();
}
}
function disableRoomTypeServices(disable) {
if (disable) {
resetRoomtypeServices(false);
$('#service_products_cont').find('button.add_roomtype_product').attr('disabled', 'disabled');
$('#service_products_cont').find('.qty_container .qty_direction a').attr('disabled', 'disabled');
} else {
$('#service_products_cont').find('button.add_roomtype_product').removeAttr('disabled');
$('#service_products_cont').find('.qty_container .qty_direction a').removeAttr('disabled');
}
}
function getRoomsServiceProducts()
{
var serviceProducts = [];
$('#additional_products input.service_product').each(function () {
serviceProducts.push({
'id_product': $(this).data('id_product'),
'quantity':$(this).val(),
});
});
return serviceProducts;
}
function getBookingOccupancyDetails(bookingform, booking_product)
{
let occupancy;
if (booking_product) {
if (occupancy_required_for_booking) {
$('.booking_guest_occupancy_conatiner .dropdown').removeClass('open');
let selected_occupancy = $(bookingform).find(".occupancy_info_block.selected")
if (selected_occupancy.length) {
occupancy = [];
$(selected_occupancy).each(function(ind, element) {
if (parseInt($(element).find('.num_adults').val())) {
let child_ages = [];
$(element).find('.guest_child_age').each(function(index) {
if ($(this).val() > -1) {
child_ages.push($(this).val());
}
});
if ($(element).find('.num_children').val()) {
if (child_ages.length != $(element).find('.num_children').val()) {
$(bookingform).find('.booking_occupancy_wrapper').parent().addClass('open')
occupancy = false;
}
}
occupancy.push({
'adults': $(element).find('.num_adults').val(),
'children': $(element).find('.num_children').val(),
'child_ages': child_ages
});
} else {
$(bookingform).find('.booking_occupancy_wrapper').parent().addClass('open')
occupancy = false;
}
});
} else {
$(bookingform).find('.booking_occupancy_wrapper').parent().addClass('open')
occupancy = false;
}
} else {
occupancy = parseInt($(bookingform).find(".quantity_wanted").val());
}
} else {
occupancy = parseInt($('#service_product_qty').val());
}
return occupancy;
}

View File

@@ -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),

View File

@@ -88,7 +88,7 @@
{dateFormat date=$data_v['data_form'] full=$is_full_date}&nbsp;-&nbsp;{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}

View File

@@ -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>

View File

@@ -1,303 +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 += (float)$demand['total_price_tax_incl'];
} else {
$totalDemandsPrice += (float)$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;
$objBkDetail = new HotelBookingDetail($this->id_htl_booking);
$objOrder = new Order($objBkDetail->id_order);
foreach ($taxCalculator->getTaxesAmount($priceTaxExcl) as $idTax => $amount) {
$quantity = 1;
if ($this->price_calc_method == HotelRoomTypeGlobalDemand::WK_PRICE_CALC_METHOD_EACH_DAY) {
$quantity = HotelHelper::getNumberOfDays($objBkDetail->date_from, $objBkDetail->date_to);
}
// Rounding as per configurations — use order's stored round settings
$totalAmount = Tools::processPriceRounding($amount, $quantity, $objOrder->round_type, $objOrder->round_mode);
$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);
}
}

View File

@@ -237,13 +237,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)
@@ -2201,23 +2194,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();
@@ -3467,14 +3443,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(
@@ -3502,7 +3470,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;
@@ -3510,28 +3477,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,

View File

@@ -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 HotelAmenities();
$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,
@@ -1644,15 +1591,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,
@@ -1664,8 +1603,6 @@ class HotelCartBookingData extends ObjectModel
1,
0
);
$totalAdditionalServicePrice = $demandPrice + $serviceProductPrice;
$occupancy = array(
array(
'adults' => $data_v['adults'],
@@ -1675,7 +1612,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'];
@@ -1730,7 +1667,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(
@@ -1907,136 +1844,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);
@@ -2048,31 +1855,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;
}
}
}

View File

@@ -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;

View File

@@ -166,7 +166,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,
@@ -231,30 +230,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,
@@ -357,59 +332,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,
@@ -532,9 +454,8 @@ class HotelReservationSystemDb
"INSERT IGNORE 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,
@@ -554,18 +475,13 @@ class HotelReservationSystemDb
FROM `"._DB_PREFIX_."lang`
ORDER BY `id_lang`;",
"INSERT IGNORE 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.'
"INSERT INTO `"._DB_PREFIX_."htl_settings_link_lang` (`id_settings_link`, `id_lang`, `name`, `hint`)
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 IGNORE 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 IGNORE 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.'
"INSERT INTO `"._DB_PREFIX_."htl_settings_link_lang` (`id_settings_link`, `id_lang`, `name`, `hint`)
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` (
@@ -614,8 +530,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`,
@@ -626,12 +540,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`,

View File

@@ -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
);
}
}

View File

@@ -1,165 +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
);
}
$numDays = 1;
if ($objGlobalDemand->price_calc_method == HotelRoomTypeGlobalDemand::WK_PRICE_CALC_METHOD_EACH_DAY) {
if ($dateFrom && $dateTo) {
$numDays = max(1, HotelHelper::getNumberOfDays($dateFrom, $dateTo));
}
}
$totalDemandsPrice += $price * $numDays;
}
}
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();
}
}

View File

@@ -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
);
}
}

View File

@@ -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 ('.implode(',', array_map('intval', $skipIds)).')' ;
}
if ($advOptions = Db::getInstance()->executeS($sql)) {
foreach ($advOptions as &$option) {
$objOption = new HotelRoomTypeGlobalDemandAdvanceOption($option['id_option']);
$objOption->delete();
}
}
return true;
}
}

View File

@@ -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;

View File

@@ -753,7 +753,7 @@ public function ajaxProcessGetCalenderData()
}
if ($product->booking_product || ($product->selling_preference_type != Product::SELLING_PREFERENCE_STANDALONE)) {
// cannot be added without room type or is a booking product.
$this->errors[] = $this->l('This product is either a room type or additional service and cannot be added thorugh this method.');
$this->errors[] = $this->l('This product is either a room type or extra service and cannot be added thorugh this method.');
} elseif (!$product->allow_multiple_quantity) {
// check if product already exists in cart.
if ($id_cart) {
@@ -879,7 +879,6 @@ public function ajaxProcessGetCalenderData()
$date_from,
$date_to,
array(),
array(),
$id_cart,
$id_guest,
$booking_type,

View File

@@ -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');
}
}

View File

@@ -40,11 +40,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';

View File

@@ -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
}
}
@@ -473,9 +403,8 @@ class HotelReservationSystem extends Module
$langTables = array(
'htl_room_type_feature_pricing',
'htl_branch_info',
'htl_features',
'htl_amenity',
'htl_room_type_global_demand',
'htl_room_type_global_demand_advance_option',
'htl_order_refund_rules',
'htl_settings_link'
);
@@ -503,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();
}
@@ -527,7 +448,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);
$this->installTab('AdminHotelImageCategory', 'Hotel Image Category', false, false);

View File

@@ -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}

View File

@@ -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;

View File

@@ -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}

View File

@@ -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>&nbsp;{l s='Edit Facility' mod='hotelreservationsystem'}
{else}
<i class='icon-plus'></i>&nbsp;{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}

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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_amenity_lang', 'id_lang', 'lang', 'id_lang'),
array('htl_amenity_lang', 'id_amenity', 'htl_amenity', 'id_amenity'),
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_features_lang', 'id_lang', 'lang', 'id_lang'),
array('htl_features_lang', 'id', 'htl_features', 'id'),
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_amenity', '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_room_type_amenity',
@@ -877,8 +865,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',

View File

@@ -2,6 +2,6 @@
"name": "qloapps/qlocrontaskmanager",
"description": "Centralized cron task manager for QloApps modules",
"require": {
"dragonmantank/cron-expression": "^3.0"
"dragonmantank/cron-expression": "3.5.0"
}
}

View File

@@ -2,21 +2,21 @@
"packages": [
{
"name": "dragonmantank/cron-expression",
"version": "v3.6.0",
"version_normalized": "3.6.0.0",
"version": "v3.5.0",
"version_normalized": "3.5.0.0",
"source": {
"type": "git",
"url": "https://github.com/dragonmantank/cron-expression.git",
"reference": "d61a8a9604ec1f8c3d150d09db6ce98b32675013"
"reference": "1b2de7f4a468165dca07b142240733a1973e766d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/dragonmantank/cron-expression/zipball/d61a8a9604ec1f8c3d150d09db6ce98b32675013",
"reference": "d61a8a9604ec1f8c3d150d09db6ce98b32675013",
"url": "https://api.github.com/repos/dragonmantank/cron-expression/zipball/1b2de7f4a468165dca07b142240733a1973e766d",
"reference": "1b2de7f4a468165dca07b142240733a1973e766d",
"shasum": ""
},
"require": {
"php": "^8.2|^8.3|^8.4|^8.5"
"php": "^7.2|^8.0"
},
"replace": {
"mtdowling/cron-expression": "^1.0"
@@ -26,7 +26,7 @@
"phpstan/phpstan": "^1.12.32|^2.1.31",
"phpunit/phpunit": "^8.5.48|^9.0"
},
"time": "2025-10-31T18:51:33+00:00",
"time": "2025-10-31T18:36:32+00:00",
"type": "library",
"extra": {
"branch-alias": {
@@ -57,7 +57,7 @@
],
"support": {
"issues": "https://github.com/dragonmantank/cron-expression/issues",
"source": "https://github.com/dragonmantank/cron-expression/tree/v3.6.0"
"source": "https://github.com/dragonmantank/cron-expression/tree/v3.5.0"
},
"funding": [
{

View File

@@ -3,7 +3,7 @@
'name' => 'qloapps/qlocrontaskmanager',
'pretty_version' => 'dev-develop',
'version' => 'dev-develop',
'reference' => 'f7d1d629ca72fc5ffd3349dea2877013367cea81',
'reference' => '8d04d350b83cd28b5d141bf0cb287d4ba95de7d0',
'type' => 'library',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
@@ -11,9 +11,9 @@
),
'versions' => array(
'dragonmantank/cron-expression' => array(
'pretty_version' => 'v3.6.0',
'version' => '3.6.0.0',
'reference' => 'd61a8a9604ec1f8c3d150d09db6ce98b32675013',
'pretty_version' => 'v3.5.0',
'version' => '3.5.0.0',
'reference' => '1b2de7f4a468165dca07b142240733a1973e766d',
'type' => 'library',
'install_path' => __DIR__ . '/../dragonmantank/cron-expression',
'aliases' => array(),
@@ -28,7 +28,7 @@
'qloapps/qlocrontaskmanager' => array(
'pretty_version' => 'dev-develop',
'version' => 'dev-develop',
'reference' => 'f7d1d629ca72fc5ffd3349dea2877013367cea81',
'reference' => '8d04d350b83cd28b5d141bf0cb287d4ba95de7d0',
'type' => 'library',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),

View File

@@ -4,8 +4,8 @@
$issues = array();
if (!(PHP_VERSION_ID >= 80200)) {
$issues[] = 'Your Composer dependencies require a PHP version ">= 8.2.0". You are running ' . PHP_VERSION . '.';
if (!(PHP_VERSION_ID >= 70200)) {
$issues[] = 'Your Composer dependencies require a PHP version ">= 7.2.0". You are running ' . PHP_VERSION . '.';
}
if ($issues) {

View File

@@ -12,7 +12,7 @@
}
],
"require": {
"php": "^8.2|^8.3|^8.4|^8.5"
"php": "^7.2|^8.0"
},
"require-dev": {
"phpstan/phpstan": "^1.12.32|^2.1.31",

Some files were not shown because too many files have changed in this diff Show More