Merge branch 'develop' into gli-2941

This commit is contained in:
amit sharma
2026-08-24 16:30:37 +05:30
40 changed files with 510 additions and 380 deletions

View File

@@ -478,41 +478,42 @@ $(document).ready(function() {
$('.no-htl-access-option').on('click', function() {
$(this).prop('selected', false);
});
initTooltip();
}); //end dom ready
function initTooltip() {
if (!$('.tooltip-trigger').length) {
return;
}
$('.tooltip-trigger').each(function () {
if ($(this).data('ui-tooltip')) {
return;
}
$(this).tooltip({
content: $(this).siblings('.tooltip-content').html(),
items: 'span',
trigger: 'hover',
tooltipClass: 'tooltip-popup',
open: function (event, ui) {
if (typeof event.originalEvent === 'undefined') {
return false;
}
var $id = $(ui.tooltip).attr('id');
if ($('div.ui-tooltip').not('#' + $id).length) {
return false;
}
},
close: function (event, ui) {
ui.tooltip.hover(
function () { $(this).stop(true).fadeTo(400, 1); },
function () { $(this).fadeOut(400, function () { $(this).remove(); }); }
);
}
});
});
function initTooltip($target, contentFn, items) {
var $elements = $target || $('.tooltip-trigger');
if (!$elements.length) {
return;
}
$elements.each(function () {
var $this = $(this);
if (!contentFn && $this.data('ui-tooltip')) {
return;
}
$this.tooltip({
content: contentFn || $this.next('.tooltip-content').html(),
items: items || 'span',
trigger: 'hover',
tooltipClass: 'tooltip-popup',
open: function (event, ui) {
if (event.buttons == 1 || event.buttons == 3) {
ui.tooltip.remove();
}
if (typeof event.originalEvent === 'undefined') {
return false;
}
var $id = $(ui.tooltip).attr('id');
if ($('div.ui-tooltip').not('#' + $id).length) {
return false;
}
},
close: function (event, ui) {
ui.tooltip.hover(
function () { $(this).stop(true).fadeTo(300, 1); },
function () { $(this).fadeOut(300, function () { $(this).remove(); }); }
);
}
});
});
}
$(document).ready(function () {
initTooltip();
});

View File

@@ -3,6 +3,10 @@ Modernizr.load([
test: window.matchMedia,
nope: ["themes/default/js/vendor/matchMedia.js", "themes/default/js/vendor/matchMedia.addListener.js"]
},
"themes/default/js/vendor/enquire.min.js",
"themes/default/js/admin-theme.js",
{
load: ["themes/default/js/vendor/enquire.min.js", "themes/default/js/admin-theme.js"],
complete: function() {
$(document).trigger('admin-theme.js.ready');
}
}
]);

View File

@@ -309,36 +309,3 @@ body.display-modal
.page-topbar
#help-container
margin-top: 140px
.tooltip-trigger
cursor: pointer
display: inline-block
vertical-align: middle
margin-left: 4px
.ui-tooltip.tooltip-popup
background: #ffffff
border: 1px solid #ddd
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2)
color: #333333
padding: 8px 12px
font-size: 13px
ul
margin: 0
padding: 0 0 0 16px
list-style: disc
li
padding: 2px 0
.tooltip-row
display: flex
justify-content: space-between
align-items: center
gap: 12px
margin: 3px 0
white-space: nowrap
label
font-weight: 600
margin: 0
.tooltip-cont
max-width: 200px

View File

@@ -1,5 +1,4 @@
.tooltip_cont
min-width: 280px
width: 100%
font-size: 14px
font-weight: 600
@@ -7,6 +6,7 @@
margin-bottom: 10px
.tip-body > div
margin-bottom: 6px
margin-right: 10px
.tip_element_head
font-size: 12px
@@ -28,3 +28,30 @@
border: none
padding: 10px
box-shadow: 0px 0px 15px 0px rgba(0, 0, 0, 0.15)
width: auto
.tooltip-trigger
cursor: pointer
display: inline-block
vertical-align: middle
.ui-tooltip.tooltip-popup
ul
margin: 0
padding: 0 0 0 16px
list-style: disc
li
padding: 2px 0
.tooltip-popup-row
display: flex
justify-content: space-between
align-items: center
gap: 12px
margin: 3px 0
white-space: nowrap
label
font-weight: 600
margin: 0

View File

@@ -0,0 +1,30 @@
{*
* 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
*}
{capture name='tooltip_list_content'}
<ul>
{foreach $tooltip_items as $tooltip_item}
<li>{$tooltip_item|escape:'html':'UTF-8'}</li>
{/foreach}
</ul>
{/capture}
{include file='helpers/tooltip.tpl' tooltip_content=$smarty.capture.tooltip_list_content allow_html=true}

View File

@@ -0,0 +1,47 @@
{**
* 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
*}
{capture name='stay_periods_tooltip'}
<div class="bootstrap tooltip_cont">
<div class="tip_header">
<div>{l s='Stay Periods'}</div>
</div>
<table class="table">
<thead>
<tr>
<th class="tip_element_head">{l s='Duration'}</th>
<th class="tip_element_head">{l s='Rooms'}</th>
</tr>
</thead>
<tbody>
{foreach from=$stay_periods item=stay_period}
<tr>
<td class="tip_element_value">{$stay_period.from} &ndash; {$stay_period.to}</td>
<td class="tip_element_value center">{$stay_period.count}</td>
</tr>
{/foreach}
</tbody>
</table>
</div>
{/capture}
{capture name='stay_periods_tooltip_title'}<span class="badge tooltip-trigger">+{$extra_stay_periods_count}</span>{/capture}
{include file='helpers/tooltip.tpl' tooltip_content=$smarty.capture.stay_periods_tooltip tooltip_title=$smarty.capture.stay_periods_tooltip_title}

View File

@@ -1404,6 +1404,7 @@
{
$("#customer_cart_details").empty();
$("#customer_cart_details").append(res.cart_detail_html);
initTooltip();
displaySummary(res);
}

View File

@@ -66,7 +66,7 @@
{capture name='room_type_service_tooltip_content'}
{assign var="priceCalcMethod" value=$product['price_calculation_method']|default:0}
<div class="tooltip-cont">
<div class="tooltip-row"><label>{l s='Applied on:'}</label></div>
<div class="tooltip-popup-row"><label>{l s='Applied on:'}</label></div>
<ul class="tooltip-days">
{foreach from=Product::getPriceCalculationMethodDaysLabel($priceCalcMethod) item='pcmDayLabel'}
<li>{$pcmDayLabel}</li>

View File

@@ -58,7 +58,7 @@
{capture name='room_type_service_tooltip_content'}
{assign var="priceCalcMethod" value=$service['price_calculation_method']|default:0}
<div class="tooltip-cont">
<div class="tooltip-row"><label>{l s='Applied on:'}</label></div>
<div class="tooltip-popup-row"><label>{l s='Applied on:'}</label></div>
<ul class="tooltip-days">
{foreach from=Product::getPriceCalculationMethodDaysLabel($priceCalcMethod) item='pcmDayLabel'}
<li>{$pcmDayLabel}</li>
@@ -153,7 +153,7 @@
{capture name='adm_pcm_tooltip_content'}
{assign var="priceCalcMethod" value=$product['price_calculation_method']|default:0}
<div class="tooltip-cont">
<div class="tooltip-row"><label>{l s='Applied on:'}</label></div>
<div class="tooltip-popup-row"><label>{l s='Applied on:'}</label></div>
<ul class="tooltip-days">
{foreach from=Product::getPriceCalculationMethodDaysLabel($priceCalcMethod) item='pcmDayLabel'}
<li>{$pcmDayLabel}</li>
@@ -323,7 +323,7 @@
{capture name='room_type_service_pcm_tooltip_content'}
{assign var="priceCalcMethod" value=$service['price_calculation_method']|default:0}
<div class="tooltip-cont">
<div class="tooltip-row"><label>{l s='Applied on:'}</label></div>
<div class="tooltip-popup-row"><label>{l s='Applied on:'}</label></div>
<ul class="tooltip-days">
{foreach from=Product::getPriceCalculationMethodDaysLabel($priceCalcMethod) item='pcmDayLabel'}
<li>{$pcmDayLabel}</li>

