+
{foreach from=Product::getPriceCalculationMethodDaysLabel($priceCalcMethod) item='pcmDayLabel'}
{$pcmDayLabel}
diff --git a/admin/themes/default/template/controllers/products/connected-rooms.tpl b/admin/themes/default/template/controllers/products/connected-rooms.tpl
index 6017e4269..5fe24f98c 100644
--- a/admin/themes/default/template/controllers/products/connected-rooms.tpl
+++ b/admin/themes/default/template/controllers/products/connected-rooms.tpl
@@ -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}
-
-
-
+ {capture name='connected_room_tooltip'}
+
+ {/capture}
+ {include file='helpers/tooltip.tpl' tooltip_content=$smarty.capture.connected_room_tooltip tooltip_icon_class='icon-random' tooltip_icon_style='color: #008abd;' }
{/if}
-
diff --git a/admin/themes/default/template/helpers/list/list_header.tpl b/admin/themes/default/template/helpers/list/list_header.tpl
index 77922dae1..13983743f 100644
--- a/admin/themes/default/template/helpers/list/list_header.tpl
+++ b/admin/themes/default/template/helpers/list/list_header.tpl
@@ -300,8 +300,8 @@
{if $params.type == 'range'}
{$field_name="`$list_id`Filter_{if isset($params.filter_key)}`$params.filter_key`{else}`$key`{/if}"}
-
-
+
+
{elseif $params.type == 'bool'}
{$field_name="`$list_id`Filter_{if isset($params.filter_key)}`$params.filter_key`{else}`$key`{/if}"}
@@ -314,14 +314,14 @@
diff --git a/admin/themes/default/template/helpers/tooltip.tpl b/admin/themes/default/template/helpers/tooltip.tpl
index 8d38c8982..dde9e5866 100644
--- a/admin/themes/default/template/helpers/tooltip.tpl
+++ b/admin/themes/default/template/helpers/tooltip.tpl
@@ -20,21 +20,19 @@
* @license https://opensource.org/license/osl-3-0-php Open Software License version 3.0
*}
-
-
+ {if isset($tooltip_title) && $tooltip_title}
+ {$tooltip_title nofilter}
+ {elseif isset($tooltip_icon_class) && $tooltip_icon_class}
+
+ {else}
+
+ {/if}
-
- {if isset($tooltip_items) && $tooltip_items|@count}
-
- {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}
diff --git a/classes/Language.php b/classes/Language.php
index 0963279bb..af5923fca 100644
--- a/classes/Language.php
+++ b/classes/Language.php
@@ -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))) {
diff --git a/classes/PaymentModule.php b/classes/PaymentModule.php
index 538e9b822..013d5c26a 100644
--- a/classes/PaymentModule.php
+++ b/classes/PaymentModule.php
@@ -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'])
diff --git a/controllers/admin/AdminNormalProductsController.php b/controllers/admin/AdminNormalProductsController.php
index 0502b6c9c..9ea5c906e 100644
--- a/controllers/admin/AdminNormalProductsController.php
+++ b/controllers/admin/AdminNormalProductsController.php
@@ -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;
}
diff --git a/controllers/admin/AdminOrdersController.php b/controllers/admin/AdminOrdersController.php
index 2394d5971..94c396fe9 100644
--- a/controllers/admin/AdminOrdersController.php
+++ b/controllers/admin/AdminOrdersController.php
@@ -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(' ', $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.');
diff --git a/controllers/front/ContactController.php b/controllers/front/ContactController.php
index 1014a8b5f..acb21798d 100644
--- a/controllers/front/ContactController.php
+++ b/controllers/front/ContactController.php
@@ -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(
diff --git a/controllers/front/GuestTrackingController.php b/controllers/front/GuestTrackingController.php
index 7956ff574..c9cc9b6a2 100644
--- a/controllers/front/GuestTrackingController.php
+++ b/controllers/front/GuestTrackingController.php
@@ -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(
diff --git a/controllers/front/OrderDetailController.php b/controllers/front/OrderDetailController.php
index ed914aa38..3105d0739 100644
--- a/controllers/front/OrderDetailController.php
+++ b/controllers/front/OrderDetailController.php
@@ -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='.
diff --git a/controllers/front/OurPropertiesController.php b/controllers/front/OurPropertiesController.php
index 52fd94a86..06520f044 100644
--- a/controllers/front/OurPropertiesController.php
+++ b/controllers/front/OurPropertiesController.php
@@ -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')
)
);
diff --git a/controllers/front/ProductController.php b/controllers/front/ProductController.php
index 20f8455e7..2dcc9eaee 100644
--- a/controllers/front/ProductController.php
+++ b/controllers/front/ProductController.php
@@ -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(
diff --git a/install/models/install.php b/install/models/install.php
index 461237b9c..32d939aeb 100644
--- a/install/models/install.php
+++ b/install/models/install.php
@@ -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();
diff --git a/modules/hotelreservationsystem/classes/HotelBookingDocument.php b/modules/hotelreservationsystem/classes/HotelBookingDocument.php
index 6c223106f..3567440e7 100644
--- a/modules/hotelreservationsystem/classes/HotelBookingDocument.php
+++ b/modules/hotelreservationsystem/classes/HotelBookingDocument.php
@@ -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()
diff --git a/modules/hotelreservationsystem/classes/HotelBranchInformation.php b/modules/hotelreservationsystem/classes/HotelBranchInformation.php
index 802ae8a5e..61083fde1 100644
--- a/modules/hotelreservationsystem/classes/HotelBranchInformation.php
+++ b/modules/hotelreservationsystem/classes/HotelBranchInformation.php
@@ -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'),
diff --git a/modules/hotelreservationsystem/controllers/admin/AdminAddHotelController.php b/modules/hotelreservationsystem/controllers/admin/AdminAddHotelController.php
index 020227614..9ebe57852 100644
--- a/modules/hotelreservationsystem/controllers/admin/AdminAddHotelController.php
+++ b/modules/hotelreservationsystem/controllers/admin/AdminAddHotelController.php
@@ -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'
diff --git a/modules/hotelreservationsystem/controllers/admin/AdminBookingDocumentController.php b/modules/hotelreservationsystem/controllers/admin/AdminBookingDocumentController.php
index c3d92c748..b161a2a27 100644
--- a/modules/hotelreservationsystem/controllers/admin/AdminBookingDocumentController.php
+++ b/modules/hotelreservationsystem/controllers/admin/AdminBookingDocumentController.php
@@ -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) {
diff --git a/modules/hotelreservationsystem/controllers/admin/AdminHotelGeneralSettingsController.php b/modules/hotelreservationsystem/controllers/admin/AdminHotelGeneralSettingsController.php
index c59bd79a8..40b356f49 100644
--- a/modules/hotelreservationsystem/controllers/admin/AdminHotelGeneralSettingsController.php
+++ b/modules/hotelreservationsystem/controllers/admin/AdminHotelGeneralSettingsController.php
@@ -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');
diff --git a/modules/hotelreservationsystem/controllers/admin/AdminOrderRefundRequestsController.php b/modules/hotelreservationsystem/controllers/admin/AdminOrderRefundRequestsController.php
index 8edfba919..81fba0d1a 100644
--- a/modules/hotelreservationsystem/controllers/admin/AdminOrderRefundRequestsController.php
+++ b/modules/hotelreservationsystem/controllers/admin/AdminOrderRefundRequestsController.php
@@ -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)
)
);
diff --git a/modules/hotelreservationsystem/hotelreservationsystem.php b/modules/hotelreservationsystem/hotelreservationsystem.php
index 2c4e74ced..9b35b1b0d 100644
--- a/modules/hotelreservationsystem/hotelreservationsystem.php
+++ b/modules/hotelreservationsystem/hotelreservationsystem.php
@@ -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);
diff --git a/modules/hotelreservationsystem/views/css/admin/wk_refund_request.css b/modules/hotelreservationsystem/views/css/admin/wk_refund_request.css
index e3cd83c23..69fc03b56 100644
--- a/modules/hotelreservationsystem/views/css/admin/wk_refund_request.css
+++ b/modules/hotelreservationsystem/views/css/admin/wk_refund_request.css
@@ -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;
}
\ No newline at end of file
diff --git a/modules/hotelreservationsystem/views/js/HotelReservationAdmin.js b/modules/hotelreservationsystem/views/js/HotelReservationAdmin.js
index 4faafa4da..d90a1246a 100644
--- a/modules/hotelreservationsystem/views/js/HotelReservationAdmin.js
+++ b/modules/hotelreservationsystem/views/js/HotelReservationAdmin.js
@@ -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(),
});
diff --git a/modules/hotelreservationsystem/views/js/admin/hotel_rooms_booking.js b/modules/hotelreservationsystem/views/js/admin/hotel_rooms_booking.js
index e52d8e4c5..8d37728d8 100644
--- a/modules/hotelreservationsystem/views/js/admin/hotel_rooms_booking.js
+++ b/modules/hotelreservationsystem/views/js/admin/hotel_rooms_booking.js
@@ -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, ""];
}
}
-});
+});
\ No newline at end of file
diff --git a/modules/hotelreservationsystem/views/js/searchResultsMap.js b/modules/hotelreservationsystem/views/js/searchResultsMap.js
index 766466446..522c00986 100644
--- a/modules/hotelreservationsystem/views/js/searchResultsMap.js
+++ b/modules/hotelreservationsystem/views/js/searchResultsMap.js
@@ -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;
diff --git a/modules/hotelreservationsystem/views/templates/admin/order_refund_requests/helpers/view/view.tpl b/modules/hotelreservationsystem/views/templates/admin/order_refund_requests/helpers/view/view.tpl
index 84faaa7a9..9254faa54 100644
--- a/modules/hotelreservationsystem/views/templates/admin/order_refund_requests/helpers/view/view.tpl
+++ b/modules/hotelreservationsystem/views/templates/admin/order_refund_requests/helpers/view/view.tpl
@@ -172,22 +172,30 @@
{displayPrice price=($booking['total_price_tax_incl'] + $booking['extra_service_total_price_tax_incl']) currency=$orderCurrency['id']}
{capture name='refund_total_tooltip'}
-
+
+ {l s='Room cost:' mod='hotelreservationsystem'}
+ {displayPrice price=$booking['total_price_tax_incl'] currency=$orderCurrency['id']}
+
+
+ {l s='Services cost:' mod='hotelreservationsystem'}
+ {displayPrice price=$booking['extra_service_total_price_tax_incl'] currency=$orderCurrency['id']}
+
{/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}
{displayPrice price=($booking['room_paid_amount'] + $booking['extra_service_total_paid_amount']) currency=$orderCurrency['id']}
{capture name='refund_paid_tooltip'}
-
+
+ {l s='Room paid amount:' mod='hotelreservationsystem'}
+ {displayPrice price=$booking['room_paid_amount'] currency=$orderCurrency['id']}
+
+
+ {l s='Services paid amount:' mod='hotelreservationsystem'}
+ {displayPrice price=$booking['extra_service_total_paid_amount'] currency=$orderCurrency['id']}
+
{/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 }
{if !$isRefundCompleted}
diff --git a/modules/qlopaypalcommerce/classes/WkPaypalCommerceWebhook.php b/modules/qlopaypalcommerce/classes/WkPaypalCommerceWebhook.php
index 4a6833f40..db2b1a837 100644
--- a/modules/qlopaypalcommerce/classes/WkPaypalCommerceWebhook.php
+++ b/modules/qlopaypalcommerce/classes/WkPaypalCommerceWebhook.php
@@ -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(
diff --git a/modules/qlopaypalcommerce/controllers/front/payment.php b/modules/qlopaypalcommerce/controllers/front/payment.php
index 3795a5e75..c151fd52e 100644
--- a/modules/qlopaypalcommerce/controllers/front/payment.php
+++ b/modules/qlopaypalcommerce/controllers/front/payment.php
@@ -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_;
}
-}
+}
\ No newline at end of file
diff --git a/themes/hotel-reservation-theme/js/contact-form.js b/themes/hotel-reservation-theme/js/contact-form.js
index 9b16260d5..e4bb06eff 100644
--- a/themes/hotel-reservation-theme/js/contact-form.js
+++ b/themes/hotel-reservation-theme/js/contact-form.js
@@ -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() {
diff --git a/themes/hotel-reservation-theme/js/order-detail.js b/themes/hotel-reservation-theme/js/order-detail.js
index 625237d5d..30a6b5649 100644
--- a/themes/hotel-reservation-theme/js/order-detail.js
+++ b/themes/hotel-reservation-theme/js/order-detail.js
@@ -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;
diff --git a/themes/hotel-reservation-theme/js/our-properties.js b/themes/hotel-reservation-theme/js/our-properties.js
index 81a0d0be9..3fe12ac2c 100644
--- a/themes/hotel-reservation-theme/js/our-properties.js
+++ b/themes/hotel-reservation-theme/js/our-properties.js
@@ -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) {
diff --git a/themes/hotel-reservation-theme/js/product.js b/themes/hotel-reservation-theme/js/product.js
index 62aa5a9c2..d36c03dc9 100644
--- a/themes/hotel-reservation-theme/js/product.js
+++ b/themes/hotel-reservation-theme/js/product.js
@@ -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);