Merge branch 'develop' into gli-2941
This commit is contained in:
@@ -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()
|
||||
|
||||
@@ -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'),
|
||||
|
||||
@@ -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.'®ion='.$country->iso_code.'&callback=initGoogleMaps'
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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');
|
||||
|
||||
@@ -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)
|
||||
)
|
||||
);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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(),
|
||||
});
|
||||
|
||||
@@ -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, ""];
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -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;
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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_;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user