View File

@@ -20,63 +20,22 @@
* @license https://opensource.org/license/osl-3-0-php Open Software License version 3.0
*}
{if isset($htl_connected_rooms) && $htl_connected_rooms|@count > 0}
<span class="connected-room-tooltip-trigger"
data-connected-details='{json_encode($htl_connected_rooms.connected_room_types)|escape:'html':'UTF-8'}'>
<i class="icon-random" style="color: #008abd; cursor: pointer;"></i>
</span>
{capture name='connected_room_tooltip'}
<div class="tooltip_cont">
<div class="tip_header"><div class="tip_date">{l s='Connected Rooms'}</div></div>
<div class="tip-body tip-body-grid">
{foreach from=$htl_connected_rooms.connected_room_types item=group}
<div>
<div class="tip_element_head">{$group.room_type_name|escape:'html':'UTF-8'}</div>
<div class="tip_element_value">
{foreach from=$group.connected_rooms item=room name=connected_rooms}
{$room.name|escape:'html':'UTF-8'}{if !$smarty.foreach.connected_rooms.last}, {/if}
{/foreach}
</div>
</div>
{/foreach}
</div>
</div>
{/capture}
{include file='helpers/tooltip.tpl' tooltip_content=$smarty.capture.connected_room_tooltip tooltip_icon_class='icon-random' tooltip_icon_style='color: #008abd;' }
{/if}
<script>
$(document).ready(function() {
{literal}
if (typeof window.initConnectedRoomTooltips === 'undefined') {
window.initConnectedRoomTooltips = function() {
if (typeof $.fn.tooltip === 'undefined' || typeof $.ui === 'undefined' || typeof $.ui.tooltip === 'undefined') {
return;
}
$('.connected-room-tooltip-trigger').each(function() {
if ($(this).data('ui-tooltip')) {
return;
}
$(this).tooltip({
items: '.connected-room-tooltip-trigger',
content: function() {
var details = $(this).data('connected-details');
if (!details || $.isEmptyObject(details)) {
return "{/literal}{l s='No rooms connected' js=1}{literal}";
}
var html = '<div class="tooltip_cont">';
html += '<div class="tip_header"><div class="tip_date">{/literal}{l s="Connected Rooms" js=1}{literal}</div></div>';
html += '<div class="tip-body tip-body-grid">';
for (var typeId in details) {
var group = details[typeId];
var names = [];
for (var i = 0; i < group.connected_rooms.length; i++) {
names.push(group.connected_rooms[i].name);
}
html += '<div>';
html += '<div class="tip_element_head">' + group.room_type_name + '</div>';
html += '<div class="tip_element_value">' + names.join(', ') + '</div>';
html += '</div>';
}
html += '</div></div>';
return html;
},
position: { my: "left top+10", at: "left bottom", collision: "flipfit", within: "#content" },
close: function(event, ui) {
ui.tooltip.hover(function() {
$(this).stop(true).fadeTo(300, 1);
},
function() {
$(this).fadeOut('300', function() {
$(this).remove();
});
});
}
});
});
};
}
window.initConnectedRoomTooltips();
{/literal}
});
</script>

View File

@@ -300,8 +300,8 @@
{if $params.type == 'range'}
{$field_name="`$list_id`Filter_{if isset($params.filter_key)}`$params.filter_key`{else}`$key`{/if}"}
<div class="input_range">
<input type="text" class="filter form-control" name="{$field_name}[0]" placeholder="{l s='From'}" value="{if isset($smarty.post[$field_name][0]) && $smarty.post[$field_name][0]}{$smarty.post[$field_name][0]}{elseif isset($params.value.0)}{$params.value.0}{/if}">
<input type="text" class="filter form-control" name="{$field_name}[1]" placeholder="{l s='To'}" value="{if isset($smarty.post[$field_name][1]) && $smarty.post[$field_name][1]}{$smarty.post[$field_name][1]}{elseif isset($params.value.1)}{$params.value.1}{/if}">
<input type="text" class="filter form-control" name="{$field_name}[0]" placeholder="{l s='From'}" value="{if isset($smarty.post[$field_name][0]) && $smarty.post[$field_name][0]}{$smarty.post[$field_name][0]|escape:'html':'UTF-8'}{elseif isset($params.value.0)}{$params.value.0}{/if}">
<input type="text" class="filter form-control" name="{$field_name}[1]" placeholder="{l s='To'}" value="{if isset($smarty.post[$field_name][1]) && $smarty.post[$field_name][1]}{$smarty.post[$field_name][1]|escape:'html':'UTF-8'}{elseif isset($params.value.1)}{$params.value.1}{/if}">
</div>
{elseif $params.type == 'bool'}
{$field_name="`$list_id`Filter_{if isset($params.filter_key)}`$params.filter_key`{else}`$key`{/if}"}
@@ -314,14 +314,14 @@
<div class="date_range">
<div class="input-group center">
<input type="text" class="filter datepicker date-input form-control" id="local_{$params.id_date}_0" name="local_{$params.name_date}[0]" placeholder="{l s='From'}" autocomplete="off"/>
<input type="hidden" id="{$params.id_date}_0" name="{$params.name_date}[0]" value="{if isset($smarty.post[$params.name_date][0]) && $smarty.post[$params.name_date][0]}{$smarty.post[$params.name_date][0]}{elseif isset($params.value.0)}{$params.value.0}{/if}">
<input type="hidden" id="{$params.id_date}_0" name="{$params.name_date}[0]" value="{if isset($smarty.post[$params.name_date][0]) && $smarty.post[$params.name_date][0]}{$smarty.post[$params.name_date][0]|escape:'html':'UTF-8'}{elseif isset($params.value.0)}{$params.value.0}{/if}">
<span class="input-group-addon">
<i class="icon-calendar"></i>
</span>
</div>
<div class="input-group center">
<input type="text" class="filter datepicker date-input form-control" id="local_{$params.id_date}_1" name="local_{$params.name_date}[1]" placeholder="{l s='To'}" autocomplete="off"/>
<input type="hidden" id="{$params.id_date}_1" name="{$params.name_date}[1]" value="{if isset($smarty.post[$params.name_date][1]) && $smarty.post[$params.name_date][1]}{$smarty.post[$params.name_date][1]}{elseif isset($params.value.1)}{$params.value.1}{/if}">
<input type="hidden" id="{$params.id_date}_1" name="{$params.name_date}[1]" value="{if isset($smarty.post[$params.name_date][1]) && $smarty.post[$params.name_date][1]}{$smarty.post[$params.name_date][1]|escape:'html':'UTF-8'}{elseif isset($params.value.1)}{$params.value.1}{/if}">
<span class="input-group-addon">
<i class="icon-calendar"></i>
</span>
@@ -398,7 +398,7 @@
{/if}
{else}
{$field_name="`$list_id`Filter_{if isset($params.filter_key)}`$params.filter_key`{else}`$key`{/if}"}
<input type="text" id="filter_input_{$key}" class="filter" name="{$field_name}" value="{if isset($smarty.post.$field_name) && $smarty.post.$field_name}{$smarty.post.$field_name}{else}{$params.value|escape:'html':'UTF-8'}{/if}" {if isset($params.width) && $params.width != 'auto'} style="width:{$params.width}px"{/if} />
<input type="text" id="filter_input_{$key}" class="filter" name="{$field_name}" value="{if isset($smarty.post.$field_name) && $smarty.post.$field_name}{$smarty.post.$field_name|escape:'html':'UTF-8'}{else}{$params.value|escape:'html':'UTF-8'}{/if}" {if isset($params.width) && $params.width != 'auto'} style="width:{$params.width}px"{/if} />
{/if}
</div>
</div>

