Merge branch 'develop' into gli-2961
This commit is contained in:
@@ -48,21 +48,65 @@
|
||||
function modules_management(action)
|
||||
{
|
||||
var modules = document.getElementsByName('modules');
|
||||
var module_list = '';
|
||||
var module_list = [];
|
||||
for (var i = 0; i < modules.length; i++)
|
||||
{
|
||||
if (modules[i].checked == true)
|
||||
if (modules[i].checked)
|
||||
{
|
||||
rel = modules[i].getAttribute('data-rel');
|
||||
var rel = modules[i].getAttribute('data-rel');
|
||||
if (rel != "false" && action == "uninstall")
|
||||
{
|
||||
if (!confirm(rel))
|
||||
return false;
|
||||
}
|
||||
module_list += '|'+modules[i].value;
|
||||
module_list.push(modules[i].value);
|
||||
}
|
||||
}
|
||||
document.location.href=currentIndex+'&token='+token+'&'+action+'='+module_list.substring(1, module_list.length);
|
||||
|
||||
module_list = encodeURIComponent(module_list.join('|'));
|
||||
if (action == 'enable' || action == 'disable') {
|
||||
var type = action == 'disable' ? 0 : 1;
|
||||
document.location.href = currentIndex+'&token='+token+'&enable='+type+'&module_name='+module_list;
|
||||
return false;
|
||||
}
|
||||
|
||||
document.location.href = currentIndex+'&token='+token+'&'+action+'='+module_list;
|
||||
return false;
|
||||
}
|
||||
|
||||
function filter_modules_by_name(table, moduleName)
|
||||
{
|
||||
var moduleNames = moduleName.split('|');
|
||||
var filteredNames = [];
|
||||
for (var i = 0; i < moduleNames.length; i++) {
|
||||
moduleNames[i] = $.trim(moduleNames[i]);
|
||||
if (moduleNames[i] !== '') {
|
||||
filteredNames.push(moduleNames[i].toLowerCase());
|
||||
}
|
||||
}
|
||||
|
||||
if (!filteredNames.length) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (filteredNames.length === 1) {
|
||||
$.uiTableFilter(table, filteredNames[0]);
|
||||
return;
|
||||
}
|
||||
|
||||
table.find('tbody tr').each(function() {
|
||||
var rowText = $(this).text().toLowerCase();
|
||||
var isMatch = false;
|
||||
|
||||
for (var i = 0; i < filteredNames.length; i++) {
|
||||
if (rowText.indexOf(filteredNames[i]) !== -1) {
|
||||
isMatch = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$(this).toggle(isMatch);
|
||||
});
|
||||
}
|
||||
|
||||
$('document').ready( function() {
|
||||
@@ -71,7 +115,7 @@
|
||||
$.uiTableFilter($('#moduleContainer').find('table'), anchor);
|
||||
|
||||
if (module_name != '')
|
||||
$.uiTableFilter($('#moduleContainer').find('table'), module_name);
|
||||
filter_modules_by_name($('#moduleContainer').find('table'), module_name);
|
||||
|
||||
$('#moduleQuicksearch').on('keyup', function(){
|
||||
val = this.value;
|
||||
|
||||
@@ -190,6 +190,19 @@
|
||||
<span class="caret"></span>
|
||||
</button>
|
||||
<ul class="dropdown-menu">
|
||||
<li>
|
||||
<a href="#" onclick="modules_management('enable')">
|
||||
<i class="icon-power-off text-success"></i>
|
||||
{l s='Enable selection'}
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#" onclick="modules_management('disable')">
|
||||
<i class="icon-power-off text-danger"></i>
|
||||
{l s='Disable selection'}
|
||||
</a>
|
||||
</li>
|
||||
<li class="divider"></li>
|
||||
<li>
|
||||
<a href="#" onclick="modules_management('install')">
|
||||
<i class="icon-plus-sign-alt"></i>
|
||||
|
||||
@@ -36,7 +36,6 @@
|
||||
class="form-control {if isset($input_class)}{$input_class} {/if}"
|
||||
name="{$input_name}_{$language.id_lang}"
|
||||
value="{$input_value[$language.id_lang]|default:''|escape:'html'}"
|
||||
onkeyup="if (isArrowKey(event)) return ;updateFriendlyURL();"
|
||||
onblur="updateLinkRewrite();"
|
||||
{if isset($required)} required="required"{/if}
|
||||
{if isset($maxchar)} data-maxchar="{$maxchar}"{/if}
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
<div class="col-lg-1"><span class="pull-right">{include file="controllers/products/multishop/checkbox.tpl" field="meta_title" type="default" multilang="true"}</span></div>
|
||||
<label class="control-label col-lg-2" for="meta_title_{$id_lang}">
|
||||
<span class="label-tooltip" data-toggle="tooltip"
|
||||
title="{l s='Public title for the product\'s page, and for search engines. Leave blank to use the room type name.'} {l s='The number of remaining characters is displayed to the left of the field.'}">
|
||||
title="{l s='Title shown in search results. Leave blank to use the room type name.'}">
|
||||
{l s='Meta title'}
|
||||
</span>
|
||||
</label>
|
||||
@@ -36,7 +36,7 @@
|
||||
languages=$languages
|
||||
input_name='meta_title'
|
||||
input_value=$product->meta_title
|
||||
maxchar=70
|
||||
maxchar=128
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
@@ -44,7 +44,7 @@
|
||||
<div class="col-lg-1"><span class="pull-right">{include file="controllers/products/multishop/checkbox.tpl" field="meta_description" type="default" multilang="true"}</span></div>
|
||||
<label class="control-label col-lg-2" for="meta_description_{$id_lang}">
|
||||
<span class="label-tooltip" data-toggle="tooltip"
|
||||
title="{l s='This description will appear in search engines. You need a single sentence, shorter than 160 characters (including spaces).'}">
|
||||
title="{l s='This description will appear in search engines. You need a single sentence, shorter than 255 characters (including spaces). Leave blank to use the room type short description.'}">
|
||||
{l s='Meta description'}
|
||||
</span>
|
||||
</label>
|
||||
@@ -53,7 +53,7 @@
|
||||
languages=$languages
|
||||
input_name='meta_description'
|
||||
input_value=$product->meta_description
|
||||
maxchar=160
|
||||
maxchar=255
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
@@ -91,16 +91,11 @@
|
||||
<button type="button" class="btn btn-default" id="generate-friendly-url" onmousedown="updateFriendlyURLByName();"><i class="icon-random"></i> {l s='Generate'}</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-lg-9 col-lg-offset-3">
|
||||
{foreach from=$languages item=language}
|
||||
<div class="alert alert-warning translatable-field lang-{$language.id_lang}">
|
||||
<i class="icon-link"></i> {l s='The product link will look like this:'}<br/>
|
||||
<strong>{if isset($rewritten_links[$language.id_lang][0])}{$rewritten_links[$language.id_lang][0]|escape:'html':'UTF-8'}{/if}<span id="friendly-url_{$language.id_lang}">{if isset($product->id)}{$product->link_rewrite[$language.id_lang]|escape:'html':'UTF-8'}{/if}</span>{if isset($rewritten_links[$language.id_lang][1])}{$rewritten_links[$language.id_lang][1]|escape:'html':'UTF-8'}{/if}</strong>
|
||||
</div>
|
||||
{/foreach}
|
||||
</div>
|
||||
</div>
|
||||
{include file="seo_preview.tpl"
|
||||
languages = $languages
|
||||
preview_link = $rewritten_links|default:''
|
||||
inputs = ['meta_title'=>$product->meta_title ,'meta_description' => $product->meta_description,'link_rewrite' => $product->link_rewrite, 'name' => $product->name, 'description_short' => $product->description_short]
|
||||
}
|
||||
<div class="panel-footer">
|
||||
<a href="{$link->getAdminLink('AdminNormalProducts')|escape:'html':'UTF-8'}{if isset($smarty.request.page) && $smarty.request.page > 1}&submitFilterproduct={$smarty.request.page|intval}{/if}" class="btn btn-default"><i class="process-icon-cancel"></i> {l s='Cancel'}</a>
|
||||
<button type="submit" name="submitAddproduct" class="btn btn-default pull-right" disabled="disabled"><i class="process-icon-loading"></i> {l s='Save'}</button>
|
||||
@@ -110,4 +105,12 @@
|
||||
<script type="text/javascript">
|
||||
if (tabs_manager.allow_hide_other_languages)
|
||||
hideOtherLanguage({$default_form_language});
|
||||
// Recalculate autosize heights when language is switched (hidden textareas gain correct width)
|
||||
(function() {
|
||||
var _orig = window.hideOtherLanguage;
|
||||
window.hideOtherLanguage = function(id) {
|
||||
_orig && _orig.call(this, id);
|
||||
$(window).trigger('resize.autosize');
|
||||
};
|
||||
})();
|
||||
</script>
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
<span class="text-count-down">{$maxchar|intval}</span>
|
||||
</span>
|
||||
{/if}
|
||||
<textarea id="{$input_name}_{$language.id_lang}" name="{$input_name}_{$language.id_lang}" class="{if isset($class)}{$class}{else}textarea-autosize{/if}"{if isset($maxlength) && $maxlength} maxlength="{$maxlength|intval}"{/if}{if isset($maxchar) && $maxchar} data-maxchar="{$maxchar|intval}"{/if}>{if isset($input_value[$language.id_lang])}{$input_value[$language.id_lang]|htmlentitiesUTF8}{/if}</textarea>
|
||||
<textarea id="{$input_name}_{$language.id_lang}" name="{$input_name}_{$language.id_lang}" class="{if isset($class)}{$class}{else}textarea-autosize{/if}" rows="1"{if isset($maxlength) && $maxlength} maxlength="{$maxlength|intval}"{/if}{if isset($maxchar) && $maxchar} data-maxchar="{$maxchar|intval}"{/if}>{if isset($input_value[$language.id_lang])}{$input_value[$language.id_lang]|htmlentitiesUTF8}{/if}</textarea>
|
||||
<span class="counter" data-max="{if isset($max)}{$max|intval}{/if}{if isset($maxlength)}{$maxlength|intval}{/if}{if !isset($max) && !isset($maxlength)}none{/if}"></span>
|
||||
{if isset($maxchar) && $maxchar}
|
||||
</div>
|
||||
@@ -61,6 +61,10 @@
|
||||
{/foreach}
|
||||
});
|
||||
{/if}
|
||||
$(".textarea-autosize").autosize();
|
||||
$(".textarea-autosize").each(function() {
|
||||
var $ta = $(this), val = $ta.val();
|
||||
$ta.val('').autosize();
|
||||
if (val) { $ta.val(val).trigger('input'); }
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
@@ -2450,7 +2450,6 @@
|
||||
</form>
|
||||
{strip}
|
||||
{addJsDef max_child_age=$max_child_age}
|
||||
{addJsDef max_child_in_room=$max_child_in_room}
|
||||
{addJsDefL name='select_age_txt'}{l s='Select age' js=1}{/addJsDefL}
|
||||
{addJsDefL name='under_1_age'}{l s='Under 1' js=1}{/addJsDefL}
|
||||
{addJsDefL name='room_txt'}{l s='Room' js=1}{/addJsDefL}
|
||||
|
||||
@@ -269,9 +269,14 @@
|
||||
<input type="hidden" name="id_order" value="{$order->id}" />
|
||||
</div>
|
||||
<div class="col-lg-3">
|
||||
<button type="submit" name="submitState" class="btn btn-primary">
|
||||
{l s='Update status'}
|
||||
</button>
|
||||
<div class="btn-group">
|
||||
<button type="submit" name="submitState" class="btn btn-primary">
|
||||
{l s='Update status'}
|
||||
</button>
|
||||
<button type="button" id="order_status_disable_info" class="btn btn-default" data-toggle="modal" data-target="#order_status_disable_reason" title="{l s='Click here to see why certain statuses can’t be selected'}" aria-label="{l s='Why are some staClick here to see why certain statuses can’t be selected'}">
|
||||
<i class="icon-info-circle"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
@@ -1302,7 +1307,30 @@
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{* Css for handling order disable status modal *}
|
||||
<style type="text/css">
|
||||
#order-status-disable-reason-body p { margin: 0 0 15px; }
|
||||
#order-status-disable-reason-body p:last-child { margin-bottom: 0; }
|
||||
</style>
|
||||
<div class="modal fade" id="order_status_disable_reason" tabindex="-1" role="dialog" aria-labelledby="order_status_disable_reason_label">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="{l s='Close'}"><span aria-hidden="true">×</span></button>
|
||||
<h4 class="modal-title" id="order_status_disable_reason_label"><i class="icon icon-ban"></i> {l s='Order Status Disable Criteria'}</h4>
|
||||
</div>
|
||||
<div class="modal-body" id="order-status-disable-reason-body">
|
||||
<p><strong>{l s='Refunded:'}</strong> {l s='Disabled when total paid amount is 0 and no discount is applied.'}</p>
|
||||
<p><strong>{l s='Cancelled:'}</strong> {l s='Disabled when the paid amount is greater than 0 or when discounts are applied.'}</p>
|
||||
<p><strong>{l s='Overbooking:'}</strong> {l s='Disabled when the order has no overbooked rooms.'}</p>
|
||||
<p><strong>{l s='Current:'}</strong> {l s='The current order status cannot be selected again.'}</p>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">{l s='Close'}</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{strip}
|
||||
{addJsDefL name=no_rm_avail_txt}{l s='No room available.' js=1}{/addJsDefL}
|
||||
{addJsDefL name=no_realloc_rm_avail_txt}{l s='No room available for reallocation.' js=1}{/addJsDefL}
|
||||
@@ -1335,7 +1363,6 @@
|
||||
{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'}
|
||||
{addJsDef max_child_in_room=$max_child_in_room|escape:'quotes':'UTF-8'}
|
||||
{addJsDef ROOM_STATUS_CHECKED_IN=$ROOM_STATUS_CHECKED_IN|escape:'quotes':'UTF-8'}
|
||||
{addJsDef ROOM_STATUS_CHECKED_OUT=$ROOM_STATUS_CHECKED_OUT|escape:'quotes':'UTF-8'}
|
||||
{addJsDef ALLOTMENT_MANUAL=$ALLOTMENT_MANUAL|escape:'quotes':'UTF-8'}
|
||||
|
||||
@@ -218,6 +218,7 @@
|
||||
|
||||
$('.product-tab-content').on('displayed', function(e) {
|
||||
$('#toolbar-footer').appendTo($(this).children('.product-tab'));
|
||||
$(window).trigger('resize.autosize');
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
@@ -39,7 +39,6 @@
|
||||
class="form-control {if isset($input_class)}{$input_class} {/if}"
|
||||
name="{$input_name}_{$language.id_lang}"
|
||||
value="{$input_value[$language.id_lang]|default:''|escape:'html'}"
|
||||
onkeyup="if (isArrowKey(event)) return ;updateFriendlyURL();"
|
||||
onblur="updateLinkRewrite();"
|
||||
{if isset($required)} required="required"{/if}
|
||||
{if isset($maxchar)} data-maxchar="{$maxchar}"{/if}
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
<div class="col-lg-1"><span class="pull-right">{include file="controllers/products/multishop/checkbox.tpl" field="meta_title" type="default" multilang="true"}</span></div>
|
||||
<label class="control-label col-lg-2" for="meta_title_{$id_lang}">
|
||||
<span class="label-tooltip" data-toggle="tooltip"
|
||||
title="{l s='Public title for the product\'s page, and for search engines. Leave blank to use the room type name.'} {l s='The number of remaining characters is displayed to the left of the field.'}">
|
||||
title="{l s='Title shown in search results. Leave blank to use the room type name.'}">
|
||||
{l s='Meta title'}
|
||||
</span>
|
||||
</label>
|
||||
@@ -39,7 +39,7 @@
|
||||
languages=$languages
|
||||
input_name='meta_title'
|
||||
input_value=$product->meta_title
|
||||
maxchar=70
|
||||
maxchar=128
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
@@ -47,7 +47,7 @@
|
||||
<div class="col-lg-1"><span class="pull-right">{include file="controllers/products/multishop/checkbox.tpl" field="meta_description" type="default" multilang="true"}</span></div>
|
||||
<label class="control-label col-lg-2" for="meta_description_{$id_lang}">
|
||||
<span class="label-tooltip" data-toggle="tooltip"
|
||||
title="{l s='This description will appear in search engines. You need a single sentence, shorter than 160 characters (including spaces).'}">
|
||||
title="{l s='This description will appear in search engines. You need a single sentence, shorter than 255 characters (including spaces). Leave blank to use the room type short description.'}">
|
||||
{l s='Meta description'}
|
||||
</span>
|
||||
</label>
|
||||
@@ -56,7 +56,7 @@
|
||||
languages=$languages
|
||||
input_name='meta_description'
|
||||
input_value=$product->meta_description
|
||||
maxchar=160
|
||||
maxchar=255
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
@@ -94,16 +94,11 @@
|
||||
<button type="button" class="btn btn-default" id="generate-friendly-url" onmousedown="updateFriendlyURLByName();"><i class="icon-random"></i> {l s='Generate'}</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-lg-9 col-lg-offset-3">
|
||||
{foreach from=$languages item=language}
|
||||
<div class="alert alert-warning translatable-field lang-{$language.id_lang}">
|
||||
<i class="icon-link"></i> {l s='The product link will look like this:'}<br/>
|
||||
<strong>{if isset($rewritten_links[$language.id_lang][0])}{$rewritten_links[$language.id_lang][0]|escape:'html':'UTF-8'}{/if}<span id="friendly-url_{$language.id_lang}">{if isset($product->id)}{$product->link_rewrite[$language.id_lang]|escape:'html':'UTF-8'}{/if}</span>{if isset($rewritten_links[$language.id_lang][1])}{$rewritten_links[$language.id_lang][1]|escape:'html':'UTF-8'}{/if}</strong>
|
||||
</div>
|
||||
{/foreach}
|
||||
</div>
|
||||
</div>
|
||||
{include file="seo_preview.tpl"
|
||||
languages = $languages
|
||||
preview_link = $rewritten_links|default:''
|
||||
inputs = ['meta_title'=>$product->meta_title ,'meta_description' => $product->meta_description,'link_rewrite' => $product->link_rewrite, 'name' => $product->name, 'description_short' => $product->description_short]
|
||||
}
|
||||
<div class="panel-footer">
|
||||
<a href="{$link->getAdminLink('AdminProducts')|escape:'html':'UTF-8'}{if isset($smarty.request.page) && $smarty.request.page > 1}&submitFilterproduct={$smarty.request.page|intval}{/if}" class="btn btn-default"><i class="process-icon-cancel"></i> {l s='Cancel'}</a>
|
||||
<button type="submit" name="submitAddproduct" class="btn btn-default pull-right" disabled="disabled"><i class="process-icon-loading"></i> {l s='Save'}</button>
|
||||
@@ -113,4 +108,12 @@
|
||||
<script type="text/javascript">
|
||||
if (tabs_manager.allow_hide_other_languages)
|
||||
hideOtherLanguage({$default_form_language});
|
||||
// Recalculate autosize heights when language is switched (hidden textareas gain correct width)
|
||||
(function() {
|
||||
var _orig = window.hideOtherLanguage;
|
||||
window.hideOtherLanguage = function(id) {
|
||||
_orig && _orig.call(this, id);
|
||||
$(window).trigger('resize.autosize');
|
||||
};
|
||||
})();
|
||||
</script>
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
<span class="text-count-down">{$maxchar|intval}</span>
|
||||
</span>
|
||||
{/if}
|
||||
<textarea id="{$input_name}_{$language.id_lang}" name="{$input_name}_{$language.id_lang}" class="{if isset($class)}{$class}{else}textarea-autosize{/if}"{if isset($maxlength) && $maxlength} maxlength="{$maxlength|intval}"{/if}{if isset($maxchar) && $maxchar} data-maxchar="{$maxchar|intval}"{/if}>{if isset($input_value[$language.id_lang])}{$input_value[$language.id_lang]|htmlentitiesUTF8}{/if}</textarea>
|
||||
<textarea id="{$input_name}_{$language.id_lang}" name="{$input_name}_{$language.id_lang}" class="{if isset($class)}{$class}{else}textarea-autosize{/if}" rows="1"{if isset($maxlength) && $maxlength} maxlength="{$maxlength|intval}"{/if}{if isset($maxchar) && $maxchar} data-maxchar="{$maxchar|intval}"{/if}>{if isset($input_value[$language.id_lang])}{$input_value[$language.id_lang]|htmlentitiesUTF8}{/if}</textarea>
|
||||
<span class="counter" data-max="{if isset($max)}{$max|intval}{/if}{if isset($maxlength)}{$maxlength|intval}{/if}{if !isset($max) && !isset($maxlength)}none{/if}"></span>
|
||||
{if isset($maxchar) && $maxchar}
|
||||
</div>
|
||||
@@ -64,6 +64,10 @@
|
||||
{/foreach}
|
||||
});
|
||||
{/if}
|
||||
$(".textarea-autosize").autosize();
|
||||
$(".textarea-autosize").each(function() {
|
||||
var $ta = $(this), val = $ta.val();
|
||||
$ta.val('').autosize();
|
||||
if (val) { $ta.val(val).trigger('input'); }
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
280
admin/themes/default/template/seo_preview.tpl
Normal file
280
admin/themes/default/template/seo_preview.tpl
Normal file
@@ -0,0 +1,280 @@
|
||||
{*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License version 3.0
|
||||
* that is bundled with this package in the file LICENSE.md
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* https://opensource.org/license/osl-3-0-php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to support@qloapps.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade this module to a newer
|
||||
* versions in the future. If you wish to customize this module for your needs
|
||||
* please refer to https://store.webkul.com/customisation-guidelines for more information.
|
||||
*
|
||||
* @author Webkul IN
|
||||
* @copyright Since 2010 Webkul
|
||||
* @license https://opensource.org/license/osl-3-0-php Open Software License version 3.0
|
||||
*}
|
||||
{if $languages}
|
||||
<div class="form-group seo-preview-group">
|
||||
<div class="col-lg-1"></div>
|
||||
<label class="control-label col-lg-2 seo-label">
|
||||
{if !isset($show_label_tooltip) || $show_label_tooltip}
|
||||
<span class="label-tooltip" data-toggle="tooltip"
|
||||
title="{l s='Preview how this page may appear in search results.'}">
|
||||
{l s='SEO Preview'}
|
||||
</span>
|
||||
{else}
|
||||
{l s='SEO Preview'}
|
||||
{if isset($show_flag) && $show_flag && count($languages) > 1}
|
||||
<img class="all_lang_icon" data-lang-id="{$currentLang.id_lang}" src="{$ps_img_dir}{$currentLang.id_lang}.jpg">
|
||||
{/if}
|
||||
{/if}
|
||||
</label>
|
||||
<div class="col-lg-8">
|
||||
{foreach from=$languages item=language}
|
||||
{assign var=id_lang value=$language.id_lang}
|
||||
<div class="panel seo-preview-panel lang-{$id_lang} translatable-field lang-{$id_lang} wk_text_field_all wk_text_field_{$id_lang}"
|
||||
data-lang-id="{$id_lang}" {if isset($currentLang) && $currentLang.id_lang != $id_lang}style="display:none;"
|
||||
{/if}>
|
||||
{assign var=seoPreviewTitleDefault value=''}
|
||||
{assign var=seoPreviewDescriptionDefault value=''}
|
||||
{if isset($inputs.name[$id_lang]) && $inputs.name[$id_lang]|trim}
|
||||
{assign var=seoPreviewTitleDefault value=$inputs.name[$id_lang]}
|
||||
{elseif isset($product) && isset($product->name[$id_lang]) && $product->name[$id_lang]|trim}
|
||||
{assign var=seoPreviewTitleDefault value=$product->name[$id_lang]}
|
||||
{elseif isset($inputs.link_rewrite[$id_lang]) && $inputs.link_rewrite[$id_lang]|trim}
|
||||
{assign var=seoPreviewTitleDefault value=$inputs.link_rewrite[$id_lang]}
|
||||
{/if}
|
||||
|
||||
{if isset($inputs.description_short[$id_lang]) && $inputs.description_short[$id_lang]|trim}
|
||||
{assign var=seoPreviewDescriptionDefault value=$inputs.description_short[$id_lang]|strip_tags}
|
||||
{elseif isset($product) && isset($product->description_short[$id_lang]) && $product->description_short[$id_lang]|trim}
|
||||
{assign var=seoPreviewDescriptionDefault value=$product->description_short[$id_lang]|strip_tags}
|
||||
{/if}
|
||||
<span id="seo-preview-title-default_{$id_lang}"
|
||||
class="seo-preview-default">{$seoPreviewTitleDefault|escape:'html':'UTF-8'}</span>
|
||||
<span id="seo-preview-description-default_{$id_lang}"
|
||||
class="seo-preview-default">{$seoPreviewDescriptionDefault|escape:'html':'UTF-8'}</span>
|
||||
<div class="seo-preview-url">
|
||||
{if isset($preview_link[$id_lang])}
|
||||
{assign var=rewriteActive value=(is_array($preview_link[$id_lang]) && isset($preview_link[$id_lang][1]))}
|
||||
<a id="seo-preview-url-link_{$id_lang}" class="seo-preview-url-text seo-preview-url-link"
|
||||
data-has-rewrite="{if $rewriteActive}1{else}0{/if}"
|
||||
{if $rewriteActive}
|
||||
href="{$preview_link[$id_lang][0]|escape:'html':'UTF-8'}{$inputs.link_rewrite[$id_lang]|default:''|escape:'html':'UTF-8'}{$preview_link[$id_lang][1]|escape:'html':'UTF-8'}"
|
||||
{elseif is_array($preview_link[$id_lang])}
|
||||
href="{$preview_link[$id_lang][0]|escape:'html':'UTF-8'}"
|
||||
{else}
|
||||
href="{$preview_link[$id_lang]|escape:'html':'UTF-8'}{$inputs.link_rewrite[$id_lang]|default:''|escape:'html':'UTF-8'}"
|
||||
{/if} target="_blank" rel="noopener" title="{l s='Open preview link'}">
|
||||
{else}
|
||||
<div class="seo-preview-url-text">
|
||||
{/if}
|
||||
{strip}
|
||||
{if isset($preview_link[$id_lang]) && $rewriteActive}
|
||||
<span class="preview-base" style="display:none">{$preview_link[$id_lang][0]|escape:'html':'UTF-8'}</span>
|
||||
<span id="friendly-url_{$id_lang}" style="display:none">{$inputs.link_rewrite[$id_lang]|default:''|escape:'html':'UTF-8'}</span>
|
||||
<span class="preview-extension" style="display:none">{$preview_link[$id_lang][1]|escape:'html':'UTF-8'}</span>
|
||||
{elseif isset($preview_link[$id_lang]) && is_array($preview_link[$id_lang])}
|
||||
<span class="preview-base" style="display:none">{$preview_link[$id_lang][0]|escape:'html':'UTF-8'}</span>
|
||||
{elseif isset($preview_link[$id_lang])}
|
||||
<span class="preview-base" style="display:none">{$preview_link[$id_lang]|escape:'html':'UTF-8'}</span>
|
||||
<span id="friendly-url_{$id_lang}" style="display:none">{$inputs.link_rewrite[$id_lang]|default:''|escape:'html':'UTF-8'}</span>
|
||||
{/if}
|
||||
{if isset($preview_link[$id_lang])}<span class="seo-url-breadcrumb"></span>{/if}
|
||||
{/strip}
|
||||
{if isset($preview_link[$id_lang])}
|
||||
</a>
|
||||
{else}
|
||||
</div>
|
||||
{/if}
|
||||
<span class="seo-preview-more" aria-hidden="true">⋮</span>
|
||||
</div>
|
||||
{if isset($inputs.meta_title[$id_lang])}
|
||||
<div id="meta-title_{$id_lang}" class="seo-meta-title primary">
|
||||
{assign var=seoPreviewTitle value=$inputs.meta_title[$id_lang]|default:''}
|
||||
{if $seoPreviewTitle|trim}
|
||||
{$seoPreviewTitle|escape:'html':'UTF-8'}
|
||||
{else}
|
||||
{$seoPreviewTitleDefault|escape:'html':'UTF-8'}
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
{if isset($inputs.meta_description[$id_lang])}
|
||||
<div id="meta-description_{$id_lang}" class="seo-meta-description">
|
||||
{assign var=seoPreviewDescription value=$inputs.meta_description[$id_lang]|default:''}
|
||||
{if $seoPreviewDescription|trim}
|
||||
{$seoPreviewDescription|escape:'html':'UTF-8'}
|
||||
{else}
|
||||
{$seoPreviewDescriptionDefault|escape:'html':'UTF-8'}
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
{/foreach}
|
||||
<div class="help-block seo-preview-note">
|
||||
{l s='Leaving Meta title or Meta description blank will use the default values in the preview (Name and Short Description).'}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{addJsDef languages=$languages}
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
if (typeof languages === 'undefined' || !languages || typeof languages.forEach !== 'function') {
|
||||
return;
|
||||
}
|
||||
|
||||
languages.forEach(function(language) {
|
||||
var idLang = language.id_lang;
|
||||
$('#meta_title_' + idLang + ', #meta_description_' + idLang + ', #link_rewrite_' + idLang)
|
||||
.on('keyup', function() {
|
||||
updateSeoPreview(idLang);
|
||||
});
|
||||
$('#name_' + idLang + ', #description_short_' + idLang + ', #short_description_' + idLang)
|
||||
.on('keyup change', function() {
|
||||
updateSeoPreview(idLang);
|
||||
});
|
||||
updateSeoPreview(idLang);
|
||||
});
|
||||
});
|
||||
|
||||
function stripTags(text) {
|
||||
return $('<div/>').html(text || '').text();
|
||||
}
|
||||
|
||||
function updateSeoPreviewDefaults(idLang) {
|
||||
var titleDefaultEl = $('#seo-preview-title-default_' + idLang);
|
||||
var descriptionDefaultEl = $('#seo-preview-description-default_' + idLang);
|
||||
|
||||
var nameValue = ($('#name_' + idLang).val() || '').trim();
|
||||
if (nameValue.length) {
|
||||
titleDefaultEl.text(nameValue);
|
||||
}
|
||||
|
||||
var descriptionValue = '';
|
||||
var descriptionShortField = $('#description_short_' + idLang);
|
||||
if (descriptionShortField.length) {
|
||||
descriptionValue = descriptionShortField.val() || '';
|
||||
} else {
|
||||
var hotelShortDescriptionField = $('#short_description_' + idLang);
|
||||
if (hotelShortDescriptionField.length) {
|
||||
descriptionValue = hotelShortDescriptionField.val() || '';
|
||||
}
|
||||
}
|
||||
descriptionValue = stripTags(descriptionValue).trim();
|
||||
if (descriptionValue.length) {
|
||||
descriptionDefaultEl.text(descriptionValue);
|
||||
}
|
||||
}
|
||||
|
||||
function truncatePreview(text, limit) {
|
||||
return text.length > limit ? text.substring(0, limit) + '...' : text;
|
||||
}
|
||||
|
||||
function updateSeoPreview(idLang) {
|
||||
var title = $('#meta_title_' + idLang).val();
|
||||
var description = $('#meta_description_' + idLang).val();
|
||||
var link = $('#link_rewrite_' + idLang).val();
|
||||
|
||||
updateSeoPreviewDefaults(idLang);
|
||||
|
||||
if (title !== undefined) {
|
||||
var titlePreview = $('#meta-title_' + idLang);
|
||||
var defaultTitle = $('#seo-preview-title-default_' + idLang).text() || '';
|
||||
var valueTitle = (title || '').trim();
|
||||
titlePreview.text(truncatePreview(valueTitle.length ? valueTitle : defaultTitle, 70));
|
||||
}
|
||||
if (description !== undefined) {
|
||||
var descriptionPreview = $('#meta-description_' + idLang);
|
||||
var defaultDescription = $('#seo-preview-description-default_' + idLang).text() || '';
|
||||
var valueDescription = (description || '').trim();
|
||||
descriptionPreview.text(truncatePreview(valueDescription.length ? valueDescription : defaultDescription, 160));
|
||||
}
|
||||
if (link !== undefined) {
|
||||
$('#friendly-url_' + idLang).text(link.trim());
|
||||
}
|
||||
updateSeoPreviewLink(idLang);
|
||||
}
|
||||
|
||||
function formatUrlBreadcrumb(url) {
|
||||
var withoutQuery = url.split('?')[0].split('#')[0].replace(/\/$/, '');
|
||||
var match = withoutQuery.match(/^(https?:\/\/[^\/]+)(\/.*)?$/);
|
||||
if (!match) return url;
|
||||
var parts = [match[1]];
|
||||
if (match[2]) {
|
||||
var segments = match[2].replace(/^\//, '').split('/').filter(function(s) { return s.length > 0; });
|
||||
parts = parts.concat(segments);
|
||||
}
|
||||
return parts.join(' › ');
|
||||
}
|
||||
|
||||
function updateSeoPreviewLink(idLang) {
|
||||
var urlLink = $('#seo-preview-url-link_' + idLang);
|
||||
if (!urlLink.length) {
|
||||
return;
|
||||
}
|
||||
|
||||
var container = $('.wk_text_field_' + idLang);
|
||||
var href;
|
||||
|
||||
if (urlLink.data('has-rewrite')) {
|
||||
var base = container.find('.preview-base').text() || '';
|
||||
var slug = container.find('#friendly-url_' + idLang).text() || '';
|
||||
var ext = container.find('.preview-extension').text() || '';
|
||||
href = (base + slug + ext).trim();
|
||||
} else {
|
||||
href = (urlLink.attr('href') || '').trim();
|
||||
}
|
||||
|
||||
if (href.length) {
|
||||
urlLink.attr('href', href);
|
||||
urlLink.find('.seo-url-breadcrumb').text(formatUrlBreadcrumb(href));
|
||||
}
|
||||
}
|
||||
</script>
|
||||
{/if}
|
||||
<style>
|
||||
.seo-preview-more {
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.seo-meta-title {
|
||||
color: #1a0dab;
|
||||
font-size: 18px;
|
||||
font-weight: normal;
|
||||
word-wrap: break-word;
|
||||
overflow-wrap: break-word;
|
||||
word-break: break-word;
|
||||
}
|
||||
|
||||
.seo-meta-description {
|
||||
font-size: 14px;
|
||||
word-wrap: break-word;
|
||||
overflow-wrap: break-word;
|
||||
word-break: break-word;
|
||||
}
|
||||
|
||||
.seo-preview-url-link {
|
||||
color: inherit !important;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.seo-url-breadcrumb {
|
||||
font-size: 12px;
|
||||
color: #4d5156;
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
.seo-preview-default {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.panel.seo-preview-panel {
|
||||
margin-bottom: 0 !important;
|
||||
}
|
||||
</style>
|
||||
@@ -1833,7 +1833,7 @@ class CartCore extends ObjectModel
|
||||
$this->id,
|
||||
[],
|
||||
0,
|
||||
null,
|
||||
isset($product['id_hotel_cart_booking']) ? $product['id_hotel_cart_booking'] : null,
|
||||
null,
|
||||
(int)$product['id_product'],
|
||||
null,
|
||||
|
||||
@@ -527,7 +527,10 @@ class AdminControllerCore extends Controller
|
||||
29 => $this->l('Successful upgrade'),
|
||||
30 => $this->l('A partial refund was successfully created.'),
|
||||
31 => $this->l('The discount was successfully generated.'),
|
||||
32 => $this->l('Successfully signed in to PrestaShop Addons')
|
||||
32 => $this->l('Successfully signed in to PrestaShop Addons'),
|
||||
33 => $this->l('The selected module(s) have been successfully enabled.'),
|
||||
34 => $this->l('The selected module(s) have been successfully disabled.'),
|
||||
|
||||
);
|
||||
|
||||
if (!$this->identifier) {
|
||||
@@ -1427,8 +1430,8 @@ class AdminControllerCore extends Controller
|
||||
} elseif ($this->postImage($object->id) && !count($this->errors) && $this->_redirect) {
|
||||
$parent_id = (int)Tools::getValue('id_parent', 1);
|
||||
// Specific back redirect
|
||||
if ($back = Tools::getValue('back')) {
|
||||
$this->redirect_after = urldecode($back).'&conf=4';
|
||||
if (($back = Tools::secureReferrer(Tools::getValue('back'))) && $back != __PS_BASE_URI__) {
|
||||
$this->redirect_after=urldecode($back).'&conf=4';
|
||||
}
|
||||
// Specific scene feature
|
||||
// @todo change stay_here submit name (not clear for redirect to scene ... )
|
||||
|
||||
@@ -498,7 +498,6 @@ class FrontControllerCore extends Controller
|
||||
'is_occupancy_wise_search' => $isOccupancyWiseSearch,
|
||||
'occupancy_required_for_booking' => $occupancyRequiredForBooking,
|
||||
'max_child_age' => Configuration::get('WK_GLOBAL_CHILD_MAX_AGE'),
|
||||
'max_child_in_room' => Configuration::get('WK_GLOBAL_MAX_CHILD_IN_ROOM'),
|
||||
'show_full_date' => $this->show_full_date
|
||||
));
|
||||
|
||||
|
||||
@@ -457,17 +457,16 @@ class OrderDetailCore extends ObjectModel
|
||||
$numDays = 1;
|
||||
}
|
||||
|
||||
$unit_price_tax_excl = array_reduce($serviceProductData['additional_services'], function ($unitPriceTaxExcl, $item) {
|
||||
return $unitPriceTaxExcl + (isset($item['unit_price_tax_excl']) ? $item['unit_price_tax_excl'] : 0);
|
||||
}, 0);
|
||||
|
||||
$quantity = array_reduce($serviceProductData['additional_services'], function ($totalQty, $item) {
|
||||
return $totalQty + (isset($item['quantity']) ? $item['quantity'] : 0);
|
||||
}, 0);
|
||||
|
||||
$firstServiceProduct = array_shift($serviceProductData['additional_services']);
|
||||
|
||||
$unit_price_tax_excl = isset($firstServiceProduct['unit_price_tax_excl']) ? $firstServiceProduct['unit_price_tax_excl'] : 0;
|
||||
|
||||
$quantity = $quantity * $numDays;
|
||||
|
||||
$firstServiceProduct = array_shift($serviceProductData['additional_services']);
|
||||
$tax_manager = TaxManagerFactory::getManager($this->vat_address, (int)$firstServiceProduct['id_tax_rules_group']);
|
||||
$this->tax_calculator = $tax_manager->getTaxCalculator();
|
||||
} elseif ($serviceProductData = $objServiceProductCartDetail->getServiceProductsInCart(
|
||||
@@ -478,15 +477,13 @@ class OrderDetailCore extends ObjectModel
|
||||
$taxGroupInfo['id_room_type'],
|
||||
$this->product_id
|
||||
)) {
|
||||
$unit_price_tax_excl = array_reduce($serviceProductData, function ($unitPriceTaxExcl, $item) {
|
||||
return $unitPriceTaxExcl + (isset($item['unit_price_tax_excl']) ? $item['unit_price_tax_excl'] : 0);
|
||||
}, 0);
|
||||
|
||||
$quantity = array_reduce($serviceProductData, function ($totalQty, $item) {
|
||||
return $totalQty + (isset($item['quantity']) ? $item['quantity'] : 0);
|
||||
}, 0);
|
||||
|
||||
$serviceProductData = array_shift($serviceProductData);
|
||||
$unit_price_tax_excl = isset($serviceProductData['unit_price_tax_excl']) ? $serviceProductData['unit_price_tax_excl'] : 0;
|
||||
|
||||
$numDays = 1;
|
||||
if ((Product::PRICE_CALCULATION_METHOD_PER_DAY == $this->product_price_calculation_method)
|
||||
|
||||
@@ -542,7 +542,7 @@ class OrderReturnCore extends ObjectModel
|
||||
* Sets the new order return state
|
||||
* @param int $newOrderReturnState
|
||||
*/
|
||||
public function changeIdOrderReturnState($newOrderReturnState, $idLang = 0)
|
||||
public function changeIdOrderReturnState($newOrderReturnState, $idLang = 0, $sendMails = true)
|
||||
{
|
||||
$objOrder = new Order($this->id_order);
|
||||
if (!$idLang) {
|
||||
@@ -555,11 +555,12 @@ class OrderReturnCore extends ObjectModel
|
||||
$this->state = $newOrderReturnState;
|
||||
$this->save();
|
||||
|
||||
if ($objOrderReturnState->send_email_to_customer
|
||||
if ($sendMails && (
|
||||
$objOrderReturnState->send_email_to_customer
|
||||
|| $objOrderReturnState->send_email_to_superadmin
|
||||
|| $objOrderReturnState->send_email_to_employee
|
||||
|| $objOrderReturnState->send_email_to_hotelier
|
||||
) {
|
||||
)) {
|
||||
// Lets create data for the email templates
|
||||
$objMail = new Mail();
|
||||
$idHotel = 0;
|
||||
|
||||
@@ -53,6 +53,10 @@ class WebserviceSpecificManagementBookingsCore Extends ObjectModel implements We
|
||||
public const API_SERVICE_PRICE_MODE_PER_BOOKING = 1;
|
||||
public const API_SERVICE_PRICE_MODE_PER_DAY = 2;
|
||||
|
||||
public const API_BOOKING_ROOM_STATUS_ALLOTTED = 1;
|
||||
public const API_BOOKING_ROOM_STATUS_CHECKIN = 2;
|
||||
public const API_BOOKING_ROOM_STATUS_CHECKOUT = 3;
|
||||
|
||||
public static $definition = array(
|
||||
'table' => 'htl_booking_detail',
|
||||
'primary' => 'id',
|
||||
@@ -158,6 +162,27 @@ class WebserviceSpecificManagementBookingsCore Extends ObjectModel implements We
|
||||
)
|
||||
);
|
||||
|
||||
public $allowedFilters = array(
|
||||
'id_property' => 'hbd.id_hotel',
|
||||
'customer' => 'customer',
|
||||
'id_customer' => 'o.id_customer',
|
||||
'id_order' => 'o.id_order',
|
||||
'reference' => 'o.reference',
|
||||
'id_room' => 'hbd.id_room',
|
||||
'is_cancelled' => 'hbd.is_cancelled',
|
||||
'stay' => 'stay',
|
||||
'room_status' => 'hbd.id_status',
|
||||
'booking_status' => 'o.current_state',
|
||||
'source' => 'o.source',
|
||||
'booking_date' => 'o.date_add',
|
||||
'checkin_date' => 'hbd.date_from',
|
||||
'checkout_date' => 'hbd.date_to',
|
||||
'id_room_type' => 'hbd.id_product',
|
||||
'payment_type' => 'op.payment_type',
|
||||
'payment_method' => 'op.payment_method',
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
* @param WebserviceOutputBuilderCore $obj
|
||||
* @return WebserviceSpecificManagementInterface
|
||||
@@ -251,7 +276,8 @@ class WebserviceSpecificManagementBookingsCore Extends ObjectModel implements We
|
||||
'facilities' => 'facility',
|
||||
'services' => 'service',
|
||||
'cart_rules' => 'cart_rule',
|
||||
'remarks' => 'remark'
|
||||
'remarks' => 'remark',
|
||||
'bookings' => 'booking'
|
||||
);
|
||||
$this->output = $this->renderXmlOutputUsingArray($this->output, array(), $parentKeys);
|
||||
}
|
||||
@@ -301,19 +327,7 @@ class WebserviceSpecificManagementBookingsCore Extends ObjectModel implements We
|
||||
|
||||
$this->renderResponse();
|
||||
} else {
|
||||
// @todo: add filters for the booking webservice
|
||||
// $filters = $this->manageFilters();
|
||||
$this->output .= $this->objOutput->getObjectRender()->renderNodeHeader('bookings', array());
|
||||
$bookings = Db::getInstance()->executeS('SELECT `id_order` FROM `'._DB_PREFIX_.'orders` WHERE 1');
|
||||
foreach ($bookings as $booking) {
|
||||
$more_attr = array(
|
||||
'xlink_resource' => $this->wsObject->wsUrl.$this->wsObject->urlSegment[0].'/'.$booking['id_order'],
|
||||
'id' => (int) $booking['id_order']
|
||||
);
|
||||
$this->output .= $this->objOutput->getObjectRender()->renderNodeHeader('booking', array('objectsNodeName' => 'bookings'), $more_attr, false);
|
||||
}
|
||||
$this->output .= $this->objOutput->getObjectRender()->renderNodeFooter('bookings', array());
|
||||
$this->output = $this->objOutput->getObjectRender()->overrideContent($this->output);
|
||||
$this->getBookingsList();
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -3539,6 +3553,511 @@ class WebserviceSpecificManagementBookingsCore Extends ObjectModel implements We
|
||||
|
||||
}
|
||||
|
||||
|
||||
private function manageBookingFilter($filters)
|
||||
{
|
||||
$ret = '';
|
||||
$allowedFilters = $this->allowedFilters;
|
||||
foreach ($filters as $field => $raw) {
|
||||
if (!$this->validateBookingFilterValue($field, $raw)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
preg_match('/^(.*)\[(.*)\](.*)$/', $raw, $matches);
|
||||
if (!array_key_exists($field, $allowedFilters)) {
|
||||
$this->wsObject->setErrorDidYouMean(400, 'This filter does not exist', $field, array_keys($allowedFilters), 32);
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($field === 'customer') {
|
||||
$escapedValue = pSQL($raw);
|
||||
$ret .= ' AND (c.`firstname` LIKE "%' . $escapedValue . '%"
|
||||
OR c.`email` LIKE "%' . $escapedValue . '%")' . "\n";
|
||||
continue;
|
||||
}
|
||||
|
||||
$column = $allowedFilters[$field];
|
||||
if (count($matches) > 1) {
|
||||
$prefix = $matches[1];
|
||||
$value = $matches[2];
|
||||
$suffix = $matches[3];
|
||||
|
||||
if ($prefix == '%' || $suffix == '%') {
|
||||
$ret .= ' AND '.$column.' LIKE "'.pSQL($prefix.$value.$suffix)."\"\n";
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($prefix == '' && $suffix == '') {
|
||||
if (strpos($value, '|') > 0) {
|
||||
$values = explode('|', $value);
|
||||
$sanitizedValues = array_map(function ($item) {
|
||||
return '"' . pSQL($item) . '"';
|
||||
}, $values);
|
||||
$ret .= ' AND '.$column.' IN (' . implode(',', $sanitizedValues) . ')';
|
||||
continue;
|
||||
}
|
||||
|
||||
if (preg_match('/^([\d\.:\-\s]+),([\d\.:\-\s]+)$/', $value, $rangeMatches)) {
|
||||
unset($rangeMatches[0]);
|
||||
if (count($rangeMatches) > 0) {
|
||||
sort($rangeMatches);
|
||||
$ret .= ' AND '.$column.' BETWEEN "'.pSQL($rangeMatches[0]).'" AND "'.pSQL($rangeMatches[1])."\"\n";
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
$ret .= ' AND '.$column.'="'.pSQL($value).'"'."\n";
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($prefix == '>') {
|
||||
$ret .= ' AND '.$column.' > "'.pSQL($value)."\"\n";
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($prefix == '<') {
|
||||
$ret .= ' AND '.$column.' < "'.pSQL($value)."\"\n";
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($prefix == '!') {
|
||||
$multipleValues = explode('|', $value);
|
||||
foreach ($multipleValues as $multipleValue) {
|
||||
$ret .= ' AND '.$column.' != "'.pSQL($multipleValue)."\"\n";
|
||||
}
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
$comparison = Validate::isFloat(pSQL($raw)) ? 'LIKE' : '=';
|
||||
$ret .= ' AND '.$column.' '.$comparison.' "'.pSQL($raw)."\"\n";
|
||||
}
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
private function validateBookingFilterValue($field, $raw)
|
||||
{
|
||||
preg_match('/^(.*)\[(.*)\](.*)$/', $raw, $matches);
|
||||
$operator = '';
|
||||
$value = $raw;
|
||||
if (count($matches) > 1) {
|
||||
$operator = $matches[1];
|
||||
$value = $matches[2];
|
||||
}
|
||||
|
||||
$numericFields = array('id_property', 'id_customer', 'id_order', 'stay', 'room_status', 'booking_status', 'id_room_type', 'id_room', 'is_cancelled');
|
||||
$dateFields = array('booking_date', 'checkin_date', 'checkout_date');
|
||||
$stringFields = array('customer', 'source', 'payment_type', 'payment_method','reference');
|
||||
|
||||
if (in_array($field, $numericFields)) {
|
||||
return $this->validateBookingNumericFilter($field, $operator, $value);
|
||||
}
|
||||
|
||||
if (in_array($field, $dateFields)) {
|
||||
return $this->validateBookingDateFilter($field, $operator, $value);
|
||||
}
|
||||
|
||||
if (in_array($field, $stringFields)) {
|
||||
return $this->validateBookingStringFilter($field, $operator, $value);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private function validateBookingNumericFilter($field, $operator, $value)
|
||||
{
|
||||
$values = strpos($value, '|') !== false ? explode('|', $value) : array($value);
|
||||
foreach ($values as $filterValue) {
|
||||
if (!Validate::isUnsignedInt($filterValue)) {
|
||||
$this->wsObject->setError(400, 'Invalid value for filter "'.$field.'".', 39);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private function validateBookingDateFilter($field, $operator, $value)
|
||||
{
|
||||
if ($operator == '' && preg_match('/^([\d\-:\s]+),([\d\-:\s]+)$/', $value, $matches)) {
|
||||
if (!Validate::isDate($matches[1]) || !Validate::isDate($matches[2])) {
|
||||
$this->wsObject->setError(400, 'Invalid value for filter "'.$field.'".', 39);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!Validate::isDate($value)) {
|
||||
$this->wsObject->setError(400, 'Invalid value for filter "'.$field.'".', 39);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private function validateBookingStringFilter($field, $operator, $value)
|
||||
{
|
||||
if (!Validate::isString($value)) {
|
||||
$this->wsObject->setError(400, 'Invalid value for filter "'.$field.'".', 39);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private function manageBookingOrderBySort($sorts)
|
||||
{
|
||||
$sqlSort = '';
|
||||
$invalidSortMessage = 'The "sort" value has to be formed as this example: "field_ASC" or \'[field_1_DESC,field_2_ASC]\'';
|
||||
|
||||
if (!$sorts) {
|
||||
return $sqlSort;
|
||||
}
|
||||
|
||||
preg_match('#^\[(.*)\]$#Ui', $sorts, $matches);
|
||||
$sortItems = count($matches) > 1 ? explode(',', $matches[1]) : array($sorts);
|
||||
$sqlSort = ' ORDER BY ';
|
||||
|
||||
foreach ($sortItems as $sortItem) {
|
||||
$delimiterPosition = strrpos($sortItem, '_');
|
||||
if ($delimiterPosition === false) {
|
||||
$this->wsObject->setError(400, $invalidSortMessage, 37);
|
||||
return false;
|
||||
}
|
||||
|
||||
$fieldName = substr($sortItem, 0, $delimiterPosition);
|
||||
$sortDirection = strtoupper(substr($sortItem, $delimiterPosition + 1));
|
||||
if (!in_array($sortDirection, array('ASC', 'DESC'))) {
|
||||
$this->wsObject->setError(400, $invalidSortMessage, 37);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!array_key_exists($fieldName, $this->allowedFilters)) {
|
||||
$this->wsObject->setErrorDidYouMean(
|
||||
400,
|
||||
'This sort field does not exist',
|
||||
$fieldName,
|
||||
array_keys($this->allowedFilters),
|
||||
38
|
||||
);
|
||||
return false;
|
||||
}
|
||||
|
||||
$sqlSort .= $this->allowedFilters[$fieldName].' '.$sortDirection.', ';
|
||||
}
|
||||
|
||||
$sqlSort = rtrim($sqlSort, ', ');
|
||||
|
||||
return $sqlSort;
|
||||
}
|
||||
|
||||
public function getBookingsList()
|
||||
{
|
||||
$selectColumns = ['o.`id_order`'];
|
||||
$fragments = $this->wsObject->urlFragments;
|
||||
if (!empty($fragments['display'])) {
|
||||
if ($fragments['display'] === 'full') {
|
||||
$selectColumns = array(
|
||||
'o.`id_order`','o.`id_currency`', 'o.`source`','o.`date_add`','o.`id_lang`','o.`current_state`','o.`total_paid_real`','o.`total_paid_tax_incl`','o.`total_paid_tax_excl`','o.`id_cart`',
|
||||
'hbd.`id_product`','hbd.`date_from`','hbd.`date_to`','hbd.`total_price_tax_incl`','hbd.`total_price_tax_excl`','hbd.`id_room`','hbd.`id`','hbd.`adults`','hbd.`children`','hbd.`id_hotel`','hbd.`room_type_name`','hbd.`child_ages`','hbd.`id_status`',
|
||||
'c.`id_customer`','c.`firstname`','c.`lastname`','c.`email`','c.`phone`','c.`id_default_group`',
|
||||
'CONCAT(c.`firstname`, " ", c.`lastname`) AS `customer`',
|
||||
'crncy.`iso_code`',
|
||||
'op.`payment_type`', 'op.`payment_method`', 'op.`transaction_id`',
|
||||
'ocr.`id_order_invoice`', 'ocr.`name` as cart_rule_name', 'ocr.`value` as cart_rule_value', '`ocr`.`id_cart_rule`',
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$whereSql = '';
|
||||
$limitSql = '';
|
||||
$orderSql = '';
|
||||
if (!empty($fragments['filter']) && is_array($fragments['filter'])) {
|
||||
$whereSql = $this->manageBookingFilter($fragments['filter']);
|
||||
if ($whereSql === false) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (!empty($fragments['sort'])) {
|
||||
$orderSql = $this->manageBookingOrderBySort($fragments['sort']);
|
||||
if ($orderSql === false) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (isset($fragments['limit'])) {
|
||||
$limitArgs = explode(',', $fragments['limit']);
|
||||
if (count($limitArgs) == 1) {
|
||||
$limitSql = ' LIMIT ' . (int) $limitArgs[0];
|
||||
} elseif (count($limitArgs) == 2) {
|
||||
$limitSql = ' LIMIT ' . (int) $limitArgs[0] . ', ' . (int) $limitArgs[1];
|
||||
} else {
|
||||
$this->wsObject->setError(400, 'The "limit" value has to be formed as this example: "5,25" or "10"', 39);
|
||||
return;
|
||||
}
|
||||
}
|
||||
$id_lang = Configuration::get('PS_LANG_DEFAULT') ;
|
||||
|
||||
$sql = '
|
||||
SELECT ' . implode(', ', $selectColumns) . '
|
||||
FROM ' . _DB_PREFIX_ . 'orders o
|
||||
INNER JOIN ' . _DB_PREFIX_ . 'htl_booking_detail hbd
|
||||
ON o.id_order = hbd.id_order
|
||||
INNER JOIN ' . _DB_PREFIX_ . 'customer c
|
||||
ON o.id_customer = c.id_customer
|
||||
INNER JOIN ' . _DB_PREFIX_ . 'currency crncy
|
||||
ON o.id_currency = crncy.id_currency
|
||||
LEFT JOIN ' . _DB_PREFIX_ . 'order_payment_detail opd
|
||||
ON o.id_order = opd.id_order
|
||||
LEFT JOIN ' . _DB_PREFIX_ . 'order_payment op
|
||||
ON opd.id_order_payment = op.id_order_payment
|
||||
LEFT JOIN ' . _DB_PREFIX_ . 'order_cart_rule ocr
|
||||
ON o.id_order = ocr.id_order
|
||||
LEFT JOIN (
|
||||
SELECT `id_order`,
|
||||
SUM(DATEDIFF(date_to, date_from)) AS stay
|
||||
FROM ' . _DB_PREFIX_ . 'htl_booking_detail
|
||||
GROUP BY id_order
|
||||
) stay_data ON o.id_order = stay_data.id_order
|
||||
WHERE 1
|
||||
' . $whereSql . '
|
||||
' . $orderSql . '
|
||||
' . $limitSql;
|
||||
try {
|
||||
|
||||
$results = Db::getInstance()->executeS($sql);
|
||||
$objServiceProductOrderDetail = new ServiceProductOrderDetail();
|
||||
$objOrder = new Order();
|
||||
$resultData = array();
|
||||
|
||||
foreach ($results as $result) {
|
||||
$orderId = (int) $result['id_order'];
|
||||
if( isset($fragments['display']) && $fragments['display'] === 'full'){
|
||||
if (!isset($resultData[$orderId])) {
|
||||
$objCart = new Cart((int) $result['id_cart']);
|
||||
$total_paid_real = Tools::ps_round($result['total_paid_real'], _PS_PRICE_COMPUTE_PRECISION_);
|
||||
$total_paid_tax_excl = Tools::ps_round($result['total_paid_tax_excl'], _PS_PRICE_COMPUTE_PRECISION_);
|
||||
$booking_status = $this->getApiBookingStatus($result['current_state'], $total_paid_real, $total_paid_tax_excl, $objCart->getOrderTotal(true, Cart::BOTH));
|
||||
$params = array();
|
||||
$params['id'] = $orderId;
|
||||
$params['id_property'] = (int) $result['id_hotel'];
|
||||
$params['currency'] = strtoupper($result['iso_code']);
|
||||
$params['booking_status'] = $booking_status;
|
||||
$params['source'] = $result['source'];
|
||||
$params['booking_date'] = $result['date_add'];
|
||||
$params['id_language'] = (int) $result['id_lang'];
|
||||
$params['remarks'] = array();
|
||||
if ($customerMessages = Message::getMessagesByOrderId($orderId)) {
|
||||
foreach ($customerMessages as $customerMessage) {
|
||||
$params['remarks'][] = $customerMessage['message'];
|
||||
}
|
||||
}
|
||||
$params['associations'] = array();
|
||||
$params['associations']['customer_detail'] = array(
|
||||
'id_customer' => (int) $result['id_customer'],
|
||||
'firstname' => $result['firstname'],
|
||||
'lastname' => $result['lastname'],
|
||||
'email' => $result['email'],
|
||||
'phone' => isset($result['phone']) ? $result['phone'] : ''
|
||||
);
|
||||
|
||||
$params['associations']['price_details'] = array(
|
||||
'total_paid' => Tools::ps_round($result['total_paid_real'], _PS_PRICE_COMPUTE_PRECISION_),
|
||||
'total_price_without_tax' => Tools::ps_round($result['total_paid_tax_excl'], _PS_PRICE_COMPUTE_PRECISION_),
|
||||
);
|
||||
$params['associations']['payment_details'] = array(
|
||||
'payment_type' => $result['payment_type'],
|
||||
'payment_method' => $result['payment_method'],
|
||||
'transaction_id' => $result['transaction_id'],
|
||||
);
|
||||
|
||||
$params['associations']['cart_rules'] = array(
|
||||
'code' => $result['cart_rule_name'],
|
||||
'value' => Tools::ps_round($result['cart_rule_value'], _PS_PRICE_COMPUTE_PRECISION_),
|
||||
'id_order_invoice' => $result['id_order_invoice'],
|
||||
);
|
||||
|
||||
$params['associations']['room_types'] = array();
|
||||
$resultData[$orderId] = $params;
|
||||
}
|
||||
|
||||
$dateJoin = $result['id_product'] . '_' . strtotime($result['date_from']) . strtotime($result['date_to']);
|
||||
|
||||
if (!isset($resultData[$orderId]['associations']['room_types'][$dateJoin])) {
|
||||
$resultData[$orderId]['associations']['room_types'][$dateJoin] = array(
|
||||
'id_room_type' => (int) $result['id_product'],
|
||||
'checkin_date' => $result['date_from'],
|
||||
'checkout_date' => $result['date_to'],
|
||||
'total_tax' => ($result['total_price_tax_incl'] - $result['total_price_tax_excl']),
|
||||
'number_of_rooms' => 1,
|
||||
'name' => $result['room_type_name'],
|
||||
'room_status' => $this->validateRoomStatus($result['id_status']),
|
||||
);
|
||||
} else {
|
||||
$resultData[$orderId]['associations']['room_types'][$dateJoin]['total_tax'] +=
|
||||
($result['total_price_tax_incl'] - $result['total_price_tax_excl']);
|
||||
$resultData[$orderId]['associations']['room_types'][$dateJoin]['number_of_rooms']++;
|
||||
}
|
||||
|
||||
$resultData[$orderId]['associations']['room_types'][$dateJoin]['total_tax'] =
|
||||
Tools::ps_round(
|
||||
$resultData[$orderId]['associations']['room_types'][$dateJoin]['total_tax'],
|
||||
_PS_PRICE_COMPUTE_PRECISION_
|
||||
);
|
||||
$roomInfo = array();
|
||||
$roomInfo['id_room'] = (int) $result['id_room'];
|
||||
$roomInfo['id_hotel_booking'] = (int) $result['id'];
|
||||
$roomInfo['adults'] = (int) $result['adults'];
|
||||
$roomInfo['child'] = (int) $result['children'];
|
||||
$roomInfo['child_ages'] = json_decode($result['child_ages'], true);
|
||||
$roomInfo['unit_price_without_tax'] = Tools::ps_round($result['total_price_tax_excl'], _PS_PRICE_COMPUTE_PRECISION_);
|
||||
$roomInfo['total_tax'] = Tools::ps_round(($result['total_price_tax_incl'] - $result['total_price_tax_excl']), _PS_PRICE_COMPUTE_PRECISION_);
|
||||
if(isset($roomInfo['services'])) {
|
||||
unset($roomInfo['services']);
|
||||
}
|
||||
|
||||
$useTax = (Group::getPriceDisplayMethod($result['id_default_group']) == PS_TAX_INC) ? 1 : 0;
|
||||
|
||||
if ($additionalServices = $objServiceProductOrderDetail->getRoomTypeServiceProducts(
|
||||
$result['id_order'],
|
||||
0,
|
||||
0,
|
||||
$result['id_product'],
|
||||
$result['date_from'],
|
||||
$result['date_to'],
|
||||
$result['id_room'],
|
||||
0,
|
||||
$useTax,
|
||||
null
|
||||
)) {
|
||||
$roomInfo['services'] = array();
|
||||
foreach ($additionalServices as $additionalService) {
|
||||
foreach ($additionalService['additional_services'] as $service) {
|
||||
$services = array();
|
||||
$services['id_service'] = (int) $service['id_product'];
|
||||
$services['name'] = $service['name'];
|
||||
$services['quantity'] = (int) $service['quantity'];
|
||||
$services['unit_price_without_tax'] = Tools::ps_round(($service['total_price_tax_excl'] / $services['quantity']), _PS_PRICE_COMPUTE_PRECISION_);
|
||||
$services['total_price_without_tax'] = Tools::ps_round(($service['total_price_tax_excl']), _PS_PRICE_COMPUTE_PRECISION_);
|
||||
$services['total_tax'] = Tools::ps_round(($service['total_price_tax_incl'] - $service['total_price_tax_excl']), _PS_PRICE_COMPUTE_PRECISION_);
|
||||
|
||||
$objProduct = new Product($service['id_product']);
|
||||
$services['per_night'] = 0;
|
||||
if ($objProduct->price_calculation_method == Product::PRICE_CALCULATION_METHOD_PER_DAY) {
|
||||
$services['per_night'] = 1;
|
||||
}
|
||||
|
||||
$services['price_mode'] = (int) $objProduct->price_calculation_method;
|
||||
$roomInfo['services'][] = $services;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$resultData[$orderId]['associations']['room_types'][$dateJoin]['rooms'][] = $roomInfo;
|
||||
|
||||
}else{
|
||||
$params['id_order'] = $orderId;
|
||||
$resultData[$orderId] = $params;
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($fragments['display']) && $fragments['display'] === 'full') {
|
||||
$responseData = [];
|
||||
foreach ($resultData as $order) {
|
||||
if (isset($order['associations']['room_types'])) {
|
||||
$order['associations']['room_types'] = array_values(
|
||||
$order['associations']['room_types']
|
||||
);
|
||||
}
|
||||
|
||||
$responseData[] = $order;
|
||||
}
|
||||
|
||||
if(!empty($responseData)) {
|
||||
$this->output['bookings'] = $responseData;
|
||||
$this->renderResponse();
|
||||
return;
|
||||
}
|
||||
}
|
||||
$this->output .= $this->objOutput->getObjectRender()
|
||||
->renderNodeHeader('bookings', []);
|
||||
|
||||
foreach ($resultData as $order) {
|
||||
$more_attr = array(
|
||||
'xlink_resource' => $this->wsObject->wsUrl.$this->wsObject->urlSegment[0].'/'.$order['id_order'],
|
||||
'id' => (int) $order['id_order']
|
||||
);
|
||||
$this->output .= $this->objOutput->getObjectRender()->renderNodeHeader('booking', array('objectsNodeName' => 'bookings'), $more_attr, false);
|
||||
}
|
||||
|
||||
$this->output .= $this->objOutput->getObjectRender()
|
||||
->renderNodeFooter('bookings', []);
|
||||
|
||||
$this->output = $this->objOutput->getObjectRender()
|
||||
->overrideContent($this->output);
|
||||
|
||||
|
||||
} catch (\Throwable $th) {
|
||||
$this->wsObject->setError(400, 'Invalid request data provided.', 39);
|
||||
}
|
||||
}
|
||||
|
||||
public function validateRoomStatus($idStatus)
|
||||
{
|
||||
$status = self::API_BOOKING_ROOM_STATUS_ALLOTTED;
|
||||
switch ($idStatus) {
|
||||
case self::API_BOOKING_ROOM_STATUS_ALLOTTED:
|
||||
$status = self::API_BOOKING_ROOM_STATUS_ALLOTTED;
|
||||
break;
|
||||
case self::API_BOOKING_ROOM_STATUS_CHECKIN:
|
||||
$status = self::API_BOOKING_ROOM_STATUS_CHECKIN;
|
||||
break;
|
||||
case self::API_BOOKING_ROOM_STATUS_CHECKOUT:
|
||||
$status = self::API_BOOKING_ROOM_STATUS_CHECKOUT;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return $status;
|
||||
}
|
||||
|
||||
public function getApiBookingStatus($bookingStatus, $totalAmount, $totalPrice, $cartTotal)
|
||||
{
|
||||
$orderStatus = self::API_BOOKING_STATUS_NEW;
|
||||
switch ($bookingStatus) {
|
||||
case self::API_BOOKING_STATUS_NEW:
|
||||
if ($totalAmount > 0 && $totalPrice > 0 && $totalPrice == $totalAmount) {
|
||||
$orderStatus = Configuration::get('PS_OS_PAYMENT_ACCEPTED');
|
||||
} else if ($totalAmount > 0 && $totalAmount < $cartTotal) {
|
||||
$orderStatus = Configuration::get('PS_OS_PARTIAL_PAYMENT_ACCEPTED');
|
||||
} else if ($totalAmount >= $cartTotal) {
|
||||
$orderStatus = Configuration::get('PS_OS_PAYMENT_ACCEPTED');
|
||||
}
|
||||
break;
|
||||
case self::API_BOOKING_STATUS_COMPLETED:
|
||||
$orderStatus = Configuration::get('PS_OS_PAYMENT_ACCEPTED');
|
||||
if (!$totalAmount) {
|
||||
$totalAmount = $cartTotal;
|
||||
} else if ($totalAmount > 0 && $totalAmount < $cartTotal) {
|
||||
$orderStatus = Configuration::get('PS_OS_PARTIAL_PAYMENT_ACCEPTED');
|
||||
}
|
||||
|
||||
break;
|
||||
case self::API_BOOKING_STATUS_CANCELLED:
|
||||
$orderStatus = Configuration::get('PS_OS_CANCELED');
|
||||
break;
|
||||
case self::API_BOOKING_STATUS_REFUNDED:
|
||||
$orderStatus = Configuration::get('PS_OS_REFUND');
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return $orderStatus;
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to get the booking details for the GET, POST and PUT request.
|
||||
*/
|
||||
@@ -3706,7 +4225,6 @@ class WebserviceSpecificManagementBookingsCore Extends ObjectModel implements We
|
||||
$roomTypeInfo[$dateJoin]['rooms'][] = $roomInfo;
|
||||
}
|
||||
}
|
||||
|
||||
$params['associations']['room_types'] = array_values($roomTypeInfo);
|
||||
$this->output['booking'] = $params;
|
||||
}
|
||||
@@ -3750,6 +4268,7 @@ class WebserviceSpecificManagementBookingsCore Extends ObjectModel implements We
|
||||
*/
|
||||
public function renderXmlOutputUsingArray($response, $keyToIgnore = array(), $parentKeys = array(), $parentKey = '', $useEmpty = false)
|
||||
{
|
||||
// ddd($response);
|
||||
$output = '';
|
||||
foreach ($response as $key => $res) {
|
||||
if (in_array($key, $keyToIgnore) && $key) {
|
||||
|
||||
@@ -624,21 +624,57 @@ class AdminModulesControllerCore extends AdminController
|
||||
public function postProcessEnable()
|
||||
{
|
||||
if ($this->tabAccess['edit'] === 1) {
|
||||
$module = Module::getInstanceByName(Tools::getValue('module_name'));
|
||||
if (Validate::isLoadedObject($module)) {
|
||||
|
||||
$moduleNames = array_unique(array_filter(
|
||||
explode('|', strip_tags((string) Tools::getValue('module_name')))
|
||||
));
|
||||
|
||||
$enable = Tools::getValue('enable');
|
||||
|
||||
if (empty($moduleNames)) {
|
||||
$this->errors[] = Tools::displayError('You must select at least one module.');
|
||||
return;
|
||||
}
|
||||
$modules = array();
|
||||
|
||||
foreach ($moduleNames as $moduleName) {
|
||||
if (!Validate::isModuleName($moduleName)) {
|
||||
$this->errors[] = Tools::displayError('Invalid module name ') . ': ' . $moduleName;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!Module::isInstalled($moduleName)) {
|
||||
$this->errors[] = Tools::displayError('This module is not installed ') . ': ' . $moduleName;
|
||||
continue;
|
||||
}
|
||||
|
||||
$module = Module::getInstanceByName($moduleName);
|
||||
if (!Validate::isLoadedObject($module)) {
|
||||
$this->errors[] = Tools::displayError('Cannot load the module\'s object ') . ': ' . $moduleName;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!$module->getPermission('configure')) {
|
||||
$this->errors[] = Tools::displayError('You do not have the permission to use this module.');
|
||||
} else {
|
||||
if (Tools::getValue('enable')) {
|
||||
$this->errors[] = Tools::displayError('You do not have the permission to use this module ') . ': ' . $module->displayName;
|
||||
continue;
|
||||
}
|
||||
|
||||
$modules[] = $module;
|
||||
}
|
||||
|
||||
if (empty($this->errors)) {
|
||||
foreach ($modules as $module) {
|
||||
if ($enable) {
|
||||
$module->enable();
|
||||
} else {
|
||||
$module->disable();
|
||||
}
|
||||
Tools::redirectAdmin($this->getCurrentUrl('enable'));
|
||||
}
|
||||
} else {
|
||||
$this->errors[] = Tools::displayError('Cannot load the module\'s object.');
|
||||
|
||||
|
||||
Tools::redirectAdmin($this->getCurrentUrl(array('enable','conf')).'&conf='.($enable ? 33 : 34));
|
||||
}
|
||||
|
||||
} else {
|
||||
$this->errors[] = Tools::displayError('You do not have permission to add this.');
|
||||
}
|
||||
|
||||
@@ -492,7 +492,6 @@ class AdminOrdersControllerCore extends AdminController
|
||||
'payment_types' => $paymentTypes,
|
||||
'PAYMENT_TYPE_PAY_AT_HOTEL' => OrderPayment::PAYMENT_TYPE_PAY_AT_HOTEL,
|
||||
'currency' => new Currency((int)$cart->id_currency),
|
||||
'max_child_in_room' => Configuration::get('WK_GLOBAL_MAX_CHILD_IN_ROOM'),
|
||||
'max_child_age' => Configuration::get('WK_GLOBAL_CHILD_MAX_AGE'),
|
||||
'occupancy_required_for_booking' => $occupancyRequiredForBooking,
|
||||
));
|
||||
@@ -3118,9 +3117,6 @@ class AdminOrdersControllerCore extends AdminController
|
||||
$this->kpis[] = $helper;
|
||||
}
|
||||
|
||||
Hook::exec('action'.$this->controller_name.'KPIListingModifier', array(
|
||||
'kpis' => &$kpis,
|
||||
));
|
||||
|
||||
return parent::renderKpis();
|
||||
}
|
||||
@@ -3634,7 +3630,6 @@ class AdminOrdersControllerCore extends AdminController
|
||||
'htl_booking_order_data' => $bookingOrderInfo,
|
||||
'hotel_order_status' => $htlOrderStatus,
|
||||
'order_detail_data' => $order_detail_data,
|
||||
'max_child_in_room' => Configuration::get('WK_GLOBAL_MAX_CHILD_IN_ROOM'),
|
||||
'max_child_age' => Configuration::get('WK_GLOBAL_CHILD_MAX_AGE'),
|
||||
'hotel_service_products' => $orderHotelServiceProducts,
|
||||
'standalone_service_products' => $orderStandaloneServiceProducts,
|
||||
|
||||
@@ -3479,10 +3479,6 @@ class AdminProductsControllerCore extends AdminController
|
||||
}
|
||||
if ($baseChildren == '' || !Validate::isUnsignedInt($baseChildren)) {
|
||||
$this->errors[] = Tools::displayError('Invalid base children');
|
||||
} else if (Configuration::get('WK_GLOBAL_MAX_CHILD_IN_ROOM')) {
|
||||
if ($baseChildren > Configuration::get('WK_GLOBAL_MAX_CHILD_IN_ROOM')) {
|
||||
$this->errors[] = sprintf(Tools::displayError('Base children cannot be greater than max childern allowed in the room of this room type (Max: %s)'), Configuration::get('WK_GLOBAL_MAX_CHILD_IN_ROOM'));
|
||||
}
|
||||
}
|
||||
if (!$maxAdults || !Validate::isUnsignedInt($maxAdults)) {
|
||||
$this->errors[] = Tools::displayError('Invalid maximum number of adults');
|
||||
@@ -3497,10 +3493,6 @@ class AdminProductsControllerCore extends AdminController
|
||||
$this->errors[] = Tools::displayError('Maximum number of children cannot be less than base children');
|
||||
} elseif ($maxChildren >= $maxGuests) {
|
||||
$this->errors[] = Tools::displayError('Maximum number of children cannot be more or equal than maximum number of guests.(1 adult is mandatory in a room)');
|
||||
} else if (Configuration::get('WK_GLOBAL_MAX_CHILD_IN_ROOM')) {
|
||||
if ($maxChildren > Configuration::get('WK_GLOBAL_MAX_CHILD_IN_ROOM')) {
|
||||
$this->errors[] = sprintf(Tools::displayError('Maximum number of children cannot be greater than max childern allowed in the room of this room type (Max: %s)'), Configuration::get('WK_GLOBAL_MAX_CHILD_IN_ROOM'));
|
||||
}
|
||||
}
|
||||
if (!$maxGuests || !Validate::isUnsignedInt($maxGuests)) {
|
||||
$this->errors[] = Tools::displayError('Invalid maximum number of guests');
|
||||
|
||||
23
js/admin.js
23
js/admin.js
@@ -1686,11 +1686,26 @@ function confirm_link(head_text, display_text, confirm_text, cancel_text, confir
|
||||
});
|
||||
}
|
||||
function countDown($source, $target) {
|
||||
var max = $source.attr("data-maxchar");
|
||||
$target.html(max-$source.val().length);
|
||||
var max = parseInt($source.attr("data-maxchar"), 10);
|
||||
|
||||
$source.keyup(function(){
|
||||
$target.html(max-$source.val().length);
|
||||
function update() {
|
||||
var val = $source.val();
|
||||
if (val.length > max) {
|
||||
$source.val(val.substring(0, max));
|
||||
}
|
||||
var remaining = max - $source.val().length;
|
||||
$target.html(remaining);
|
||||
if (remaining <= 0) {
|
||||
$target.addClass('text-danger');
|
||||
} else {
|
||||
$target.removeClass('text-danger');
|
||||
}
|
||||
}
|
||||
|
||||
update();
|
||||
|
||||
$source.on('keyup input', function() {
|
||||
update();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -1063,7 +1063,7 @@ class HotelHelper
|
||||
Configuration::updateValue('WK_ADVANCED_PAYMENT_INC_TAX', 1);
|
||||
|
||||
Configuration::updateValue('WK_GLOBAL_CHILD_MAX_AGE', 15);
|
||||
Configuration::updateValue('WK_GLOBAL_MAX_CHILD_IN_ROOM', 0);
|
||||
Configuration::updateValue('QLO_GLOBAL_MAX_INFANT_AGE', 1);
|
||||
|
||||
Configuration::updateValue('PS_MAX_CHECKOUT_OFFSET', 365);
|
||||
Configuration::updateValue('PS_MIN_BOOKING_OFFSET', 0);
|
||||
|
||||
@@ -206,10 +206,24 @@ class AdminAddHotelController extends ModuleAdminController
|
||||
$treeContent = $tree->render();
|
||||
$smartyVars['hotel_feature_tree'] = $treeContent;
|
||||
}
|
||||
|
||||
$smartyVars['rewrite_url'] = [];
|
||||
$idHotelCategory = (int) $hotelBranchInfo->id_category;
|
||||
if ($idHotelCategory > 0 && !empty($smartyVars['languages'])) {
|
||||
foreach ($smartyVars['languages'] as $lang) {
|
||||
$idLang = (int) $lang['id_lang'];
|
||||
$category = new Category($idHotelCategory, $idLang);
|
||||
if (!Validate::isLoadedObject($category)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$fullUrl = $this->context->link->getCategoryLink($category, '[REWRITE]', $idLang);
|
||||
$smartyVars['rewrite_url'][$idLang] = explode('[REWRITE]', $fullUrl);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$idCountry = Tools::getValue('hotel_country');
|
||||
}
|
||||
|
||||
// manage state option
|
||||
$stateOptions = null;
|
||||
if ($idCountry) {
|
||||
@@ -258,6 +272,7 @@ class AdminAddHotelController extends ModuleAdminController
|
||||
$address = Tools::getValue('address');
|
||||
$active = Tools::getValue('ENABLE_HOTEL');
|
||||
$fax = Tools::getValue('fax');
|
||||
$vatNumber = trim(Tools::getValue('vat_number'));
|
||||
$activeRefund = Tools::getValue('active_refund');
|
||||
$enableUseGlobalMaxCheckoutOffset = Tools::getValue('enable_use_global_max_checkout_offset');
|
||||
$maxCheckoutOffset = trim(Tools::getValue('max_checkout_offset'));
|
||||
@@ -387,6 +402,11 @@ class AdminAddHotelController extends ModuleAdminController
|
||||
if ($fax && !Validate::isGenericName($fax)) {
|
||||
$this->errors[] = $this->l('Field fax in invalid.');
|
||||
}
|
||||
if ($vatNumber && !Validate::isGenericName($vatNumber)) {
|
||||
$this->errors[] = $this->l('Field VAT number is invalid.');
|
||||
} else if (Tools::strlen($vatNumber) > 64) {
|
||||
$this->errors[] = $this->l('Field VAT number cannot exceed 64 characters.');
|
||||
}
|
||||
|
||||
if (!$country) {
|
||||
$this->errors[] = $this->l('Country is required field.');
|
||||
@@ -642,6 +662,7 @@ class AdminAddHotelController extends ModuleAdminController
|
||||
$objAddress->id_country = $country;
|
||||
$objAddress->id_state = $state;
|
||||
$objAddress->city = $city;
|
||||
$objAddress->vat_number = $vatNumber;
|
||||
$objAddress->postcode = $zipcode;
|
||||
$hotelName = $objHotelBranch->hotel_name[$defaultLangId];
|
||||
$hotelName = trim(preg_replace('/[0-9!<>,;?=+()@#"°{}_$%:]*$/u', '', $hotelName));
|
||||
|
||||
@@ -378,14 +378,14 @@ class AdminHotelGeneralSettingsController extends ModuleAdminController
|
||||
'hint' => $this->l('Enter the age of the guest, which that guest will be considered as child.'),
|
||||
'class' => 'fixed-width-xxl',
|
||||
),
|
||||
'WK_GLOBAL_MAX_CHILD_IN_ROOM' => array(
|
||||
'title' => $this->l('Maximum children allowed in a room'),
|
||||
'QLO_GLOBAL_MAX_INFANT_AGE' => array(
|
||||
'title' => $this->l('Consider guest as Infant below age'),
|
||||
'type' => 'text',
|
||||
'required' => true,
|
||||
'validation' => 'isUnsignedInt',
|
||||
'hint' => $this->l('Enter number of the child allowed in a room.'),
|
||||
'desc' => $this->l('Set as 0 if you do not want to limit children in a room.'),
|
||||
'hint' => $this->l('Enter the maximum age (in years) below which a guest is considered an infant.'),
|
||||
'class' => 'fixed-width-xxl',
|
||||
'desc' => $this->l('Infant age must be at least 1 and less than the child max age.'),
|
||||
),
|
||||
),
|
||||
'submit' => array(
|
||||
@@ -531,13 +531,25 @@ class AdminHotelGeneralSettingsController extends ModuleAdminController
|
||||
// Validation for the occupancy settings
|
||||
// max age of infant after which guest will considered as child // below 18
|
||||
$globalChildMaxAge = Tools::getValue('WK_GLOBAL_CHILD_MAX_AGE');
|
||||
$globalMaxChildInRoom = Tools::getValue('WK_GLOBAL_MAX_CHILD_IN_ROOM');
|
||||
$globalInfantAge = Tools::getValue('QLO_GLOBAL_MAX_INFANT_AGE');
|
||||
|
||||
if (!Validate::isUnsignedInt($globalChildMaxAge)) {
|
||||
$this->errors[] = $this->l('Invalid value for "Consider guest as child below age".');
|
||||
} else if ($globalChildMaxAge <= 0) {
|
||||
$this->errors[] = $this->l('The value for "Consider guest as child below age" must be at least 1.');
|
||||
}
|
||||
|
||||
if ($globalInfantAge === '' || $globalInfantAge === false) {
|
||||
$this->context->controller->errors[] = $this->l('Infant age is required');
|
||||
} elseif (!Validate::isUnsignedInt($globalInfantAge)) {
|
||||
$this->context->controller->errors[] = $this->l('Invalid infant age');
|
||||
} elseif ($globalInfantAge <= 0) {
|
||||
$this->context->controller->errors[] = $this->l('The value for infant age must be at least 1.');
|
||||
} elseif ($globalInfantAge >= $globalChildMaxAge) {
|
||||
$this->context->controller->errors[] = sprintf($this->l('The infant age cannot be greater than the Global child age (%s years)'), $globalChildMaxAge);
|
||||
} else {
|
||||
Configuration::updateValue('QLO_GLOBAL_MAX_INFANT_AGE', $globalInfantAge);
|
||||
}
|
||||
// End occupancy fields validation
|
||||
|
||||
if (!$hotelNameSearchThreshold && $hotelNameSearchThreshold !== '0') {
|
||||
|
||||
@@ -384,7 +384,6 @@ class AdminHotelRoomsBookingController extends ModuleAdminController
|
||||
'date_to' => $this->date_to,
|
||||
'occupancy_required_for_booking' => $occupancyRequiredForBooking,
|
||||
'max_child_age' => Configuration::get('WK_GLOBAL_CHILD_MAX_AGE'),
|
||||
'max_child_in_room' => Configuration::get('WK_GLOBAL_MAX_CHILD_IN_ROOM'),
|
||||
'link' => $this->context->link,
|
||||
'ALLOTMENT_MANUAL' => HotelBookingDetail::ALLOTMENT_MANUAL,
|
||||
'htl_connected_rooms' => HotelConnectedRoom::getConnectedRooms(null, $this->context->language->id),
|
||||
@@ -982,7 +981,6 @@ class AdminHotelRoomsBookingController extends ModuleAdminController
|
||||
'SELLING_PREFERENCE_WITH_ROOM_TYPE' => Product::SELLING_PREFERENCE_WITH_ROOM_TYPE,
|
||||
'SELLING_PREFERENCE_STANDALONE' => Product::SELLING_PREFERENCE_STANDALONE,
|
||||
'max_child_age' => Configuration::get('WK_GLOBAL_CHILD_MAX_AGE'),
|
||||
'max_child_in_room' => Configuration::get('WK_GLOBAL_MAX_CHILD_IN_ROOM'),
|
||||
'occupancy_required_for_booking' => $occupancyRequiredForBooking,
|
||||
'rooms_reallocation_url' => $this->context->link->getAdminLink('AdminHotelRoomsBooking'),
|
||||
'rooms_booking_url' => $this->context->link->getAdminLink('AdminHotelRoomsBooking'),
|
||||
|
||||
@@ -195,6 +195,12 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label" for="vat_number">{l s='VAT Number' mod='hotelreservationsystem'}</label>
|
||||
<div class="col-sm-6">
|
||||
<input autocomplete="off" type="text" class="form-control" id="vat_number" name="vat_number" value="{if isset($smarty.post.vat_number)}{$smarty.post.vat_number|escape:'htmlall':'UTF-8'}{elseif isset($edit)}{$address_info.vat_number|escape:'htmlall':'UTF-8'}{/if}" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label required">{l s='Address :' mod='hotelreservationsystem'}</label>
|
||||
<div class="col-sm-6">
|
||||
@@ -345,14 +351,19 @@
|
||||
<div class="col-lg-6">
|
||||
{foreach from=$languages item=language}
|
||||
{assign var="meta_title" value="meta_title_`$language.id_lang`"}
|
||||
<div class="input-group wk_text_field_all wk_text_field_{$language.id_lang}" {if $currentLang.id_lang != $language.id_lang}style="display:none;"{/if}>
|
||||
<span id="meta_title_{$language.id_lang}_counter" class="input-group-addon">
|
||||
<span class="text-count-down">128</span>
|
||||
</span>
|
||||
<input type="text"
|
||||
id="meta_title_{$language.id_lang}"
|
||||
name="meta_title_{$language.id_lang}"
|
||||
value="{if isset($smarty.post.$meta_title)}{$smarty.post.$meta_title|escape:'htmlall':'UTF-8'}{elseif isset($edit)}{$meta_title_info[$language.id_lang]|escape:'htmlall':'UTF-8'}{/if}""
|
||||
class="form-control wk_text_field_all wk_text_field_{$language.id_lang}"
|
||||
value="{if isset($smarty.post.$meta_title)}{$smarty.post.$meta_title|truncate:128:'':true|escape:'htmlall':'UTF-8'}{elseif isset($edit)}{$meta_title_info[$language.id_lang]|truncate:128:'':true|escape:'htmlall':'UTF-8'}{/if}"
|
||||
class="form-control"
|
||||
maxlength="128"
|
||||
{if $currentLang.id_lang != $language.id_lang}style="display:none;"{/if} />
|
||||
{/foreach}
|
||||
data-maxchar="128" />
|
||||
</div>
|
||||
{/foreach}
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
@@ -363,13 +374,18 @@
|
||||
<div class="col-lg-6">
|
||||
{foreach from=$languages item=language}
|
||||
{assign var="meta_description" value="meta_description_`$language.id_lang`"}
|
||||
<input type="text"
|
||||
id="meta_description_{$language.id_lang}"
|
||||
name="meta_description_{$language.id_lang}"
|
||||
value="{if isset($smarty.post.$meta_description)}{$smarty.post.$meta_description|escape:'htmlall':'UTF-8'}{elseif isset($edit)}{$meta_description_info[{$language.id_lang}]|escape:'htmlall':'UTF-8'}{/if}"
|
||||
class="form-control wk_text_field_all wk_text_field_{$language.id_lang}"
|
||||
maxlength="225"
|
||||
{if $currentLang.id_lang != $language.id_lang}style="display:none;"{/if} />
|
||||
<div class="input-group wk_text_field_all wk_text_field_{$language.id_lang}" {if $currentLang.id_lang != $language.id_lang}style="display:none;"{/if}>
|
||||
<span id="meta_description_{$language.id_lang}_counter" class="input-group-addon">
|
||||
<span class="text-count-down">255</span>
|
||||
</span>
|
||||
<textarea
|
||||
id="meta_description_{$language.id_lang}"
|
||||
name="meta_description_{$language.id_lang}"
|
||||
class="form-control textarea-autosize"
|
||||
rows="1"
|
||||
maxlength="255"
|
||||
data-maxchar="255">{if isset($smarty.post.$meta_description)}{$smarty.post.$meta_description|truncate:255:'':true|escape:'htmlall':'UTF-8'}{elseif isset($edit)}{$meta_description_info[{$language.id_lang}]|truncate:255:'':true|escape:'htmlall':'UTF-8'}{/if}</textarea>
|
||||
</div>
|
||||
{/foreach}
|
||||
</div>
|
||||
</div>
|
||||
@@ -401,6 +417,20 @@
|
||||
{/foreach}
|
||||
</div>
|
||||
</div>
|
||||
{include file="seo_preview.tpl"
|
||||
languages = $languages
|
||||
preview_link = $rewrite_url|default:''
|
||||
show_label_tooltip = false
|
||||
show_flag = true
|
||||
inputs = [
|
||||
'meta_title' => $meta_title_info,
|
||||
'meta_description' => $meta_description_info,
|
||||
'link_rewrite' => $link_rewrite_info,
|
||||
'meta_keywords' => $meta_keywords_info,
|
||||
'name' => $hotel_info.hotel_name,
|
||||
'description_short' => $hotel_info.short_description
|
||||
]
|
||||
}
|
||||
{hook h='displayAdminAddHotelFormSeoTabAfter' id_hotel=$hook_arg_id_hotel}
|
||||
</div>
|
||||
<div class="tab-pane" id="hotel-images">
|
||||
@@ -657,6 +687,33 @@
|
||||
});
|
||||
{/block}
|
||||
|
||||
{foreach from=$languages item=language}
|
||||
countDown($("#meta_title_{$language.id_lang}"), $("#meta_title_{$language.id_lang}_counter"));
|
||||
countDown($("#meta_description_{$language.id_lang}"), $("#meta_description_{$language.id_lang}_counter"));
|
||||
{/foreach}
|
||||
|
||||
$('a[href="#hotel-seo"]').on('shown.bs.tab', function() {
|
||||
$(window).trigger('resize.autosize');
|
||||
});
|
||||
|
||||
// handle case where SEO tab is already active on load
|
||||
if ($('#hotel-seo').hasClass('active')) {
|
||||
$(window).trigger('resize.autosize');
|
||||
}
|
||||
|
||||
// Trigger autosize width recalculation when language is switched
|
||||
$(document).on('wk.lang.changed', function(e, idLang) {
|
||||
$(window).trigger('resize.autosize');
|
||||
});
|
||||
});
|
||||
$(".textarea-autosize").autosize();
|
||||
// After full page load, reinit visible textareas so they start at the correct height
|
||||
$(window).on('load', function() {
|
||||
$(".textarea-autosize:visible").each(function() {
|
||||
var $ta = $(this), val = $ta.val();
|
||||
$ta.val('').trigger('autosize.destroy').removeData('autosize').autosize();
|
||||
if (val) { $ta.val(val).trigger('input'); }
|
||||
});
|
||||
});
|
||||
</script>
|
||||
{/block}
|
||||
|
||||
@@ -79,7 +79,7 @@
|
||||
</div>
|
||||
<div class="form-group col-xs-6 occupancy_count_block">
|
||||
<label>{l s='Children' mod='hotelreservationsystem'} <span class="label-desc-txt"></span></label>
|
||||
<input type="number" class="form-control num_occupancy num_children" name="occupancy[0][children]" value="0" min="0" data-max="{if isset($book_v)}{$book_v['max_children']|escape:'html':'UTF-8'}{else}{$max_child_in_room}{/if}">
|
||||
<input type="number" class="form-control num_occupancy num_children" name="occupancy[0][children]" value="0" min="0" data-max="{if isset($book_v)}{$book_v['max_children']|escape:'html':'UTF-8'}{/if}">
|
||||
({l s='Below' mod='hotelreservationsystem'} {$max_child_age|escape:'htmlall':'UTF-8'} {l s='years' mod='hotelreservationsystem'})
|
||||
</div>
|
||||
</div>
|
||||
@@ -172,7 +172,7 @@
|
||||
</div>
|
||||
<div class="form-group col-xs-6 occupancy_count_block">
|
||||
<label>{l s='Children' mod='hotelreservationsystem'} <span class="label-desc-txt"></span></label>
|
||||
<input type="number" class="form-control num_occupancy num_children" name="occupancy[0][children]" value="0" min="0" data-max="{if isset($book_v)}{$book_v['max_children']|escape:'html':'UTF-8'}{else}{$max_child_in_room}{/if}">
|
||||
<input type="number" class="form-control num_occupancy num_children" name="occupancy[0][children]" value="0" min="0" data-max="{if isset($book_v)}{$book_v['max_children']|escape:'html':'UTF-8'}{/if}">
|
||||
({l s='Below'} {$max_child_age|escape:'htmlall':'UTF-8'} {l s='years' mod='hotelreservationsystem'})
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -84,7 +84,7 @@
|
||||
</div>
|
||||
<div class="form-group col-xs-6 occupancy_count_block">
|
||||
<label>{l s='Children' mod='hotelreservationsystem'} <span class="label-desc-txt"></span></label>
|
||||
<input type="number" class="form-control num_occupancy num_children" name="occupancy[{$key|escape:'htmlall':'UTF-8'}][children]" value="{$room_occupancy['children']|escape:'htmlall':'UTF-8'}" min="0" {if $max_child_in_room}max="{$max_child_in_room}"{/if}>
|
||||
<input type="number" class="form-control num_occupancy num_children" name="occupancy[{$key|escape:'htmlall':'UTF-8'}][children]" value="{$room_occupancy['children']|escape:'htmlall':'UTF-8'}" min="0">
|
||||
({l s='Below' mod='hotelreservationsystem'} {$max_child_age|escape:'htmlall':'UTF-8'} {l s='years' mod='hotelreservationsystem'})
|
||||
</div>
|
||||
</div>
|
||||
@@ -126,7 +126,7 @@
|
||||
</div>
|
||||
<div class="form-group col-xs-6 occupancy_count_block">
|
||||
<label>{l s='Children' mod='hotelreservationsystem'} <span class="label-desc-txt"></span></label>
|
||||
<input type="number" class="form-control num_occupancy num_children" name="occupancy[0][children]" value="0" min="0" {if $max_child_in_room}max="{$max_child_in_room}"{/if}>
|
||||
<input type="number" class="form-control num_occupancy num_children" name="occupancy[0][children]" value="0" min="0">
|
||||
({l s='Below' mod='hotelreservationsystem'} {$max_child_age|escape:'htmlall':'UTF-8'} {l s='years' mod='hotelreservationsystem'})
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -696,37 +696,26 @@ $(document).ready(function() {
|
||||
if (childElement) {
|
||||
var totalChilds = $(this).closest('.occupancy_info_block').find('.guest_child_age').length;
|
||||
|
||||
if (max_child_in_room == 0 || totalChilds < max_child_in_room) {
|
||||
element.val(elementVal);
|
||||
$(this).closest('.occupancy_info_block').find('.children_age_info_block').show();
|
||||
element.val(elementVal);
|
||||
$(this).closest('.occupancy_info_block').find('.children_age_info_block').show();
|
||||
|
||||
var roomBlockIndex = parseInt($(this).closest('.occupancy_info_block').attr('occ_block_index'));
|
||||
var roomBlockIndex = parseInt($(this).closest('.occupancy_info_block').attr('occ_block_index'));
|
||||
|
||||
var childAgeSelect = '<div>';
|
||||
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);
|
||||
|
||||
// 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"));
|
||||
var childAgeSelect = '<div>';
|
||||
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>';
|
||||
}
|
||||
} else {
|
||||
showOccupancyError(max_occupancy_reached_txt, $(this).closest(".occupancy_info_block"));
|
||||
}
|
||||
}
|
||||
childAgeSelect += '</select>';
|
||||
childAgeSelect += '</div>';
|
||||
|
||||
$(this).closest('.occupancy_info_block').find('.children_ages').append(childAgeSelect);
|
||||
|
||||
// set input field value
|
||||
$(this).closest('.occupancy_count_block').find('.occupancy_count > span').text(elementVal);
|
||||
|
||||
} else {
|
||||
element.val(elementVal);
|
||||
|
||||
@@ -934,7 +923,7 @@ $(document).ready(function() {
|
||||
|
||||
// set positions of popups when required
|
||||
if (page_name == 'index') {
|
||||
$('#hotel_location, #id_hotel_button, #guest_occupancy').focus(function () {
|
||||
$('#hotel_location, #id_hotel_button_chosen, #guest_occupancy').focus(function () {
|
||||
setBookingSearchPositions();
|
||||
});
|
||||
|
||||
|
||||
@@ -62,7 +62,6 @@
|
||||
{addJsDef is_occupancy_wise_search=$is_occupancy_wise_search|boolval}
|
||||
{addJsDef occupancy_required_for_booking=$occupancy_required_for_booking|boolval}
|
||||
{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}
|
||||
|
||||
@@ -58,8 +58,6 @@ $(document).ready(function(){
|
||||
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 (elementVal < max_child_in_room && elementVal < max_allowed_for_current) {
|
||||
element.val(elementVal + 1);
|
||||
|
||||
Reference in New Issue
Block a user