Merge branch 'develop' into gli-1475
This commit is contained in:
@@ -82,6 +82,9 @@
|
||||
var with_room_type = {Product::SERVICE_PRODUCT_WITH_ROOMTYPE|intval};
|
||||
var without_room_type = {Product::SERVICE_PRODUCT_WITHOUT_ROOMTYPE|intval};
|
||||
|
||||
var price_addition_type_with_room = {Product::PRICE_ADDITION_TYPE_WITH_ROOM|intval};
|
||||
var price_addition_type_independent = {Product::PRICE_ADDITION_TYPE_INDEPENDENT|intval};
|
||||
|
||||
|
||||
var has_combinations = {$has_combinations|intval};
|
||||
|
||||
|
||||
@@ -139,7 +139,14 @@ $(document).ready(function () {
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="form-group {if $product->auto_add_to_cart && $product->price_addition_type == Product::PRICE_ADDITION_TYPE_WITH_ROOM}show_on_auto_add_Withroom{/if}" {if !$product->auto_add_to_cart || $product->price_addition_type != Product::PRICE_ADDITION_TYPE_WITH_ROOM}style="display:none"{/if}>
|
||||
<div class="col-lg-9 col-lg-offset-3">
|
||||
<div class="alert alert-info">
|
||||
{l s='This service product price will be auto added to room price so the tax rule set on room type will be applied on this service product'}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group {if $product->auto_add_to_cart && $product->price_addition_type == Product::PRICE_ADDITION_TYPE_WITH_ROOM}hide_on_auto_add_Withroom{/if}" {if $product->auto_add_to_cart && $product->price_addition_type == Product::PRICE_ADDITION_TYPE_WITH_ROOM}style="display:none"{/if}>
|
||||
<div class="col-lg-1"><span class="pull-right">{include file="controllers/products/multishop/checkbox.tpl" field="id_tax_rules_group" type="default"}</span></div>
|
||||
<label class="control-label col-lg-2" for="id_tax_rules_group">
|
||||
{l s='Tax rule:'}
|
||||
@@ -193,7 +200,7 @@ $(document).ready(function () {
|
||||
<input maxlength="27" id="ecotax" name="ecotax" type="text" value="{$product->ecotax|string_format:$priceDisplayPrecisionFormat}" onkeyup="$('#priceType').val('TI');if (isArrowKey(event))return; calcPriceTE(); this.value = this.value.replace(/,/g, '.'); if (parseInt(this.value) > getE('priceTE').value) this.value = getE('priceTE').value; if (isNaN(this.value)) this.value = 0;" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group" {if !$country_display_tax_label || $tax_exclude_taxe_option}style="display:none;"{/if} >
|
||||
<div class="form-group {if $product->auto_add_to_cart && $product->price_addition_type == Product::PRICE_ADDITION_TYPE_WITH_ROOM}hide_on_auto_add_Withroom{/if}" {if !$country_display_tax_label || $tax_exclude_taxe_option}style="display:none;"{/if} {if $product->auto_add_to_cart && $product->price_addition_type == Product::PRICE_ADDITION_TYPE_WITH_ROOM}style="display:none"{/if}>
|
||||
<label class="control-label col-lg-3" for="priceTI">{l s='Retail price with tax'}</label>
|
||||
<div class="input-group col-lg-2">
|
||||
<span class="input-group-addon">{$currency->prefix}{$currency->suffix}</span>
|
||||
|
||||
@@ -71,17 +71,18 @@
|
||||
<div class="col-xs-6 occupancy_count_block">
|
||||
<div class="col-sm-12">
|
||||
<label>{l s='Adults'}</label>
|
||||
<input type="number" class="form-control num_occupancy num_adults" name="occupancy[0][adults]" value="{$data['adults']}" min="1" max="{$data['room_type_info']['max_adults']|escape:'html':'UTF-8'}">
|
||||
<input type="number" class="form-control num_occupancy num_adults" name="occupancy[0][adults]" value="{$data['adults']}" min="1">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-6 occupancy_count_block">
|
||||
<div class="col-sm-12">
|
||||
<label>{l s='Children'} <span class="label-desc-txt"></span></label>
|
||||
<input type="number" class="form-control num_occupancy num_children" name="occupancy[0][children]" value="{$data['children']}" min="0" max="{$data['room_type_info']['max_children']|escape:'html':'UTF-8'}">
|
||||
<input type="number" class="form-control num_occupancy num_children" name="occupancy[0][children]" value="{$data['children']}" min="0">
|
||||
({l s='Below'} {$max_child_age|escape:'htmlall':'UTF-8'} {l s='years'})
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<p style="display:none;"><span class="text-danger occupancy-input-errors"></span></p>
|
||||
<div class="row children_age_info_block" {if !isset($data['child_ages']) || !$data['child_ages']}style="display:none"{/if}>
|
||||
<div class="col-sm-12">
|
||||
<label class="col-sm-12">{l s='All Children'}</label>
|
||||
|
||||
@@ -88,6 +88,7 @@
|
||||
({l s='Below'} {$max_child_age|escape:'htmlall':'UTF-8'} {l s='years'})
|
||||
</div>
|
||||
</div>
|
||||
<p style="display:none;"><span class="text-danger occupancy-input-errors"></span></p>
|
||||
<div class="row children_age_info_block" style="display:none">
|
||||
<div class="form-group col-sm-12">
|
||||
<label class="">{l s='All Children'}</label>
|
||||
|
||||
@@ -62,7 +62,7 @@
|
||||
<div class="fixed-width-xl room_check_in_div">
|
||||
<div class="input-group">
|
||||
<div class="input-group-addon">{l s='Check In'}</div>
|
||||
<input type="text" class="form-control edit_product_date_from" name="edit_product[date_from]" value="{$data.date_from|date_format:"%d-%m-%Y"}"/>
|
||||
<input type="text" class="form-control edit_product_date_from" name="edit_product[date_from]" value="{$data.date_from|date_format:"%d-%m-%Y"}" data-min_date="{$data.date_from|date_format:"%d-%m-%Y"}"/>
|
||||
<div class="input-group-addon"><i class="icon-calendar"></i></div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -70,7 +70,7 @@
|
||||
<div class="fixed-width-xl room_check_out_div">
|
||||
<div class="input-group">
|
||||
<div class="input-group-addon">{l s='Check Out'}</div>
|
||||
<input type="text" class="form-control edit_product_date_to" name="edit_product[date_to]" value="{$data.date_to|date_format:"%d-%m-%Y"}"/>
|
||||
<input type="text" class="form-control edit_product_date_to" name="edit_product[date_to]" value="{$data.date_to|date_format:"%d-%m-%Y"}" data-min_date="{$data.date_from|date_format:"%d-%m-%Y"}"/>
|
||||
<div class="input-group-addon"><i class="icon-calendar"></i></div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -124,6 +124,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<p style="display:none;"><span class="text-danger occupancy-input-errors"></span></p>
|
||||
<div class="row children_age_info_block" {if !isset($data['child_ages']) || !$data['child_ages']}style="display:none"{/if}>
|
||||
<div class="col-sm-12 form-group">
|
||||
<label class="col-sm-12">{l s='All Children'}</label>
|
||||
|
||||
@@ -386,28 +386,51 @@
|
||||
});
|
||||
|
||||
$(document).on('change', '.num_occupancy', function(e) {
|
||||
let elementVal = parseInt($(this).val());
|
||||
let current_room_occupancy = 0;
|
||||
$(this).closest('.occupancy_info_block').find('.num_occupancy').each(function(){
|
||||
current_room_occupancy += parseInt($(this).val());
|
||||
});
|
||||
let max_guests_in_room = $(this).closest(".booking_occupancy_wrapper").find('.max_guests').val();
|
||||
let max_allowed_for_current = (max_guests_in_room - current_room_occupancy) + parseInt($(this).val());
|
||||
if ($(this).val() > $(this).attr('max')) {
|
||||
$(this).val($(this).attr('max'));
|
||||
}
|
||||
if ($(this).val() > max_allowed_for_current) {
|
||||
$(this).val(max_allowed_for_current);
|
||||
}
|
||||
let haserror = false
|
||||
if ($(this).hasClass('num_children')) {
|
||||
var totalChilds = $(this).closest('.occupancy_info_block').find('.guest_child_age').length;
|
||||
if (totalChilds < $(this).val()) {
|
||||
if (totalChilds < max_child_in_room) {
|
||||
max_child_in_room = $(this).closest(".booking_occupancy_wrapper").find('.max_children').val();
|
||||
console.log(no_children_allowed_txt);
|
||||
if (elementVal > max_child_in_room) {
|
||||
$(this).val(max_child_in_room);
|
||||
if (elementVal == 1) {
|
||||
showOccupancyError(no_children_allowed_txt, $(this).closest(".occupancy_info_block"));
|
||||
haserror = true;
|
||||
} else {
|
||||
showOccupancyError(max_children_txt, $(this).closest(".occupancy_info_block"));
|
||||
haserror = true;
|
||||
}
|
||||
} else if (elementVal > max_allowed_for_current) {
|
||||
$(this).val(max_allowed_for_current);
|
||||
showOccupancyError(max_occupancy_reached_txt, $(this).closest(".occupancy_info_block"));
|
||||
haserror = true;
|
||||
}
|
||||
} else {
|
||||
max_adults_in_room = $(this).closest(".booking_occupancy_wrapper").find('.max_adults').val();
|
||||
if (elementVal >= max_adults_in_room) {
|
||||
$(this).val(max_adults_in_room);
|
||||
showOccupancyError(max_adults_txt, $(this).closest(".occupancy_info_block"));
|
||||
haserror = true;
|
||||
} else if (elementVal > max_allowed_for_current) {
|
||||
$(this).val(max_allowed_for_current);
|
||||
showOccupancyError(max_occupancy_reached_txt, $(this).closest(".occupancy_info_block"));
|
||||
haserror = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!haserror) {
|
||||
if ($(this).hasClass('num_children')) {
|
||||
let totalChilds = $(this).closest('.occupancy_info_block').find('.guest_child_age').length;
|
||||
if (totalChilds < $(this).val()) {
|
||||
$(this).closest('.occupancy_info_block').find('.children_age_info_block').show();
|
||||
while ($(this).closest('.occupancy_info_block').find('.guest_child_age').length < $(this).val()) {
|
||||
|
||||
|
||||
var roomBlockIndex = parseInt($(this).closest('.occupancy_info_block').attr('occ_block_index'));
|
||||
|
||||
var childAgeSelect = '<p class="col-xs-12 col-sm-12 col-md-6 col-lg-6">';
|
||||
childAgeSelect += '<select class="guest_child_age room_occupancies" name="occupancy[' +roomBlockIndex+ '][child_ages][]">';
|
||||
childAgeSelect += '<option value="-1">' + select_age_txt + '</option>';
|
||||
@@ -419,24 +442,36 @@
|
||||
childAgeSelect += '</p>';
|
||||
$(this).closest('.occupancy_info_block').find('.children_ages').append(childAgeSelect);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
let child = $(this).val();
|
||||
$(this).closest('.occupancy_info_block').find('.guest_child_age').each(function(ind, element) {
|
||||
if (child <= ind) {
|
||||
$(element).parent().remove();
|
||||
} else {
|
||||
let child = $(this).val();
|
||||
$(this).closest('.occupancy_info_block').find('.guest_child_age').each(function(ind, element) {
|
||||
if (child <= ind) {
|
||||
$(element).parent().remove();
|
||||
}
|
||||
});
|
||||
if (child == 0) {
|
||||
$(this).closest('.occupancy_info_block').find('.children_age_info_block').hide();
|
||||
}
|
||||
});
|
||||
if (child == 0) {
|
||||
$(this).closest('.occupancy_info_block').find('.children_age_info_block').hide();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
setRoomTypeGuestOccupancy($(this).closest('.booking_occupancy_wrapper'));
|
||||
|
||||
});
|
||||
|
||||
var errorMsgTime;
|
||||
$('.occupancy-input-errors').parent().hide();
|
||||
function showOccupancyError(msg, occupancy_info_block)
|
||||
{
|
||||
var errorMsgBlock = $(occupancy_info_block).find('.occupancy-input-errors')
|
||||
$(errorMsgBlock).html(msg).parent().show('fast');
|
||||
clearTimeout(errorMsgTime);
|
||||
errorMsgTime = setTimeout(function() {
|
||||
$(errorMsgBlock).parent().hide('fast');
|
||||
}, 1000);
|
||||
|
||||
}
|
||||
|
||||
|
||||
$(document).on('click', '.booking_guest_occupancy', function(e) {
|
||||
$(this).parent().toggleClass('open');
|
||||
@@ -1390,21 +1425,14 @@
|
||||
});
|
||||
if (addresses.length == 0)
|
||||
{
|
||||
$('#addresses_err').show().html('{l s='You must add at least one address to process the order.'}');
|
||||
$('#address_delivery, #address_invoice').hide();
|
||||
$("#new_address").show();
|
||||
|
||||
//by webkul (if there is no address then order can not be created)
|
||||
$("button[name=\"submitAddOrder\"]").attr("disabled", "disabled");
|
||||
}
|
||||
else
|
||||
{
|
||||
$('#addresses_err').hide();
|
||||
$("#new_address").hide();
|
||||
$('#address_delivery, #address_invoice').show();
|
||||
|
||||
//by webkul
|
||||
$("button[name=\"submitAddOrder\"]").removeAttr("disabled");
|
||||
}
|
||||
|
||||
/*Changed by webkul to make delivery and invoice addresses same*/
|
||||
@@ -2146,7 +2174,13 @@
|
||||
{addJsDefL name='below_txt'}{l s='Below' js=1}{/addJsDefL}
|
||||
{addJsDefL name='years_txt'}{l s='years' js=1}{/addJsDefL}
|
||||
{addJsDefL name='all_children_txt'}{l s='All Children' js=1}{/addJsDefL}
|
||||
{addJsDefL name='max_occupancy_reached_txt'}{l s='Maximum room occupancy reached' js=1}{/addJsDefL}
|
||||
{addJsDefL name='max_adults_txt'}{l s='Maximum adult occupancy reached' js=1}{/addJsDefL}
|
||||
{addJsDefL name='max_children_txt'}{l s='Maximum children occupancy reached' js=1}{/addJsDefL}
|
||||
{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}
|
||||
|
||||
|
||||
{/strip}
|
||||
|
||||
<div id="loader_container">
|
||||
|
||||
@@ -48,6 +48,7 @@
|
||||
var txt_confirm = "{l s='Are you sure?' js=1}";
|
||||
var statesShipped = new Array();
|
||||
var has_voucher = {if count($discounts)}1{else}0{/if};
|
||||
var allowBackdateOrder = {if $allowBackdateOrder}{$allowBackdateOrder}{else}false{/if};
|
||||
{foreach from=$states item=state}
|
||||
{if (isset($currentState->shipped) && !$currentState->shipped && $state['shipped'])}
|
||||
statesShipped.push({$state['id_order_state']});
|
||||
@@ -325,8 +326,8 @@
|
||||
{/if}
|
||||
|
||||
{* field for the current date *}
|
||||
<input class="room_status_date wk-input-date" type="text" name="status_date" value="{if $data['id_status'] == $hotel_order_status['STATUS_CHECKED_IN']['id_status']}{$data['date_to']|date_format:"%d-%m-%Y"}{else}{$data['date_from']|date_format:"%d-%m-%Y"}{/if}" readonly/>
|
||||
|
||||
<input class="room_status_date wk-input-date" type="text" name="status_date" value="{if $data['id_status'] == $hotel_order_status['STATUS_CHECKED_IN']['id_status']}{$data['date_to']|date_format:"%d-%m-%Y"} {$data['check_out_time']}{else}{$data['date_from']|date_format:"%d-%m-%Y"} {$data['check_in_time']}{/if}" readonly/>
|
||||
<input type="hidden" name="id_hotel_booking_detail" value="{$data['id']}" />
|
||||
<input type="hidden" name="date_from" value="{$data['date_from']|date_format:"%Y-%m-%d"}" />
|
||||
<input type="hidden" name="date_to" value="{$data['date_to']|date_format:"%Y-%m-%d"}" />
|
||||
<input type="hidden" name="id_room" value="{$data['id_room']}" />
|
||||
@@ -1687,6 +1688,10 @@
|
||||
{addJsDefL name='below_txt'}{l s='Below' js=1}{/addJsDefL}
|
||||
{addJsDefL name='years_txt'}{l s='years' js=1}{/addJsDefL}
|
||||
{addJsDefL name='all_children_txt'}{l s='All Children' js=1}{/addJsDefL}
|
||||
{addJsDefL name='max_occupancy_reached_txt'}{l s='Maximum room occupancy reached' js=1}{/addJsDefL}
|
||||
{addJsDefL name='max_adults_txt'}{l s='Maximum adult occupancy reached' js=1}{/addJsDefL}
|
||||
{addJsDefL name='max_children_txt'}{l s='Maximum children occupancy reached' js=1}{/addJsDefL}
|
||||
{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='select_room_txt'}{l s='Select room' js=1}{/addJsDefL}
|
||||
{addJsDef max_child_age=$max_child_age|escape:'quotes':'UTF-8'}
|
||||
@@ -1718,12 +1723,11 @@
|
||||
{* open date picker for the date input of check-in checkout dates *}
|
||||
$(document).on('focus', '.room_status_date', function() {
|
||||
var dateFrom = $(this).closest('.room_status_info_form').find('[name="date_from"]').val();
|
||||
minDate = $.datepicker.parseDate('yy-mm-dd', dateFrom);
|
||||
minDate = new Date(dateFrom+'T00:00:00');
|
||||
|
||||
var dateTo = $(this).closest('.room_status_info_form').find('[name="date_to"]').val();
|
||||
maxDate = $.datepicker.parseDate('yy-mm-dd', dateTo);
|
||||
|
||||
$(this).datepicker({
|
||||
maxDate = new Date(dateTo+'T23:59:59');
|
||||
$(this).datetimepicker({
|
||||
dateFormat: 'dd-mm-yy',
|
||||
minDate: minDate,
|
||||
maxDate: maxDate,
|
||||
|
||||
@@ -81,17 +81,21 @@
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<div class="fixed-width-xl">
|
||||
<select class="service_product_id_tax_rules_group" name="{$inputs_prefix}id_tax_rules_group">
|
||||
<option value="0">{l s='No Tax'}</option>
|
||||
{foreach from=$tax_rules_groups item=tax_rules_group}
|
||||
<option value="{$tax_rules_group.id_tax_rules_group}" {if $service_product.association_info.id_tax_rules_group == $tax_rules_group.id_tax_rules_group}selected="selected"{/if} >
|
||||
{$tax_rules_group['name']|htmlentitiesUTF8}
|
||||
</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
</div>
|
||||
<div class="help-block">{l s='Default tax rule: %s' sprintf=$service_product.association_info.default_tax_rules_group_name}</div>
|
||||
{if $service_product.association_info.auto_add_to_cart && $service_product.association_info.price_addition_type == Product::PRICE_ADDITION_TYPE_WITH_ROOM}
|
||||
{l s='-'}
|
||||
{else}
|
||||
<div class="fixed-width-xl">
|
||||
<select class="service_product_id_tax_rules_group" name="{$inputs_prefix}id_tax_rules_group">
|
||||
<option value="0">{l s='No Tax'}</option>
|
||||
{foreach from=$tax_rules_groups item=tax_rules_group}
|
||||
<option value="{$tax_rules_group.id_tax_rules_group}" {if $service_product.association_info.id_tax_rules_group == $tax_rules_group.id_tax_rules_group}selected="selected"{/if} >
|
||||
{$tax_rules_group['name']|htmlentitiesUTF8}
|
||||
</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
</div>
|
||||
<div class="help-block">{l s='Default tax rule: %s' sprintf=$service_product.association_info.default_tax_rules_group_name}</div>
|
||||
{/if}
|
||||
</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
{extends file="helpers/view/view.tpl"}
|
||||
|
||||
{block name="override_tpl"}
|
||||
{include file="./translation_inputs_update.tpl"}
|
||||
{if $mod_security_warning}
|
||||
<div class="alert alert-warning">
|
||||
{l s='Apache mod_security is activated on your server. This could result in some Bad Request errors'}
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
{extends file="helpers/view/view.tpl"}
|
||||
|
||||
{block name="override_tpl"}
|
||||
{include file="./translation_inputs_update.tpl"}
|
||||
{if $mod_security_warning}
|
||||
<div class="alert alert-warning">
|
||||
{l s='Apache mod_security is activated on your server. This could result in some Bad Request errors'}
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
{**
|
||||
* 2010-2023 Webkul.
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* All right is reserved,
|
||||
* Please go through LICENSE.txt file inside our module
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade this module to newer
|
||||
* versions in the future. If you wish to customize this module for your
|
||||
* needs please refer to CustomizationPolicy.txt file inside our module for more information.
|
||||
*
|
||||
* @author Webkul IN
|
||||
* @copyright 2010-2023 Webkul IN
|
||||
* @license LICENSE.txt
|
||||
*}
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function(){
|
||||
$('#translations_form input:text,textarea').each(function(){
|
||||
$(this).data('name',$(this).attr('name'));
|
||||
$(this).removeAttr('name');
|
||||
});
|
||||
$('#translations_form').on('change','input:text,textarea',function(){
|
||||
var name = $(this).data('name');
|
||||
if(name) $(this).attr('name',name);
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@@ -26,6 +26,7 @@
|
||||
{extends file="helpers/view/view.tpl"}
|
||||
|
||||
{block name="override_tpl"}
|
||||
{include file="./translation_inputs_update.tpl"}
|
||||
{if $mod_security_warning}
|
||||
<div class="alert alert-warning">
|
||||
{l s='Apache mod_security is activated on your server. This could result in some Bad Request errors'}
|
||||
|
||||
@@ -326,9 +326,9 @@ class HookCore extends ObjectModel
|
||||
}
|
||||
// For payment modules, we check that they are available in the contextual country
|
||||
elseif ($frontend) {
|
||||
if (Validate::isLoadedObject($context->country)) {
|
||||
$sql->where('((h.`name` = "displayPayment" OR h.`name` = "displayPaymentEU") AND (SELECT `id_country` FROM `'._DB_PREFIX_.'module_country` mc WHERE mc.`id_module` = m.`id_module` AND `id_country` = '.(int)$context->country->id.' AND `id_shop` = '.(int)$context->shop->id.' LIMIT 1) = '.(int)$context->country->id.')');
|
||||
}
|
||||
// if (Validate::isLoadedObject($context->country)) {
|
||||
// $sql->where('((h.`name` = "displayPayment" OR h.`name` = "displayPaymentEU") AND (SELECT `id_country` FROM `'._DB_PREFIX_.'module_country` mc WHERE mc.`id_module` = m.`id_module` AND `id_country` = '.(int)$context->country->id.' AND `id_shop` = '.(int)$context->shop->id.' LIMIT 1) = '.(int)$context->country->id.')');
|
||||
// }
|
||||
if (Validate::isLoadedObject($context->currency)) {
|
||||
$sql->where('((h.`name` = "displayPayment" OR h.`name` = "displayPaymentEU") AND (SELECT `id_currency` FROM `'._DB_PREFIX_.'module_currency` mcr WHERE mcr.`id_module` = m.`id_module` AND `id_currency` IN ('.(int)$context->currency->id.', -1, -2) LIMIT 1) IN ('.(int)$context->currency->id.', -1, -2))');
|
||||
}
|
||||
|
||||
@@ -181,9 +181,6 @@ abstract class PaymentModuleCore extends Module
|
||||
ShopUrl::resetMainDomainCache();
|
||||
$id_currency = $currency_special ? (int)$currency_special : (int)$this->context->cart->id_currency;
|
||||
$this->context->currency = new Currency((int)$id_currency, null, (int)$this->context->shop->id);
|
||||
if (Configuration::get('PS_TAX_ADDRESS_TYPE') == 'id_address_delivery') {
|
||||
$context_country = $this->context->country;
|
||||
}
|
||||
|
||||
$order_status = new OrderState((int)$id_order_state, (int)$this->context->language->id);
|
||||
if (!Validate::isLoadedObject($order_status)) {
|
||||
@@ -274,14 +271,6 @@ abstract class PaymentModuleCore extends Module
|
||||
$order = new Order();
|
||||
$order->product_list = $package['product_list'];
|
||||
|
||||
if (Configuration::get('PS_TAX_ADDRESS_TYPE') == 'id_address_delivery') {
|
||||
$address = new Address((int)$id_address);
|
||||
$this->context->country = new Country((int)$address->id_country, (int)$this->context->cart->id_lang);
|
||||
if (!$this->context->country->active && $this->name != 'wsorder') {
|
||||
throw new PrestaShopException('The delivery address country is not active.');
|
||||
}
|
||||
}
|
||||
|
||||
$carrier = null;
|
||||
if (!$this->context->cart->isVirtualCart() && isset($package['id_carrier'])) {
|
||||
$carrier = new Carrier((int)$package['id_carrier'], (int)$this->context->cart->id_lang);
|
||||
@@ -463,15 +452,6 @@ abstract class PaymentModuleCore extends Module
|
||||
}
|
||||
}
|
||||
|
||||
// The country can only change if the address used for the calculation is the delivery address, and if multi-shipping is activated
|
||||
if (Configuration::get('PS_TAX_ADDRESS_TYPE') == 'id_address_delivery') {
|
||||
$this->context->country = $context_country;
|
||||
}
|
||||
|
||||
if (!$this->context->country->active && $this->name != 'wsorder') {
|
||||
PrestaShopLogger::addLog('PaymentModule::validateOrder - Country is not active', 3, null, 'Cart', (int)$id_cart, true);
|
||||
throw new PrestaShopException('The order address country is not active.');
|
||||
}
|
||||
|
||||
if (self::DEBUG_MODE) {
|
||||
PrestaShopLogger::addLog('PaymentModule::validateOrder - Payment is about to be added', 1, null, 'Cart', (int)$id_cart, true);
|
||||
|
||||
@@ -2999,7 +2999,7 @@ class ProductCore extends ObjectModel
|
||||
public static function getPriceStatic($id_product, $usetax = true, $id_product_attribute = null, $decimals = 6, $divisor = null,
|
||||
$only_reduc = false, $usereduc = true, $quantity = 1, $force_associated_tax = false, $id_customer = null, $id_cart = null,
|
||||
$id_address = null, &$specific_price_output = null, $with_ecotax = true, $use_group_reduction = true, Context $context = null,
|
||||
$use_customer_price = true, $id_roomtype = false)
|
||||
$use_customer_price = true, $id_product_roomtype = false)
|
||||
{
|
||||
if (!$context) {
|
||||
$context = Context::getContext();
|
||||
@@ -3065,9 +3065,9 @@ class ProductCore extends ObjectModel
|
||||
|
||||
if (!$id_address) {
|
||||
if (!Product::isBookingProduct($id_product)) {
|
||||
if ($id_roomtype) {
|
||||
if ($id_product_roomtype) {
|
||||
// if room type is provided with product then we know that the service product price should be calculated accroding to roomt type
|
||||
$id_address = Cart::getIdAddressForTaxCalculation($id_roomtype);
|
||||
$id_address = Cart::getIdAddressForTaxCalculation($id_product_roomtype);
|
||||
}
|
||||
} else {
|
||||
$id_address = Cart::getIdAddressForTaxCalculation($id_product);
|
||||
@@ -3121,7 +3121,7 @@ class ProductCore extends ObjectModel
|
||||
$use_customer_price,
|
||||
$id_cart,
|
||||
$cart_quantity,
|
||||
$id_roomtype
|
||||
$id_product_roomtype
|
||||
);
|
||||
|
||||
return $return;
|
||||
@@ -3155,9 +3155,8 @@ class ProductCore extends ObjectModel
|
||||
**/
|
||||
public static function priceCalculation($id_shop, $id_product, $id_product_attribute, $id_country, $id_state, $zipcode, $id_currency,
|
||||
$id_group, $quantity, $use_tax, $decimals, $only_reduc, $use_reduc, $with_ecotax, &$specific_price, $use_group_reduction,
|
||||
$id_customer = 0, $use_customer_price = true, $id_cart = 0, $real_quantity = 0, $id_roomtype = false)
|
||||
$id_customer = 0, $use_customer_price = true, $id_cart = 0, $real_quantity = 0, $id_product_roomtype = false)
|
||||
{
|
||||
|
||||
static $address = null;
|
||||
static $context = null;
|
||||
|
||||
@@ -3184,7 +3183,7 @@ class ProductCore extends ObjectModel
|
||||
$cache_id = (int)$id_product.'-'.(int)$id_shop.'-'.(int)$id_currency.'-'.(int)$id_country.'-'.$id_state.'-'.$zipcode.'-'.(int)$id_group.
|
||||
'-'.(int)$quantity.'-'.(int)$id_product_attribute.
|
||||
'-'.(int)$with_ecotax.'-'.(int)$id_customer.'-'.(int)$use_group_reduction.'-'.(int)$id_cart.'-'.(int)$real_quantity.
|
||||
'-'.($only_reduc?'1':'0').'-'.($use_reduc?'1':'0').'-'.($use_tax?'1':'0').'-'.(int)$decimals.'-'.($id_roomtype?(int)$id_roomtype:'0');
|
||||
'-'.($only_reduc?'1':'0').'-'.($use_reduc?'1':'0').'-'.($use_tax?'1':'0').'-'.(int)$decimals.'-'.($id_product_roomtype?(int)$id_product_roomtype:'0');
|
||||
|
||||
// reference parameter is filled before any returns
|
||||
$specific_price = SpecificPrice::getSpecificPrice(
|
||||
@@ -3248,10 +3247,10 @@ class ProductCore extends ObjectModel
|
||||
$result = self::$_pricesLevel2[$cache_id_2][(int)$id_product_attribute];
|
||||
|
||||
// get price per room type
|
||||
if ($id_roomtype) {
|
||||
if ($id_product_roomtype) {
|
||||
$priceForRoomInfo = RoomTypeServiceProductPrice::getProductRoomTypePriceAndTax(
|
||||
$id_product,
|
||||
$id_roomtype,
|
||||
$id_product_roomtype,
|
||||
RoomTypeServiceProduct::WK_ELEMENT_TYPE_ROOM_TYPE
|
||||
);
|
||||
}
|
||||
|
||||
@@ -33,13 +33,9 @@ class CheckoutCustomerDetailsStepCore extends AbstractCheckoutStepCore
|
||||
if (Tools::getValue('proceed_to_customer_dtl')) {
|
||||
$this->step_is_reachable = 1;
|
||||
$this->step_is_current = 1;
|
||||
if ($idAddressDelivery) {
|
||||
if (!Validate::isLoadedObject($objAddress)) {
|
||||
if ($this->context->cookie->__get('customer_details_proceeded')) {
|
||||
$this->step_is_current = 0;
|
||||
$this->step_is_complete = 1;
|
||||
}
|
||||
}
|
||||
if ($this->context->cookie->__get('customer_details_proceeded')) {
|
||||
$this->step_is_current = 0;
|
||||
$this->step_is_complete = 1;
|
||||
}
|
||||
} elseif (Tools::getValue('proceed_to_payment')) {
|
||||
$guestInfoComplete = true;
|
||||
@@ -52,34 +48,20 @@ class CheckoutCustomerDetailsStepCore extends AbstractCheckoutStepCore
|
||||
}
|
||||
$this->step_is_reachable = 1;
|
||||
$this->step_is_current = 1;
|
||||
if ($idAddressDelivery && $guestInfoComplete) {
|
||||
if (Validate::isLoadedObject($objAddress)) {
|
||||
$this->step_is_current = 0;
|
||||
$this->step_is_complete = 1;
|
||||
$this->context->cookie->__set('customer_details_proceeded', 1);
|
||||
}
|
||||
if ($guestInfoComplete) {
|
||||
$this->step_is_current = 0;
|
||||
$this->step_is_complete = 1;
|
||||
$this->context->cookie->__set('customer_details_proceeded', 1);
|
||||
}
|
||||
} elseif ($this->context->cookie->__get('customer_details_proceeded')
|
||||
|| $this->context->cookie->__get('cart_summary_proceeded')
|
||||
) {
|
||||
if ($idAddressDelivery) {
|
||||
if (!Validate::isLoadedObject($objAddress)) {
|
||||
$this->context->cookie->__set('customer_details_proceeded', 0);
|
||||
$this->step_is_reachable = 1;
|
||||
$this->step_is_current = 1;
|
||||
}
|
||||
} else {
|
||||
$this->step_is_reachable = 1;
|
||||
$this->step_is_current = 1;
|
||||
$this->context->cookie->__set('customer_details_proceeded', 0);
|
||||
}
|
||||
} elseif ($this->context->customer->logged) {
|
||||
$this->step_is_reachable = 1;
|
||||
if ($idAddressDelivery) {
|
||||
$this->step_is_complete = 1;
|
||||
} else {
|
||||
$this->step_is_complete = 0;
|
||||
$this->step_is_current = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -417,11 +417,12 @@ class FrontControllerCore extends Controller
|
||||
|
||||
$display_tax_label = $this->context->country->display_tax_label;
|
||||
if (isset($cart->{Configuration::get('PS_TAX_ADDRESS_TYPE')}) && $cart->{Configuration::get('PS_TAX_ADDRESS_TYPE')}) {
|
||||
$infos = Address::getCountryAndState((int)$cart->{Configuration::get('PS_TAX_ADDRESS_TYPE')});
|
||||
$country = new Country((int)$infos['id_country']);
|
||||
$this->context->country = $country;
|
||||
if (Validate::isLoadedObject($country)) {
|
||||
$display_tax_label = $country->display_tax_label;
|
||||
if ($infos = Address::getCountryAndState((int)$cart->{Configuration::get('PS_TAX_ADDRESS_TYPE')})) {
|
||||
$country = new Country((int)$infos['id_country']);
|
||||
$this->context->country = $country;
|
||||
if (Validate::isLoadedObject($country)) {
|
||||
$display_tax_label = $country->display_tax_label;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2069,9 +2069,6 @@ abstract class ModuleCore
|
||||
public static function getPaymentModules()
|
||||
{
|
||||
$context = Context::getContext();
|
||||
if (isset($context->cart)) {
|
||||
$billing = new Address((int)$context->cart->id_address_invoice);
|
||||
}
|
||||
|
||||
$use_groups = Group::isFeatureActive();
|
||||
|
||||
@@ -2101,7 +2098,6 @@ abstract class ModuleCore
|
||||
LEFT JOIN `'._DB_PREFIX_.'hook_module` hm ON hm.`id_module` = m.`id_module`
|
||||
LEFT JOIN `'._DB_PREFIX_.'hook` h ON hm.`id_hook` = h.`id_hook`
|
||||
WHERE h.`name` = \''.pSQL($hook_payment).'\'
|
||||
'.(isset($billing) && $frontend ? 'AND mc.id_country = '.(int)$billing->id_country : '').'
|
||||
AND (SELECT COUNT(*) FROM '._DB_PREFIX_.'module_shop ms WHERE ms.id_module = m.id_module AND ms.id_shop IN('.implode(', ', $list).')) = '.count($list).'
|
||||
AND hm.id_shop IN('.implode(', ', $list).')
|
||||
'.((count($groups) && $frontend && $use_groups) ? 'AND (mg.`id_group` IN ('.implode(', ', $groups).'))' : '').'
|
||||
|
||||
@@ -104,7 +104,7 @@ abstract class ModuleGraphCore extends Module
|
||||
$this->_values[$j][$i] = 0;
|
||||
}
|
||||
}
|
||||
$this->_legend[$i] = ($i % 2) ? '' : sprintf('%02d', $i);
|
||||
$this->_legend[$i] = sprintf('%02d', $i);
|
||||
}
|
||||
}
|
||||
if (is_callable(array($this, 'setMonthValues'))) {
|
||||
@@ -197,15 +197,15 @@ abstract class ModuleGraphCore extends Module
|
||||
if (count($this->_legend)) {
|
||||
$total = 0;
|
||||
if ($datas['type'] == 'pie') {
|
||||
foreach ($this->_legend as $key => $legend) {
|
||||
// foreach ($this->_legend as $key => $legend) {
|
||||
for ($i = 0, $total_main = (is_array($this->_titles['main']) ? count($this->_values) : 1); $i < $total_main; ++$i) {
|
||||
$total += (is_array($this->_values[$i]) ? $this->_values[$i][$key] : $this->_values[$key]);
|
||||
$total += (is_array($this->_values[$i]) ? $this->_values[$i][$key] : $this->_values[$i]);
|
||||
}
|
||||
}
|
||||
// }
|
||||
}
|
||||
foreach ($this->_legend as $key => $legend) {
|
||||
$this->_csv .= $legend.';';
|
||||
for ($i = 0, $total_main = (is_array($this->_titles['main']) ? count($this->_values) : 1); $i < $total_main; ++$i) {
|
||||
for ($i = 0, $total_main = (is_array($this->_titles['main']) ? (count($this->_titles['main']) - 1) : 1); $i < $total_main; ++$i) {
|
||||
if (!isset($this->_values[$i]) || !is_array($this->_values[$i])) {
|
||||
if (isset($this->_values[$key])) {
|
||||
// We don't want strings to be divided. Example: product name
|
||||
|
||||
@@ -1823,7 +1823,11 @@ class OrderCore extends ObjectModel
|
||||
$order_payment->order_reference = $this->reference;
|
||||
$order_payment->id_currency = ($currency ? $currency->id : $this->id_currency);
|
||||
// we kept the currency rate for historization reasons
|
||||
$order_payment->conversion_rate = ($currency ? $currency->conversion_rate : 1);
|
||||
$order_payment->conversion_rate = (
|
||||
$currency ?
|
||||
$currency->conversion_rate :
|
||||
(new Currency($this->id_currency))->getConversationRate()
|
||||
);
|
||||
// if payment_method is define, we used this
|
||||
$order_payment->payment_method = ($payment_method ? $payment_method : $this->payment);
|
||||
$order_payment->payment_type = ($payment_type ? $payment_type : $this->payment_type);
|
||||
|
||||
@@ -120,13 +120,6 @@ class AdminCustomerPreferencesControllerCore extends AdminController
|
||||
'cast' => 'intval',
|
||||
'type' => 'bool'
|
||||
),
|
||||
'PS_CUSTOMER_ADDRESS_CREATION' => array(
|
||||
'title' => $this->l('Address creation during checkout'),
|
||||
'hint' => $this->l('If disabled, Address form will not appear to user during checkout process. So by default hotel address, which rooms guest has in his cart will be considered as user address. Else user has to fill adress details.'),
|
||||
'validation' => 'isBool',
|
||||
'cast' => 'intval',
|
||||
'type' => 'bool'
|
||||
),
|
||||
),
|
||||
'submit' => array('title' => $this->l('Save')),
|
||||
),
|
||||
|
||||
@@ -1905,6 +1905,12 @@ class AdminNormalProductsControllerCore extends AdminController
|
||||
// set product visibility to none for current flow.
|
||||
$object->visibility = 'none';
|
||||
|
||||
// if service is auto_added and price addition is in room price, then the tax rule is applied of room price.
|
||||
// so setting tax rule as no tax for now
|
||||
if ($object->auto_add_to_cart && $object->price_addition_type == Product::PRICE_ADDITION_TYPE_WITH_ROOM) {
|
||||
$object->id_tax_rules_group = 0;
|
||||
}
|
||||
|
||||
// Duplicate combinations if not associated to shop
|
||||
if ($this->context->shop->getContext() == Shop::CONTEXT_SHOP && !$object->isAssociatedToShop()) {
|
||||
$is_associated_to_shop = false;
|
||||
|
||||
@@ -90,6 +90,16 @@ class AdminOrderPreferencesControllerCore extends AdminController
|
||||
'class' => 'fixed-width-xl',
|
||||
'suffix' => $this->l('day(s)'),
|
||||
),
|
||||
'PS_BACKDATE_ORDER_SUPERADMIN' => array(
|
||||
'title' => $this->l('Allow backdate order from Back-office for super-admin'),
|
||||
'hint' => $this->l('Allow superadmin to create bookings for backdate'),
|
||||
'type' => 'bool',
|
||||
),
|
||||
'PS_BACKDATE_ORDER_EMPLOYEES' => array(
|
||||
'title' => $this->l('Allow backdate order from Back-office for employees'),
|
||||
'hint' => $this->l('Allow employees to create bookings for backdate'),
|
||||
'type' => 'bool',
|
||||
),
|
||||
),
|
||||
'submit' => array(
|
||||
'title' => $this->l('Save'),
|
||||
|
||||
@@ -365,6 +365,15 @@ class AdminOrdersControllerCore extends AdminController
|
||||
$cart_order_exists = $cart->orderExists();
|
||||
if (!$cart_order_exists) {
|
||||
$this->context->cart = $cart;
|
||||
if ($this->context->employee->isSuperAdmin()) {
|
||||
$backOrderConfigKey = 'PS_BACKDATE_ORDER_SUPERADMIN';
|
||||
} else {
|
||||
$backOrderConfigKey = 'PS_BACKDATE_ORDER_EMPLOYEES';
|
||||
}
|
||||
if (!Configuration::get($backOrderConfigKey)) {
|
||||
$objHotelCartBookingData = new HotelCartBookingData();
|
||||
$objHotelCartBookingData->removeBackdateRoomsFromCart($this->context->cart->id);
|
||||
}
|
||||
$this->context->currency = new Currency((int)$cart->id_currency);
|
||||
$cart_detail_data = array();
|
||||
$cart_detail_data_obj = new HotelCartBookingData();
|
||||
@@ -1173,15 +1182,23 @@ class AdminOrdersControllerCore extends AdminController
|
||||
Context::getContext()->currency = new Currency((int)$cart->id_currency);
|
||||
Context::getContext()->customer = new Customer((int)$cart->id_customer);
|
||||
|
||||
$bad_delivery = false;
|
||||
if (($bad_delivery = (bool)!Address::isCountryActiveById((int)$cart->id_address_delivery))
|
||||
|| !Address::isCountryActiveById((int)$cart->id_address_invoice)) {
|
||||
if ($bad_delivery) {
|
||||
$this->errors[] = Tools::displayError('This booking address country is not active.');
|
||||
} else {
|
||||
$this->errors[] = Tools::displayError('This invoice address country is not active.');
|
||||
}
|
||||
if ($this->context->employee->isSuperAdmin()) {
|
||||
$backOrderConfigKey = 'PS_BACKDATE_ORDER_SUPERADMIN';
|
||||
} else {
|
||||
$backOrderConfigKey = 'PS_BACKDATE_ORDER_EMPLOYEES';
|
||||
}
|
||||
if (!Configuration::get($backOrderConfigKey)) {
|
||||
$objCartBookingData = new HotelCartBookingData();
|
||||
if ($cartBookingData = $objCartBookingData->getCartCurrentDataByCartId($cart->id)) {
|
||||
foreach ($cartBookingData as $cartRoom) {
|
||||
if (strtotime($cartRoom['date_from']) < strtotime(date('Y-m-d'))) {
|
||||
$this->errors[] = Tools::displayError('You cannot book rooms before today date.');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($this->errors)) {
|
||||
$employee = new Employee((int)Context::getContext()->cookie->id_employee);
|
||||
$payment_module->validateOrder(
|
||||
(int)$cart->id,
|
||||
@@ -2084,6 +2101,13 @@ class AdminOrdersControllerCore extends AdminController
|
||||
// hotel booking statuses
|
||||
$htlOrderStatus = HotelBookingDetail::getAllHotelOrderStatus();
|
||||
|
||||
if ($this->context->employee->isSuperAdmin()) {
|
||||
$backOrderConfigKey = 'PS_BACKDATE_ORDER_SUPERADMIN';
|
||||
} else {
|
||||
$backOrderConfigKey = 'PS_BACKDATE_ORDER_EMPLOYEES';
|
||||
}
|
||||
$allowBackdateOrder = Configuration::get($backOrderConfigKey);
|
||||
|
||||
// applicable refund policies
|
||||
$applicableRefundPolicies = HotelOrderRefundRules::getApplicableRefundRules($order->id);
|
||||
|
||||
@@ -2113,6 +2137,7 @@ class AdminOrdersControllerCore extends AdminController
|
||||
'order' => $order,
|
||||
'cart' => new Cart($order->id_cart),
|
||||
'customer' => $customer,
|
||||
'allowBackdateOrder' => $allowBackdateOrder,
|
||||
'gender' => $gender,
|
||||
'customerGuestDetail' => $customerGuestDetail,
|
||||
'genders' => Gender::getGenders(),
|
||||
@@ -3051,12 +3076,21 @@ class AdminOrdersControllerCore extends AdminController
|
||||
'result' => false,
|
||||
'error' => Tools::displayError('Please Enter a valid Check out Date.'),
|
||||
)));
|
||||
} elseif ($date_from < $curr_date) {
|
||||
die(json_encode(array(
|
||||
'result' => false,
|
||||
'error' => Tools::displayError('Check In date should not be date before current date.'),
|
||||
)));
|
||||
} elseif ($date_to <= $date_from) {
|
||||
}
|
||||
if ($this->context->employee->isSuperAdmin()) {
|
||||
$backOrderConfigKey = 'PS_BACKDATE_ORDER_SUPERADMIN';
|
||||
} else {
|
||||
$backOrderConfigKey = 'PS_BACKDATE_ORDER_EMPLOYEES';
|
||||
}
|
||||
if (!Configuration::get($backOrderConfigKey)) {
|
||||
if ($date_from < $curr_date) {
|
||||
die(json_encode(array(
|
||||
'result' => false,
|
||||
'error' => Tools::displayError('Check In date should not be date before current date.'),
|
||||
)));
|
||||
}
|
||||
}
|
||||
if ($date_to <= $date_from) {
|
||||
die(json_encode(array(
|
||||
'result' => false,
|
||||
'error' => Tools::displayError('Check out Date Should be after Check In date.'),
|
||||
@@ -4147,6 +4181,20 @@ class AdminOrdersControllerCore extends AdminController
|
||||
|
||||
// get extra demands of the room before changing in the booking table
|
||||
$objBookingDemand = new HotelBookingDemands();
|
||||
$objRoomTypeServiceProductOrderDetail = new RoomTypeServiceProductOrderDetail();
|
||||
$orderServiceProducts = $objRoomTypeServiceProductOrderDetail->getroomTypeServiceProducts(
|
||||
$id_order,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
$old_date_from,
|
||||
$old_date_to,
|
||||
$id_room,
|
||||
0,
|
||||
null,
|
||||
null
|
||||
);
|
||||
|
||||
$extraDemands = $objBookingDemand->getRoomTypeBookingExtraDemands(
|
||||
$id_order,
|
||||
0,
|
||||
@@ -4210,6 +4258,61 @@ class AdminOrdersControllerCore extends AdminController
|
||||
// change order total save
|
||||
$objOrder->save();
|
||||
}
|
||||
|
||||
if (isset($orderServiceProducts)
|
||||
&& is_array($orderServiceProducts)
|
||||
&& count($orderServiceProducts)
|
||||
) {
|
||||
$objOrder = new Order((int) $id_order);
|
||||
foreach ($orderServiceProducts as $orderServiceProduct) {
|
||||
if (isset($orderServiceProduct['additional_services'])
|
||||
&& is_array($orderServiceProduct['additional_services'])
|
||||
&& count($orderServiceProduct['additional_services'])
|
||||
) {
|
||||
foreach ($orderServiceProduct['additional_services'] as $serviceProduct) {
|
||||
if (Product::getProductPriceCalculation($serviceProduct['id_product']) == Product::PRICE_CALCULATION_METHOD_PER_DAY) {
|
||||
$newNumDays = HotelHelper::getNumberOfDays($new_date_from, $new_date_to);
|
||||
$objRoomTypeServiceProductOrderDetail = new RoomTypeServiceProductOrderDetail((int) $serviceProduct['id_room_type_service_product_order_detail']);
|
||||
$unitPriceTaxExcl = $objRoomTypeServiceProductOrderDetail->unit_price_tax_excl;
|
||||
$unitPriceTaxIncl = $objRoomTypeServiceProductOrderDetail->unit_price_tax_incl;
|
||||
|
||||
$newTotalPriceTaxExcl = $newNumDays * $objRoomTypeServiceProductOrderDetail->quantity * $unitPriceTaxExcl; $unitPriceTaxIncl = $objRoomTypeServiceProductOrderDetail->unit_price_tax_incl;
|
||||
$newTotalPriceTaxIncl = $newNumDays * $objRoomTypeServiceProductOrderDetail->quantity * $unitPriceTaxIncl;
|
||||
|
||||
$objOrder->total_paid_tax_excl -= $objRoomTypeServiceProductOrderDetail->total_price_tax_excl;
|
||||
$objOrder->total_paid_tax_incl -= $objRoomTypeServiceProductOrderDetail->total_price_tax_incl;
|
||||
$objOrder->total_paid -= $objRoomTypeServiceProductOrderDetail->total_price_tax_incl;
|
||||
|
||||
// change order total
|
||||
$objOrder->total_paid_tax_excl += $newTotalPriceTaxExcl;
|
||||
$objOrder->total_paid_tax_incl += $newTotalPriceTaxIncl;
|
||||
$objOrder->total_paid += $newTotalPriceTaxIncl;
|
||||
|
||||
$objOrderDetail = new OrderDetail((int) $serviceProduct['id_order_detail']);
|
||||
$objOrderDetail->total_price_tax_excl -= $objRoomTypeServiceProductOrderDetail->total_price_tax_excl;
|
||||
$objOrderDetail->total_price_tax_incl -= $objRoomTypeServiceProductOrderDetail->total_price_tax_incl;
|
||||
$objOrderDetail->total_price_tax_excl += $newTotalPriceTaxExcl;
|
||||
$objOrderDetail->total_price_tax_incl += $newTotalPriceTaxIncl;
|
||||
|
||||
$oldNumDays = HotelHelper::getNumberOfDays($old_date_from, $old_date_to);
|
||||
$oldProductQuantity = $objRoomTypeServiceProductOrderDetail->quantity * $oldNumDays;
|
||||
$newProductQuantity = $objRoomTypeServiceProductOrderDetail->quantity * $newNumDays;
|
||||
$objOrderDetail->product_quantity += ($newProductQuantity - $oldProductQuantity);
|
||||
$objOrderDetail->save();
|
||||
|
||||
$objRoomTypeServiceProductOrderDetail->unit_price_tax_excl = $unitPriceTaxExcl;
|
||||
$objRoomTypeServiceProductOrderDetail->unit_price_tax_incl = $unitPriceTaxIncl;
|
||||
$objRoomTypeServiceProductOrderDetail->total_price_tax_excl = $newTotalPriceTaxExcl;
|
||||
$objRoomTypeServiceProductOrderDetail->total_price_tax_incl = $newTotalPriceTaxIncl;
|
||||
$objRoomTypeServiceProductOrderDetail->save();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$objOrder->save();
|
||||
}
|
||||
}
|
||||
|
||||
if (is_array(Tools::getValue('product_quantity'))) {
|
||||
@@ -4823,12 +4926,22 @@ class AdminOrdersControllerCore extends AdminController
|
||||
'result' => false,
|
||||
'error' => Tools::displayError('Please Enter a valid Check out Date.'),
|
||||
)));
|
||||
} elseif ($new_date_from < $curr_date) {
|
||||
die(json_encode(array(
|
||||
'result' => false,
|
||||
'error' => Tools::displayError('Check In date should not be after current date.'),
|
||||
)));
|
||||
} elseif ($new_date_to <= $new_date_from) {
|
||||
}
|
||||
if ($this->context->employee->isSuperAdmin()) {
|
||||
$backOrderConfigKey = 'PS_BACKDATE_ORDER_SUPERADMIN';
|
||||
} else {
|
||||
$backOrderConfigKey = 'PS_BACKDATE_ORDER_EMPLOYEES';
|
||||
}
|
||||
if (!Configuration::get($backOrderConfigKey)) {
|
||||
$compareDate = min(date('Y-m-d'), $old_date_from);
|
||||
if ($new_date_from < $compareDate) {
|
||||
die(json_encode(array(
|
||||
'result' => false,
|
||||
'error' => sprintf(Tools::displayError('Check In date should not be date before %s.'),$compareDate)
|
||||
)));
|
||||
}
|
||||
}
|
||||
if ($new_date_to <= $new_date_from) {
|
||||
die(json_encode(array(
|
||||
'result' => false,
|
||||
'error' => Tools::displayError('Check out Date Should be after Check In date.'),
|
||||
@@ -5390,46 +5503,58 @@ class AdminOrdersControllerCore extends AdminController
|
||||
$quantity = Tools::getValue('qty');
|
||||
|
||||
if (Validate::isLoadedObject($objRoomTypeServiceProductOrderDetail = new RoomTypeServiceProductOrderDetail($id_room_type_service_product_order_detail))) {
|
||||
$objOrderDetail = new OrderDetail($objRoomTypeServiceProductOrderDetail->id_order_detail);
|
||||
if ($objOrderDetail->product_allow_multiple_quantity) {
|
||||
if (!Validate::isUnsignedInt($quantity)) {
|
||||
$response['hasError'] = true;
|
||||
$response['errors'] = $this->l('Invalid quantity provided');
|
||||
} else {
|
||||
$objRoomTypeServiceProductOrderDetail->quantity = $quantity;
|
||||
$oldPriceTaxExcl = $objRoomTypeServiceProductOrderDetail->total_price_tax_excl;
|
||||
$oldPriceTaxIncl = $objRoomTypeServiceProductOrderDetail->total_price_tax_incl;
|
||||
$objRoomTypeServiceProductOrderDetail->total_price_tax_excl = $objRoomTypeServiceProductOrderDetail->unit_price_tax_excl * $quantity;
|
||||
$objRoomTypeServiceProductOrderDetail->total_price_tax_incl = $objRoomTypeServiceProductOrderDetail->unit_price_tax_incl * $quantity;
|
||||
$res = true;
|
||||
if ($res &= $objRoomTypeServiceProductOrderDetail->save()) {
|
||||
$order = new Order($objRoomTypeServiceProductOrderDetail->id_order);
|
||||
$priceDiffTaxExcl = $objRoomTypeServiceProductOrderDetail->total_price_tax_excl - $oldPriceTaxExcl;
|
||||
$priceDiffTaxIncl = $objRoomTypeServiceProductOrderDetail->total_price_tax_incl - $oldPriceTaxIncl;
|
||||
|
||||
$objOrderDetail->product_quantity = $quantity;
|
||||
$objOrderDetail->total_price_tax_excl += $priceDiffTaxExcl;
|
||||
$objOrderDetail->total_price_tax_incl += $priceDiffTaxIncl;
|
||||
|
||||
$res &= $objOrderDetail->updateTaxAmount($order);
|
||||
|
||||
$res &= $objOrderDetail->update();
|
||||
|
||||
$order->total_paid_tax_excl += $priceDiffTaxExcl;
|
||||
$order->total_paid_tax_incl += $priceDiffTaxIncl;
|
||||
$order->total_paid += $priceDiffTaxIncl;
|
||||
|
||||
$res &= $order->update();
|
||||
}
|
||||
if (Validate::isLoadedObject($objHotelBookingDetail = new HotelBookingDetail((int) $objRoomTypeServiceProductOrderDetail->id_htl_booking_detail))) {
|
||||
$numDays = 1;
|
||||
if (Product::getProductPriceCalculation($objRoomTypeServiceProductOrderDetail->id_product) == Product::PRICE_CALCULATION_METHOD_PER_DAY) {
|
||||
$numDays = HotelHelper::getNumberOfDays($objHotelBookingDetail->date_from, $objHotelBookingDetail->date_to);
|
||||
}
|
||||
if (!$res) {
|
||||
|
||||
$objOrderDetail = new OrderDetail($objRoomTypeServiceProductOrderDetail->id_order_detail);
|
||||
if ($objOrderDetail->product_allow_multiple_quantity) {
|
||||
if (!Validate::isUnsignedInt($quantity)) {
|
||||
$response['hasError'] = true;
|
||||
$response['errors'] = $this->l('Invalid quantity provided');
|
||||
} else {
|
||||
$oldQuantity = $objRoomTypeServiceProductOrderDetail->quantity;
|
||||
$objRoomTypeServiceProductOrderDetail->quantity = $quantity;
|
||||
$oldPriceTaxExcl = $objRoomTypeServiceProductOrderDetail->total_price_tax_excl;
|
||||
$oldPriceTaxIncl = $objRoomTypeServiceProductOrderDetail->total_price_tax_incl;
|
||||
$objRoomTypeServiceProductOrderDetail->total_price_tax_excl = $objRoomTypeServiceProductOrderDetail->unit_price_tax_excl * $quantity * $numDays;
|
||||
$objRoomTypeServiceProductOrderDetail->total_price_tax_incl = $objRoomTypeServiceProductOrderDetail->unit_price_tax_incl * $quantity * $numDays;
|
||||
$res = true;
|
||||
if ($res &= $objRoomTypeServiceProductOrderDetail->save()) {
|
||||
$order = new Order($objRoomTypeServiceProductOrderDetail->id_order);
|
||||
$priceDiffTaxExcl = $objRoomTypeServiceProductOrderDetail->total_price_tax_excl - $oldPriceTaxExcl;
|
||||
$priceDiffTaxIncl = $objRoomTypeServiceProductOrderDetail->total_price_tax_incl - $oldPriceTaxIncl;
|
||||
|
||||
$objOrderDetail->product_quantity += (($quantity - $oldQuantity) * $numDays);
|
||||
$objOrderDetail->total_price_tax_excl += $priceDiffTaxExcl;
|
||||
$objOrderDetail->total_price_tax_incl += $priceDiffTaxIncl;
|
||||
|
||||
$res &= $objOrderDetail->updateTaxAmount($order);
|
||||
|
||||
$res &= $objOrderDetail->update();
|
||||
|
||||
$order->total_paid_tax_excl += $priceDiffTaxExcl;
|
||||
$order->total_paid_tax_incl += $priceDiffTaxIncl;
|
||||
$order->total_paid += $priceDiffTaxIncl;
|
||||
|
||||
$res &= $order->update();
|
||||
}
|
||||
}
|
||||
if (!$res) {
|
||||
$response['hasError'] = true;
|
||||
$response['errors'] = $this->l('Error while updating service, please try refresing the page');
|
||||
}
|
||||
} else {
|
||||
$response['hasError'] = true;
|
||||
$response['errors'] = $this->l('Error while updating service, please try refresing the page');
|
||||
$response['errors'] = $this->l('cannot order multiple quanitity for this service');
|
||||
}
|
||||
} else {
|
||||
$response['hasError'] = true;
|
||||
$response['errors'] = $this->l('cannot order multiple quanitity for this service');
|
||||
$response['errors'] = $this->l('Additional service not found');
|
||||
}
|
||||
|
||||
$objHotelBookingDetail = new HotelBookingDetail($objRoomTypeServiceProductOrderDetail->id_htl_booking_detail);
|
||||
$response['service_panel']= $servicesBlock = $this->processRenderServicesPanel(
|
||||
$objOrderDetail->id_order,
|
||||
@@ -5579,54 +5704,70 @@ class AdminOrdersControllerCore extends AdminController
|
||||
$roomInfo = $objHotelRoomType->getRoomTypeInfoByIdProduct($objHotelBookingDetail->id_product);
|
||||
$totalPriceChangeTaxExcl = 0;
|
||||
$totalPriceChangeTaxIncl = 0;
|
||||
$unitPriceTaxIncl = 0;
|
||||
$unitPriceTaxExcl = 0;
|
||||
foreach ($productList as &$product) {
|
||||
$totalPriceChangeTaxExcl += $totalPriceTaxExcl = $objRoomTypeServiceProductPrice->getServicePrice(
|
||||
(int)$product['id_product'],
|
||||
$roomInfo['id'],
|
||||
$product['cart_quantity'],
|
||||
$objHotelBookingDetail->date_from,
|
||||
$objHotelBookingDetail->date_to,
|
||||
false
|
||||
);
|
||||
$totalPriceChangeTaxIncl += $totalPriceTaxIncl = $objRoomTypeServiceProductPrice->getServicePrice(
|
||||
(int)$product['id_product'],
|
||||
$roomInfo['id'],
|
||||
$product['cart_quantity'],
|
||||
$objHotelBookingDetail->date_from,
|
||||
$objHotelBookingDetail->date_to,
|
||||
true
|
||||
);
|
||||
$unitPriceTaxExcl = $objRoomTypeServiceProductPrice->getServicePrice(
|
||||
(int)$product['id_product'],
|
||||
$roomInfo['id'],
|
||||
1,
|
||||
$objHotelBookingDetail->date_from,
|
||||
$objHotelBookingDetail->date_to,
|
||||
false
|
||||
);
|
||||
$unitPriceTaxIncl = $objRoomTypeServiceProductPrice->getServicePrice(
|
||||
(int)$product['id_product'],
|
||||
$roomInfo['id'],
|
||||
1,
|
||||
$objHotelBookingDetail->date_from,
|
||||
$objHotelBookingDetail->date_to,
|
||||
true
|
||||
);
|
||||
switch (Configuration::get('PS_ROUND_TYPE')) {
|
||||
case Order::ROUND_TOTAL:
|
||||
$product['total'] = $totalPriceTaxExcl;
|
||||
$product['total_wt'] = $totalPriceTaxIncl;
|
||||
break;
|
||||
case Order::ROUND_LINE:
|
||||
$product['total'] = Tools::ps_round($totalPriceTaxExcl, _PS_PRICE_COMPUTE_PRECISION_);
|
||||
$product['total_wt'] = Tools::ps_round($totalPriceTaxIncl, _PS_PRICE_COMPUTE_PRECISION_);
|
||||
break;
|
||||
// This is used to get the actual quanity of the service as it is calculated incorrectly if the service is per night
|
||||
if ($id_room_type_service_product_cart_detail = $objRoomTypeServiceProductCartDetail->alreadyExists(
|
||||
$service['id'],
|
||||
$cart->id,
|
||||
$roomHtlCartInfo['id'])
|
||||
) {
|
||||
$objRoomTypeServiceProductCartDetail = new RoomTypeServiceProductCartDetail((int) $id_room_type_service_product_cart_detail);
|
||||
$totalPriceChangeTaxExcl += $totalPriceTaxExcl = $objRoomTypeServiceProductPrice->getServicePrice(
|
||||
(int)$product['id_product'],
|
||||
$roomInfo['id'],
|
||||
$objRoomTypeServiceProductCartDetail->quantity,
|
||||
$objHotelBookingDetail->date_from,
|
||||
$objHotelBookingDetail->date_to,
|
||||
false
|
||||
);
|
||||
$totalPriceChangeTaxIncl += $totalPriceTaxIncl = $objRoomTypeServiceProductPrice->getServicePrice(
|
||||
(int)$product['id_product'],
|
||||
$roomInfo['id'],
|
||||
$objRoomTypeServiceProductCartDetail->quantity,
|
||||
$objHotelBookingDetail->date_from,
|
||||
$objHotelBookingDetail->date_to,
|
||||
true
|
||||
);
|
||||
$numDays = 1;
|
||||
if (Product::getProductPriceCalculation($product['id_product']) == Product::PRICE_CALCULATION_METHOD_PER_DAY) {
|
||||
$numDays = HotelHelper::getNumberOfDays($objHotelBookingDetail->date_from, $objHotelBookingDetail->date_to);
|
||||
}
|
||||
$product['cart_quantity'] = $objRoomTypeServiceProductCartDetail->quantity * $numDays;
|
||||
|
||||
case Order::ROUND_ITEM:
|
||||
default:
|
||||
$product['total'] = Tools::ps_round($totalPriceTaxExcl, _PS_PRICE_COMPUTE_PRECISION_) * (int)$product['cart_quantity'];
|
||||
$product['total_wt'] = Tools::ps_round($totalPriceTaxIncl, _PS_PRICE_COMPUTE_PRECISION_) * (int)$product['cart_quantity'];
|
||||
break;
|
||||
$unitPriceTaxExcl = $objRoomTypeServiceProductPrice->getServicePrice(
|
||||
(int)$product['id_product'],
|
||||
$roomInfo['id'],
|
||||
1,
|
||||
$objHotelBookingDetail->date_from,
|
||||
$objHotelBookingDetail->date_to,
|
||||
false
|
||||
)/ $numDays;
|
||||
$unitPriceTaxIncl = $objRoomTypeServiceProductPrice->getServicePrice(
|
||||
(int)$product['id_product'],
|
||||
$roomInfo['id'],
|
||||
1,
|
||||
$objHotelBookingDetail->date_from,
|
||||
$objHotelBookingDetail->date_to,
|
||||
true
|
||||
)/ $numDays;
|
||||
switch (Configuration::get('PS_ROUND_TYPE')) {
|
||||
case Order::ROUND_TOTAL:
|
||||
$product['total'] = $totalPriceTaxExcl;
|
||||
$product['total_wt'] = $totalPriceTaxIncl;
|
||||
break;
|
||||
case Order::ROUND_LINE:
|
||||
$product['total'] = Tools::ps_round($totalPriceTaxExcl, _PS_PRICE_COMPUTE_PRECISION_);
|
||||
$product['total_wt'] = Tools::ps_round($totalPriceTaxIncl, _PS_PRICE_COMPUTE_PRECISION_);
|
||||
break;
|
||||
|
||||
case Order::ROUND_ITEM:
|
||||
default:
|
||||
$product['total'] = Tools::ps_round($totalPriceTaxExcl, _PS_PRICE_COMPUTE_PRECISION_);
|
||||
$product['total_wt'] = Tools::ps_round($totalPriceTaxIncl, _PS_PRICE_COMPUTE_PRECISION_);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5644,7 +5785,7 @@ class AdminOrdersControllerCore extends AdminController
|
||||
$objRoomTypeServiceProductOrderDetail->total_price_tax_excl = $totalPriceTaxExcl;
|
||||
$objRoomTypeServiceProductOrderDetail->total_price_tax_incl = $totalPriceTaxIncl;
|
||||
$objRoomTypeServiceProductOrderDetail->name = $product['name'];
|
||||
$objRoomTypeServiceProductOrderDetail->quantity = $product['cart_quantity'];
|
||||
$objRoomTypeServiceProductOrderDetail->quantity = $objRoomTypeServiceProductCartDetail->quantity;
|
||||
$objRoomTypeServiceProductOrderDetail->save();
|
||||
|
||||
// update totals amount of order
|
||||
@@ -5910,97 +6051,69 @@ class AdminOrdersControllerCore extends AdminController
|
||||
// To change the status of the room
|
||||
public function changeRoomStatus()
|
||||
{
|
||||
$idRoom = (int) Tools::getValue('id_room');
|
||||
$idOrder = (int) Tools::getValue('id_order');
|
||||
$dateFrom = Tools::getValue('date_from');
|
||||
$dateTo = Tools::getValue('date_to');
|
||||
$newStatus = (int) Tools::getValue('booking_order_status');
|
||||
$idHotelBookingDetail = (int) Tools::getValue('id_hotel_booking_detail');
|
||||
if (Validate::isLoadedObject($objHotelBookingDetail = new HotelBookingDetail($idHotelBookingDetail))) {
|
||||
$newStatus = (int) Tools::getValue('booking_order_status');
|
||||
// date choosen for the status change
|
||||
if ($statusDate = Tools::getValue('status_date')) {
|
||||
$statusDate = date('Y-m-d H:i:s', strtotime($statusDate));
|
||||
}
|
||||
|
||||
// date choosen for the status change
|
||||
if ($statusDate = Tools::getValue('status_date')) {
|
||||
$statusDate = date('Y-m-d', strtotime($statusDate));
|
||||
}
|
||||
// Lets validate the fields
|
||||
if (!$idRoom) {
|
||||
$this->errors[] = Tools::displayError('Room information not found.');
|
||||
}
|
||||
if (!$idOrder) {
|
||||
$this->errors[] = Tools::displayError('Order information not found.');
|
||||
}
|
||||
if (!$dateFrom
|
||||
|| !$dateTo
|
||||
|| !Validate::isDate($dateFrom)
|
||||
|| !Validate::isDate($dateTo)
|
||||
) {
|
||||
$this->errors[] = Tools::displayError('Invalid dates found.');
|
||||
}
|
||||
|
||||
if (!$newStatus) {
|
||||
$this->errors[] = Tools::displayError('Invalid booking status found.');
|
||||
} elseif (
|
||||
$newStatus == HotelBookingDetail::STATUS_CHECKED_IN
|
||||
|| $newStatus == HotelBookingDetail::STATUS_CHECKED_OUT
|
||||
) {
|
||||
if (!$statusDate || !Validate::isDate($statusDate)) {
|
||||
$this->errors[] = Tools::displayError('Invalid dates found.');
|
||||
} elseif ((strtotime($statusDate) < strtotime($dateFrom))
|
||||
|| (strtotime($statusDate) > strtotime($dateTo))
|
||||
$dateFrom = date('Y-m-d H:i:s', strtotime(date('Y-m-d', strtotime($objHotelBookingDetail->date_from))));
|
||||
$dateTo = date('Y-m-d H:i:s', strtotime(date('Y-m-d', strtotime($objHotelBookingDetail->date_to)).' 23:59:59'));
|
||||
if (!$newStatus) {
|
||||
$this->errors[] = Tools::displayError('Invalid booking status found.');
|
||||
} elseif ($newStatus == HotelBookingDetail::STATUS_CHECKED_IN
|
||||
|| $newStatus == HotelBookingDetail::STATUS_CHECKED_OUT
|
||||
) {
|
||||
$this->errors[] = Tools::displayError('Invalid dates found.');
|
||||
}
|
||||
}
|
||||
|
||||
if (!count($this->errors)) {
|
||||
$objBookingDetail = new HotelBookingDetail();
|
||||
if ($roomBookingInfo = $objBookingDetail->getRoomBookingData($idRoom, $idOrder, $dateFrom, $dateTo)) {
|
||||
// if admin choose Check-Out status
|
||||
if ($newStatus == HotelBookingDetail::STATUS_CHECKED_OUT
|
||||
&& $roomBookingInfo['check_in'] == '0000-00-00 00:00:00'
|
||||
if (!$statusDate || !Validate::isDate($statusDate)) {
|
||||
$this->errors[] = Tools::displayError('Invalid dates found.');
|
||||
} elseif ((strtotime($statusDate) < strtotime($dateFrom))
|
||||
|| (strtotime($statusDate) > strtotime($dateTo))
|
||||
) {
|
||||
$this->errors[] = Tools::displayError('Room status must be set to Check-In before setting the room status to Check-Out.');
|
||||
} elseif ($newStatus == HotelBookingDetail::STATUS_CHECKED_OUT
|
||||
&& $roomBookingInfo['check_in'] != '0000-00-00 00:00:00'
|
||||
&& strtotime($roomBookingInfo['check_in']) >= strtotime($statusDate)
|
||||
) {
|
||||
$this->errors[] = Tools::displayError('Check-Out date can not be before Check-In date').
|
||||
'('.date('d-m-Y', strtotime($roomBookingInfo['check_in'])).')';
|
||||
} elseif ($newStatus == HotelBookingDetail::STATUS_CHECKED_IN && $roomBookingInfo['check_out'] == '0000-00-00 00:00:00'
|
||||
&& strtotime($roomBookingInfo['check_in']) >= strtotime($dateTo)
|
||||
) {
|
||||
$this->errors[] = Tools::displayError('Check-In date can not be after Check-Out date').
|
||||
'('.date('d-m-Y', strtotime($roomBookingInfo['date_to'])).')';
|
||||
} elseif ($newStatus == HotelBookingDetail::STATUS_CHECKED_IN && $roomBookingInfo['check_out'] != '0000-00-00 00:00:00'
|
||||
&& strtotime($roomBookingInfo['check_out']) <= strtotime($statusDate)
|
||||
) {
|
||||
$this->errors[] = Tools::displayError('Check-In date can not be after Check-Out date').
|
||||
'('.date('d-m-Y', strtotime($roomBookingInfo['check_out'])).')';
|
||||
} else {
|
||||
if ($objBookingDetail->updateBookingOrderStatusByOrderId(
|
||||
$idOrder,
|
||||
$newStatus,
|
||||
$idRoom,
|
||||
$dateFrom,
|
||||
$dateTo,
|
||||
$statusDate
|
||||
)) {
|
||||
Hook::exec(
|
||||
'actionRoomBookingStatusUpdateAfter',
|
||||
array(
|
||||
'id_order' => $idOrder,
|
||||
'id_room' => $idRoom,
|
||||
'date_from' => $dateFrom,
|
||||
'date_to' => $dateTo
|
||||
)
|
||||
);
|
||||
|
||||
Tools::redirectAdmin(self::$currentIndex.'&id_order='.(int) $idOrder.'&vieworder&token='.$this->token.'&conf=4');
|
||||
} else {
|
||||
$this->errors[] = Tools::displayError('Some error occurred. Please try again.');
|
||||
}
|
||||
$this->errors[] = Tools::displayError('Date should be between booking from date and to date.');
|
||||
}
|
||||
} else {
|
||||
$this->errors[] = Tools::displayError('Invalid booking information. Please try again.');
|
||||
}
|
||||
if ($newStatus == HotelBookingDetail::STATUS_CHECKED_OUT) {
|
||||
if ($objHotelBookingDetail->check_in == '0000-00-00 00:00:00') {
|
||||
$this->errors[] = Tools::displayError('Room status must be set to Check-In before setting the room status to Check-Out.');
|
||||
} elseif (strtotime($objHotelBookingDetail->check_in) > strtotime($statusDate)) {
|
||||
$this->errors[] = sprintf(
|
||||
Tools::displayError('Check-Out date can not be before Check-In date (%s)'),
|
||||
date('d-m-Y', strtotime($objHotelBookingDetail->check_in))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($this->errors)) {
|
||||
$objHotelBookingDetail->id_status = $newStatus;
|
||||
if ($newStatus == HotelBookingDetail::STATUS_CHECKED_IN) {
|
||||
$objHotelBookingDetail->check_in = $statusDate;
|
||||
} elseif ($newStatus == HotelBookingDetail::STATUS_CHECKED_OUT) {
|
||||
$objHotelBookingDetail->check_out = $statusDate;
|
||||
} else {
|
||||
$objHotelBookingDetail->check_in = '';
|
||||
$objHotelBookingDetail->check_out = '';
|
||||
}
|
||||
if ($objHotelBookingDetail->save()) {
|
||||
Hook::exec(
|
||||
'actionRoomBookingStatusUpdateAfter',
|
||||
array(
|
||||
'id_hotel_booking_detail' => $objHotelBookingDetail->id,
|
||||
'id_order' => $objHotelBookingDetail->id_order,
|
||||
'id_room' => $objHotelBookingDetail->id_room,
|
||||
'date_from' => $objHotelBookingDetail->date_from,
|
||||
'date_to' => $objHotelBookingDetail->date_to
|
||||
)
|
||||
);
|
||||
|
||||
Tools::redirectAdmin(self::$currentIndex.'&id_order='.(int) $objHotelBookingDetail->id_order.'&vieworder&token='.$this->token.'&conf=4');
|
||||
} else {
|
||||
$this->errors[] = Tools::displayError('Some error occurred. Please try again.');
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$this->errors[] = Tools::displayError('Invalid booking information. Please try again.');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -205,13 +205,13 @@ class AdminPaymentControllerCore extends AdminController
|
||||
'identifier' => 'id_group',
|
||||
'icon' => 'icon-group',
|
||||
),
|
||||
array('items' =>Country::getCountries($this->context->language->id),
|
||||
'title' => $this->l('Country restrictions'),
|
||||
'desc' => $this->l('Please mark each checkbox for the country, or countries, in which you want the payment module(s) to be available.'),
|
||||
'name_id' => 'country',
|
||||
'identifier' => 'id_country',
|
||||
'icon' => 'icon-globe',
|
||||
)
|
||||
// array('items' =>Country::getCountries($this->context->language->id),
|
||||
// 'title' => $this->l('Country restrictions'),
|
||||
// 'desc' => $this->l('Please mark each checkbox for the country, or countries, in which you want the payment module(s) to be available.'),
|
||||
// 'name_id' => 'country',
|
||||
// 'identifier' => 'id_country',
|
||||
// 'icon' => 'icon-globe',
|
||||
// )
|
||||
);
|
||||
|
||||
foreach ($lists as $key_list => $list) {
|
||||
@@ -243,13 +243,13 @@ class AdminPaymentControllerCore extends AdminController
|
||||
}
|
||||
|
||||
// If is a country list and the country is limited, remove it from list
|
||||
if ($name_id == 'country'
|
||||
&& isset($module->limited_countries)
|
||||
&& !empty($module->limited_countries)
|
||||
&& is_array($module->limited_countries)
|
||||
&& !(in_array(strtoupper($item['iso_code']), array_map('strtoupper', $module->limited_countries)))) {
|
||||
$list['items'][$key_item]['check_list'][$key_module] = null;
|
||||
}
|
||||
// if ($name_id == 'country'
|
||||
// && isset($module->limited_countries)
|
||||
// && !empty($module->limited_countries)
|
||||
// && is_array($module->limited_countries)
|
||||
// && !(in_array(strtoupper($item['iso_code']), array_map('strtoupper', $module->limited_countries)))) {
|
||||
// $list['items'][$key_item]['check_list'][$key_module] = null;
|
||||
// }
|
||||
}
|
||||
}
|
||||
// update list
|
||||
|
||||
@@ -3007,6 +3007,7 @@ class AdminProductsControllerCore extends AdminController
|
||||
$associationInfo['id_product'] = $objProduct->id;
|
||||
$associationInfo['name'] = $objProduct->name;
|
||||
$associationInfo['auto_add_to_cart'] = $objProduct->auto_add_to_cart;
|
||||
$associationInfo['price_addition_type'] = $objProduct->price_addition_type;
|
||||
$associationInfo['category'] = $objProduct->category;
|
||||
$associationInfo['default_price'] = $objProduct->price;
|
||||
$associationInfo['id_tax_rules_group'] = $objProduct->id_tax_rules_group;
|
||||
@@ -3137,7 +3138,9 @@ class AdminProductsControllerCore extends AdminController
|
||||
}
|
||||
|
||||
$objRoomTypeServiceProductPrice->price = $price;
|
||||
$objRoomTypeServiceProductPrice->id_tax_rules_group = $idTaxRulesGroup;
|
||||
if ($idTaxRulesGroup) {
|
||||
$objRoomTypeServiceProductPrice->id_tax_rules_group = $idTaxRulesGroup;
|
||||
}
|
||||
|
||||
$objRoomTypeServiceProductPrice->save();
|
||||
} else {
|
||||
|
||||
@@ -292,32 +292,63 @@ class AdminTranslationsControllerCore extends AdminController
|
||||
}
|
||||
}
|
||||
|
||||
if ($fd = fopen($file_path, 'w')) {
|
||||
// Get value of button save and stay
|
||||
$save_and_stay = Tools::isSubmit('submitTranslations'.$type.'AndStay');
|
||||
// Get value of button save and stay
|
||||
$save_and_stay = Tools::isSubmit('submitTranslations'.$type.'AndStay');
|
||||
|
||||
// Get language
|
||||
$lang = strtolower(Tools::getValue('lang'));
|
||||
// Get language
|
||||
$lang = strtolower(Tools::getValue('lang'));
|
||||
|
||||
// Unset all POST which are not translations
|
||||
unset(
|
||||
$_POST['submitTranslations'.$type],
|
||||
$_POST['submitTranslations'.$type.'AndStay'],
|
||||
$_POST['lang'],
|
||||
$_POST['token'],
|
||||
$_POST['theme'],
|
||||
$_POST['type']
|
||||
);
|
||||
// Unset all POST which are not translations
|
||||
unset(
|
||||
$_POST['submitTranslations'.$type],
|
||||
$_POST['submitTranslations'.$type.'AndStay'],
|
||||
$_POST['lang'],
|
||||
$_POST['token'],
|
||||
$_POST['theme'],
|
||||
$_POST['type']
|
||||
);
|
||||
|
||||
// Get all POST which aren't empty
|
||||
$to_insert = array();
|
||||
foreach ($_POST as $key => $value) {
|
||||
if (!empty($value)) {
|
||||
$to_insert[$key] = $value;
|
||||
// Get all POST which aren't empty
|
||||
$to_update = array();
|
||||
$keysToUpdate = array();
|
||||
foreach ($_POST as $key => $value) {
|
||||
$keysToUpdate[] = $key;
|
||||
$to_update[$key] = $value;
|
||||
}
|
||||
include_once($file_path);
|
||||
switch($this->type_selected) {
|
||||
case 'front':
|
||||
$to_insert = $GLOBALS['_LANG'];
|
||||
break;
|
||||
case 'back':
|
||||
$to_insert = $GLOBALS['_LANGADM'];
|
||||
break;
|
||||
case 'errors':
|
||||
$to_insert = $GLOBALS['_ERRORS'];
|
||||
break;
|
||||
case 'fields':
|
||||
$to_insert = $GLOBALS['_FIELDS'];
|
||||
break;
|
||||
case 'pdf':
|
||||
$to_insert = $GLOBALS['_LANGPDF'];
|
||||
break;
|
||||
|
||||
}
|
||||
foreach ($to_insert as $key => $value) {
|
||||
if (in_array($key, $keysToUpdate)) {
|
||||
if ($to_update[$key]) {
|
||||
$to_insert[$key] = $to_update[$key];
|
||||
} else {
|
||||
unset($to_insert[$key]);
|
||||
}
|
||||
unset($to_update[$key]);
|
||||
}
|
||||
}
|
||||
foreach ($to_update as $key => $value) {
|
||||
$to_insert[$key] = $value;
|
||||
}
|
||||
|
||||
// translations array is ordered by key (easy merge)
|
||||
if ($fd = fopen($file_path, 'w')) {
|
||||
ksort($to_insert);
|
||||
$tab = $translation_informations['var'];
|
||||
fwrite($fd, "<?php\n\nglobal \$".$tab.";\n\$".$tab." = array();\n");
|
||||
@@ -929,9 +960,12 @@ class AdminTranslationsControllerCore extends AdminController
|
||||
static $cache_file = array();
|
||||
static $str_write = '';
|
||||
static $array_check_duplicate = array();
|
||||
static $module_existing_translations = array();
|
||||
|
||||
// Set file_name in static var, this allow to open and wright the file just one time
|
||||
if (!isset($cache_file[$theme_name.'-'.$file_name])) {
|
||||
require $file_name;
|
||||
$module_existing_translations = $_MODULE;
|
||||
$str_write = '';
|
||||
$cache_file[$theme_name.'-'.$file_name] = true;
|
||||
if (!Tools::file_exists_cache(dirname($file_name))) {
|
||||
@@ -984,6 +1018,13 @@ class AdminTranslationsControllerCore extends AdminController
|
||||
$this->total_expression++;
|
||||
}
|
||||
}
|
||||
foreach ($module_existing_translations as $key => $value) {
|
||||
if (!in_array('\''.$key.'\'', $array_check_duplicate)) {
|
||||
$str_write .= '$_MODULE[\''.$key.'\'] = \''.pSQL(str_replace(array("\r\n", "\r", "\n"), ' ', $value)).'\';'."\n";
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -411,7 +411,10 @@ class AuthControllerCore extends FrontController
|
||||
$firstnameAddress = Tools::getValue('firstname');
|
||||
$_POST['lastname'] = Tools::getValue('customer_lastname', $lastnameAddress);
|
||||
$_POST['firstname'] = Tools::getValue('customer_firstname', $firstnameAddress);
|
||||
$addresses_types = array('address');
|
||||
$addresses_types = [];
|
||||
if (Configuration::get('PS_REGISTRATION_PROCESS_TYPE')) {
|
||||
$addresses_types[] = 'address';
|
||||
}
|
||||
|
||||
if (!Configuration::get('PS_ORDER_PROCESS_TYPE') && Configuration::get('PS_GUEST_CHECKOUT_ENABLED') && Tools::getValue('invoice_address')) {
|
||||
$addresses_types[] = 'address_invoice';
|
||||
@@ -435,36 +438,6 @@ class AuthControllerCore extends FrontController
|
||||
$this->errors[] = Tools::displayError('You must register at least one phone number.');
|
||||
}
|
||||
|
||||
// if PS_CUSTOMER_ADDRESS_CREATION is disabled And customer has no addresses then create customer address
|
||||
// with the details of first hotel which rooms he has in cart
|
||||
if (!Configuration::get('PS_CUSTOMER_ADDRESS_CREATION')
|
||||
&& isset($this->context->cart->id)
|
||||
&& $this->context->cart->id
|
||||
) {
|
||||
if (Module::isInstalled('hotelreservationsystem')) {
|
||||
include_once _PS_MODULE_DIR_.'hotelreservationsystem/define.php';
|
||||
$objHtlCart = new HotelCartBookingData();
|
||||
if ($htlCartInfo = $objHtlCart->getCartCurrentDataByCartId($this->context->cart->id)) {
|
||||
if (isset($htlCartInfo[0]['id_hotel']) && ($idHotel = $htlCartInfo[0]['id_hotel'])) {
|
||||
if ($address_info = HotelBranchInformation::getAddress($idHotel)) {
|
||||
$_POST['lastname'] = Tools::getValue('customer_lastname');
|
||||
$_POST['firstname'] = Tools::getValue('customer_firstname');
|
||||
$_POST['address1'] = $address_info['address1'];
|
||||
$_POST['city'] = $address_info['city'];
|
||||
$_POST['postcode'] = $address_info['postcode'];
|
||||
$_POST['alias'] = 'My address';
|
||||
$_POST['id_country'] = $address_info['id_country'];
|
||||
$_POST['id_state'] = $address_info['id_state'];
|
||||
$_POST['auto_generated'] = true;
|
||||
// if form is shorter then address name will be customer name
|
||||
$lastnameAddress = $_POST['lastname'];
|
||||
$firstnameAddress = $_POST['firstname'];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// End
|
||||
$this->errors = array_unique(array_merge($this->errors, $customer->validateController()));
|
||||
|
||||
// Check the requires fields which are settings in the BO
|
||||
@@ -576,7 +549,7 @@ class AuthControllerCore extends FrontController
|
||||
}
|
||||
|
||||
if ($country->need_identification_number) {
|
||||
if (!Configuration::get('PS_CUSTOMER_ADDRESS_CREATION')) {
|
||||
if (!Configuration::get('PS_REGISTRATION_PROCESS_TYPE')) {
|
||||
$$addresses_type->dni = null;
|
||||
} elseif (!Tools::getValue('dni') || !Validate::isDniLite(Tools::getValue('dni'))) {
|
||||
$this->errors[] = Tools::displayError('The identification number is incorrect or has already been used.');
|
||||
|
||||
@@ -347,10 +347,10 @@ class CartControllerCore extends FrontController
|
||||
if (!count($this->errors)) {
|
||||
foreach($occupancy as $key => $roomOccupancy) {
|
||||
if ($roomOccupancy['adults'] > $roomTypeInfo['max_adults']) {
|
||||
$this->errors[] = sprintf(Tools::displayError('Room %s cannot have adults more than %s'), $key + 1, $roomTypeInfo['max_adults']);
|
||||
$this->errors[] = sprintf(Tools::displayError('Room %s cannot have adults more than %s adults'), $key + 1, $roomTypeInfo['max_adults']);
|
||||
}
|
||||
if ($roomOccupancy['children'] > $roomTypeInfo['max_children']) {
|
||||
$this->errors[] = sprintf(Tools::displayError('Room %s cannot have children more than %s'), $key + 1, $roomTypeInfo['max_children']);
|
||||
$this->errors[] = sprintf(Tools::displayError('Room %s cannot have children more than %s children'), $key + 1, $roomTypeInfo['max_children']);
|
||||
}
|
||||
if ($roomOccupancy['adults'] + $roomOccupancy['children'] > $roomTypeInfo['max_guests']) {
|
||||
$this->errors[] = sprintf(Tools::displayError('Room %s cannot have total guests more than %s'), $key + 1, $roomTypeInfo['max_guests']);
|
||||
@@ -373,7 +373,6 @@ class CartControllerCore extends FrontController
|
||||
$this->errors[] = Tools::displayError('You can\'t book room after date '.$maxOrdDate);
|
||||
}
|
||||
}
|
||||
|
||||
if (!$this->errors) {
|
||||
$objBookingDetail = new HotelBookingDetail();
|
||||
$num_days = $objBookingDetail->getNumberOfDays($date_from, $date_to);
|
||||
|
||||
@@ -496,7 +496,7 @@ class OrderOpcControllerCore extends ParentOrderController
|
||||
// 'allDemands' => $allDemands,
|
||||
// 'defaultcurrencySign' => $objCurrency->sign,
|
||||
'THEME_DIR' => _THEME_DIR_,
|
||||
'PS_CUSTOMER_ADDRESS_CREATION' => Configuration::get('PS_CUSTOMER_ADDRESS_CREATION'),
|
||||
'PS_REGISTRATION_PROCESS_TYPE' => Configuration::get('PS_REGISTRATION_PROCESS_TYPE'),
|
||||
'PS_ROOM_PRICE_AUTO_ADD_BREAKDOWN' => Configuration::get('PS_ROOM_PRICE_AUTO_ADD_BREAKDOWN'),
|
||||
'free_shipping' => $free_shipping,
|
||||
'isGuest' => isset($this->context->cookie->is_guest) ? $this->context->cookie->is_guest : 0,
|
||||
@@ -767,9 +767,6 @@ class OrderOpcControllerCore extends ParentOrderController
|
||||
}
|
||||
$address_delivery = new Address($this->context->cart->id_address_delivery);
|
||||
$address_invoice = ($this->context->cart->id_address_delivery == $this->context->cart->id_address_invoice ? $address_delivery : new Address($this->context->cart->id_address_invoice));
|
||||
if (!$this->context->cart->id_address_delivery || !$this->context->cart->id_address_invoice || !Validate::isLoadedObject($address_delivery) || !Validate::isLoadedObject($address_invoice) || $address_invoice->deleted || $address_delivery->deleted) {
|
||||
return '<p class="warning">'.Tools::displayError('Error: Please select an address.').'</p>';
|
||||
}
|
||||
if (count($this->context->cart->getDeliveryOptionList()) == 0 && !$this->context->cart->isVirtualCart()) {
|
||||
if ($this->context->cart->isMultiAddressDelivery()) {
|
||||
return '<p class="warning">'.Tools::displayError('Error: None of your chosen carriers deliver to some of the addresses you have selected.').'</p>';
|
||||
|
||||
@@ -399,56 +399,54 @@ class ParentOrderControllerCore extends FrontController
|
||||
Tools::redirect('');
|
||||
} elseif (!Customer::getAddressesTotalById($this->context->customer->id)) {
|
||||
$multi = (int)Tools::getValue('multi-shipping');
|
||||
Tools::redirect('index.php?controller=address&back='.urlencode('order.php?step=1'.($multi ? '&multi-shipping='.$multi : '')));
|
||||
}
|
||||
|
||||
$customer = $this->context->customer;
|
||||
if (Validate::isLoadedObject($customer)) {
|
||||
/* Getting customer addresses */
|
||||
$customerAddresses = $customer->getAddresses($this->context->language->id);
|
||||
if ($customerAddresses = $customer->getAddresses($this->context->language->id)) {
|
||||
// Getting a list of formated address fields with associated values
|
||||
$formatedAddressFieldsValuesList = array();
|
||||
|
||||
// Getting a list of formated address fields with associated values
|
||||
$formatedAddressFieldsValuesList = array();
|
||||
foreach ($customerAddresses as $i => $address) {
|
||||
if (!Address::isCountryActiveById((int)$address['id_address'])) {
|
||||
unset($customerAddresses[$i]);
|
||||
}
|
||||
$tmpAddress = new Address($address['id_address']);
|
||||
$formatedAddressFieldsValuesList[$address['id_address']]['ordered_fields'] = AddressFormat::getOrderedAddressFields($address['id_country']);
|
||||
$formatedAddressFieldsValuesList[$address['id_address']]['formated_fields_values'] = AddressFormat::getFormattedAddressFieldsValues(
|
||||
$tmpAddress,
|
||||
$formatedAddressFieldsValuesList[$address['id_address']]['ordered_fields']);
|
||||
|
||||
foreach ($customerAddresses as $i => $address) {
|
||||
if (!Address::isCountryActiveById((int)$address['id_address'])) {
|
||||
unset($customerAddresses[$i]);
|
||||
unset($tmpAddress);
|
||||
}
|
||||
$tmpAddress = new Address($address['id_address']);
|
||||
$formatedAddressFieldsValuesList[$address['id_address']]['ordered_fields'] = AddressFormat::getOrderedAddressFields($address['id_country']);
|
||||
$formatedAddressFieldsValuesList[$address['id_address']]['formated_fields_values'] = AddressFormat::getFormattedAddressFieldsValues(
|
||||
$tmpAddress,
|
||||
$formatedAddressFieldsValuesList[$address['id_address']]['ordered_fields']);
|
||||
|
||||
unset($tmpAddress);
|
||||
}
|
||||
$customerAddresses = array_values($customerAddresses);
|
||||
|
||||
$customerAddresses = array_values($customerAddresses);
|
||||
if (!count($customerAddresses) && !Tools::isSubmit('ajax')) {
|
||||
$bad_delivery = false;
|
||||
if (($bad_delivery = (bool)!Address::isCountryActiveById((int)$this->context->cart->id_address_delivery)) || !Address::isCountryActiveById((int)$this->context->cart->id_address_invoice)) {
|
||||
$params = array();
|
||||
if ($this->step) {
|
||||
$params['step'] = (int)$this->step;
|
||||
}
|
||||
if ($multi = (int)Tools::getValue('multi-shipping')) {
|
||||
$params['multi-shipping'] = $multi;
|
||||
}
|
||||
$back_url = $this->context->link->getPageLink('order', true, (int)$this->context->language->id, $params);
|
||||
|
||||
$params = array('back' => $back_url, 'id_address' => ($bad_delivery ? (int)$this->context->cart->id_address_delivery : (int)$this->context->cart->id_address_invoice));
|
||||
if ($multi) {
|
||||
$params['multi-shipping'] = $multi;
|
||||
}
|
||||
|
||||
if (!count($customerAddresses) && !Tools::isSubmit('ajax')) {
|
||||
$bad_delivery = false;
|
||||
if (($bad_delivery = (bool)!Address::isCountryActiveById((int)$this->context->cart->id_address_delivery)) || !Address::isCountryActiveById((int)$this->context->cart->id_address_invoice)) {
|
||||
$params = array();
|
||||
if ($this->step) {
|
||||
$params['step'] = (int)$this->step;
|
||||
}
|
||||
if ($multi = (int)Tools::getValue('multi-shipping')) {
|
||||
$params['multi-shipping'] = $multi;
|
||||
}
|
||||
$back_url = $this->context->link->getPageLink('order', true, (int)$this->context->language->id, $params);
|
||||
|
||||
$params = array('back' => $back_url, 'id_address' => ($bad_delivery ? (int)$this->context->cart->id_address_delivery : (int)$this->context->cart->id_address_invoice));
|
||||
if ($multi) {
|
||||
$params['multi-shipping'] = $multi;
|
||||
}
|
||||
|
||||
Tools::redirect($this->context->link->getPageLink('address', true, (int)$this->context->language->id, $params));
|
||||
}
|
||||
$this->context->smarty->assign(array(
|
||||
'addresses' => $customerAddresses,
|
||||
'formatedAddressFieldsValuesList' => $formatedAddressFieldsValuesList)
|
||||
);
|
||||
}
|
||||
$this->context->smarty->assign(array(
|
||||
'addresses' => $customerAddresses,
|
||||
'formatedAddressFieldsValuesList' => $formatedAddressFieldsValuesList)
|
||||
);
|
||||
|
||||
/* Setting default addresses for cart */
|
||||
if (count($customerAddresses)) {
|
||||
|
||||
@@ -904,6 +904,12 @@
|
||||
</configuration>
|
||||
<configuration id="PS_SERVICE_PRODUCT_CATEGORY_FILTER" name="PS_SERVICE_PRODUCT_CATEGORY_FILTER">
|
||||
<value>1</value>
|
||||
</configuration>
|
||||
<configuration id="PS_BACKDATE_ORDER_SUPERADMIN" name="PS_BACKDATE_ORDER_SUPERADMIN">
|
||||
<value>1</value>
|
||||
</configuration>
|
||||
<configuration id="PS_BACKDATE_ORDER_EMPLOYEES" name="PS_BACKDATE_ORDER_EMPLOYEES">
|
||||
<value>0</value>
|
||||
</configuration>
|
||||
</entities>
|
||||
</entity_configuration>
|
||||
|
||||
@@ -498,7 +498,25 @@ product_tabs['Informations'] = new function(){
|
||||
$('#max_quantity_container').show('fast');
|
||||
}
|
||||
}
|
||||
toggleAutoAddWithRoomNotice();
|
||||
});
|
||||
|
||||
$('#price_addition_type').on('change', function () {
|
||||
toggleAutoAddWithRoomNotice();
|
||||
});
|
||||
|
||||
function toggleAutoAddWithRoomNotice()
|
||||
{
|
||||
if ($('#auto_add_to_cart_on').prop('checked')
|
||||
&& $('#price_addition_type').val() == price_addition_type_with_room
|
||||
) {
|
||||
$('.hide_on_auto_add_Withroom').hide();
|
||||
$('.show_on_auto_add_Withroom').show();
|
||||
} else {
|
||||
$('.hide_on_auto_add_Withroom').show();
|
||||
$('.show_on_auto_add_Withroom').hide();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.bindTagImage = function (){
|
||||
|
||||
@@ -557,46 +557,98 @@ function initProductEvents()
|
||||
});
|
||||
|
||||
$(document).on('change', '.num_occupancy', function(e) {
|
||||
let elementVal = parseInt($(this).val());
|
||||
let current_room_occupancy = 0;
|
||||
$(this).closest('.occupancy_info_block').find('.num_occupancy').each(function(){
|
||||
current_room_occupancy += parseInt($(this).val());
|
||||
});
|
||||
|
||||
if ($(this).hasClass('num_children')) {
|
||||
var totalChilds = $(this).closest('.occupancy_info_block').find('.guest_child_age').length;
|
||||
if (totalChilds < $(this).val()) {
|
||||
$(this).closest('.occupancy_info_block').find('.children_age_info_block').show();
|
||||
while ($(this).closest('.occupancy_info_block').find('.guest_child_age').length < $(this).val()) {
|
||||
var roomBlockIndex = parseInt($(this).closest('.occupancy_info_block').attr('occ_block_index'));
|
||||
|
||||
var childAgeSelect = '<p class="col-xs-12 col-sm-12 col-md-6 col-lg-6">';
|
||||
childAgeSelect += '<select class="guest_child_age room_occupancies" name="occupancy[' +roomBlockIndex+ '][child_ages][]">';
|
||||
childAgeSelect += '<option value="-1">' + select_age_txt + '</option>';
|
||||
childAgeSelect += '<option value="0">' + under_1_age + '</option>';
|
||||
for (let age = 1; age < max_child_age; age++) {
|
||||
childAgeSelect += '<option value="'+age+'">'+age+'</option>';
|
||||
}
|
||||
childAgeSelect += '</select>';
|
||||
childAgeSelect += '</p>';
|
||||
$(this).closest('.occupancy_info_block').find('.children_ages').append(childAgeSelect);
|
||||
let max_guests_in_room = $(this).closest(".booking_occupancy_wrapper").find('.max_guests').val();
|
||||
let max_allowed_for_current = (max_guests_in_room - current_room_occupancy) + parseInt($(this).val());
|
||||
let haserror = false
|
||||
if ($(this).hasClass('num_children')) {
|
||||
max_child_in_room = $(this).closest(".booking_occupancy_wrapper").find('.max_children').val();
|
||||
if (elementVal > max_child_in_room) {
|
||||
$(this).val(max_child_in_room);
|
||||
if (elementVal == 1) {
|
||||
showOccupancyError(no_children_allowed_txt, $(this).closest(".occupancy_info_block"));
|
||||
haserror = true;
|
||||
} else {
|
||||
showOccupancyError(max_children_txt, $(this).closest(".occupancy_info_block"));
|
||||
haserror = true;
|
||||
}
|
||||
} else {
|
||||
let child = $(this).val();
|
||||
$(this).closest('.occupancy_info_block').find('.guest_child_age').each(function(ind, element) {
|
||||
if (child <= ind) {
|
||||
$(element).parent().remove();
|
||||
} else if (elementVal > max_allowed_for_current) {
|
||||
$(this).val(max_allowed_for_current);
|
||||
showOccupancyError(max_occupancy_reached_txt, $(this).closest(".occupancy_info_block"));
|
||||
haserror = true;
|
||||
}
|
||||
} else {
|
||||
max_adults_in_room = $(this).closest(".booking_occupancy_wrapper").find('.max_adults').val();
|
||||
if (elementVal >= max_adults_in_room) {
|
||||
$(this).val(max_adults_in_room);
|
||||
showOccupancyError(max_adults_txt, $(this).closest(".occupancy_info_block"));
|
||||
haserror = true;
|
||||
} else if (elementVal > max_allowed_for_current) {
|
||||
$(this).val(max_allowed_for_current);
|
||||
showOccupancyError(max_occupancy_reached_txt, $(this).closest(".occupancy_info_block"));
|
||||
haserror = true;
|
||||
}
|
||||
}
|
||||
if (!haserror) {
|
||||
if ($(this).hasClass('num_children')) {
|
||||
var totalChilds = $(this).closest('.occupancy_info_block').find('.guest_child_age').length;
|
||||
if (totalChilds < $(this).val()) {
|
||||
let max_child_in_room;
|
||||
if ($(this).closest(".booking_occupancy_wrapper").find('.max_children').val()) {
|
||||
max_child_in_room = $(this).closest(".booking_occupancy_wrapper").find('.max_children').val();
|
||||
} else {
|
||||
max_child_in_room = window.max_child_in_room;
|
||||
}
|
||||
});
|
||||
if (child == 0) {
|
||||
$(this).closest('.occupancy_info_block').find('.children_age_info_block').hide();
|
||||
}
|
||||
if (totalChilds < max_child_in_room) {
|
||||
$(this).closest('.occupancy_info_block').find('.children_age_info_block').show();
|
||||
while ($(this).closest('.occupancy_info_block').find('.guest_child_age').length < $(this).val()) {
|
||||
|
||||
|
||||
var roomBlockIndex = parseInt($(this).closest('.occupancy_info_block').attr('occ_block_index'));
|
||||
|
||||
var childAgeSelect = '<p class="col-xs-12 col-sm-12 col-md-6 col-lg-6">';
|
||||
childAgeSelect += '<select class="guest_child_age room_occupancies" name="occupancy[' +roomBlockIndex+ '][child_ages][]">';
|
||||
childAgeSelect += '<option value="-1">' + select_age_txt + '</option>';
|
||||
childAgeSelect += '<option value="0">' + under_1_age + '</option>';
|
||||
for (let age = 1; age < max_child_age; age++) {
|
||||
childAgeSelect += '<option value="'+age+'">'+age+'</option>';
|
||||
}
|
||||
childAgeSelect += '</select>';
|
||||
childAgeSelect += '</p>';
|
||||
$(this).closest('.occupancy_info_block').find('.children_ages').append(childAgeSelect);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
let child = $(this).val();
|
||||
$(this).closest('.occupancy_info_block').find('.guest_child_age').each(function(ind, element) {
|
||||
if (child <= ind) {
|
||||
$(element).parent().remove();
|
||||
}
|
||||
});
|
||||
if (child == 0) {
|
||||
$(this).closest('.occupancy_info_block').find('.children_age_info_block').hide();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
setRoomTypeGuestOccupancy($(this).closest('.booking_occupancy_wrapper'));
|
||||
});
|
||||
|
||||
var errorMsgTime;
|
||||
$('.occupancy-input-errors').parent().hide();
|
||||
function showOccupancyError(msg, occupancy_info_block)
|
||||
{
|
||||
var errorMsgBlock = $(occupancy_info_block).find('.occupancy-input-errors')
|
||||
$(errorMsgBlock).html(msg).parent().show('fast');
|
||||
clearTimeout(errorMsgTime);
|
||||
errorMsgTime = setTimeout(function() {
|
||||
$(errorMsgBlock).parent().hide('fast');
|
||||
}, 1000);
|
||||
}
|
||||
|
||||
$(document).on('click', '.booking_guest_occupancy:not(.disabled)', function(e) {
|
||||
$(this).parent().toggleClass('open');
|
||||
@@ -1124,6 +1176,13 @@ function initRoomEvents()
|
||||
$('tr#new_product .booking_guest_occupancy').removeClass('disabled');
|
||||
setRoomTypeGuestOccupancy($('tr#new_product .booking_occupancy_wrapper'));
|
||||
}
|
||||
if (data.room_type_info) {
|
||||
$('tr#new_product .max_adults').val(data.room_type_info.max_adults);
|
||||
$('tr#new_product .max_children').val(data.room_type_info.max_children);
|
||||
$('tr#new_product .max_guests').val(data.room_type_info.max_guests);
|
||||
// $('tr#new_product .num_adults').attr('max', data.room_type_info.max_adults);
|
||||
// $('tr#new_product .num_children').attr('max', data.room_type_info.max_children);
|
||||
}
|
||||
|
||||
// Keep product variable
|
||||
current_product = data;
|
||||
@@ -1514,12 +1573,25 @@ function initRoomEvents()
|
||||
|
||||
$('.add_room_date_to').datepicker('option', 'minDate', objDateToMin);
|
||||
},
|
||||
beforeShow : function () {
|
||||
if(allowBackdateOrder) {
|
||||
var minDate = null;
|
||||
} else {
|
||||
var minDate = new Date();
|
||||
}
|
||||
$(this).datepicker("option", "minDate", minDate);
|
||||
}
|
||||
});
|
||||
|
||||
$(".add_room_date_to").datepicker(
|
||||
{
|
||||
showOtherMonths: true,
|
||||
dateFormat: 'dd-mm-yy'
|
||||
dateFormat: 'dd-mm-yy',
|
||||
beforeShow : function () {
|
||||
var date_from = $.datepicker.parseDate('dd-mm-yy', $(this).closest('.bookingDuration').find('.add_room_date_from').val());
|
||||
date_from.setDate(date_from.getDate() + 1);
|
||||
$(this).datepicker("option", "minDate", date_from);
|
||||
}
|
||||
});
|
||||
|
||||
$(".edit_product_date_from").datepicker(
|
||||
@@ -1532,12 +1604,25 @@ function initRoomEvents()
|
||||
|
||||
$('.edit_product_date_to').datepicker('option', 'minDate', objDateToMin);
|
||||
},
|
||||
beforeShow : function () {
|
||||
if(allowBackdateOrder) {
|
||||
var minDate = null;
|
||||
} else {
|
||||
var minDate = new Date(Math.min($.datepicker.parseDate('dd-mm-yy', $(this).data('min_date')), new Date()));
|
||||
}
|
||||
$(this).datepicker("option", "minDate", minDate);
|
||||
}
|
||||
});
|
||||
|
||||
$(".edit_product_date_to").datepicker(
|
||||
{
|
||||
showOtherMonths: true,
|
||||
dateFormat: 'dd-mm-yy'
|
||||
dateFormat: 'dd-mm-yy',
|
||||
beforeShow : function () {
|
||||
var date_from = $.datepicker.parseDate('dd-mm-yy', $(this).closest('.form-group').find('.edit_product_date_from').val());
|
||||
date_from.setDate(date_from.getDate() + 1);
|
||||
$(this).datepicker("option", "minDate", date_from);
|
||||
}
|
||||
});
|
||||
/*End*/
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ class BankwireValidationModuleFrontController extends ModuleFrontController
|
||||
public function postProcess()
|
||||
{
|
||||
$cart = $this->context->cart;
|
||||
if ($cart->id_customer == 0 || $cart->id_address_delivery == 0 || $cart->id_address_invoice == 0 || !$this->module->active)
|
||||
if ($cart->id_customer == 0 || !$this->module->active)
|
||||
Tools::redirect('index.php?controller=order&step=1');
|
||||
|
||||
// Check that this payment option is still available in case the customer changed his address just before the end of the checkout process
|
||||
|
||||
@@ -33,7 +33,7 @@ class ChequeValidationModuleFrontController extends ModuleFrontController
|
||||
{
|
||||
$cart = $this->context->cart;
|
||||
|
||||
if ($cart->id_customer == 0 || $cart->id_address_delivery == 0 || $cart->id_address_invoice == 0 || !$this->module->active)
|
||||
if ($cart->id_customer == 0 || !$this->module->active)
|
||||
Tools::redirect('index.php?controller=order&step=1');
|
||||
|
||||
// Check that this payment option is still available in case the customer changed his address just before the end of the checkout process
|
||||
|
||||
@@ -774,6 +774,34 @@ class HotelCartBookingData extends ObjectModel
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* [removeBackdateRoomsFromCart :: To delete the rooms from cart whose booking date is before the current date
|
||||
*
|
||||
* @param [int] $idCart [Id of the cart]
|
||||
*
|
||||
* @return [boolean] [If removed successfully returns true else returns false]
|
||||
*/
|
||||
public function removeBackdateRoomsFromCart($idCart)
|
||||
{
|
||||
if ($cartBookingData = $this->getCartCurrentDataByCartId($idCart)) {
|
||||
$res = true;
|
||||
foreach ($cartBookingData as $cartRoom) {
|
||||
if (strtotime($cartRoom['date_from']) < strtotime(date('Y-m-d'))) {
|
||||
$res = $res && $this->deleteRoomDataFromOrderLine(
|
||||
$cartRoom['id_cart'],
|
||||
$cartRoom['id_guest'],
|
||||
$cartRoom['id_product'],
|
||||
$cartRoom['date_from'],
|
||||
$cartRoom['date_to']
|
||||
);
|
||||
}
|
||||
}
|
||||
return $res;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* [getCustomerIdRoomsByIdCartIdProduct :: To get array of rooms ids in the cart booked by a customer for a date range].
|
||||
*
|
||||
|
||||
@@ -64,14 +64,13 @@ class RoomTypeServiceProductCartDetail extends ObjectModel
|
||||
}
|
||||
|
||||
if ($updateQty = $quantity - $objRoomTypeServiceProductCartDetail->quantity) {
|
||||
$way = $updateQty > 0 ? 'up' : 'down';
|
||||
$objRoomTypeServiceProductCartDetail->quantity += $updateQty;
|
||||
if (Product::getProductPriceCalculation($idProduct) == Product::PRICE_CALCULATION_METHOD_PER_DAY) {
|
||||
$objHotelCartBookingData = new HotelCartBookingData($idHtlCartData);
|
||||
$numdays = HotelHelper::getNumberOfDays($objHotelCartBookingData->date_from, $objHotelCartBookingData->date_to);
|
||||
$updateQty *= $numdays;
|
||||
|
||||
}
|
||||
$way = $updateQty > 0 ? 'up' : 'down';
|
||||
$objRoomTypeServiceProductCartDetail->quantity = $quantity;
|
||||
if ($objRoomTypeServiceProductCartDetail->save()) {
|
||||
$objCart = new Cart($idCart);
|
||||
return $objCart->updateQty((int)abs($updateQty), $idProduct, null, false, $way);
|
||||
@@ -86,16 +85,45 @@ class RoomTypeServiceProductCartDetail extends ObjectModel
|
||||
public function removeServiceProductByIdHtlCartBooking($htlCartBookingId)
|
||||
{
|
||||
if ($stadardProductsData = Db::getInstance()->executeS(
|
||||
'SELECT * FROM `'._DB_PREFIX_.'htl_room_type_service_product_cart_detail`
|
||||
WHERE `htl_cart_booking_id` = '.(int)$htlCartBookingId
|
||||
'SELECT * FROM `' . _DB_PREFIX_ . 'htl_room_type_service_product_cart_detail`
|
||||
WHERE `htl_cart_booking_id` = ' . (int)$htlCartBookingId
|
||||
)) {
|
||||
foreach ($stadardProductsData as $product) {
|
||||
if (Validate::isLoadedObject(
|
||||
$objRoomTypeServiceProductCartDetail = new RoomTypeServiceProductCartDetail($product['id_room_type_service_product_cart_detail'])
|
||||
)) {
|
||||
$updateQty = $product['quantity'];
|
||||
if (Product::getProductPriceCalculation($product['id_product']) == Product::PRICE_CALCULATION_METHOD_PER_DAY) {
|
||||
$objHotelCartBookingData = new HotelCartBookingData($idHtlCartData);
|
||||
$numdays = HotelHelper::getNumberOfDays($objHotelCartBookingData->date_from, $objHotelCartBookingData->date_to);
|
||||
$updateQty *= $numdays;
|
||||
}
|
||||
if ($objRoomTypeServiceProductCartDetail->delete()) {
|
||||
$objCart = new Cart($product['id_cart']);
|
||||
$objCart->updateQty((int)($product['quantity']), $product['id_product'], null, false, 'down');
|
||||
if (isset(Context::getContext()->controller->controller_type)) {
|
||||
$controllerType = Context::getContext()->controller->controller_type;
|
||||
} else {
|
||||
$controllerType = 'front';
|
||||
}
|
||||
if ($controllerType == 'admin' || $controllerType == 'moduleadmin') {
|
||||
if ($cartQty = Cart::getProductQtyInCart($product['id_cart'], $product['id_product'])) {
|
||||
if ($product['quantity'] < $cartQty) {
|
||||
Db::getInstance()->update(
|
||||
'cart_product',
|
||||
array('quantity' => (int)($cartQty - $product['quantity'])),
|
||||
'`id_product` = '.(int)$product['id_product'].' AND `id_cart` = '.(int)$product['id_cart']
|
||||
);
|
||||
} else {
|
||||
//if room type has no qty remaining in cart then delete row
|
||||
Db::getInstance()->delete(
|
||||
'cart_product',
|
||||
'`id_product` = '.(int)$product['id_product'].' AND `id_cart` = '.(int)$product['id_cart']
|
||||
);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$objCart->updateQty((int)($updateQty), $product['id_product'], null, false, 'down');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,12 +69,24 @@ class RoomTypeServiceProductPrice extends ObjectModel
|
||||
|
||||
public static function getProductRoomTypePriceAndTax($idProduct, $idElement, $elementType)
|
||||
{
|
||||
return Db::getInstance()->getRow(
|
||||
'SELECT `price`, `id_tax_rules_group` FROM `'._DB_PREFIX_.'htl_room_type_service_product_price`
|
||||
WHERE `id_product`='.(int)$idProduct.
|
||||
' AND `id_element`='.(int)$idElement.
|
||||
' AND `element_type`='.(int)$elementType
|
||||
);
|
||||
if ($result = Db::getInstance()->getRow('
|
||||
SELECT spp.`price`, spp.`id_tax_rules_group`, p.`auto_add_to_cart`, p.`price_addition_type`
|
||||
FROM `'._DB_PREFIX_.'product` p
|
||||
LEFT JOIN `'._DB_PREFIX_.'htl_room_type_service_product` sp ON (sp.`id_product` = p.`id_product`)
|
||||
LEFT JOIN `'._DB_PREFIX_.'htl_room_type_service_product_price` spp ON (spp.`id_product` = p.`id_product`)
|
||||
WHERE p.`id_product`='.(int)$idProduct.
|
||||
' AND sp.`id_element`='.(int)$idElement.
|
||||
' AND sp.`element_type`='.(int)$elementType)
|
||||
) {
|
||||
if ($result['auto_add_to_cart'] && $result['price_addition_type'] == Product::PRICE_ADDITION_TYPE_WITH_ROOM) {
|
||||
// if service is auto add to cart and added in room price, we need to find room type tax rule group
|
||||
if ($elementType == RoomTypeServiceProduct::WK_ELEMENT_TYPE_ROOM_TYPE) {
|
||||
$result['id_tax_rules_group'] = Product::getIdTaxRulesGroupByIdProduct((int)$idElement);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function getProductRoomTypeLinkPriceInfo($idProduct, $idElement, $elementType)
|
||||
|
||||
@@ -69,6 +69,15 @@ class AdminHotelRoomsBookingController extends ModuleAdminController
|
||||
$objCustomer->id_guest = (int) $this->context->cookie->id_guest;
|
||||
|
||||
$this->context->customer = $objCustomer;
|
||||
if ($this->context->employee->isSuperAdmin()) {
|
||||
$backOrderConfigKey = 'PS_BACKDATE_ORDER_SUPERADMIN';
|
||||
} else {
|
||||
$backOrderConfigKey = 'PS_BACKDATE_ORDER_EMPLOYEES';
|
||||
}
|
||||
if (!Configuration::get($backOrderConfigKey)) {
|
||||
$htlCart = new HotelCartBookingData();
|
||||
$htlCart->removeBackdateRoomsFromCart($this->context->cart->id);
|
||||
}
|
||||
}
|
||||
|
||||
protected function createNewCart()
|
||||
@@ -98,13 +107,23 @@ class AdminHotelRoomsBookingController extends ModuleAdminController
|
||||
} else {
|
||||
$date_from = date('Y-m-d');
|
||||
}
|
||||
if ($this->context->employee->isSuperAdmin()) {
|
||||
$backOrderConfigKey = 'PS_BACKDATE_ORDER_SUPERADMIN';
|
||||
} else {
|
||||
$backOrderConfigKey = 'PS_BACKDATE_ORDER_EMPLOYEES';
|
||||
}
|
||||
if (!Configuration::get($backOrderConfigKey)) {
|
||||
if (strtotime(date('Y-m-d')) > strtotime($date_from)) {
|
||||
$date_from = date('Y-m-d');
|
||||
}
|
||||
}
|
||||
if (Tools::getValue('date_to')) {
|
||||
$date_to = Tools::getValue('date_to');
|
||||
} else {
|
||||
$date_to = date('Y-m-d');
|
||||
if (strtotime($date_from) >= strtotime($date_to)) {
|
||||
$date_to = date('Y-m-d', strtotime('+1 day', strtotime($date_to)));
|
||||
}
|
||||
}
|
||||
if (strtotime($date_from) >= strtotime($date_to)) {
|
||||
$date_to = date('Y-m-d', strtotime('+1 day', strtotime($date_to)));
|
||||
}
|
||||
|
||||
if (Tools::getValue('id_hotel')) {
|
||||
@@ -886,6 +905,13 @@ class AdminHotelRoomsBookingController extends ModuleAdminController
|
||||
if (Configuration::get('PS_BACKOFFICE_ROOM_BOOKING_TYPE') == HotelBookingDetail::PS_ROOM_UNIT_SELECTION_TYPE_OCCUPANCY) {
|
||||
$occupancyRequiredForBooking = true;
|
||||
}
|
||||
if ($this->context->employee->isSuperAdmin()) {
|
||||
$backOrderConfigKey = 'PS_BACKDATE_ORDER_SUPERADMIN';
|
||||
} else {
|
||||
$backOrderConfigKey = 'PS_BACKDATE_ORDER_EMPLOYEES';
|
||||
}
|
||||
$PS_BACKDATE_ORDER_ALLOW = (int)Configuration::get($backOrderConfigKey);
|
||||
|
||||
$jsVars = array(
|
||||
'currency_prefix' => $currency->prefix,
|
||||
'currency_suffix' => $currency->suffix,
|
||||
@@ -925,7 +951,12 @@ class AdminHotelRoomsBookingController extends ModuleAdminController
|
||||
'below_txt' => $this->l('Below', null, true),
|
||||
'years_txt' => $this->l('years', null, true),
|
||||
'all_children_txt' => $this->l('All Children', null, true),
|
||||
'max_occupancy_reached_txt' => $this->l('Maximum room occupancy reached', null, true),
|
||||
'max_adults_txt' => $this->l('Maximum adult occupancy reached', null, true),
|
||||
'max_children_txt' => $this->l('Maximum children occupancy reached', null, true),
|
||||
'no_children_allowed_txt' => $this->l('Only adults can be accommodated', null, true),
|
||||
'invalid_occupancy_txt' => $this->l('Invalid occupancy(adults/children) found.', null, true),
|
||||
'PS_BACKDATE_ORDER_ALLOW' => $PS_BACKDATE_ORDER_ALLOW,
|
||||
// 'check_calender_var' => $check_calender_var,
|
||||
'txtSomeErr' => $this->l('Some error occurred. Please try again.'),
|
||||
'no_rm_avail_txt' => $this->l('No room available.', null, true),
|
||||
|
||||
@@ -76,24 +76,8 @@ class HotelReservationSystem extends Module
|
||||
if (!Configuration::get('PS_CATALOG_MODE')) {
|
||||
/*To remove room from cart before todays date*/
|
||||
if (isset($this->context->cart->id) && $this->context->cart->id) {
|
||||
$htlCart = new HotelCartBookingData();
|
||||
if ($cartBookingData = $htlCart->getCartBookingDetailsByIdCartIdGuest(
|
||||
$this->context->cart->id,
|
||||
$this->context->cart->id_guest,
|
||||
$this->context->language->id
|
||||
)) {
|
||||
foreach ($cartBookingData as $cartRoom) {
|
||||
if (strtotime($cartRoom['date_from']) < strtotime(date('Y-m-d'))) {
|
||||
$htlCart->deleteRoomDataFromOrderLine(
|
||||
$cartRoom['id_cart'],
|
||||
$cartRoom['id_guest'],
|
||||
$cartRoom['id_product'],
|
||||
$cartRoom['date_from'],
|
||||
$cartRoom['date_to']
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
$objHotelCartBookingData = new HotelCartBookingData();
|
||||
$objHotelCartBookingData->removeBackdateRoomsFromCart($this->context->cart->id);
|
||||
}
|
||||
}
|
||||
//End
|
||||
|
||||
@@ -230,6 +230,7 @@ $(document).ready(function() {
|
||||
dateFormat: 'dd-mm-yy',
|
||||
altFormat: 'yy-mm-dd',
|
||||
altField: '#date_from',
|
||||
minDate: PS_BACKDATE_ORDER_ALLOW == 1 ? null : 0,
|
||||
beforeShowDay: function (date) {
|
||||
return highlightDateBorder($("#from_date").val(), date);
|
||||
},
|
||||
@@ -246,6 +247,11 @@ $(document).ready(function() {
|
||||
dateFormat: 'dd-mm-yy',
|
||||
altFormat: 'yy-mm-dd',
|
||||
altField: '#date_to',
|
||||
beforeShow: function () {
|
||||
from_date = $.datepicker.parseDate('dd-mm-yy', $("#from_date").val());
|
||||
from_date.setDate(from_date.getDate() + 1);
|
||||
$("#to_date").datepicker("option", "minDate", from_date);
|
||||
},
|
||||
beforeShowDay: function (date) {
|
||||
return highlightDateBorder($("#to_date").val(), date);
|
||||
},
|
||||
@@ -597,55 +603,91 @@ $(document).ready(function() {
|
||||
});
|
||||
|
||||
$(document).on('change', '.num_occupancy', function(e) {
|
||||
|
||||
let elementVal = parseInt($(this).val());
|
||||
let current_room_occupancy = 0;
|
||||
$(this).closest('.occupancy_info_block').find('.num_occupancy').each(function(){
|
||||
current_room_occupancy += parseInt($(this).val());
|
||||
});
|
||||
let max_guests_in_room = $(this).closest(".booking_occupancy_wrapper").find('.max_guests').val();
|
||||
let max_allowed_for_current = (max_guests_in_room - current_room_occupancy) + parseInt($(this).val());
|
||||
if ($(this).val() > $(this).attr('max')) {
|
||||
$(this).val($(this).attr('max'));
|
||||
}
|
||||
if ($(this).val() > max_allowed_for_current) {
|
||||
$(this).val(max_allowed_for_current);
|
||||
}
|
||||
|
||||
let haserror = false
|
||||
if ($(this).hasClass('num_children')) {
|
||||
let totalChilds = $(this).closest('.occupancy_info_block').find('.guest_child_age').length;
|
||||
if (totalChilds < $(this).val()) {
|
||||
$(this).closest('.occupancy_info_block').find('.children_age_info_block').show();
|
||||
while ($(this).closest('.occupancy_info_block').find('.guest_child_age').length < $(this).val()) {
|
||||
var roomBlockIndex = parseInt($(this).closest('.occupancy_info_block').attr('occ_block_index'));
|
||||
var childAgeSelect = '<div class="form-group col-xs-12 col-sm-12 col-md-6 col-lg-6">';
|
||||
childAgeSelect += '<select class="guest_child_age room_occupancies" name="occupancy[' +roomBlockIndex+ '][child_ages][]">';
|
||||
childAgeSelect += '<option value="-1">' + select_age_txt + '</option>';
|
||||
childAgeSelect += '<option value="0">' + under_1_age + '</option>';
|
||||
for (let age = 1; age < max_child_age; age++) {
|
||||
childAgeSelect += '<option value="'+age+'">'+age+'</option>';
|
||||
}
|
||||
childAgeSelect += '</select>';
|
||||
childAgeSelect += '</div>';
|
||||
$(this).closest('.occupancy_info_block').find('.children_ages').append(childAgeSelect);
|
||||
max_child_in_room = $(this).closest(".booking_occupancy_wrapper").find('.max_children').val();
|
||||
if (elementVal > max_child_in_room) {
|
||||
$(this).val(max_child_in_room);
|
||||
if (elementVal == 1) {
|
||||
showOccupancyError(no_children_allowed_txt, $(this).closest(".occupancy_info_block"));
|
||||
haserror = true;
|
||||
} else {
|
||||
showOccupancyError(max_children_txt, $(this).closest(".occupancy_info_block"));
|
||||
haserror = true;
|
||||
}
|
||||
} else {
|
||||
let child = $(this).val();
|
||||
$(this).closest('.occupancy_info_block').find('.guest_child_age').each(function(ind, element) {
|
||||
if (child <= ind) {
|
||||
$(element).parent().remove();
|
||||
}
|
||||
});
|
||||
if (child == 0) {
|
||||
$(this).closest('.occupancy_info_block').find('.children_age_info_block').hide();
|
||||
}
|
||||
|
||||
} else if (elementVal > max_allowed_for_current) {
|
||||
$(this).val(max_allowed_for_current);
|
||||
showOccupancyError(max_occupancy_reached_txt, $(this).closest(".occupancy_info_block"));
|
||||
haserror = true;
|
||||
}
|
||||
} else {
|
||||
max_adults_in_room = $(this).closest(".booking_occupancy_wrapper").find('.max_adults').val();
|
||||
if (elementVal >= max_adults_in_room) {
|
||||
$(this).val(max_adults_in_room);
|
||||
showOccupancyError(max_adults_txt, $(this).closest(".occupancy_info_block"));
|
||||
haserror = true;
|
||||
} else if (elementVal > max_allowed_for_current) {
|
||||
$(this).val(max_allowed_for_current);
|
||||
showOccupancyError(max_occupancy_reached_txt, $(this).closest(".occupancy_info_block"));
|
||||
haserror = true;
|
||||
}
|
||||
}
|
||||
|
||||
setRoomTypeGuestOccupancy($(this).closest('.booking_occupancy_wrapper'));
|
||||
if (!haserror) {
|
||||
if ($(this).hasClass('num_children')) {
|
||||
let totalChilds = $(this).closest('.occupancy_info_block').find('.guest_child_age').length;
|
||||
if (totalChilds < $(this).val()) {
|
||||
$(this).closest('.occupancy_info_block').find('.children_age_info_block').show();
|
||||
while ($(this).closest('.occupancy_info_block').find('.guest_child_age').length < $(this).val()) {
|
||||
var roomBlockIndex = parseInt($(this).closest('.occupancy_info_block').attr('occ_block_index'));
|
||||
var childAgeSelect = '<div class="form-group col-xs-12 col-sm-12 col-md-6 col-lg-6">';
|
||||
childAgeSelect += '<select class="guest_child_age room_occupancies" name="occupancy[' +roomBlockIndex+ '][child_ages][]">';
|
||||
childAgeSelect += '<option value="-1">' + select_age_txt + '</option>';
|
||||
childAgeSelect += '<option value="0">' + under_1_age + '</option>';
|
||||
for (let age = 1; age < max_child_age; age++) {
|
||||
childAgeSelect += '<option value="'+age+'">'+age+'</option>';
|
||||
}
|
||||
childAgeSelect += '</select>';
|
||||
childAgeSelect += '</div>';
|
||||
$(this).closest('.occupancy_info_block').find('.children_ages').append(childAgeSelect);
|
||||
}
|
||||
} else {
|
||||
let child = $(this).val();
|
||||
$(this).closest('.occupancy_info_block').find('.guest_child_age').each(function(ind, element) {
|
||||
if (child <= ind) {
|
||||
$(element).parent().remove();
|
||||
}
|
||||
});
|
||||
if (child == 0) {
|
||||
$(this).closest('.occupancy_info_block').find('.children_age_info_block').hide();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
setRoomTypeGuestOccupancy($(this).closest('.booking_occupancy_wrapper'));
|
||||
});
|
||||
|
||||
var errorMsgTime;
|
||||
$('.occupancy-input-errors').parent().hide();
|
||||
function showOccupancyError(msg, occupancy_info_block)
|
||||
{
|
||||
var errorMsgBlock = $(occupancy_info_block).find('.occupancy-input-errors')
|
||||
$(errorMsgBlock).html(msg).parent().show('fast');
|
||||
clearTimeout(errorMsgTime);
|
||||
errorMsgTime = setTimeout(function() {
|
||||
$(errorMsgBlock).parent().hide('fast');
|
||||
}, 1000);
|
||||
}
|
||||
|
||||
|
||||
$(document).on('click', '.booking_guest_occupancy', function(e) {
|
||||
$(this).parent().toggleClass('open');
|
||||
});
|
||||
|
||||
@@ -115,6 +115,7 @@
|
||||
({l s='Below'} {$max_child_age|escape:'htmlall':'UTF-8'} {l s='years' mod='hotelreservationsystem'})
|
||||
</div>
|
||||
</div>
|
||||
<p style="display:none;"><span class="text-danger occupancy-input-errors"></span></p>
|
||||
<div class="row children_age_info_block" style="display:none">
|
||||
<div class="form-group col-sm-12">
|
||||
<label class="">{l s='All Children' mod='hotelreservationsystem'}</label>
|
||||
@@ -212,6 +213,7 @@
|
||||
({l s='Below' mod='hotelreservationsystem'} {$max_child_age|escape:'htmlall':'UTF-8'} {l s='years' mod='hotelreservationsystem'})
|
||||
</div>
|
||||
</div>
|
||||
<p style="display:none;"><span class="text-danger occupancy-input-errors"></span></p>
|
||||
<div class="row children_age_info_block" style="display:none">
|
||||
<div class="form-group col-sm-12">
|
||||
<label class="">{l s='All Children' mod='hotelreservationsystem'}</label>
|
||||
@@ -240,6 +242,7 @@
|
||||
({l s='Below' mod='hotelreservationsystem'} {$max_child_age|escape:'htmlall':'UTF-8'} {l s='years' mod='hotelreservationsystem'})
|
||||
</div>
|
||||
</div>
|
||||
<p style="display:none;"><span class="text-danger occupancy-input-errors"></span></p>
|
||||
<div class="row children_age_info_block" style="display:none">
|
||||
<div class="form-group col-sm-12">
|
||||
<label class="">{l s='All Children' mod='hotelreservationsystem'}</label>
|
||||
|
||||
@@ -325,12 +325,7 @@ class WkPaypalCommerceHelper
|
||||
$sql .= ' AND a.`id_address` = ' . (int) $idAddress;
|
||||
}
|
||||
|
||||
$res = Db::getInstance()->executeS($sql);
|
||||
if (count($res) === 1) {
|
||||
return $res[0];
|
||||
} else {
|
||||
return $res;
|
||||
}
|
||||
return Db::getInstance()->getRow($sql);
|
||||
}
|
||||
|
||||
public static function getOrdersByCartId($idCart)
|
||||
|
||||
@@ -278,10 +278,6 @@ class QloPaypalCommercePaymentModuleFrontController extends ModuleFrontControlle
|
||||
$customer = new Customer((int)$cart->id_customer);
|
||||
|
||||
$ppHelper = new WkPaypalCommerceHelper();
|
||||
$bilAddr = $ppHelper->getSimpleAddress(
|
||||
(int)$cart->id_customer,
|
||||
(int)$cart->id_address_invoice
|
||||
);
|
||||
|
||||
$orderData['payer'] = array(
|
||||
'name' => array(
|
||||
@@ -291,14 +287,20 @@ class QloPaypalCommercePaymentModuleFrontController extends ModuleFrontControlle
|
||||
'email_address' => $customer->email
|
||||
);
|
||||
|
||||
$orderData['payer']['address'] = array(
|
||||
'address_line_1' => $bilAddr['address1'],
|
||||
'address_line_2' => $bilAddr['address2'],
|
||||
'admin_area_2' => $bilAddr['city'],
|
||||
'admin_area_1' => $bilAddr['state_iso'],
|
||||
'postal_code' => $bilAddr['postcode'],
|
||||
'country_code' => $bilAddr['country_iso'],
|
||||
);
|
||||
// address is not required in paypal payment, if customer has added an address then we add tha address to paypal payer object
|
||||
if ($bilAddr = $ppHelper->getSimpleAddress(
|
||||
(int)$cart->id_customer,
|
||||
(int)$cart->id_address_invoice
|
||||
)) {
|
||||
$orderData['payer']['address'] = array(
|
||||
'address_line_1' => $bilAddr['address1'],
|
||||
'address_line_2' => $bilAddr['address2'],
|
||||
'admin_area_2' => $bilAddr['city'],
|
||||
'admin_area_1' => $bilAddr['state_iso'],
|
||||
'postal_code' => $bilAddr['postcode'],
|
||||
'country_code' => $bilAddr['country_iso'],
|
||||
);
|
||||
}
|
||||
|
||||
$timestamp = time().rand(100, 999);
|
||||
$currency = Currency::getCurrency((int) $cart->id_currency);
|
||||
|
||||
@@ -191,7 +191,7 @@ class StatsBestCategories extends ModuleGrid
|
||||
AND hbd.`date_to` > "'.pSQL($date_from).'" AND hbd.`date_from` < "'.pSQL($date_to).'"
|
||||
) AS totalOrders,
|
||||
(
|
||||
SELECT IFNULL(SUM(ROUND((DATEDIFF(LEAST(hbd.`date_to`, "'.pSQL($date_to).'"), GREATEST(hbd.`date_from`, "'.pSQL($date_from).'")) / DATEDIFF(hbd.`date_to`, hbd.`date_from`)) * hbd.`total_price_tax_excl`, 2)), 0)
|
||||
SELECT IFNULL(SUM(ROUND((DATEDIFF(LEAST(hbd.`date_to`, "'.pSQL($date_to).'"), GREATEST(hbd.`date_from`, "'.pSQL($date_from).'")) / DATEDIFF(hbd.`date_to`, hbd.`date_from`)) * (hbd.`total_price_tax_excl` / o.`conversion_rate`), 2)), 0)
|
||||
FROM `'._DB_PREFIX_.'htl_booking_detail` hbd
|
||||
LEFT JOIN `'._DB_PREFIX_.'orders` o
|
||||
ON (o.`id_order` = hbd.`id_order`)
|
||||
|
||||
@@ -176,7 +176,7 @@ class StatsBestProducts extends ModuleGrid
|
||||
AND hbd.`date_to` > "'.pSQL($date_from).'" AND hbd.`date_from` < "'.pSQL($date_to).'"
|
||||
) AS sellingPrice,
|
||||
(
|
||||
SELECT IFNULL(SUM(ROUND((DATEDIFF(LEAST(hbd.`date_to`, "'.pSQL($date_to).'"), GREATEST(hbd.`date_from`, "'.pSQL($date_from).'")) / DATEDIFF(hbd.`date_to`, hbd.`date_from`)) * hbd.`total_price_tax_excl`, 2)), 0)
|
||||
SELECT IFNULL(SUM(ROUND((DATEDIFF(LEAST(hbd.`date_to`, "'.pSQL($date_to).'"), GREATEST(hbd.`date_from`, "'.pSQL($date_from).'")) / DATEDIFF(hbd.`date_to`, hbd.`date_from`)) * (hbd.`total_price_tax_excl` / o.`conversion_rate`) , 2)), 0)
|
||||
FROM `'._DB_PREFIX_.'htl_booking_detail` hbd
|
||||
LEFT JOIN `'._DB_PREFIX_.'orders` o
|
||||
ON (o.`id_order` = hbd.`id_order`)
|
||||
|
||||
@@ -179,7 +179,10 @@ class StatsEquipment extends ModuleGraph
|
||||
{
|
||||
switch ($option) {
|
||||
case 'wb':
|
||||
$this->_titles['main'] = $this->l('Web browser used');
|
||||
$this->_titles['main'][] = $this->l('Web browser used');
|
||||
if (Tools::getValue('export')) {
|
||||
$this->_titles['main'][] = '';
|
||||
}
|
||||
$this->query = 'SELECT wb.`name`, COUNT(g.`id_web_browser`) AS total
|
||||
FROM `'._DB_PREFIX_.'web_browser` wb
|
||||
LEFT JOIN `'._DB_PREFIX_.'guest` g ON g.`id_web_browser` = wb.`id_web_browser`
|
||||
@@ -191,7 +194,10 @@ class StatsEquipment extends ModuleGraph
|
||||
break;
|
||||
|
||||
case 'os':
|
||||
$this->_titles['main'] = $this->l('Operating system used');
|
||||
$this->_titles['main'][] = $this->l('Operating system used');
|
||||
if (Tools::getValue('export')) {
|
||||
$this->_titles['main'][] = '';
|
||||
}
|
||||
$this->query = 'SELECT os.`name`, COUNT(g.`id_operating_system`) AS total
|
||||
FROM `'._DB_PREFIX_.'operating_system` os
|
||||
LEFT JOIN `'._DB_PREFIX_.'guest` g ON g.`id_operating_system` = os.`id_operating_system`
|
||||
|
||||
@@ -125,10 +125,12 @@ class StatsNewsletter extends ModuleGraph
|
||||
|
||||
protected function getData($layers)
|
||||
{
|
||||
$this->_titles['main'][0] = $this->l('Customers');
|
||||
$this->_titles['main'][1] = $this->l('Visitors');
|
||||
$this->_titles['main'][2] = $this->l('Newsletter statistics');
|
||||
$this->_titles['main'][3] = $this->l('Both');
|
||||
if (Tools::getValue('export')) {
|
||||
$this->_titles['main'][] = $this->l('Date');
|
||||
}
|
||||
$this->_titles['main'][] = $this->l('Customers');
|
||||
$this->_titles['main'][] = $this->l('Visitors');
|
||||
$this->_titles['main'][] = $this->l('Both');
|
||||
$this->_formats['y'] = 'd';
|
||||
|
||||
$this->_query = 'SELECT newsletter_date_add
|
||||
|
||||
@@ -142,7 +142,10 @@ class StatsOrigin extends ModuleGraph
|
||||
|
||||
protected function getData($layers)
|
||||
{
|
||||
$this->_titles['main'] = $this->l('Top ten referral websites');
|
||||
$this->_titles['main'][] = $this->l('Top ten referral websites');
|
||||
if (Tools::getValue('export')) {
|
||||
$this->_titles['main'][] = $this->l('Referal percentage');
|
||||
}
|
||||
$websites = $this->getOrigins($this->getDate());
|
||||
$total = 0;
|
||||
$total2 = 0;
|
||||
|
||||
@@ -212,7 +212,12 @@ class StatsPersonalInfos extends ModuleGraph
|
||||
{
|
||||
switch ($this->option) {
|
||||
case 'gender':
|
||||
$this->_titles['main'] = $this->l('Gender distribution');
|
||||
if (Tools::getValue('export')) {
|
||||
$this->_titles['main'][] = $this->l('Gender');
|
||||
$this->_titles['main'][] = '';
|
||||
} else {
|
||||
$this->_titles['main'] = $this->l('Gender distribution');
|
||||
}
|
||||
$genders = array(
|
||||
0 => $this->l('Male'),
|
||||
1 => $this->l('Female'),
|
||||
@@ -243,7 +248,12 @@ class StatsPersonalInfos extends ModuleGraph
|
||||
break;
|
||||
|
||||
case 'age':
|
||||
$this->_titles['main'] = $this->l('Age range');
|
||||
if (Tools::getValue('export')) {
|
||||
$this->_titles['main'][] = $this->l('Age');
|
||||
$this->_titles['main'][] = '';
|
||||
} else {
|
||||
$this->_titles['main'] = $this->l('Age range');
|
||||
}
|
||||
|
||||
// 0 - 18 years
|
||||
$sql = 'SELECT COUNT(`id_customer`) as total
|
||||
@@ -334,7 +344,12 @@ class StatsPersonalInfos extends ModuleGraph
|
||||
break;
|
||||
|
||||
case 'country':
|
||||
$this->_titles['main'] = $this->l('Country distribution');
|
||||
if (Tools::getValue('export')) {
|
||||
$this->_titles['main'][] = $this->l('Country');
|
||||
$this->_titles['main'][] = '';
|
||||
} else {
|
||||
$this->_titles['main'] = $this->l('Country distribution');
|
||||
}
|
||||
$sql = 'SELECT cl.`name`, COUNT(c.`id_country`) AS total
|
||||
FROM `'._DB_PREFIX_.'address` a
|
||||
LEFT JOIN `'._DB_PREFIX_.'customer` cu ON cu.id_customer = a.id_customer
|
||||
@@ -351,7 +366,12 @@ class StatsPersonalInfos extends ModuleGraph
|
||||
break;
|
||||
|
||||
case 'currency':
|
||||
$this->_titles['main'] = $this->l('Currency distribution');
|
||||
if (Tools::getValue('export')) {
|
||||
$this->_titles['main'][] = $this->l('Currency');
|
||||
$this->_titles['main'][] = '';
|
||||
} else {
|
||||
$this->_titles['main'] = $this->l('Currency distribution');
|
||||
}
|
||||
$sql = 'SELECT c.`name`, COUNT(c.`id_currency`) AS total
|
||||
FROM `'._DB_PREFIX_.'orders` o
|
||||
LEFT JOIN `'._DB_PREFIX_.'currency` c ON o.`id_currency` = c.`id_currency`
|
||||
@@ -366,7 +386,12 @@ class StatsPersonalInfos extends ModuleGraph
|
||||
break;
|
||||
|
||||
case 'language':
|
||||
$this->_titles['main'] = $this->l('Language distribution');
|
||||
if (Tools::getValue('export')) {
|
||||
$this->_titles['main'][] = $this->l('Language');
|
||||
$this->_titles['main'][] = '';
|
||||
} else {
|
||||
$this->_titles['main'] = $this->l('Language distribution');
|
||||
}
|
||||
$sql = 'SELECT c.`name`, COUNT(c.`id_lang`) AS total
|
||||
FROM `'._DB_PREFIX_.'orders` o
|
||||
LEFT JOIN `'._DB_PREFIX_.'lang` c ON o.`id_lang` = c.`id_lang`
|
||||
|
||||
@@ -351,8 +351,11 @@ class StatsProduct extends ModuleGraph
|
||||
$date_between = $this->getDate();
|
||||
switch ($this->option) {
|
||||
case 1:
|
||||
$this->_titles['main'][0] = $this->l('Room nights');
|
||||
$this->_titles['main'][1] = $this->l('Views (x100)');
|
||||
if (Tools::getValue('export')) {
|
||||
$this->_titles['main'][] = $this->l('Date');
|
||||
}
|
||||
$this->_titles['main'][] = $this->l('Room nights');
|
||||
$this->_titles['main'][] = $this->l('Views (x100)');
|
||||
$this->_titles['x'] = $this->l('Date');
|
||||
$this->_titles['y'] = $this->l('Room nights, Views (x100)');
|
||||
$this->_formats['y'] = 'd';
|
||||
|
||||
@@ -172,7 +172,10 @@ class StatsRegistrations extends ModuleGraph
|
||||
WHERE 1
|
||||
'.Shop::addSqlRestriction(Shop::SHARE_CUSTOMER).'
|
||||
AND `date_add` BETWEEN';
|
||||
$this->_titles['main'] = $this->l('Number of customer registrations');
|
||||
if (Tools::getValue('export')) {
|
||||
$this->_titles['main'][] = $this->l('Date');
|
||||
}
|
||||
$this->_titles['main'][] = $this->l('Number of customer registrations');
|
||||
$this->_formats['y'] = 'd';
|
||||
$this->setDateGraph($layers, true);
|
||||
}
|
||||
|
||||
@@ -214,14 +214,23 @@ class StatsSales extends ModuleGraph
|
||||
list($this->option, $this->id_country, $this->id_hotel) = explode('-', $options);
|
||||
switch ($this->option) {
|
||||
case 1:
|
||||
$this->_titles['main'] = $this->l('Orders placed');
|
||||
if (Tools::getValue('export')) {
|
||||
$this->_titles['main'][] = $this->l('Date');
|
||||
}
|
||||
$this->_titles['main'][] = $this->l('Orders placed');
|
||||
break;
|
||||
case 2:
|
||||
if (Tools::getValue('export')) {
|
||||
$this->_titles['main'][] = $this->l('Date');
|
||||
}
|
||||
$currency = new Currency((int)Configuration::get('PS_CURRENCY_DEFAULT'));
|
||||
$this->_titles['main'] = sprintf($this->l('Revenue currency: %s'), $currency->iso_code);
|
||||
$this->_titles['main'][] = sprintf($this->l('Revenue currency: %s'), $currency->iso_code);
|
||||
break;
|
||||
case 3:
|
||||
$this->_titles['main'] = $this->l('Percentage of orders per status.');
|
||||
if (Tools::getValue('export')) {
|
||||
$this->_titles['main'][] = $this->l('Payment method');
|
||||
}
|
||||
$this->_titles['main'][] = $this->l('Percentage of orders per status.');
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -137,9 +137,12 @@ class StatsVisits extends ModuleGraph
|
||||
{
|
||||
switch ($option) {
|
||||
case 3:
|
||||
$this->_titles['main'][0] = $this->l('Visits');
|
||||
$this->_titles['main'][1] = $this->l('Number of visits and unique visitors');
|
||||
$this->_titles['main'][2] = $this->l('Visitors');
|
||||
if (Tools::getValue('export')) {
|
||||
$this->_titles['main'][] = $this->l('Date');
|
||||
}
|
||||
|
||||
$this->_titles['main'][] = $this->l('Visits');
|
||||
$this->_titles['main'][] = $this->l('Number of visits and unique visitors');
|
||||
$this->query[0] = 'SELECT date_add, COUNT(`date_add`) as total
|
||||
FROM `'._DB_PREFIX_.'connections`
|
||||
WHERE 1
|
||||
|
||||
@@ -273,6 +273,8 @@
|
||||
font-weight: 400;}
|
||||
#search_occupancy_wrapper .occupancy_info_block .qty_direction .occupancy_quantity_down {
|
||||
margin-top: 3px;}
|
||||
#search_occupancy_wrapper .occupancy-input-errors {
|
||||
font-weight: 700;}
|
||||
|
||||
#search_occupancy_wrapper .children_ages {
|
||||
display: grid;
|
||||
|
||||
@@ -447,6 +447,16 @@ $(document).ready(function() {
|
||||
|
||||
// set input field value
|
||||
$(this).closest('.occupancy_count_block').find('.occupancy_count > span').text(elementVal);
|
||||
} else {
|
||||
if (elementVal >= max_child_in_room) {
|
||||
if (elementVal == 0) {
|
||||
showOccupancyError(no_children_allowed_txt, $(this).closest(".occupancy_info_block"));
|
||||
} else {
|
||||
showOccupancyError(max_children_txt, $(this).closest(".occupancy_info_block"));
|
||||
}
|
||||
} else {
|
||||
showOccupancyError(max_occupancy_reached_txt, $(this).closest(".occupancy_info_block"));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
element.val(elementVal);
|
||||
@@ -458,6 +468,18 @@ $(document).ready(function() {
|
||||
setGuestOccupancy();
|
||||
});
|
||||
|
||||
var errorMsgTime;
|
||||
function showOccupancyError(msg, occupancy_info_block)
|
||||
{
|
||||
var errorMsgBlock = $(occupancy_info_block).find('.occupancy-input-errors')
|
||||
$(errorMsgBlock).html(msg).parent().show('fast');
|
||||
clearTimeout(errorMsgTime);
|
||||
errorMsgTime = setTimeout(function() {
|
||||
$(errorMsgBlock).parent().hide('fast');
|
||||
}, 1000);
|
||||
|
||||
}
|
||||
|
||||
$(document).on('click', '#search_occupancy_wrapper .occupancy_quantity_down', function(e) {
|
||||
e.preventDefault();
|
||||
// set input field value
|
||||
|
||||
@@ -112,6 +112,8 @@
|
||||
<p class="label-desc-txt">({l s='Below' mod='wkroomsearchblock'} {$max_child_age|escape:'htmlall':'UTF-8'} {l s='years' mod='wkroomsearchblock'})</p>
|
||||
</div>
|
||||
</div>
|
||||
<p style="display:none;"><span class="text-danger occupancy-input-errors"></span></p>
|
||||
|
||||
<div class="row">
|
||||
<div class="form-group children_age_info_block col-sm-12" {if isset($occupancy['child_ages']) && $occupancy['child_ages']}style="display:block;"{/if}>
|
||||
<label>{l s='All Children' mod='wkroomsearchblock'}</label>
|
||||
@@ -186,6 +188,7 @@
|
||||
<p class="label-desc-txt">({l s='Below' mod='wkroomsearchblock'} {$max_child_age|escape:'htmlall':'UTF-8'} {l s='years' mod='wkroomsearchblock'})</p>
|
||||
</div>
|
||||
</div>
|
||||
<p style="display:none;"><span class="text-danger occupancy-input-errors"></span></p>
|
||||
<div class="row">
|
||||
<div class="form-group children_age_info_block col-sm-12">
|
||||
<label>{l s='All Children' mod='wkroomsearchblock'}</label>
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*}
|
||||
{if $invoice_address}
|
||||
<table id="addresses-tab" cellspacing="0" cellpadding="0">
|
||||
<tr>
|
||||
<!-- <td width="33%"><span class="bold"> </span><br/><br/>
|
||||
@@ -38,3 +39,4 @@
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
{/if}
|
||||
@@ -84,6 +84,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<p style="display:none;"><span class="text-danger occupancy-input-errors"></span></p>
|
||||
<div class="form-group row children_age_info_block" {if isset($occupancy['child_ages']) && $occupancy['child_ages']}style="display:block;"{/if}>
|
||||
<label class="col-sm-12">{l s='All Children'}</label>
|
||||
<div class="col-sm-12">
|
||||
@@ -162,6 +163,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<p style="display:none;"><span class="text-danger occupancy-input-errors"></span></p>
|
||||
<div class="form-group row children_age_info_block">
|
||||
<label class="col-sm-12">{l s='All Children'}</label>
|
||||
<div class="col-sm-12">
|
||||
|
||||
@@ -30,6 +30,8 @@
|
||||
margin-top: 15px;
|
||||
margin-right: -20px;
|
||||
margin-left: -20px;}
|
||||
.booking_occupancy_wrapper .occupancy-input-errors {
|
||||
font-weight: 700;}
|
||||
.booking_occupancy_wrapper .children_age_info_block {
|
||||
display: none;}
|
||||
.booking_occupancy_wrapper .children_age_info_block label {
|
||||
|
||||
@@ -62,6 +62,10 @@
|
||||
{addJsDef max_child_age=$max_child_age}
|
||||
{addJsDef max_child_in_room=$max_child_in_room}
|
||||
|
||||
{addJsDefL name='max_occupancy_reached_txt'}{l s='Maximum room occupancy reached' js=1}{/addJsDefL}
|
||||
{addJsDefL name='max_adults_txt'}{l s='Maximum adult occupancy reached' js=1}{/addJsDefL}
|
||||
{addJsDefL name='max_children_txt'}{l s='Maximum children occupancy reached' js=1}{/addJsDefL}
|
||||
{addJsDefL name='no_children_allowed_txt'}{l s='Only adults can be accommodated' js=1}{/addJsDefL}
|
||||
{addJsDefL name='select_occupancy_txt'}{l s='Select Occupancy' 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}
|
||||
|
||||
@@ -78,6 +78,16 @@ $(document).ready(function(){
|
||||
|
||||
// set input field value
|
||||
$(this).closest('.occupancy_count_block').find('.occupancy_count > span').text(elementVal + 1);
|
||||
} else {
|
||||
if (elementVal >= max_child_in_room) {
|
||||
if (elementVal == 0) {
|
||||
showOccupancyError(no_children_allowed_txt, $(this).closest(".occupancy_info_block"));
|
||||
} else {
|
||||
showOccupancyError(max_children_txt, $(this).closest(".occupancy_info_block"));
|
||||
}
|
||||
} else {
|
||||
showOccupancyError(max_occupancy_reached_txt, $(this).closest(".occupancy_info_block"));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
let max_adults_in_room;
|
||||
@@ -87,11 +97,30 @@ $(document).ready(function(){
|
||||
if (elementVal < max_adults_in_room && elementVal < max_allowed_for_current) {
|
||||
element.val(elementVal + 1);
|
||||
$(this).closest('.occupancy_count_block').find('.occupancy_count > span').text(elementVal + 1);
|
||||
} else {
|
||||
if (elementVal >= max_adults_in_room) {
|
||||
showOccupancyError(max_adults_txt, $(this).closest(".occupancy_info_block"));
|
||||
} else {
|
||||
showOccupancyError(max_occupancy_reached_txt, $(this).closest(".occupancy_info_block"));
|
||||
}
|
||||
}
|
||||
}
|
||||
setRoomTypeGuestOccupancy($(this).closest('.booking_occupancy_wrapper'));
|
||||
});
|
||||
|
||||
var errorMsgTime;
|
||||
$('.occupancy-input-errors').parent().hide();
|
||||
function showOccupancyError(msg, occupancy_info_block)
|
||||
{
|
||||
var errorMsgBlock = $(occupancy_info_block).find('.occupancy-input-errors')
|
||||
$(errorMsgBlock).html(msg).parent().show('fast');
|
||||
clearTimeout(errorMsgTime);
|
||||
errorMsgTime = setTimeout(function() {
|
||||
$(errorMsgBlock).parent().hide('fast');
|
||||
}, 1000);
|
||||
|
||||
}
|
||||
|
||||
$(document).on('click', '.booking_occupancy_wrapper .occupancy_quantity_down', function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
@@ -247,6 +276,7 @@ $(document).ready(function(){
|
||||
occupancy_block += '</div>';
|
||||
occupancy_block += '</div>';
|
||||
occupancy_block += '</div>';
|
||||
occupancy_block += '<p style="display:none;"><span class="text-danger occupancy-input-errors"></span></p>';
|
||||
occupancy_block += '<div class="form-group row children_age_info_block">';
|
||||
occupancy_block += '<label class="col-sm-12">' + all_children_txt + '</label>';
|
||||
occupancy_block += '<div class="col-sm-12">';
|
||||
|
||||
@@ -346,7 +346,7 @@ $(document).ready(function()
|
||||
static_token = jsonData.token;
|
||||
|
||||
// It's not a new customer
|
||||
if (PS_CUSTOMER_ADDRESS_CREATION && $('#opc_id_customer').val() !== '0') {
|
||||
if (PS_REGISTRATION_PROCESS_TYPE && $('#opc_id_customer').val() !== '0') {
|
||||
saveAddress('delivery', function() {
|
||||
location.reload();
|
||||
});
|
||||
|
||||
@@ -106,7 +106,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{if $PS_CUSTOMER_ADDRESS_CREATION}
|
||||
{if isset($PS_REGISTRATION_PROCESS_TYPE) && $PS_REGISTRATION_PROCESS_TYPE}
|
||||
<div class="row">
|
||||
<div class="select form-group date-select col-sm-12">
|
||||
<label>{l s='Date of Birth'}</label>
|
||||
@@ -316,5 +316,5 @@
|
||||
{if isset($countries)}
|
||||
{addJsDef countries=$countries}
|
||||
{/if}
|
||||
{addJsDef PS_CUSTOMER_ADDRESS_CREATION=$PS_CUSTOMER_ADDRESS_CREATION|intval}
|
||||
{addJsDef PS_REGISTRATION_PROCESS_TYPE=$PS_REGISTRATION_PROCESS_TYPE|intval}
|
||||
{/strip}
|
||||
|
||||
@@ -103,7 +103,7 @@
|
||||
<input type="text" class="text form-control validate" name="phone_mobile" id="phone_mobile" data-validate="isPhoneNumber" value="{if isset($guestInformations) && isset($guestInformations.phone_mobile) && $guestInformations.phone_mobile}{$guestInformations.phone_mobile}{/if}" />
|
||||
</div>
|
||||
</div>
|
||||
{if $PS_CUSTOMER_ADDRESS_CREATION}
|
||||
{if isset($PS_REGISTRATION_PROCESS_TYPE) && $PS_REGISTRATION_PROCESS_TYPE}
|
||||
{if isset($birthday) && $birthday}
|
||||
<div class="row">
|
||||
<div class="select form-group date-select col-sm-12">
|
||||
@@ -137,7 +137,6 @@
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
{if isset($newsletter) && $newsletter}
|
||||
<div class="checkbox">
|
||||
<label for="newsletter">
|
||||
|
||||
Reference in New Issue
Block a user