View File

@@ -20,21 +20,19 @@
* @license https://opensource.org/license/osl-3-0-php Open Software License version 3.0
*}
<span class="tooltip-trigger{if isset($tooltip_class) && $tooltip_class} {$tooltip_class|escape:'html':'UTF-8'}{/if}">
<img src="themes/default/img/icon-info.svg" />
{if isset($tooltip_title) && $tooltip_title}
{$tooltip_title nofilter}
{elseif isset($tooltip_icon_class) && $tooltip_icon_class}
<i class="{$tooltip_icon_class|escape:'html':'UTF-8'}"{if isset($tooltip_icon_style) && $tooltip_icon_style} style="{$tooltip_icon_style|escape:'html':'UTF-8'}"{/if}></i>
{else}
<img src="themes/default/img/icon-info.svg" alt="" />
{/if}
</span>
<div class="tooltip-content" style="display: none;">
{if isset($tooltip_items) && $tooltip_items|@count}
<ul class="tooltip-days">
{foreach $tooltip_items as $item}
<li>{$item|escape:'html':'UTF-8'}</li>
{/foreach}
</ul>
{elseif isset($allow_html) && $allow_html}
{$tooltip_content nofilter}
{else}
{$tooltip_content|escape:'html':'UTF-8'}
{/if}
{if isset($allow_html) && !$allow_html}
{$tooltip_content|escape:'html':'UTF-8'}
{else}
{$tooltip_content nofilter}
{/if}
</div>

View File

@@ -919,9 +919,9 @@ class LanguageCore extends ObjectModel
$file = _PS_TRANSLATIONS_DIR_.(string)$iso.'.gzip';
if (!$lang_pack_link = Tools::file_get_contents(_QLO_API_URL_.'/lang_pack/get_lang_pack.php?version='.$version.'&iso_lang='.Tools::strtolower((string)$iso))) {
$errors[] = Tools::displayError('Archive cannot be downloaded from prestashop.com.');
$errors[] = Tools::displayError('Archive cannot be downloaded from QloApps Api.');
} elseif (!$lang_pack = json_decode($lang_pack_link)) {
$errors[] = Tools::displayError('Error occurred when language was checked according to your Prestashop version.');
$errors[] = Tools::displayError('Error occurred when language was checked according to your QloApps version.');
} elseif (empty($lang_pack->error) && ($content = Tools::file_get_contents($lang_pack->download_link))) {
if (!@file_put_contents($file, $content)) {
if (is_writable(dirname($file))) {

View File

@@ -229,11 +229,17 @@ abstract class PaymentModuleCore extends Module
$this->currentOrderReference = $reference;
$order_creation_failed = false;
$cart_total_paid = (float)Tools::ps_round((float)$this->context->cart->getOrderTotal(true, Cart::BOTH), _PS_PRICE_COMPUTE_PRECISION_);
if ($this->context->cart->is_advance_payment) {
$full_cart_total = (float)Tools::ps_round((float)$this->context->cart->getOrderTotal(true, Cart::BOTH), _PS_PRICE_COMPUTE_PRECISION_);
$amount_paid = !$dont_touch_amount ? Tools::ps_round((float)$amount_paid, _PS_PRICE_COMPUTE_PRECISION_) : $amount_paid;
if ($amount_paid >= $full_cart_total) {
$is_advance_payment = false;
$cart_total_paid = $full_cart_total;
} else {
$is_advance_payment = true;
$cart_total_paid = (float)Tools::ps_round(
(float)$this->context->cart->getOrderTotal(true, CART::ADVANCE_PAYMENT),
(float)$this->context->cart->getOrderTotal(true, Cart::ADVANCE_PAYMENT),
_PS_PRICE_COMPUTE_PRECISION_
);
}
@@ -314,7 +320,6 @@ abstract class PaymentModuleCore extends Module
$order->gift_message = $this->context->cart->gift_message;
$order->mobile_theme = $this->context->cart->mobile_theme;
$order->conversion_rate = $this->context->currency->conversion_rate;
$amount_paid = !$dont_touch_amount ? Tools::ps_round((float)$amount_paid, _PS_PRICE_COMPUTE_PRECISION_) : $amount_paid;
$order->total_paid_real = 0;
$order->total_products = (float)$this->context->cart->getOrderTotal(false, Cart::ONLY_PRODUCTS, $order->product_list, $id_carrier);
@@ -371,7 +376,7 @@ abstract class PaymentModuleCore extends Module
}
// advance payment information
$order->is_advance_payment = $this->context->cart->is_advance_payment;
$order->is_advance_payment = (int)$is_advance_payment;
$order->amount_paid = 0;
if ($order->is_advance_payment) {
$order->advance_paid_amount = (float)Tools::ps_round(
@@ -892,7 +897,7 @@ abstract class PaymentModuleCore extends Module
/*for saving details of the advance payment product wise*/
$objBookingDetail->total_paid_amount = $total_price['total_price_tax_incl'];
if ($this->context->cart->is_advance_payment) {
if ($is_advance_payment) {
$prod_adv_payment = $objAdvancedPayment->getIdAdvPaymentByIdProduct($idProduct);
if (!$prod_adv_payment
|| (isset($prod_adv_payment['payment_type']) && $prod_adv_payment['payment_type'])

View File

@@ -455,7 +455,7 @@ class AdminNormalProductsControllerCore extends AdminController
'tooltip_items' => $options,
));
$tooltip = $this->context->smarty->fetch('helpers/tooltip.tpl');
$tooltip = $this->context->smarty->fetch('controllers/normal_products/_price_calculation_method_options.tpl');
return count($options) . ' ' . $this->l('Selected') . ' ' . $tooltip;
}

View File

@@ -72,6 +72,7 @@ class AdminOrdersControllerCore extends AdminController
) FROM `'._DB_PREFIX_.'htl_booking_detail` hbd WHERE hbd.`id_order` = a.`id_order`) as total_guests,
(SELECT SUM(DATEDIFF(hbd.`date_to`, hbd.`date_from`)) FROM `'._DB_PREFIX_.'htl_booking_detail` hbd WHERE hbd.`id_order` = a.`id_order`) as los,
hbd.`id_room` AS id_room_information,
(SELECT GROUP_CONCAT(CONCAT(ps.period, \'~\', ps.cnt) ORDER BY ps.period SEPARATOR \'::\') FROM (SELECT CONCAT(hbd.`date_from`, \'|\', hbd.`date_to`) AS period, COUNT(*) AS cnt FROM `'._DB_PREFIX_.'htl_booking_detail` hbd WHERE hbd.`id_order` = a.`id_order` GROUP BY hbd.`date_from`, hbd.`date_to`) AS ps) AS stay_periods,
(SELECT COUNT(spod.`id_service_product_order_detail`) FROM `'._DB_PREFIX_.'service_product_order_detail` spod WHERE spod.`id_order` = a.`id_order` AND spod.`id_htl_booking_detail`=0) as num_products';
$this->_join = '
@@ -196,6 +197,15 @@ class AdminOrdersControllerCore extends AdminController
'type'=>'date',
'displayed' => false,
),
'stay_periods' => array(
'title' => $this->l('Stay Periods'),
'type' => 'text',
'callback' => 'formatStayPeriods',
'optional' => true,
'search' => false,
'displayed' => true,
'visible_default' => true,
),
'total_guests' => array(
'title' => $this->l('Guests'),
'type' => 'range',
@@ -212,7 +222,7 @@ class AdminOrdersControllerCore extends AdminController
'visible_default' => true
),
'los' => array(
'title' => $this->l('Stay period'),
'title' => $this->l('Stay duration'),
'align' => 'text-center',
'type' => 'range',
'havingFilter' => true,
@@ -359,6 +369,43 @@ class AdminOrdersControllerCore extends AdminController
return Tools::displayPrice($echo, (int)$idCurrency);
}
public function formatStayPeriods($value, $row)
{
if (empty($value)) {
return '--';
}
$stayPeriods = array();
foreach (explode('::', $value) as $stays) {
$countStays = explode('~', $stays);
$stayDates = explode('|', $countStays[0]);
if (count($stayDates) === 2) {
$stayPeriods[] = array(
'from' => Tools::displayDate(trim($stayDates[0])),
'to' => Tools::displayDate(trim($stayDates[1])),
'count' => isset($countStays[1]) ? (int)$countStays[1] : 1,
);
}
}
$datesDisplay = array();
foreach (array_slice($stayPeriods, 0, 1) as $stayPeriod) {
$datesDisplay[] = $stayPeriod['from'].' - '.$stayPeriod['to'];
}
$stayPeriodHtml = implode('<br>', $datesDisplay);
$uniqueStayPeriods = count($stayPeriods);
if ($uniqueStayPeriods > 1) {
$this->context->smarty->assign(array(
'stay_periods' => $stayPeriods,
'extra_stay_periods_count' => $uniqueStayPeriods - 1,
));
$stayPeriodHtml .= ' '.$this->createTemplate('_stay_periods_tooltip.tpl')->fetch();
}
return $stayPeriodHtml;
}
public function initPageHeaderToolbar()
{
if (empty($this->display)) {
@@ -1409,7 +1456,6 @@ class AdminOrdersControllerCore extends AdminController
$this->addJqueryUI('ui.datepicker');
$this->addJqueryUI('ui.tooltip', 'base', true);
$this->addJS(_PS_JS_DIR_.'vendor/d3.v3.min.js');
$this->addJqueryUI(array('ui.tooltip'), 'base', true);
@@ -4005,10 +4051,11 @@ class AdminOrdersControllerCore extends AdminController
$this->errors[] = $this->l('Please select a file to upload.');
} elseif ($objHotelBookingDocument->fileInfo['size'] > Tools::getMaxUploadSize()) {
$this->errors[] = $this->l('Uploaded file size is too large.');
} elseif(!(ImageManager::isRealImage($objHotelBookingDocument->fileInfo['tmp_name'])
|| $objHotelBookingDocument->fileInfo['mime'] == 'application/pdf')
) {
$this->errors[] = $this->l('Please upload an image or a PDF file only. Allowed image formats: .gif, .jpg, .jpeg and .png');
} else {
$objHotelBookingDocument->setFileType();
if (!$objHotelBookingDocument->file_type) {
$this->errors[] = $this->l('Please upload an image or a PDF file only. Allowed image formats: .gif, .jpg, .jpeg and .png');
}
}
} else {
$this->errors[] = Tools::displayError('You do not have permission to edit this order.');

View File

@@ -237,11 +237,11 @@ class ContactControllerCore extends FrontController
$this->addJS(_PS_JS_DIR_.'validate.js');
// GOOGLE MAP
if (($PS_API_KEY = Configuration::get('PS_API_KEY')) && ($PS_MAP_ID = Configuration::get('PS_MAP_ID')) && Configuration::get('WK_GOOGLE_ACTIVE_MAP')) {
if (($PS_API_KEY = Configuration::get('PS_API_KEY')) && Configuration::get('WK_GOOGLE_ACTIVE_MAP')) {
Media::addJsDef(
array(
'PS_STORES_ICON' => $this->context->link->getMediaLink(_PS_IMG_.Configuration::get('PS_STORES_ICON')),
'PS_MAP_ID' => $PS_MAP_ID,
'PS_MAP_ID' => Configuration::get('PS_MAP_ID'),
)
);
$this->addJS(

View File

@@ -639,7 +639,6 @@ class GuestTrackingControllerCore extends FrontController
if (Validate::isLoadedObject($objHotelBranchInformation)) {
if (($apiKey = Configuration::get('PS_API_KEY'))
&& Configuration::get('WK_GOOGLE_ACTIVE_MAP')
&& ($PS_MAP_ID = Configuration::get('PS_MAP_ID'))
) {
if (floatval($objHotelBranchInformation->latitude) != 0
&& floatval($objHotelBranchInformation->longitude) != 0
@@ -647,7 +646,7 @@ class GuestTrackingControllerCore extends FrontController
Media::addJsDef(array(
'PS_STORES_ICON' => $this->context->link->getMediaLink(_PS_IMG_.Configuration::get('PS_STORES_ICON')),
'initiateMap' => 1,
'PS_MAP_ID' => $PS_MAP_ID,
'PS_MAP_ID' => Configuration::get('PS_MAP_ID'),
));
$this->addJS(

View File

@@ -884,7 +884,6 @@ class OrderDetailControllerCore extends FrontController
if (Validate::isLoadedObject($objHotelBranchInformation)) {
if (($apiKey = Configuration::get('PS_API_KEY'))
&& Configuration::get('WK_GOOGLE_ACTIVE_MAP')
&& ($PS_MAP_ID = Configuration::get('PS_MAP_ID'))
) {
if (floatval($objHotelBranchInformation->latitude) != 0
&& floatval($objHotelBranchInformation->longitude) != 0
@@ -892,7 +891,7 @@ class OrderDetailControllerCore extends FrontController
Media::addJsDef(array(
'PS_STORES_ICON' => $this->context->link->getMediaLink(_PS_IMG_.Configuration::get('PS_STORES_ICON')),
'initiateMap' => 1,
'PS_MAP_ID' => $PS_MAP_ID,
'PS_MAP_ID' => Configuration::get('PS_MAP_ID'),
));
$this->addJS(
'https://maps.googleapis.com/maps/api/js?key='.$apiKey.'&libraries=places,marker&loading=async&callback=initMap&language='.

View File

@@ -111,7 +111,7 @@ class OurPropertiesControllerCore extends FrontController
$hotelsInfo = array_slice($hotelsInfo, $page * 10, 10);
}
if ($displayHotelMap && Configuration::get('PS_API_KEY') && Configuration::get('WK_GOOGLE_ACTIVE_MAP') && Configuration::get('PS_MAP_ID')) {
if ($displayHotelMap && Configuration::get('PS_API_KEY') && Configuration::get('WK_GOOGLE_ACTIVE_MAP')) {
if ($hotelLocations = $objHotelInfo->getMapFormatHotelsInfo(Configuration::get('WK_MAP_HOTEL_ACTIVE_ONLY'))) {
$hotelLocationArray = str_replace(array('\n', '\r'), '', json_encode($hotelLocations));
}
@@ -144,11 +144,11 @@ class OurPropertiesControllerCore extends FrontController
$this->addJS(_THEME_JS_DIR_.'our-properties.js');
$this->addCSS(_THEME_CSS_DIR_.'our-properties.css');
// GOOGLE MAP
if (($PS_API_KEY = Configuration::get('PS_API_KEY')) && ($PS_MAP_ID = Configuration::get('PS_MAP_ID')) && Configuration::get('WK_GOOGLE_ACTIVE_MAP')) {
if (($PS_API_KEY = Configuration::get('PS_API_KEY')) && Configuration::get('WK_GOOGLE_ACTIVE_MAP')) {
Media::addJsDef(
array(
'PS_STORES_ICON' => $this->context->link->getMediaLink(_PS_IMG_.Configuration::get('PS_STORES_ICON')),
'PS_MAP_ID' => $PS_MAP_ID
'PS_MAP_ID' => Configuration::get('PS_MAP_ID')
)
);

View File

@@ -67,9 +67,7 @@ class ProductControllerCore extends FrontController
$this->addJqueryPlugin('jqzoom');
}
if (($PS_API_KEY = Configuration::get('PS_API_KEY'))
&& ($PS_MAP_ID = Configuration::get('PS_MAP_ID'))
) {
if ($PS_API_KEY = Configuration::get('PS_API_KEY')) {
$objHotelRoomType = new HotelRoomType();
if ($roomTypeInfo = $objHotelRoomType->getRoomTypeInfoByIdProduct($this->product->id)) {
$objHotelBranchInformation = new HotelBranchInformation($roomTypeInfo['id_hotel']);
@@ -82,7 +80,7 @@ class ProductControllerCore extends FrontController
'longitude' => $objHotelBranchInformation->longitude,
),
'PS_STORES_ICON' => $this->context->link->getMediaLink(_PS_IMG_.Configuration::get('PS_STORES_ICON')),
'PS_MAP_ID' => $PS_MAP_ID
'PS_MAP_ID' => Configuration::get('PS_MAP_ID')
));
$this->addJS(

View File

@@ -347,7 +347,10 @@ class InstallModelInstall extends InstallAbstractModel
if (InstallSession::getInstance()->safe_mode) {
Language::checkAndAddLanguage($iso, false, true, $params_lang);
} else {
Language::downloadAndInstallLanguagePack($iso, _QLO_INSTALL_VERSION_, $params_lang);
$lang_pack_response = Language::downloadAndInstallLanguagePack($iso, _QLO_INSTALL_VERSION_, $params_lang);
if ($lang_pack_response !== true) {
Language::checkAndAddLanguage($iso, false, true, $params_lang);
}
}
Language::loadLanguages();

View File

@@ -133,16 +133,19 @@ class HotelBookingDocument extends ObjectModel
public function getDestinationFilePath()
{
$fileExtension = pathinfo($this->fileInfo['rename'], PATHINFO_EXTENSION);
return $this->documentFolder.$this->id.'.'.$fileExtension;
return $this->documentFolder.$this->id.'.'.$this->getFileExtension();
}
public function setFileType()
{
if (ImageManager::isRealImage($this->fileInfo['tmp_name'])) {
$content = @file_get_contents($this->fileInfo['tmp_name']);
$activeContentPattern = '/\/(JavaScript|JS|OpenAction|AA|Launch|SubmitForm|ImportData)\b/i';
$this->imageInfo = @getimagesize($this->fileInfo['tmp_name']);
if ($this->imageInfo && ImageManager::isRealImage($this->fileInfo['tmp_name'])) {
$this->file_type = self::FILE_TYPE_IMAGE;
} elseif ($this->fileInfo['mime'] == 'application/pdf') {
} elseif ($content !== false && substr($content, 0, 5) === '%PDF-' && !preg_match($activeContentPattern, $content)) {
$this->file_type = self::FILE_TYPE_PDF;
} else {
$this->file_type = 0;
@@ -151,8 +154,22 @@ class HotelBookingDocument extends ObjectModel
public function setFileName()
{
$fileExtension = pathinfo($this->fileInfo['rename'], PATHINFO_EXTENSION);
$this->file_name = $this->id.'.'.$fileExtension;
$this->file_name = $this->id.'.'.$this->getFileExtension();
}
/**
* Extension is derived from the file's real, validated content
* (getimagesize()/PDF signature), captured once in setFileType(),
* never from the uploaded filename or mime header (both are
* attacker-controlled).
*/
public function getFileExtension()
{
if ($this->file_type == self::FILE_TYPE_PDF) {
return 'pdf';
}
return image_type_to_extension($this->imageInfo[2], false);
}
public function getContentType()

View File

@@ -55,8 +55,8 @@ class HotelBranchInformation extends ObjectModel
'check_in' => array('type' => self::TYPE_STRING, 'required' => true),
'check_out' => array('type' => self::TYPE_STRING, 'required' => true),
'active' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
'latitude' => array('type' => self::TYPE_FLOAT, 'validate' => 'isFloat'),
'longitude' => array('type' => self::TYPE_FLOAT, 'validate' => 'isFloat'),
'latitude' => array('type' => self::TYPE_FLOAT, 'validate' => 'isCoordinate'),
'longitude' => array('type' => self::TYPE_FLOAT, 'validate' => 'isCoordinate'),
'map_formated_address' => array('type' => self::TYPE_HTML, 'validate' => 'isCleanHtml'),
'map_input_text' => array('type' => self::TYPE_STRING, 'validate' => 'isString'),
'active_refund' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),

View File

@@ -211,7 +211,7 @@ class AdminAddHotelController extends ModuleAdminController
}
$smartyVars['state_var'] = $stateOptions;
$smartyVars['enabledDisplayMap'] = Configuration::get('PS_API_KEY') && Configuration::get('PS_MAP_ID') && Configuration::get('WK_GOOGLE_ACTIVE_MAP');
$smartyVars['enabledDisplayMap'] = Configuration::get('PS_API_KEY') && Configuration::get('WK_GOOGLE_ACTIVE_MAP');
$smartyVars['ps_img_dir'] = _PS_IMG_.'l/';
$smartyVars['PS_MAX_CHECKOUT_OFFSET'] = (int) Configuration::get('PS_MAX_CHECKOUT_OFFSET');
$smartyVars['PS_MIN_BOOKING_OFFSET'] = (int) Configuration::get('PS_MIN_BOOKING_OFFSET');
@@ -258,8 +258,8 @@ class AdminAddHotelController extends ModuleAdminController
$maxCheckoutOffset = trim(Tools::getValue('max_checkout_offset'));
$enableUseGlobalMinBookingOffset = Tools::getValue('enable_use_global_min_booking_offset');
$minBookingOffset = trim(Tools::getValue('min_booking_offset'));
$latitude = Tools::getValue('loclatitude');
$longitude = Tools::getValue('loclongitude');
$latitude = number_format((float) Tools::getValue('loclatitude'), 8, '.', '');
$longitude = number_format((float) Tools::getValue('loclongitude'), 8, '.', '');
$map_formated_address = Tools::getValue('locformatedAddr');
$map_input_text = Tools::getValue('googleInputField');
$hotelAmenities = Tools::getValue('id_amenities', array());
@@ -610,8 +610,8 @@ class AdminAddHotelController extends ModuleAdminController
$objHotelBranch->check_in = $check_in;
$objHotelBranch->check_out = $check_out;
$objHotelBranch->rating = $rating;
$objHotelBranch->latitude = Validate::isFloat($latitude) ? Tools::ps_round($latitude, 8) : $latitude;
$objHotelBranch->longitude = Validate::isFloat($longitude) ? Tools::ps_round($longitude, 8) : $longitude;
$objHotelBranch->latitude = Validate::isCoordinate($latitude) ? Tools::ps_round($latitude, 8) : $latitude;
$objHotelBranch->longitude = Validate::isCoordinate($longitude) ? Tools::ps_round($longitude, 8) : $longitude;
$objHotelBranch->map_formated_address = $map_formated_address;
$objHotelBranch->map_input_text = $map_input_text;
$objHotelBranch->save();
@@ -994,7 +994,7 @@ class AdminAddHotelController extends ModuleAdminController
// GOOGLE MAP
$language = $this->context->language;
$country = $this->context->country;
if (($PS_API_KEY = Configuration::get('PS_API_KEY')) && $PS_MAP_ID) {
if ($PS_API_KEY = Configuration::get('PS_API_KEY')) {
$this->addJS(
'https://maps.googleapis.com/maps/api/js?key='.$PS_API_KEY.'&libraries=places,marker&loading=async&language='.
$language->iso_code.'&region='.$country->iso_code.'&callback=initGoogleMaps'

View File

@@ -34,7 +34,11 @@ class AdminBookingDocumentController extends ModuleAdminController
$contentLength = $objHotelBookingDocument->getContentLength();
$filePath = $objHotelBookingDocument->getPhysicalPath();
$downloadFileName = $objHotelBookingDocument->getDownloadFileName();
$contentDisposition = Tools::getValue('is_preview') ? 'inline' : 'attachment';
// Only images are safe to render inline; PDFs can carry embedded JavaScript
// that executes when opened inline, so they always force a download instead.
$contentDisposition = (Tools::getValue('is_preview')
&& $objHotelBookingDocument->file_type == HotelBookingDocument::FILE_TYPE_IMAGE)
? 'inline' : 'attachment';
if (Tools::file_exists_cache($filePath)) {
if (ob_get_level() && ob_get_length() > 0) {

View File

@@ -398,13 +398,15 @@ class AdminHotelGeneralSettingsController extends ModuleAdminController
'PS_API_KEY' => array(
'title' => $this->l('Google Maps API Key'),
'hint' => $this->l('Unique API key for Google Maps.'),
'validation' => 'isGenericName',
'type' => 'text',
'desc' => $this->l('Google Maps API Key is required to display Google Maps.')
),
'PS_MAP_ID' => array(
'title' => $this->l('Google Map ID'),
'hint' => $this->l('Map Id for Google Maps.'),
'type' => 'text',
'desc' => $this->l('Google Maps API Key and Google Map ID is required to display Google Maps.')
'hint' => $this->l('Map Id for Google Maps (optional).'),
'validation' => 'isGenericName',
'type' => 'text'
),
'WK_GOOGLE_ACTIVE_MAP' => array(
'title' => $this->l('Display Google Maps For Hotel Location'),
@@ -621,9 +623,6 @@ class AdminHotelGeneralSettingsController extends ModuleAdminController
if (!Tools::getValue('PS_API_KEY')) {
$this->errors[] = $this->l('Please enter Google API key.');
}
if (!Tools::getValue('PS_MAP_ID')) {
$this->errors[] = $this->l('Please enter Google Map Id.');
}
}
if (!trim(Tools::getValue('PS_SHOP_NAME'))) {
$this->errors[] = $this->l('Website name field is required');

View File

@@ -350,7 +350,6 @@ class AdminOrderRefundRequestsController extends ModuleAdminController
'isRefundCompleted' => $objOrderReturn->hasBeenCompleted(),
'paymentMethods' => $paymentMethods,
'name_controller' => Tools::getValue('controller'),
'info_icon_path' => $this->context->link->getMediaLink(_MODULE_DIR_.'hotelreservationsystem/views/img/Slices/icon-info.svg'),
'expiry_date' => time() + (3600 * 24 * 365.25)
)
);

View File

@@ -288,8 +288,8 @@ class HotelReservationSystem extends Module
if (Tools::getValue('controller') == 'category') {
if (($apiKey = Configuration::get('PS_API_KEY'))
&& Configuration::get('WK_GOOGLE_ACTIVE_MAP')
&& ($PS_MAP_ID = Configuration::get('PS_MAP_ID'))
) {
$PS_MAP_ID = Configuration::get('PS_MAP_ID');
$idCategory = Tools::getValue('id_category');
$idHotel = HotelBranchInformation::getHotelIdByIdCategory($idCategory);
$objHotel = new HotelBranchInformation($idHotel, $this->context->language->id);

View File

@@ -24,9 +24,9 @@ body.adminorderrefundrequests .ui-tooltip {
padding: 10px;
box-shadow: 0px 0px 15px 0px #00000026;
}
.ui-tooltip.price_info-tooltip span {
.ui-tooltip.tooltip-popup span {
margin-left: 15px;
}
.ui-tooltip.price_info-tooltip label {
.ui-tooltip.tooltip-popup label {
font-weight: 600;
}

View File

@@ -84,11 +84,15 @@ var GoogleMapsManager = {
if (!this.map) {
var that = this;
that.setDefaultLatLng(function() {
that.map = new google.maps.Map($(that.mapDiv).get(0), {
var mapOptions = {
zoom: that.defaultZoom,
clickableIcons: true,
mapId: PS_MAP_ID
});
};
if (PS_MAP_ID) {
mapOptions.mapId = PS_MAP_ID;
}
that.map = new google.maps.Map($(that.mapDiv).get(0), mapOptions);
google.maps.event.trigger(that.map, 'resize');
that.map.setCenter(that.defaultLatLng);
if (that.defaultLatLng && that.formattedAddress) {
that.addMarker(that.defaultLatLng, null, that.formattedAddress);
@@ -171,12 +175,22 @@ var GoogleMapsManager = {
icon.style.width = '24px';
icon.style.height = '24px';
var marker = new google.maps.marker.AdvancedMarkerElement({
position: latLng,
map: that.map,
content: icon,
draggable: true,
});
var marker;
if (PS_MAP_ID) {
marker = new google.maps.marker.AdvancedMarkerElement({
position: latLng,
map: that.map,
content: icon,
draggable: true,
});
} else {
marker = new google.maps.Marker({
position: latLng,
map: that.map,
icon: PS_STORES_ICON,
draggable: true,
});
}
that.markers.push(marker);
marker.addListener('dragend', function(e) {
var latLng = {
@@ -234,10 +248,10 @@ var GoogleMapsManager = {
that.clearAllMarkers();
});
var latLng = marker.position;
var latLng = marker.position ? marker.position : marker.getPosition();
that.setFormVars({
lat: latLng.lat,
lng: latLng.lng,
lat: typeof latLng.lat === 'function' ? latLng.lat() : latLng.lat,
lng: typeof latLng.lng === 'function' ? latLng.lng() : latLng.lng,
formattedAddress: content,
inputText: $('#pac-input').val(),
});

View File

@@ -23,8 +23,9 @@
$(document).ready(function() {
// calender
if ($('#fullcalendar').length) {
var calendar = new FullCalendar.Calendar($('#fullcalendar').get(0), {
var calendar;
function initBookingCalendar() {
calendar = new FullCalendar.Calendar($('#fullcalendar').get(0), {
initialView: 'dayGridMonth',
initialDate: initialDate,
events: {
@@ -53,32 +54,23 @@ $(document).ready(function() {
if (info.event.extendedProps.is_notification) {
var $cell = $(info.el).closest('td');
$cell.css('background-color', info.event.backgroundColor);
$cell.tooltip({
content: function()
{
$('#date-stats-tooltop .tip_date').text(info.event.extendedProps.data.date_format);
$.each(info.event.extendedProps.data.stats, function(elem, val) {
if (elem == 'num_part_avai') {
$('#date-stats-tooltop').find('.'+elem).hide().find('.tip_element_value').text('');
} else {
$('#date-stats-tooltop').find('.'+elem).show().find('.tip_element_value').text(val);
}
});
return $('#date-stats-tooltop').html();
},
items: "td",
trigger : 'hover',
initTooltip($cell, function() {
$('#date-stats-tooltop .tip_date').text(info.event.extendedProps.data.date_format);
$.each(info.event.extendedProps.data.stats, function(elem, val) {
if (elem == 'num_part_avai') {
$('#date-stats-tooltop').find('.'+elem).hide().find('.tip_element_value').text('');
} else {
$('#date-stats-tooltop').find('.'+elem).show().find('.tip_element_value').text(val);
}
});
return $('#date-stats-tooltop').html();
}, 'td');
$cell.tooltip('option', {
position: {
my: "left top",
at: "left+50% bottom-50%",
collision: "flipfit"
},
show: {
delay: 100,
},
hide: {
delay: 300,
},
open: function(event, ui)
{
if(event.buttons == 1 || event.buttons == 3){
@@ -102,27 +94,11 @@ $(document).ready(function() {
if ($('div.ui-tooltip').not('#' + $id).length) {
return false;
}
// ajax function to pull in data and add it to the tooltip goes here
},
close: function(event, ui)
{
ui.tooltip.hover(function() {
$(this).stop(true).fadeTo(300, 1);
},
function() {
$(this).fadeOut('300', function()
{
$(this).remove();
});
});
}
});
} else {
$(info.el).addClass('search-result-event');
$(info.el).tooltip({
content: function()
{
}
});
} else {
$(info.el).addClass('search-result-event');
initTooltip($(info.el), function() {
$('#date-stats-tooltop .tip_date').text(info.event.extendedProps.data.date_from_format + ' - ' +info.event.extendedProps.data.date_to_format);
$.each(info.event.extendedProps.data.stats, function(elem, val) {
if (elem == 'num_part_avai') {
@@ -136,48 +112,8 @@ $(document).ready(function() {
}
});
return $('#date-stats-tooltop').html();
},
items: "div",
trigger : 'hover',
track: true,
show: {
delay: 100,
},
hide: {
delay: 300,
},
open: function(event, ui)
{
if(event.buttons == 1 || event.buttons == 3){
ui.tooltip.remove();
}
if (typeof(event.originalEvent) === 'undefined') {
return false;
}
var $id = $(ui.tooltip).attr('id');
// close any lingering tooltips
if ($('div.ui-tooltip').not('#' + $id).length) {
return false;
}
// ajax function to pull in data and add it to the tooltip goes here
},
close: function(event, ui)
{
ui.tooltip.hover(function() {
$(this).stop(true).fadeTo(300, 1);
},
function() {
$(this).fadeOut('300', function()
{
$(this).remove();
});
});
}
});
}, 'div');
$(info.el).tooltip('option', 'track', true);
info.el.style.borderLeftColor = info.event.extendedProps.data.eventColor;
resizeSearchResultEventBar($(info.el));
}
@@ -201,6 +137,14 @@ $(document).ready(function() {
});
}
if ($('#fullcalendar').length) {
if (typeof initTooltip === 'function') {
initBookingCalendar();
} else {
$(document).on('admin-theme.js.ready', initBookingCalendar);
}
}
function resizeSearchResultEventBar($bar) {
requestAnimationFrame(function() {
var $td = $bar.closest('td');
@@ -548,6 +492,7 @@ $(document).ready(function() {
} else {
showSuccessMessage(removed_room_success_txt);
$("#htl_rooms_list").empty().append(result.data.room_tpl);
initTooltip();
refreshCartData();
refreshStatsData();
calendar.refetchEvents();
@@ -1077,4 +1022,4 @@ $(document).ready(function() {
return [true, ""];
}
}
});
});

View File

@@ -26,25 +26,38 @@ function initMap() {
lng: Number(hotel_location.longitude),
};
const map = new google.maps.Map($('#search-results-wrap .map-wrap').get(0), {
const mapOptions = {
zoom: 10,
center: hotelLocation,
disableDefaultUI: true,
fullscreenControl: true,
mapId: PS_MAP_ID
});
};
if (PS_MAP_ID) {
mapOptions.mapId = PS_MAP_ID;
}
const map = new google.maps.Map($('#search-results-wrap .map-wrap').get(0), mapOptions);
let icon = document.createElement('img');
icon.src = PS_STORES_ICON;
icon.style.width = '24px';
icon.style.height = '24px';
const marker = new google.maps.marker.AdvancedMarkerElement({
map: map,
position: hotelLocation,
title: location.hotel_name,
content: icon,
});
let marker;
if (PS_MAP_ID) {
marker = new google.maps.marker.AdvancedMarkerElement({
map: map,
position: hotelLocation,
title: location.hotel_name,
content: icon,
});
} else {
marker = new google.maps.Marker({
map: map,
position: hotelLocation,
title: location.hotel_name,
icon: PS_STORES_ICON,
});
}
marker.query = location.query || null;
marker.latitude = hotelLocation.lat;

View File

@@ -172,22 +172,30 @@
<td>
{displayPrice price=($booking['total_price_tax_incl'] + $booking['extra_service_total_price_tax_incl']) currency=$orderCurrency['id']}
{capture name='refund_total_tooltip'}
<div class="tooltip-cont">
<div class="tooltip-row"><label>{l s='Room cost:' mod='hotelreservationsystem'}</label><span>{displayPrice price=$booking['total_price_tax_incl'] currency=$orderCurrency['id']}</span></div>
<div class="tooltip-row"><label>{l s='Services cost:' mod='hotelreservationsystem'}</label><span>{displayPrice price=$booking['extra_service_total_price_tax_incl'] currency=$orderCurrency['id']}</span></div>
</div>
<div>
<label>{l s='Room cost:' mod='hotelreservationsystem'}</label>
<span class="pull-right">{displayPrice price=$booking['total_price_tax_incl'] currency=$orderCurrency['id']}</span>
</div>
<div>
<label>{l s='Services cost:' mod='hotelreservationsystem'}</label>
<span class="pull-right">{displayPrice price=$booking['extra_service_total_price_tax_incl'] currency=$orderCurrency['id']}</span>
</div>
{/capture}
{include file='helpers/tooltip.tpl' tooltip_content=$smarty.capture.refund_total_tooltip allow_html=true}
{include file='helpers/tooltip.tpl' tooltip_content=$smarty.capture.refund_total_tooltip}
</td>
<td>
{displayPrice price=($booking['room_paid_amount'] + $booking['extra_service_total_paid_amount']) currency=$orderCurrency['id']}
{capture name='refund_paid_tooltip'}
<div class="tooltip-cont">
<div class="tooltip-row"><label>{l s='Room paid amount:' mod='hotelreservationsystem'}</label><span>{displayPrice price=$booking['room_paid_amount'] currency=$orderCurrency['id']}</span></div>
<div class="tooltip-row"><label>{l s='Services paid amount:' mod='hotelreservationsystem'}</label><span>{displayPrice price=$booking['extra_service_total_paid_amount'] currency=$orderCurrency['id']}</span></div>
</div>
<div>
<label>{l s='Room paid amount:' mod='hotelreservationsystem'}</label>
<span class="pull-right">{displayPrice price=$booking['room_paid_amount'] currency=$orderCurrency['id']}</span>
</div>
<div>
<label>{l s='Services paid amount:' mod='hotelreservationsystem'}</label>
<span class="pull-right">{displayPrice price=$booking['extra_service_total_paid_amount'] currency=$orderCurrency['id']}</span>
</div>
{/capture}
{include file='helpers/tooltip.tpl' tooltip_content=$smarty.capture.refund_paid_tooltip allow_html=true}
{include file='helpers/tooltip.tpl' tooltip_content=$smarty.capture.refund_paid_tooltip }
</td>
{if !$isRefundCompleted}
<td>

View File

@@ -97,11 +97,13 @@ class WkPaypalCommerceWebhook
if ($eventData['event_type'] == 'CHECKOUT.ORDER.COMPLETED') {
$cartID = $transactionData['id_cart'];
$objCart = new Cart($cartID);
if ($objCart->is_advance_payment) {
$orderStatus = Configuration::get('PS_OS_PARTIAL_PAYMENT_ACCEPTED');
} else {
$orderStatus = Configuration::get('PS_OS_PAYMENT_ACCEPTED');
}
$capturedAmount = isset($purchase['payments']['captures'][0]['amount']['value'])
? (float)$purchase['payments']['captures'][0]['amount']['value']
: 0;
$fullTotal = (float)$objCart->getOrderTotal(true, Cart::BOTH);
$orderStatus = $capturedAmount >= $fullTotal
? Configuration::get('PS_OS_PAYMENT_ACCEPTED')
: Configuration::get('PS_OS_PARTIAL_PAYMENT_ACCEPTED');
if ($orders = WkPaypalCommerceHelper::getOrdersByCartId($cartID)) {
foreach ($orders as $order) {
$this->updatePaymentStatus(
@@ -127,11 +129,13 @@ class WkPaypalCommerceWebhook
)) {
$cartID = $transactionData['id_cart'];
$objCart = new Cart($cartID);
if ($objCart->is_advance_payment) {
$orderStatus = Configuration::get('PS_OS_PARTIAL_PAYMENT_ACCEPTED');
} else {
$orderStatus = Configuration::get('PS_OS_PAYMENT_ACCEPTED');
}
$capturedAmount = isset($eventData['resource']['amount']['value'])
? (float)$eventData['resource']['amount']['value']
: 0;
$fullTotal = (float)$objCart->getOrderTotal(true, Cart::BOTH);
$orderStatus = $capturedAmount >= $fullTotal
? Configuration::get('PS_OS_PAYMENT_ACCEPTED')
: Configuration::get('PS_OS_PARTIAL_PAYMENT_ACCEPTED');
if ($orders = WkPaypalCommerceHelper::getOrdersByCartId($cartID)) {
foreach ($orders as $order) {
$this->updatePaymentStatus(

View File

@@ -126,20 +126,19 @@ class QloPaypalCommercePaymentModuleFrontController extends ModuleFrontControlle
$transaction_id = $this->saveOrderData($returnData);
if ($paypalOrderID) {
$currency = $this->context->currency;
$total = (float)$cart->getOrderTotal(true, Cart::BOTH);
if ($cart->is_advance_payment) {
$total = (float)$cart->getOrderTotal(true, Cart::ADVANCE_PAYMENT);
} else {
$total = (float)$cart->getOrderTotal(true, Cart::BOTH);
}
// Order status/amount must reflect what PayPal actually captured,
// not the cart's is_advance_payment flag (still editable by the
// customer after payment, so it cannot be trusted here).
$capturedAmount = isset($returnData['data']['purchase_units'][0]['payments']['captures'][0]['amount']['value']) ?
(float) $returnData['data']['purchase_units'][0]['payments']['captures'][0]['amount']['value'] : 0;
$fullTotal = (float) $cart->getOrderTotal(true, Cart::BOTH);
$isFullyPaid = $capturedAmount >= $fullTotal;
// set order status
if ($returnData['data']['status'] == 'COMPLETED') {
if ($cart->is_advance_payment) {
$orderStatus = Configuration::get('PS_OS_PARTIAL_PAYMENT_ACCEPTED');
} else {
$orderStatus = Configuration::get('PS_OS_PAYMENT_ACCEPTED');
}
$orderStatus = $isFullyPaid
? Configuration::get('PS_OS_PAYMENT_ACCEPTED')
: Configuration::get('PS_OS_PARTIAL_PAYMENT_ACCEPTED');
} else {
$orderStatus = Configuration::get('PS_OS_AWAITING_PAYMENT');
}
@@ -149,7 +148,7 @@ class QloPaypalCommercePaymentModuleFrontController extends ModuleFrontControlle
$this->module->validateOrder(
$cart->id,
$orderStatus,
$total,
$capturedAmount,
$this->module->l('PayPal Checkout', 'payment'),
null,
$extraVars,
@@ -389,4 +388,4 @@ class QloPaypalCommercePaymentModuleFrontController extends ModuleFrontControlle
{
return _PS_PRICE_COMPUTE_PRECISION_;
}
}
}

View File

@@ -66,7 +66,7 @@ function initMap() {
hotelLocationArray = JSON.parse(hotelLocationArray);
// Display a map on the page
map = new google.maps.Map(document.getElementById("map"), {mapId: PS_MAP_ID});
map = new google.maps.Map(document.getElementById("map"), PS_MAP_ID ? {mapId: PS_MAP_ID} : {});
google.maps.event.trigger(map, 'resize');
map.setTilt(45);
@@ -84,12 +84,21 @@ function initMap() {
icon.style.width = '24px';
icon.style.height = '24px';
marker = new google.maps.marker.AdvancedMarkerElement({
map: map,
position: position,
title: location.hotel_name,
content: icon,
});
if (PS_MAP_ID) {
marker = new google.maps.marker.AdvancedMarkerElement({
map: map,
position: position,
title: location.hotel_name,
content: icon,
});
} else {
marker = new google.maps.Marker({
map: map,
position: position,
title: location.hotel_name,
icon: PS_STORES_ICON,
});
}
// Allow each marker to have an info window
google.maps.event.addListener(marker, 'click', (function(marker, i) {
return function() {

View File

@@ -70,25 +70,38 @@ function initMap() {
lat: Number($(this).attr('latitude')),
lng: Number($(this).attr('longitude')),
};
const map = new google.maps.Map(element, {
const mapOptions = {
zoom: 10,
center: hotelLocation,
disableDefaultUI: true,
fullscreenControl: true,
mapId: PS_MAP_ID
});
};
if (PS_MAP_ID) {
mapOptions.mapId = PS_MAP_ID;
}
const map = new google.maps.Map(element, mapOptions);
let icon = document.createElement('img');
icon.src = PS_STORES_ICON;
icon.style.width = '24px';
icon.style.height = '24px';
const marker = new google.maps.marker.AdvancedMarkerElement({
position: hotelLocation,
map: map,
title: location.hotel_name,
content: icon,
});
let marker;
if (PS_MAP_ID) {
marker = new google.maps.marker.AdvancedMarkerElement({
position: hotelLocation,
map: map,
title: location.hotel_name,
content: icon,
});
} else {
marker = new google.maps.Marker({
position: hotelLocation,
map: map,
title: location.hotel_name,
icon: PS_STORES_ICON,
});
}
marker.query = location.query || null;
marker.latitude = hotelLocation.lat;

View File

@@ -34,7 +34,7 @@ function initMap() {
hotelLocationArray = JSON.parse(hotelLocationArray);
// Display a map on the page
map = new google.maps.Map(document.getElementById("map"), {mapId: PS_MAP_ID});
map = new google.maps.Map(document.getElementById("map"), PS_MAP_ID ? {mapId: PS_MAP_ID} : {});
google.maps.event.trigger(map, 'resize');
map.setTilt(45);
@@ -52,12 +52,21 @@ function initMap() {
icon.style.width = '24px';
icon.style.height = '24px';
marker = new google.maps.marker.AdvancedMarkerElement({
map: map,
position: position,
title: location.hotel_name,
content: icon,
});
if (PS_MAP_ID) {
marker = new google.maps.marker.AdvancedMarkerElement({
map: map,
position: position,
title: location.hotel_name,
content: icon,
});
} else {
marker = new google.maps.Marker({
map: map,
position: position,
title: location.hotel_name,
icon: PS_STORES_ICON,
});
}
// Allow each marker to have an info window
google.maps.event.addListener(marker, 'click', (function(marker, i) {

View File

@@ -1311,11 +1311,14 @@ function updateRoomServiceQuantity(that) {
function initMap() {
const map = new google.maps.Map($('#room_type_map_tab .map-wrap').get(0), {
const mapOptions = {
zoom: 10,
streetViewControl: false,
mapId: PS_MAP_ID
});
};
if (PS_MAP_ID) {
mapOptions.mapId = PS_MAP_ID;
}
const map = new google.maps.Map($('#room_type_map_tab .map-wrap').get(0), mapOptions);
const hotelLatLng = {
lat: Number(hotel_location.latitude),
@@ -1327,11 +1330,20 @@ function initMap() {
icon.src = PS_STORES_ICON;
icon.style.width = '24px';
icon.style.height = '24px';
let marker = new google.maps.marker.AdvancedMarkerElement({
position: hotelLatLng,
map: map,
content: icon,
});
let marker;
if (PS_MAP_ID) {
marker = new google.maps.marker.AdvancedMarkerElement({
position: hotelLatLng,
map: map,
content: icon,
});
} else {
marker = new google.maps.Marker({
position: hotelLatLng,
map: map,
icon: PS_STORES_ICON,
});
}
const uiContent = $('#room-info-map-ui-content .hotel-info-wrap').get(0);
map.controls[google.maps.ControlPosition.LEFT_TOP].push(uiContent);