diff --git a/mails/en/order_conf.txt b/mails/en/order_conf.txt
index 06eeabbb7..2f6384972 100644
--- a/mails/en/order_conf.txt
+++ b/mails/en/order_conf.txt
@@ -37,9 +37,6 @@ Extra Services Tax
Final Booking Amount
{total_paid}
-Customer address
-{invoice_block_html}
-
You can review your order and download your invoice from the
"Order history" [{history_url}] section of your
customer account by clicking "My account"
diff --git a/mails/en/overbooking.html b/mails/en/overbooking.html
index 4fc0e43c6..95631ee77 100755
--- a/mails/en/overbooking.html
+++ b/mails/en/overbooking.html
@@ -318,35 +318,6 @@
-
-
-
-
-
-
-
-
-
-
-
- Customer address
-
- {invoice_block_html}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/mails/en/overbooking.txt b/mails/en/overbooking.txt
index a6bd05b32..6a8f8975a 100644
--- a/mails/en/overbooking.txt
+++ b/mails/en/overbooking.txt
@@ -43,9 +43,6 @@ Extra Services Tax
Final Booking Amount
{total_paid}
-Customer address
-{invoice_block_html}
-
You can review your order and download your invoice from the
"Order history" [{history_url}] section of your
customer account by clicking "My account"
diff --git a/modules/blocknewsletter/blocknewsletter.php b/modules/blocknewsletter/blocknewsletter.php
index 959a54249..3a1609409 100644
--- a/modules/blocknewsletter/blocknewsletter.php
+++ b/modules/blocknewsletter/blocknewsletter.php
@@ -86,6 +86,8 @@ class Blocknewsletter extends Module
'actionExportGDPRData',
'actionObjectCustomerUpdateBefore',
'actionDeleteGDPRCustomer',
+ 'actionCustomerCartRulesModifier',
+ 'actionValidateCartRule',
'actionObjectCustomerDeleteAfter',
)
);
@@ -133,6 +135,40 @@ class Blocknewsletter extends Module
}
}
+ public function hookActionCustomerCartRulesModifier($params)
+ {
+ $customer = new Customer($params['id_customer']);
+ foreach($params['cart_rules'] as $key => $cartRule) {
+ if ($cartRule['code'] == Configuration::get('NW_VOUCHER_CODE')) {
+ if ($customer->id && !$customer->is_guest) {
+ if (count(Order::getCustomerOrders($customer->id))) {
+ // remove welcome voucher
+ unset($params['cart_rules'][$key]);
+ }
+ } else {
+ // remove welcome voucher
+ unset($params['cart_rules'][$key]);
+ }
+ }
+ }
+ }
+
+ public function hookActionValidateCartRule($params)
+ {
+ $customer = new Customer($params['context']->cart->id_customer);
+ if ($params['cart_rule']->code == Configuration::get('NW_VOUCHER_CODE')) {
+ if ($customer->id && !$customer->is_guest) {
+ if (count(Order::getCustomerOrders($customer->id))) {
+ $params['isValidatedByModules'] = false;
+ $params['isValidatedByModulesError'] = $this->l('This voucher is not available for this booking.');
+ }
+ } else {
+ $params['isValidatedByModules'] = false;
+ $params['isValidatedByModulesError'] = $this->l('This voucher is not available for this booking.');
+ }
+ }
+ }
+
public function install()
{
if (!parent::install() || !$this->registerHooks() || !$this->callInstallTab()) {
diff --git a/modules/blocknewsletter/mails/en/newsletter_voucher.html b/modules/blocknewsletter/mails/en/newsletter_voucher.html
index cb8e3db1e..1156ed1e4 100644
--- a/modules/blocknewsletter/mails/en/newsletter_voucher.html
+++ b/modules/blocknewsletter/mails/en/newsletter_voucher.html
@@ -87,7 +87,12 @@
Newsletter subscription
- Regarding your newsletter subscription, we are pleased to offer you the following voucher: {discount}
+ Regarding your newsletter subscription, we are pleased to offer you the welcome voucher: {discount}
+
+
+
+
+ Please note that the voucher will be valid on your first order.
diff --git a/modules/blocknewsletter/mails/en/newsletter_voucher.txt b/modules/blocknewsletter/mails/en/newsletter_voucher.txt
index 7e1039388..5d95feb94 100644
--- a/modules/blocknewsletter/mails/en/newsletter_voucher.txt
+++ b/modules/blocknewsletter/mails/en/newsletter_voucher.txt
@@ -4,7 +4,9 @@
Hi,
Regarding your newsletter subscription, we are pleased to offer
-you the following voucher: {discount}
+you the welcome voucher: {discount}
+
+Please note that the voucher will be valid on your first order.
{shop_name} [/{shop_url}] powered by Webkul(tm)
[https://webkul.com]
diff --git a/modules/dashactivity/views/templates/hook/dashboard_zone_one.tpl b/modules/dashactivity/views/templates/hook/dashboard_zone_one.tpl
index 5ed29c94c..b705d8be9 100644
--- a/modules/dashactivity/views/templates/hook/dashboard_zone_one.tpl
+++ b/modules/dashactivity/views/templates/hook/dashboard_zone_one.tpl
@@ -80,7 +80,7 @@
-
+
{l s="Bookings (not paid)" mod='dashactivity'}
@@ -90,7 +90,7 @@
-
+
{l s="Refunds" mod='dashactivity'}
@@ -100,7 +100,7 @@
-
+
{l s="Abandoned Carts" mod='dashactivity'}
diff --git a/modules/dashinsights/views/js/dashinsights.js b/modules/dashinsights/views/js/dashinsights.js
index c4c065975..7cdfb2d66 100644
--- a/modules/dashinsights/views/js/dashinsights.js
+++ b/modules/dashinsights/views/js/dashinsights.js
@@ -21,9 +21,8 @@ function line_chart_dashinsights(widget_name, chart_details) {
$('#dashinsights_room_nights svg').html('');
nv.addGraph(function () {
var chart = nv.models.lineChart()
- .useInteractiveGuideline(true)
.x(function (d) { return (d !== undefined ? d[0] : 0); })
- .y(function (d) { return (d !== undefined ? d[1] : 0); })
+ .y(function (d) { return (d !== undefined ? parseInt(d[1]) : 0); })
.forceY([0, 1])
.margin({
left: 40,
@@ -32,7 +31,7 @@ function line_chart_dashinsights(widget_name, chart_details) {
chart.yAxis.scale().domain([0, 1]);
// create content for the tooltip of chart
- chart.interactiveLayer.tooltip.contentGenerator((obj, element) => {
+ chart.tooltip.contentGenerator((obj, element) => {
var totalNightsBooked = 0;
var tooltipContent = '';
diff --git a/modules/dashperformance/views/templates/hook/dashboard_zone_two.tpl b/modules/dashperformance/views/templates/hook/dashboard_zone_two.tpl
index 97b3051de..fc59ed294 100644
--- a/modules/dashperformance/views/templates/hook/dashboard_zone_two.tpl
+++ b/modules/dashperformance/views/templates/hook/dashboard_zone_two.tpl
@@ -30,7 +30,7 @@
-
+
{l s='Average Daily Rate' mod='dashperformance'}
diff --git a/modules/dashtrends/dashtrends.php b/modules/dashtrends/dashtrends.php
index 7c6f1d06a..ae009aafc 100644
--- a/modules/dashtrends/dashtrends.php
+++ b/modules/dashtrends/dashtrends.php
@@ -107,6 +107,7 @@ class Dashtrends extends Module
$tmp_data['total_paid_tax_excl'][$date] = $tmp_data['orders'][$date] * $tmp_data['average_cart_value'][$date];
$tmp_data['total_purchases'][$date] = $tmp_data['total_paid_tax_excl'][$date] * rand(50, 70) / 100;
$tmp_data['total_expenses'][$date] = $tmp_data['total_paid_tax_excl'][$date] * rand(0, 10) / 100;
+ $tmp_data['total_refunds'][$date] = $tmp_data['total_paid_tax_excl'][$date] * rand(0, 5) / 100;
}
} else {
$tmp_data['visits'] = AdminStatsController::getVisits(false, $date_from, $date_to, 'day');
@@ -114,6 +115,7 @@ class Dashtrends extends Module
$tmp_data['total_paid_tax_excl'] = AdminStatsController::getTotalSales($date_from, $date_to, 'day', $id_hotel);
$tmp_data['total_purchases'] = AdminStatsController::getPurchases($date_from, $date_to, 'day', $id_hotel);
$tmp_data['total_expenses'] = AdminStatsController::getExpenses($date_from, $date_to, 'day', $id_hotel);
+ $tmp_data['total_refunds'] = AdminStatsController::getRefunds($date_from, $date_to, 'day', $id_hotel);
}
return $tmp_data;
@@ -151,6 +153,7 @@ class Dashtrends extends Module
$refined_data['net_profits'][$date] += (isset($gross_data['total_paid_tax_excl'][$date]) ? $gross_data['total_paid_tax_excl'][$date] : 0);
$refined_data['net_profits'][$date] -= (isset($gross_data['total_purchases'][$date]) ? $gross_data['total_purchases'][$date] : 0);
$refined_data['net_profits'][$date] -= (isset($gross_data['total_expenses'][$date]) ? $gross_data['total_expenses'][$date] : 0);
+ $refined_data['net_profits'][$date] -= (isset($gross_data['total_refunds'][$date]) ? $gross_data['total_refunds'][$date] : 0);
}
return $refined_data;
diff --git a/modules/hotelreservationsystem/classes/HotelBookingDemands.php b/modules/hotelreservationsystem/classes/HotelBookingDemands.php
index 57904d0a4..fc613a6c0 100644
--- a/modules/hotelreservationsystem/classes/HotelBookingDemands.php
+++ b/modules/hotelreservationsystem/classes/HotelBookingDemands.php
@@ -75,8 +75,8 @@ class HotelBookingDemands extends ObjectModel
$groupByRoom = 1,
$getTotalPrice = 0,
$useTax = 1,
- $idOrderDetail = 0,
- $idHtlBookingDetail = 0
+ $idHtlBookingDetail = 0,
+ $idOrderDetail = 0
) {
$moduleObj = Module::getInstanceByName('hotelreservationsystem');
$context = Context::getContext();
diff --git a/modules/hotelreservationsystem/classes/HotelBookingDetail.php b/modules/hotelreservationsystem/classes/HotelBookingDetail.php
index 2cf3dac59..5d7df1dba 100644
--- a/modules/hotelreservationsystem/classes/HotelBookingDetail.php
+++ b/modules/hotelreservationsystem/classes/HotelBookingDetail.php
@@ -2369,7 +2369,7 @@ class HotelBookingDetail extends ObjectModel
return Db::getInstance()->executeS($sql);
}
- public function UpdateHotelCartHotelOrderOnOrderEdit(
+ public function updateHotelCartHotelOrderOnOrderEdit(
$idOrder,
$idRoom,
$oldDateFrom,
@@ -2377,11 +2377,10 @@ class HotelBookingDetail extends ObjectModel
$newDateFrom,
$newDateTo,
$occupancy,
- $newTotalPrice = null
+ $newTotalPrice = null,
+ $idHotelBookingDetail
) {
- // retrieve HotelBookingDetail row
- $roomBookingData = $this->getRoomBookingData($idRoom, $idOrder, $oldDateFrom, $oldDateTo);
- $objHotelBookingDetail = new self($roomBookingData['id']);
+ $objHotelBookingDetail = new self((int) $idHotelBookingDetail);
if (Validate::isLoadedObject($objHotelBookingDetail)) {
// retrieve HotelCartBookingData row
$idHotelCartBookingData = Db::getInstance()->getValue(
@@ -2748,9 +2747,6 @@ class HotelBookingDetail extends ObjectModel
if (!$this->context->cart->id_address_invoice && isset($addresses[0])) {
$this->context->cart->id_address_invoice = (int)$addresses[0]['id_address'];
}
- if (!$this->context->cart->id_address_delivery && isset($addresses[0])) {
- $this->context->cart->id_address_delivery = $addresses[0]['id_address'];
- }
$this->context->cart->setNoMultishipping();
if ($this->context->cart->save()) {
diff --git a/modules/hotelreservationsystem/classes/HotelBranchInformation.php b/modules/hotelreservationsystem/classes/HotelBranchInformation.php
index c05c86dde..e91aa93be 100644
--- a/modules/hotelreservationsystem/classes/HotelBranchInformation.php
+++ b/modules/hotelreservationsystem/classes/HotelBranchInformation.php
@@ -71,10 +71,10 @@ class HotelBranchInformation extends ObjectModel
public $zipcode;
public $address;
public $phone;
- public $use_global_max_order_date;
- public $max_order_date;
- public $use_global_preparation_time;
- public $preparation_time;
+ public $use_global_max_order_date = 1;
+ public $max_order_date = '0000-00-00';
+ public $use_global_preparation_time = 1;
+ public $preparation_time = '0000-00-00';
protected $webserviceParameters = array(
'objectsNodeName' => 'hotels',
@@ -140,7 +140,7 @@ class HotelBranchInformation extends ObjectModel
$this->moduleInstance = Module::getInstanceByName('hotelreservationsystem');
parent::__construct($id, $id_lang, $id_shop);
- $this->use_global_max_order_date = $this->max_order_date = $this->use_global_preparation_time = $this->preparation_time = $this->id_country = $this->id_state = $this->city = $this->zipcode = $this->address = $this->phone = null;
+ $this->id_country = $this->id_state = $this->city = $this->zipcode = $this->address = $this->phone = null;
if ($id) {
if ($hotelAddress = $this->getAddress($id)) {
$this->id_country = $hotelAddress['id_country'];
@@ -1023,18 +1023,26 @@ class HotelBranchInformation extends ObjectModel
}
$hotelName = $this->hotel_name[Configuration::get('PS_LANG_DEFAULT')];
- $hotelName = preg_replace('/[0-9!<>,;"?=+()@#°{}_$%:]*/u', '', $hotelName);
-
+ $hotelName = trim(preg_replace('/[0-9!<>,;?=+()@#"°{}_$%:]*$/u', '', $hotelName));
$objAddress->id_hotel = $this->id;
$objAddress->id_country = $this->id_country;
$objAddress->id_state = $this->id_state;
$objAddress->city = $this->city;
$objAddress->postcode = $this->zipcode;
- $objAddress->lastname = $hotelName;
- $objAddress->firstname = $hotelName;
- $objAddress->alias = $hotelName;
$objAddress->address1 = $this->address;
$objAddress->phone = $this->phone;
+ $objAddress->alias = substr($hotelName, 0, 32);
+ $addressFirstName = $hotelName;
+ $addressLastName = $hotelName;
+ if (Tools::strlen($hotelName) > 32) {
+ $addressFirstName = trim(substr($hotelName, 0, 32));
+ if (!$addressLastName = trim(substr($hotelName, 32, 32))) {
+ $addressLastName = $addressFirstName;
+ }
+ }
+
+ $objAddress->firstname = $addressFirstName;
+ $objAddress->lastname = $addressLastName;
return $objAddress->save();
}
@@ -1069,186 +1077,96 @@ class HotelBranchInformation extends ObjectModel
if (isset($this->webservice_validation) && $this->webservice_validation) {
if ($this->rating < 1 || $this->rating > 5) {
$message = Tools::displayError('Rating must be between 1 and 5.');
- if ($die) {
- throw new PrestaShopException($message);
- }
- return $error_return ? $message : false;
- }
-
- if (!strtotime($this->check_in)) {
+ } elseif (!strtotime($this->check_in)) {
$message = Tools::displayError('Check In time is invalid.');
- if ($die) {
- throw new PrestaShopException($message);
- }
- return $error_return ? $message : false;
- }
- if (!strtotime($this->check_out)) {
+ } elseif (!strtotime($this->check_out)) {
$message = Tools::displayError('Check out time is invalid.');
- if ($die) {
- throw new PrestaShopException($message);
- }
- return $error_return ? $message : false;
- }
-
- if ($this->check_in && $this->check_out && strtotime($this->check_out) >= strtotime($this->check_in)) {
+ } elseif ($this->check_in && $this->check_out && strtotime($this->check_out) >= strtotime($this->check_in)) {
$message = Tools::displayError('Check Out time must be before Check In time.');
- if ($die) {
- throw new PrestaShopException($message);
- }
- return $error_return ? $message : false;
- }
- if (!$this->phone) {
+ } elseif (!trim($this->phone)) {
$message = Tools::displayError('Phone number is required field.');
- if ($die) {
- throw new PrestaShopException($message);
- }
- return $error_return ? $message : false;
} elseif (!Validate::isPhoneNumber($this->phone)) {
$message = Tools::displayError('Please enter a valid phone number.');
- if ($die) {
- throw new PrestaShopException($message);
- }
- return $error_return ? $message : false;
- }
- if ($this->address == '') {
+ } elseif (trim($this->address) == '') {
$message = Tools::displayError('Address is required field.');
- if ($die) {
- throw new PrestaShopException($message);
- }
- return $error_return ? $message : false;
} elseif (!Validate::isAddress($this->address)) {
$message = Tools::displayError('Address is invalid.');
- if ($die) {
- throw new PrestaShopException($message);
- }
- return $error_return ? $message : false;
- }
-
- if (!$this->id_country) {
+ } elseif (!$this->id_country) {
$message = Tools::displayError('Country is required field.');
- if ($die) {
- throw new PrestaShopException($message);
- }
- return $error_return ? $message : false;
- } else {
- if (Validate::isLoadedObject($objCountry = new Country($this->id_country))) {
- $statesbycountry = State::getStatesByIdCountry($this->id_country);
- /*If selected country has states only the validate state field*/
- if ($this->id_state) {
- $objState = new State($this->id_state);
- if ($objState->id_country != $this->id_country) {
- $message = Tools::displayError('State is invalid.');
- if ($die) {
- throw new PrestaShopException($message);
- }
- return $error_return ? $message : false;
- }
- } else {
- if ($statesbycountry) {
- $message = Tools::displayError('State is required field.');
- if ($die) {
- throw new PrestaShopException($message);
- }
- return $error_return ? $message : false;
- }
- }
- /* Check zip code format */
- if (empty($this->zipcode) && $objCountry->need_zip_code) {
- $message = Tools::displayError('A Zip / Postal code is required.');
- if ($die) {
- throw new PrestaShopException($message);
- }
- return $error_return ? $message : false;
- } elseif ($objCountry->zip_code_format && !$objCountry->checkZipCode($this->zipcode)) {
- $message = sprintf(Tools::displayError('The Zip/Postal code you have entered is invalid. It must follow this format: %s'), str_replace('C', $objCountry->iso_code, str_replace('N', '0', str_replace('L', 'A', $objCountry->zip_code_format))));
- if ($die) {
- throw new PrestaShopException($message);
- }
- return $error_return ? $message : false;
- } elseif ($this->zipcode && !Validate::isPostCode($this->zipcode)) {
- $message = Tools::displayError('The Zip / Postal code is invalid.');
- if ($die) {
- throw new PrestaShopException($message);
- }
- return $error_return ? $message : false;
- }
- } else {
- $message = Tools::displayError('country is invalid.');
- if ($die) {
- throw new PrestaShopException($message);
- }
- return $error_return ? $message : false;
- }
- }
-
- if ($this->city == '') {
+ } elseif ($this->city == '') {
$message = Tools::displayError('City is required field.');
- if ($die) {
- throw new PrestaShopException($message);
- }
- return $error_return ? $message : false;
} elseif (!Validate::isCityName($this->city)) {
$message = Tools::displayError('Enter a Valid City Name.');
- if ($die) {
- throw new PrestaShopException($message);
- }
- return $error_return ? $message : false;
- }
-
- if (!Validate::isBool($this->use_global_max_order_date)) {
+ } elseif (!Validate::isBool($this->use_global_max_order_date)) {
$message = Tools::displayError('invalid value for use_global_max_order_date.');
- if ($die) {
- throw new PrestaShopException($message);
- }
- return $error_return ? $message : false;
- }
-
- if (!Validate::isBool($this->use_global_preparation_time)) {
+ } elseif (!Validate::isBool($this->use_global_preparation_time)) {
$message = Tools::displayError('invalid value for use_global_preparation_time.');
+ } elseif (!$this->use_global_max_order_date && $this->max_order_date == '') {
+ $message = Tools::displayError('Maximum date to book a room is required.');
+ } elseif (!$this->use_global_max_order_date && !Validate::isDate($this->max_order_date)) {
+ $message = Tools::displayError('Maximum date to book a room is invalid.');
+ } elseif (!$this->use_global_max_order_date
+ && ($maxOrderDateFormatted = date('Y-m-d', strtotime($this->max_order_date)))
+ && strtotime($maxOrderDateFormatted) < strtotime(date('Y-m-d'))
+ ) {
+ $message = Tools::displayError('Maximum Global Date to book a room can not be a past date. Please use a future date.');
+ } elseif (!$this->use_global_preparation_time && $this->preparation_time === '') {
+ $message = Tools::displayError('Minimum booking offset is a required.');
+ } elseif (!$this->use_global_preparation_time && $this->preparation_time !== '0' && !Validate::isUnsignedInt($this->preparation_time)) {
+ $message = Tools::displayError('Minimum booking offset is invalid.');
+ } elseif (!Validate::isLoadedObject($objCountry = new Country($this->id_country))) {
+ $message = Tools::displayError('country is invalid.');
+ } elseif ($this->id_state
+ && (!Validate::isLoadedObject($objState = new State($this->id_state)) || $objState->id_country != $this->id_country)
+ ) {
+ $message = Tools::displayError('State is invalid.');
+ } elseif (State::getStatesByIdCountry($this->id_country) && !$this->id_state) {
+ $message = Tools::displayError('State is required field.');
+ } elseif (empty($this->zipcode) && $objCountry->need_zip_code) {
+ $message = Tools::displayError('A Zip / Postal code is required.');
+ } elseif ($objCountry->zip_code_format && !$objCountry->checkZipCode($this->zipcode)) {
+ $message = sprintf(Tools::displayError('The Zip/Postal code you have entered is invalid. It must follow this format: %s'), str_replace('C', $objCountry->iso_code, str_replace('N', '0', str_replace('L', 'A', $objCountry->zip_code_format))));
+ } elseif ($this->zipcode && !Validate::isPostCode($this->zipcode)) {
+ $message = Tools::displayError('The Zip / Postal code is invalid.');
+ } else {
+ if ($addressValidation = Address::getValidationRules('Address')) {
+ foreach ($addressValidation['size'] as $field => $maxSize) {
+ if ('phone' == $field && Tools::strlen($this->phone) > $maxSize) {
+ $message = sprintf(
+ Tools::displayError('The Hotel phone number is too long (%1$d chars max).'),
+ $maxSize
+ );
+ break;
+ } elseif ('address1' == $field && Tools::strlen($this->address) > $maxSize) {
+ $message = sprintf(
+ Tools::displayError('The Hotel address is too long (%1$d chars max).'),
+ $maxSize
+ );
+ break;
+ } elseif ('city' == $field && Tools::strlen($this->city) > $maxSize) {
+ $message = sprintf(
+ Tools::displayError('The Hotel city name is too long (%1$d chars max).'),
+ $maxSize
+ );
+ break;
+ } elseif ('postcode' == $field && Tools::strlen($this->zipcode) > $maxSize) {
+ $message = sprintf(
+ Tools::displayError('The Hotel zip code is too long (%1$d chars max).'),
+ $maxSize
+ );
+ break;
+ }
+ }
+ }
+ }
+
+ if (isset($message) && $message != '') {
if ($die) {
throw new PrestaShopException($message);
}
+
return $error_return ? $message : false;
}
-
- if (!$this->use_global_max_order_date) {
- $maxOrderDateFormatted = date('Y-m-d', strtotime($this->max_order_date));
- if ($this->max_order_date == '') {
- $message = Tools::displayError('Maximum date to book a room is required.');
- if ($die) {
- throw new PrestaShopException($message);
- }
- return $error_return ? $message : false;
- } elseif (!Validate::isDate($this->max_order_date)) {
- $message = Tools::displayError('Maximum date to book a room is invalid.');
- if ($die) {
- throw new PrestaShopException($message);
- }
- return $error_return ? $message : false;
- } elseif (strtotime($maxOrderDateFormatted) < strtotime(date('Y-m-d'))) {
- $message = Tools::displayError('Maximum Global Date to book a room can not be a past date. Please use a future date.');
- if ($die) {
- throw new PrestaShopException($message);
- }
- return $error_return ? $message : false;
- }
- }
-
- if (!$this->use_global_preparation_time) {
- if ($this->preparation_time === '') {
- $message = Tools::displayError('Minimum booking offset is a required.');
- if ($die) {
- throw new PrestaShopException($message);
- }
- return $error_return ? $message : false;
- } elseif ($this->preparation_time !== '0' && !Validate::isUnsignedInt($this->preparation_time)) {
- $message = Tools::displayError('Minimum booking offset is invalid.');
- if ($die) {
- throw new PrestaShopException($message);
- }
- return $error_return ? $message : false;
- }
- }
}
return parent::validateFields($die, $error_return);
@@ -1280,6 +1198,11 @@ class HotelBranchInformation extends ObjectModel
}
$objCountry = new Country();
$countryName = $objCountry->getNameById($idLang, $this->id_country);
+ $linkRewriteArray = array();
+ foreach (Language::getLanguages(true) as $lang) {
+ $linkRewriteArray[$lang['id_lang']] = Tools::link_rewrite($this->hotel_name[$lang['id_lang']]);
+ }
+
if ($catCountry = $this->addCategory($countryName, false, $groupIds)) {
if ($this->id_state) {
$objState = new State();
@@ -1292,8 +1215,15 @@ class HotelBranchInformation extends ObjectModel
if ($catState) {
if ($catCity = $this->addCategory($this->city, $catState, $groupIds)) {
$hotelCatName = $this->hotel_name[Configuration::get('PS_LANG_DEFAULT')];
- if ($catHotel = $this->addCategory(
- $hotelCatName, $catCity, $groupIds, 1, $this->id
+ if ($this->id_category) {
+ $objCategory = new Category($this->id_category);
+ $objCategory->name = $this->hotel_name;
+ $objCategory->link_rewrite = $linkRewriteArray;
+ $objCategory->id_parent = $catCity;
+ $objCategory->save();
+ Category::regenerateEntireNtree();
+ } else if ($catHotel = $this->addCategory(
+ $hotelCatName, $catCity, $groupIds, 1, $this->id, $linkRewriteArray
)) {
$this->id_category = $catHotel;
$this->save();
diff --git a/modules/hotelreservationsystem/classes/HotelCartBookingData.php b/modules/hotelreservationsystem/classes/HotelCartBookingData.php
index df5c6c616..0efd7d634 100644
--- a/modules/hotelreservationsystem/classes/HotelCartBookingData.php
+++ b/modules/hotelreservationsystem/classes/HotelCartBookingData.php
@@ -1574,14 +1574,29 @@ class HotelCartBookingData extends ObjectModel
$data_v['id_room'],
0
);
+ $priceWithoutDiscount = HotelRoomTypeFeaturePricing::getRoomTypeTotalPrice(
+ $product['id_product'],
+ $data_v['date_from'],
+ $data_v['date_to'],
+ 0,
+ 0,
+ $context->cart->id,
+ $context->cart->id_guest,
+ $data_v['id_room'],
+ 1,
+ 0
+ );
if (!$price_tax) {
$amount = $roomTypeDateRangePrice['total_price_tax_excl'];
$amountWithoutAutoAdd = $roomTypeDateRangePriceWithoutAutoAdd['total_price_tax_excl'];
+ $totalPriceWithoutDiscount = $priceWithoutDiscount['total_price_tax_excl'];
} else {
$amount = $roomTypeDateRangePrice['total_price_tax_incl'];
$amountWithoutAutoAdd = $roomTypeDateRangePriceWithoutAutoAdd['total_price_tax_incl'];
+ $totalPriceWithoutDiscount = $priceWithoutDiscount['total_price_tax_incl'];
}
$cartHotelData[$prodKey]['date_diff'][$dateJoin]['amount'] = $amount * $varQty;
+ $cartHotelData[$prodKey]['date_diff'][$dateJoin]['total_price_without_discount'] = $totalPriceWithoutDiscount * $varQty;
$cartHotelData[$prodKey]['date_diff'][$dateJoin]['amount_without_auto_add'] = $amountWithoutAutoAdd * $varQty;
} else {
$cartHotelData[$prodKey]['date_diff'][$dateJoin]['demand_price'] = $totalAdditionalServicePrice;
@@ -1621,15 +1636,30 @@ class HotelCartBookingData extends ObjectModel
$data_v['id_room'],
0
);
+ $priceWithoutDiscount = HotelRoomTypeFeaturePricing::getRoomTypeTotalPrice(
+ $product['id_product'],
+ $data_v['date_from'],
+ $data_v['date_to'],
+ 0,
+ 0,
+ $context->cart->id,
+ $context->cart->id_guest,
+ $data_v['id_room'],
+ 1,
+ 0
+ );
if (!$price_tax) {
$amount = $roomTypeDateRangePrice['total_price_tax_excl'];
$amountWithoutAutoAdd = $roomTypeDateRangePriceWithoutAutoAdd['total_price_tax_excl'];
+ $totalPriceWithoutDiscount = $priceWithoutDiscount['total_price_tax_excl'];
} else {
$amount = $roomTypeDateRangePrice['total_price_tax_incl'];
$amountWithoutAutoAdd = $roomTypeDateRangePriceWithoutAutoAdd['total_price_tax_incl'];
+ $totalPriceWithoutDiscount = $priceWithoutDiscount['total_price_tax_incl'];
}
$cartHotelData[$prodKey]['date_diff'][$dateJoin]['amount'] = $amount;
$cartHotelData[$prodKey]['date_diff'][$dateJoin]['amount_without_auto_add'] = $amountWithoutAutoAdd;
+ $cartHotelData[$prodKey]['date_diff'][$dateJoin]['total_price_without_discount'] = $totalPriceWithoutDiscount;
$cartHotelData[$prodKey]['date_diff'][$dateJoin]['link'] = $context->link->getPageLink(
'order-opc',
null,
@@ -1875,13 +1905,31 @@ class HotelCartBookingData extends ObjectModel
}
}
+ public function update($null_values = false)
+ {
+ if (!$this->extra_demands) {
+ $this->extra_demands = json_encode(array());
+ }
+
+ return parent::update($null_values);
+ }
+
+ public function add($auto_date = true, $null_values = false)
+ {
+ if (!$this->extra_demands) {
+ $this->extra_demands = json_encode(array());
+ }
+
+ return parent::add($auto_date, $null_values);
+ }
+
// Webservice :: get extra demands for the cart booking
public function getWsExtraDemands()
{
$extraDemands = json_decode($this->extra_demands, true);
- if (count($extraDemands)) {
- foreach ($extraDemands as &$demnad) {
- $demnad['id'] = $demnad['id_global_demand'];
+ if ($extraDemands) {
+ foreach ($extraDemands as &$demand) {
+ $demand['id'] = $demand['id_global_demand'];
}
return $extraDemands;
}
diff --git a/modules/hotelreservationsystem/classes/HotelHelper.php b/modules/hotelreservationsystem/classes/HotelHelper.php
index 1b3057831..d44240626 100644
--- a/modules/hotelreservationsystem/classes/HotelHelper.php
+++ b/modules/hotelreservationsystem/classes/HotelHelper.php
@@ -2521,4 +2521,336 @@ class HotelHelper
return $isValid;
}
+
+ /**
+ * This function is a utility function for creating an associative array for generating tree
+ * provide tree structure in the following format
+ * country --> root
+ * state
+ * city
+ * hotel
+ * room_type
+ * room --> leaf
+ *
+ * You can edit the start and end point to generate tree for different levels
+ * @param $rootNode = 'country'
+ * @param $leafNode = 'room'
+ * @param $rootNodeId int|array
+ * @param $selectedElements int|array
+ */
+
+ const NODE_COUNTRY = 1;
+ const NODE_STATE = 2;
+ const NODE_CITY = 3;
+ const NODE_HOTEL = 4;
+ const NODE_ROOM_TYPE = 5;
+ const NODE_ROOM = 6;
+
+ public static function generateTreeData($params)
+ {
+ extract($params);
+
+ if (!isset($rootNode)) {
+ $rootNode = self::NODE_COUNTRY;
+ }
+ if (!isset($leafNode)) {
+ $leafNode = self::NODE_ROOM;
+ }
+ if (!isset($selectedElements)) {
+ $selectedElements = array();
+ }
+ if (!isset($rootNodeId)) {
+ $rootNodeId = false;
+ }
+ $treeData = array();
+
+ if ($rootNode == self::NODE_COUNTRY) {
+ $treeData = self::generateCountryNodes($rootNodeId, $leafNode, $selectedElements);
+ } else if ($rootNode == self::NODE_STATE) {
+ $treeData = self::generateStateNodes($rootNodeId, $leafNode, $selectedElements);
+ } else if ($rootNode == self::NODE_CITY) {
+ $treeData = self::generateCityNodes($rootNodeId, $leafNode, $selectedElements);
+ } else if ($rootNode == self::NODE_HOTEL) {
+ $treeData = self::generateHotelNodes($rootNodeId, $leafNode, $selectedElements);
+ } else if ($rootNode == self::NODE_ROOM_TYPE) {
+ $treeData = self::generateRoomTypeNodes($rootNodeId, $leafNode, $selectedElements);
+ } else if ($rootNode == self::NODE_ROOM) {
+ $treeData = self::generateRoomNodes($rootNodeId, $leafNode, $selectedElements);
+ }
+
+ return $treeData;
+ }
+
+ /**
+ * Generate the node data for country
+ */
+ protected static function generateCountryNodes($rootNodeId, $leafNode, $selectedElements, $previousElements = false)
+ {
+ $return = array();
+ $countries = self::getcategoryByParent($previousElements, 3, 'country', $rootNodeId);
+ $countriesIds = array_column($countries, 'value');
+
+ if ($leafNode > self::NODE_COUNTRY) {
+ $states = self::generateStateNodes(false, $leafNode, $selectedElements, $countriesIds);
+ }
+
+ foreach ($countries as $country) {
+ if (isset($selectedElements['state']) && in_array($country['value'], $selectedElements['state'])) {
+ $country['selected'] = true;
+ }
+
+ if (isset($states[$country['value']])) {
+ $country['children'] = $states[$country['value']];
+ }
+
+ if ($previousElements) {
+ $return[$country['id_parent']][] = $country;
+ } else {
+ $return[] = $country;
+ }
+ }
+
+ return $return;
+ }
+
+ /**
+ * Generate the node data for state
+ */
+ protected static function generateStateNodes($rootNodeId, $leafNode, $selectedElements, $previousElements = false)
+ {
+ $return = array();
+ $states = self::getcategoryByParent($previousElements, 4, 'state', $rootNodeId);
+ $stateIds = array_column($states, 'value');
+
+ if ($leafNode > self::NODE_STATE) {
+ $cities = self::generateCityNodes(false, $leafNode, $selectedElements, $stateIds);
+ }
+
+ foreach ($states as $state) {
+ if (isset($selectedElements['state']) && in_array($state['value'], $selectedElements['state'])) {
+ $state['selected'] = true;
+ }
+
+ if (isset($cities[$state['value']])) {
+ $state['children'] = $cities[$state['value']];
+ }
+
+ if ($previousElements) {
+ $return[$state['id_parent']][] = $state;
+ } else {
+ $return[] = $state;
+ }
+ }
+
+ return $return;
+ }
+
+ /**
+ * Generate the node data for city
+ */
+ protected static function generateCityNodes($rootNodeId, $leafNode, $selectedElements, $previousElements = false)
+ {
+ $return = array();
+ $cities = self::getcategoryByParent($previousElements, 5, 'city', $rootNodeId);
+ $cityIds = array_column($cities, 'value');
+
+ if ($leafNode > self::NODE_CITY) {
+ $hotels = self::generateHotelNodes(false, $leafNode, $selectedElements, $cityIds);
+ }
+
+ foreach ($cities as $city) {
+ if (isset($selectedElements['city']) && in_array($city['value'], $selectedElements['city'])) {
+ $city['selected'] = true;
+ }
+
+ if (isset($hotels[$city['value']])) {
+ $city['children'] = $hotels[$city['value']];
+ }
+
+ if ($previousElements) {
+ $return[$city['id_parent']][] = $city;
+ } else {
+ $return[] = $city;
+ }
+ }
+
+ return $return;
+ }
+
+ /**
+ * Generate the node data for hotels
+ */
+ protected static function generateHotelNodes($rootNodeId, $leafNode, $selectedElements, $previousElements = false)
+ {
+ $return = array();
+ $hotels = self::getHotelsByIdCity($previousElements, $rootNodeId);
+ $hotelIds = array_column($hotels, 'value');
+
+ if ($leafNode > self::NODE_HOTEL) {
+ $roomTypes = self::generateRoomTypeNodes(false, $leafNode, $selectedElements, $hotelIds);
+ }
+
+ foreach ($hotels as $hotel) {
+ if (isset($selectedElements['hotel']) && in_array($hotel['value'], $selectedElements['hotel'])) {
+ $hotel['selected'] = true;
+ }
+
+ if (isset($roomTypes[$hotel['value']])) {
+ $hotel['children'] = $roomTypes[$hotel['value']];
+ }
+
+ if ($previousElements) {
+ $return[$hotel['id_parent']][] = $hotel;
+ } else {
+ $return[] = $hotel;
+ }
+ }
+
+ return $return;
+ }
+
+ /**
+ * Generate the node data for room types
+ */
+ protected static function generateRoomTypeNodes($rootNodeId, $leafNode, $selectedElements, $previousElements = false)
+ {
+ $return = array();
+ $roomTypes = self::getRoomTypesByHotelsId($previousElements, $rootNodeId);
+ $roomTypeIds = array_column($roomTypes, 'value');
+
+ if ($leafNode > self::NODE_ROOM_TYPE) {
+ $rooms = self::generateRoomNodes(false, $leafNode, $selectedElements, $roomTypeIds);
+ }
+
+ foreach ($roomTypes as $roomType) {
+ if (isset($selectedElements['room_type']) && in_array($roomType['value'], $selectedElements['room_type'])) {
+ $roomType['selected'] = true;
+ }
+
+ if (isset($rooms[$roomType['value']])) {
+ $roomType['children'] = $rooms[$roomType['value']];
+ }
+ $roomType['hint'] = 'This is Room type hint';
+ $roomType['badge'] = array(
+ 'class' => 'badge-danger',
+ 'title' => 'Disabled'
+ );
+ if ($previousElements) {
+ $return[$roomType['id_hotel']][] = $roomType;
+ } else {
+ $return[] = $roomType;
+ }
+ }
+
+ return $return;
+ }
+
+ /**
+ * Generate the node data for rooms
+ */
+ protected static function generateRoomNodes($rootNodeId, $leafNode, $selectedElements, $previousElements = false)
+ {
+ $return = array();
+ $rooms = self::getRoomsByRoomTypeId($previousElements, $rootNodeId);
+
+ foreach ($rooms as $room) {
+ if (isset($selectedElements['room']) && in_array($room['value'], $selectedElements['room'])) {
+ $room['selected'] = true;
+ }
+
+ if ($previousElements) {
+ $return[$room['id_product']][] = $room;
+ } else {
+ $return[] = $room;
+ }
+ }
+
+ return $return;
+ }
+
+ /**
+ * Get all the children category of the provided id categories
+ */
+ protected static function getcategoryByParent($idParents, $levelDepth, $input_name, $rootNodeId)
+ {
+ $locationCategory = new Category(Configuration::get('PS_LOCATIONS_CATEGORY'));
+ $sql = 'SELECT c.`id_category` as `value` , cl.`name`, "'.pSQL($input_name).'_box" as `input_name`, c.`id_parent`
+ FROM `'._DB_PREFIX_.'category` AS c
+ INNER JOIN `'._DB_PREFIX_.'category_lang` AS cl
+ ON (c.`id_category` = cl.`id_category` AND cl.`id_lang`='.(int)Context::getContext()->language->id.')
+ WHERE c.`nleft` > '.(int)$locationCategory->nleft.' AND c.`nright` < '.(int)$locationCategory->nright.'
+ AND c.`level_depth` = '.(int)$levelDepth;
+
+ if ($idParents) {
+ $sql .= ' AND c.`id_parent` IN ('.implode(', ', $idParents).')';
+ }
+ if ($rootNodeId) {
+ $sql .= ' AND c.`id_category` = '.(int)$rootNodeId;
+ }
+
+ return Db::getInstance()->executeS($sql);
+ }
+
+ /**
+ * Get all the hotels of the passed cities (city id_category)
+ */
+ protected static function getHotelsByIdCity($cities, $rootNodeId)
+ {
+
+ $sql = 'SELECT hbi.`id` as `value` , hbil.`hotel_name` as `name`, "hotel_box" as `input_name`, c.`id_parent`
+ FROM `'._DB_PREFIX_.'htl_branch_info` AS hbi
+ INNER JOIN `'._DB_PREFIX_.'htl_branch_info_lang` AS hbil
+ ON (hbi.`id` = hbil.`id` AND hbil.`id_lang`='.(int)Context::getContext()->language->id.')
+ INNER JOIN `'._DB_PREFIX_.'category` AS c ON (hbi.`id_category` = c.`id_category`)
+ WHERE 1';
+
+ if ($cities) {
+ $sql .= ' AND c.`id_parent` IN ('.implode(', ', $cities).')';
+ }
+ if ($rootNodeId) {
+ $sql .= ' AND hbi.`id` = '.(int)$rootNodeId;
+ }
+ return Db::getInstance()->executeS($sql);
+ }
+
+ /**
+ * Get all the room types of the passed hotels
+ */
+ protected static function getRoomTypesByHotelsId($hotels, $rootNodeId)
+ {
+ $sql = 'SELECT p.`id_product` AS `value`, pl.`name`, "room_type_box" as `input_name`, rt.`id_hotel`
+ FROM `'._DB_PREFIX_.'htl_room_type` AS rt';
+
+ $sql .= ' INNER JOIN `'._DB_PREFIX_.'product` AS p ON (rt.`id_product` = p.`id_product`)
+ INNER JOIN `'._DB_PREFIX_.'product_lang` AS pl
+ ON (p.`id_product` = pl.`id_product` AND pl.`id_lang`='.(int)Context::getContext()->language->id.')
+ WHERE 1';
+
+ if ($hotels) {
+ $sql .= ' AND rt.`id_hotel` IN ('.implode(', ', $hotels).')';
+ }
+ if ($rootNodeId) {
+ $sql .= ' AND p.`id_product` = '.(int)$rootNodeId;
+ }
+
+ return Db::getInstance()->executeS($sql);
+ }
+
+ /**
+ * Get all the rooms of the passed room types (city id_category)
+ */
+ protected static function getRoomsByRoomTypeId($roomTypes, $rootNodeId)
+ {
+ $sql = 'SELECT `id` as `value`, `room_num` as `name`, "room_box" as `input_name`, `id_product`
+ FROM `'._DB_PREFIX_.'htl_room_information`
+ WHERE 1';
+ if ($roomTypes) {
+ $sql .= ' AND `id_product` IN ('.implode(', ', $roomTypes).')';
+ }
+ if ($rootNodeId) {
+ $sql .= ' AND `id` = '.(int)$rootNodeId;
+ }
+
+ return Db::getInstance()->executeS($sql);
+ }
}
diff --git a/modules/hotelreservationsystem/classes/HotelRoomInformation.php b/modules/hotelreservationsystem/classes/HotelRoomInformation.php
index 26ffbbb5d..f3c2b05af 100644
--- a/modules/hotelreservationsystem/classes/HotelRoomInformation.php
+++ b/modules/hotelreservationsystem/classes/HotelRoomInformation.php
@@ -285,7 +285,10 @@ class HotelRoomInformation extends ObjectModel
if ($roomTypeInfo = $objRoomType->getRoomTypeInfoByIdProduct($this->id_product)) {
$this->id_hotel = $roomTypeInfo['id_hotel'];
return $this->add($autodate, $null_values);
+ } else {
+ WebserviceRequest::getInstance()->setError(400, 'Invalid id product', 134);
}
+
return false;
}
@@ -296,7 +299,10 @@ class HotelRoomInformation extends ObjectModel
if ($roomTypeInfo = $objRoomType->getRoomTypeInfoByIdProduct($this->id_product)) {
$this->id_hotel = $roomTypeInfo['id_hotel'];
return $this->update($null_values);
+ } else {
+ WebserviceRequest::getInstance()->setError(400, 'Invalid id product', 134);
}
+
return false;
}
diff --git a/modules/hotelreservationsystem/classes/HotelRoomType.php b/modules/hotelreservationsystem/classes/HotelRoomType.php
index 6c0a80fd4..4316f94ce 100644
--- a/modules/hotelreservationsystem/classes/HotelRoomType.php
+++ b/modules/hotelreservationsystem/classes/HotelRoomType.php
@@ -419,4 +419,24 @@ class HotelRoomType extends ObjectModel
'SELECT `id` FROM `'._DB_PREFIX_.'htl_room_information` WHERE `id_product` = '.(int)$this->id_product.' ORDER BY `id` ASC'
);
}
+
+ public function validateFields($die = true, $error_return = false)
+ {
+ if (isset($this->webservice_validation) && $this->webservice_validation) {
+ if (!(int) $this->id_product || !Validate::isLoadedObject(new Product((int) $this->id_product))) {
+ $message = Tools::displayError('Invalid Id product.');
+ } elseif (!(int)$this->id_hotel || !Validate::isLoadedObject(new HotelBranchInformation((int) $this->id_hotel))) {
+ $message = Tools::displayError('Invalid Id hotel.');
+ }
+
+ if (isset($message)) {
+ if ($die) {
+ throw new PrestaShopException($message);
+ }
+ return $error_return ? $message : false;
+ }
+ }
+ return parent::validateFields($die, $error_return);
+ }
+
}
diff --git a/modules/hotelreservationsystem/classes/HotelRoomTypeDemand.php b/modules/hotelreservationsystem/classes/HotelRoomTypeDemand.php
index e02bdf307..7be39da7f 100644
--- a/modules/hotelreservationsystem/classes/HotelRoomTypeDemand.php
+++ b/modules/hotelreservationsystem/classes/HotelRoomTypeDemand.php
@@ -336,8 +336,10 @@ class HotelRoomTypeDemand extends ObjectModel
$price = $objGlobalDemand->price;
}
}
+
+ $price = Tools::convertPrice($price, $idCurrency);
}
- $price = Tools::convertPrice($price, $idCurrency);
+
// Tax calculation section
$address->id_country = $idCountry;
$address->id_state = $idState;
diff --git a/modules/hotelreservationsystem/classes/HotelRoomTypeFeaturePricing.php b/modules/hotelreservationsystem/classes/HotelRoomTypeFeaturePricing.php
index a6a66e82e..de0131c57 100644
--- a/modules/hotelreservationsystem/classes/HotelRoomTypeFeaturePricing.php
+++ b/modules/hotelreservationsystem/classes/HotelRoomTypeFeaturePricing.php
@@ -82,10 +82,6 @@ class HotelRoomTypeFeaturePricing extends ObjectModel
protected $webserviceParameters = array(
'objectsNodeName' => 'feature_prices',
'objectNodeName' => 'feature_price',
- 'objectMethods' => array(
- 'add' => 'addWs',
- 'update' => 'updateWs',
- ),
'fields' => array(
'id_product' => array(
'xlink_resource' => array(
@@ -277,7 +273,7 @@ class HotelRoomTypeFeaturePricing extends ObjectModel
$date_from = date('Y-m-d', strtotime($date_from));
$date_to = date('Y-m-d', strtotime($date_to));
for($date = $date_from; $date < $date_to; $date = date('Y-m-d', strtotime('+1 day', strtotime($date)))) {
- $currentDate = date('Y-m-d', $date);
+ $currentDate = date('Y-m-d', strtotime($date));
$nextDayDate = date('Y-m-d', strtotime('+1 day', strtotime($currentDate)));
if ($id_product) {
$bookingParams = array(
@@ -647,15 +643,16 @@ class HotelRoomTypeFeaturePricing extends ObjectModel
$id_cart = 0,
$id_guest = 0,
$id_room = 0,
- $with_auto_room_services = 1
+ $with_auto_room_services = 1,
+ $use_reduc = 1
) {
$totalPrice = array();
$totalPrice['total_price_tax_incl'] = 0;
$totalPrice['total_price_tax_excl'] = 0;
$featureImpactPriceTE = 0;
$featureImpactPriceTI = 0;
- $productPriceTI = Product::getPriceStatic((int) $id_product, true);
- $productPriceTE = Product::getPriceStatic((int) $id_product, false);
+ $productPriceTI = Product::getPriceStatic((int) $id_product, true, false, 6, null, false, $use_reduc);
+ $productPriceTE = Product::getPriceStatic((int) $id_product, false, false, 6, null, false, $use_reduc);
if ($productPriceTE) {
$taxRate = (($productPriceTI-$productPriceTE)/$productPriceTE)*100;
} else {
@@ -678,14 +675,14 @@ class HotelRoomTypeFeaturePricing extends ObjectModel
$date_from = date('Y-m-d', strtotime($date_from));
$date_to = date('Y-m-d', strtotime($date_to));
for($currentDate = $date_from; $currentDate < $date_to; $currentDate = date('Y-m-d', strtotime('+1 day', strtotime($currentDate)))) {
- if ($featurePrice = $hotelCartBookingData->getProductFeaturePricePlanByDateByPriority(
+ if ($use_reduc && ($featurePrice = $hotelCartBookingData->getProductFeaturePricePlanByDateByPriority(
$id_product,
$currentDate,
$id_group,
$id_cart,
$id_guest,
$id_room
- )) {
+ ))) {
if ($featurePrice['impact_type'] == self::IMPACT_TYPE_PERCENTAGE) {
//percentage
$featureImpactPriceTE = $productPriceTE * ($featurePrice['impact_value'] / 100);
@@ -728,7 +725,8 @@ class HotelRoomTypeFeaturePricing extends ObjectModel
Product::PRICE_ADDITION_TYPE_WITH_ROOM,
true,
$id_cart,
- $id_guest
+ $id_guest,
+ $use_reduc
)) {
foreach($servicesWithTax as $service) {
$totalPrice['total_price_tax_incl'] += $service['price'];
@@ -741,7 +739,8 @@ class HotelRoomTypeFeaturePricing extends ObjectModel
Product::PRICE_ADDITION_TYPE_WITH_ROOM,
false,
$id_cart,
- $id_guest
+ $id_guest,
+ $use_reduc
)) {
foreach($servicesWithoutTax as $service) {
$totalPrice['total_price_tax_excl'] += $service['price'];
@@ -771,7 +770,8 @@ class HotelRoomTypeFeaturePricing extends ObjectModel
$id_cart = 0,
$id_guest = 0,
$id_room = 0,
- $with_auto_room_services = 1
+ $with_auto_room_services = 1,
+ $use_reduc = 1
) {
$dateFrom = date('Y-m-d', strtotime($date_from));
$dateTo = date('Y-m-d', strtotime($date_to));
@@ -784,7 +784,8 @@ class HotelRoomTypeFeaturePricing extends ObjectModel
$id_cart,
$id_guest,
$id_room,
- $with_auto_room_services
+ $with_auto_room_services,
+ $use_reduc
);
$totalDurationPriceTI = $totalDurationPrice['total_price_tax_incl'];
@@ -919,72 +920,37 @@ class HotelRoomTypeFeaturePricing extends ObjectModel
return true;
}
- // Webservice :: function will run when feature price added from API
- public function addWs($autodate = true, $null_values = false)
+ public function validateFields($die = true, $error_return = false)
{
- $postData = trim(file_get_contents('php://input'));
- libxml_use_internal_errors(true);
- $xml = simplexml_load_string(utf8_decode($postData));
- $postFieldsObj = json_decode(json_encode($xml));
-
- // we will check this also as empty value comes in empty std class
- $specialDaysArray = (array) $postFieldsObj->feature_price->special_days;
-
- if (!empty($postFieldsObj->feature_price->special_days)
- && $postFieldsObj->feature_price->special_days
- && $specialDaysArray
- ) {
+ if (isset($this->webservice_validation) && $this->webservice_validation) {
$weekDays = ['mon', 'tue', 'wed', 'thu', 'fri', 'sat', 'sun'];
- $specialDays = json_decode($postFieldsObj->feature_price->special_days, true);
- if (is_array($specialDays) && $specialDays) {
- if (count(array_diff($specialDays, $weekDays))) {
- WebserviceRequest::getInstance()->setError(400, 'Invalid special days. format must match with : ["mon", "tue", "wed", "thu", "fri", "sat", "sun"]', 134);
-
- return false;
+ if($this->is_special_days_exists) {
+ if ($this->special_days
+ && ($specialDays = json_decode($this->special_days, true))
+ ) {
+ if (is_array($specialDays) && $specialDays) {
+ if (count(array_diff($specialDays, $weekDays))) {
+ $message = Tools::displayError('Invalid special days. format must match with : ["mon", "tue", "wed", "thu", "fri", "sat", "sun"]', false);
+ }
+ } else {
+ $message = Tools::displayError('Invalid special days. format must match with : ["mon", "tue", "wed", "thu", "fri", "sat", "sun"]', false);
+ }
+ } else {
+ $message = Tools::displayError('Invalid special days. format must match with : ["mon", "tue", "wed", "thu", "fri", "sat", "sun"]', false);
}
- } else {
- WebserviceRequest::getInstance()->setError(400, 'Invalid special days. format must match with : ["mon", "tue", "wed", "thu", "fri", "sat", "sun"]', 134);
+ }
- return false;
+ if (isset($message) && $message != '') {
+ if ($die) {
+ throw new PrestaShopException($message);
+ }
+
+ return $error_return ? $message : false;
}
}
- return $this->add($autodate, $null_values);
+ return parent::validateFields($die, $error_return);
}
-
- // Webservice :: function will run when feature price updated from API
- public function updateWs($null_values = false)
- {
- $postData = trim(file_get_contents('php://input'));
- libxml_use_internal_errors(true);
- $xml = simplexml_load_string(utf8_decode($postData));
- $postFieldsObj = json_decode(json_encode($xml));
-
- // we will check this also as empty value comes in empty std class
- $specialDaysArray = (array) $postFieldsObj->feature_price->special_days;
-
- if (!empty($postFieldsObj->feature_price->special_days)
- && $postFieldsObj->feature_price->special_days
- && $specialDaysArray
- ) {
- $weekDays = ['mon', 'tue', 'wed', 'thu', 'fri', 'sat', 'sun'];
- $specialDays = json_decode($postFieldsObj->feature_price->special_days, true);
- if (is_array($specialDays) && $specialDays) {
- if (count(array_diff($specialDays, $weekDays))) {
- WebserviceRequest::getInstance()->setError(400, 'Invalid special days. format must match with : ["mon", "tue", "wed", "thu", "fri", "sat", "sun"]', 134);
-
- return false;
- }
- } else {
- WebserviceRequest::getInstance()->setError(400, 'Invalid special days. format must match with : ["mon", "tue", "wed", "thu", "fri", "sat", "sun"]', 134);
-
- return false;
- }
- }
-
- return $this->update($null_values);
- }
-
public static function createAutoFeaturePrice($params)
{
$context = Context::getContext();
diff --git a/modules/hotelreservationsystem/classes/RoomTypeServiceProduct.php b/modules/hotelreservationsystem/classes/RoomTypeServiceProduct.php
index 5acb6ef60..90c3b85e0 100644
--- a/modules/hotelreservationsystem/classes/RoomTypeServiceProduct.php
+++ b/modules/hotelreservationsystem/classes/RoomTypeServiceProduct.php
@@ -107,9 +107,9 @@ class RoomTypeServiceProduct extends ObjectModel
);
if ($formated) {
- $response = array('hotels' => array(), 'room_types' => array());
+ $response = array('hotel' => array(), 'room_type' => array());
foreach($rows as $row) {
- $key = $row['element_type'] == self::WK_ELEMENT_TYPE_HOTEL ? 'hotels' : 'room_types';
+ $key = $row['element_type'] == self::WK_ELEMENT_TYPE_HOTEL ? 'hotel' : 'room_type';
$response[$key][] = $row['id_element'];
}
return $response;
@@ -135,7 +135,7 @@ class RoomTypeServiceProduct extends ObjectModel
return Db::getInstance()->getValue($sql);
}
- public static function getAutoAddServices($idProduct, $dateFrom = null, $dateTo = null, $priceAdditionType = null, $useTax = null, $idCart = 0, $idGuest = 0)
+ public static function getAutoAddServices($idProduct, $dateFrom = null, $dateTo = null, $priceAdditionType = null, $useTax = null, $idCart = 0, $idGuest = 0, $use_reduc = 1)
{
if (Product::isBookingProduct($idProduct)) {
$sql = 'SELECT p.`id_product` FROM `'._DB_PREFIX_.'htl_room_type_service_product` rsp
@@ -157,7 +157,10 @@ class RoomTypeServiceProduct extends ObjectModel
1,
$dateFrom,
$dateTo,
- $useTax
+ $useTax,
+ false,
+ null,
+ $use_reduc
);
}
return $services;
diff --git a/modules/hotelreservationsystem/classes/RoomTypeServiceProductOrderDetail.php b/modules/hotelreservationsystem/classes/RoomTypeServiceProductOrderDetail.php
index f7e4bc2c0..8692ee1e4 100644
--- a/modules/hotelreservationsystem/classes/RoomTypeServiceProductOrderDetail.php
+++ b/modules/hotelreservationsystem/classes/RoomTypeServiceProductOrderDetail.php
@@ -69,9 +69,9 @@ class RoomTypeServiceProductOrderDetail extends ObjectModel
$useTax = null,
$autoAddToCart = 0,
$priceAdditionType = null,
- $idOrderDetail = 0
+ $idOrderDetail = 0,
+ $idHtlBookingDetail = 0
) {
-
if ($useTax === null) {
$useTax = Product::$_taxCalculationMethod == PS_TAX_EXC ? false : true;
}
@@ -111,6 +111,9 @@ class RoomTypeServiceProductOrderDetail extends ObjectModel
if ($idRoom) {
$sql .= ' AND hbd.`id_room`='.(int) $idRoom;
}
+ if ($idHtlBookingDetail) {
+ $sql .= ' AND hbd.`id` = '.(int)$idHtlBookingDetail;
+ }
$sql .= ' ORDER BY hbd.`id`';
if ($getTotalPrice) {
diff --git a/modules/hotelreservationsystem/classes/RoomTypeServiceProductPrice.php b/modules/hotelreservationsystem/classes/RoomTypeServiceProductPrice.php
index 7300566ee..8d7b37bdd 100644
--- a/modules/hotelreservationsystem/classes/RoomTypeServiceProductPrice.php
+++ b/modules/hotelreservationsystem/classes/RoomTypeServiceProductPrice.php
@@ -101,7 +101,7 @@ class RoomTypeServiceProductPrice extends ObjectModel
);
}
- public function getServicePrice($idProduct, $idProductRoomType, $quantity, $dateFrom = null, $dateTo = null, $useTax = null, $id_cart = false, $id_address = null, $test= false)
+ public function getServicePrice($idProduct, $idProductRoomType, $quantity, $dateFrom = null, $dateTo = null, $useTax = null, $id_cart = false, $id_address = null, $use_reduc= 1)
{
if ($useTax === null)
$useTax = Product::$_taxCalculationMethod == PS_TAX_EXC ? false : true;
@@ -115,7 +115,7 @@ class RoomTypeServiceProductPrice extends ObjectModel
6,
null,
false,
- true,
+ $use_reduc,
(int)$quantity,
false,
null,
diff --git a/modules/hotelreservationsystem/classes/WebserviceSpecificManagementQlo.php b/modules/hotelreservationsystem/classes/WebserviceSpecificManagementQlo.php
index 11280b267..d048a24a8 100644
--- a/modules/hotelreservationsystem/classes/WebserviceSpecificManagementQlo.php
+++ b/modules/hotelreservationsystem/classes/WebserviceSpecificManagementQlo.php
@@ -107,11 +107,15 @@ class WebserviceSpecificManagementQlo implements WebserviceSpecificManagementInt
if (!isset($this->wsObject->urlFragments['id_hotel']) ) {
throw new WebserviceException('You have to set \'id_hotel\', \'date_from\' and \'date_to\'parameters to get a result', array(100, 400));
}
- $kwargs = [
+ $dateFrom = isset($this->wsObject->urlFragments['date_from']) ? $this->wsObject->urlFragments['date_from'] : date('Y-m-d');
+ $dateTo = isset($this->wsObject->urlFragments['date_to']) ? $this->wsObject->urlFragments['date_to'] : date('Y-m-d', strtotime($dateFrom.' + 1 day'));
+ $kwargs = array(
'idHotel' => $this->wsObject->urlFragments['id_hotel'],
- 'dateFrom' => $this->wsObject->urlFragments['date_from'],
- 'dateTo' => $this->wsObject->urlFragments['date_to'],
- ];
+ 'dateFrom' => $dateFrom,
+ 'dateTo' => $dateTo,
+ 'idRoomType' => isset($this->wsObject->urlFragments['id_room_type']) ? $this->wsObject->urlFragments['id_room_type'] : 0,
+ );
+
$this->output .= $objQloRoomType->getRoomRates($kwargs);
break;
diff --git a/modules/hotelreservationsystem/controllers/admin/AdminAddHotelController.php b/modules/hotelreservationsystem/controllers/admin/AdminAddHotelController.php
index c36ca04dc..ded152095 100644
--- a/modules/hotelreservationsystem/controllers/admin/AdminAddHotelController.php
+++ b/modules/hotelreservationsystem/controllers/admin/AdminAddHotelController.php
@@ -274,7 +274,7 @@ class AdminAddHotelController extends ModuleAdminController
}
}
- if (!$phone) {
+ if (!$phone = trim($phone)) {
$this->errors[] = $this->l('Phone number is required field.');
} elseif (!Validate::isPhoneNumber($phone)) {
$this->errors[] = $this->l('Please enter a valid phone number.');
@@ -300,7 +300,7 @@ class AdminAddHotelController extends ModuleAdminController
$this->errors[] = $this->l('Rating is required field.');
}
- if ($address == '') {
+ if (!$address = trim($address)) {
$this->errors[] = $this->l('Address is required field.');
}
@@ -329,7 +329,39 @@ class AdminAddHotelController extends ModuleAdminController
if ($city == '') {
$this->errors[] = $this->l('City is required field.');
} elseif (!Validate::isCityName($city)) {
- $this->errors[] = $this->l('Enter a Valid City Name.');
+ $this->errors[] = $this->l('Enter a valid city name.');
+ }
+
+ //Since the address for the hotel is saved in the address table. We are validating the hotel address here manually.
+ $addressValidation = Address::getValidationRules('Address');
+ foreach ($addressValidation['size'] as $field => $maxSize) {
+ if ('phone' == $field && Tools::strlen($phone) > $maxSize) {
+ $this->errors[] = sprintf(
+ Tools::displayError('The Hotel phone number is too long (%1$d chars max).'),
+ $maxSize
+ );
+ } else if ('address1' == $field && Tools::strlen($address) > $maxSize) {
+ $this->errors[] = sprintf(
+ Tools::displayError('The Hotel address is too long (%1$d chars max).'),
+ $maxSize
+ );
+ } else if ('city' == $field && Tools::strlen($city) > $maxSize) {
+ $this->errors[] = sprintf(
+ Tools::displayError('The Hotel city name is too long (%1$d chars max).'),
+ $maxSize
+ );
+ } else if ('postcode' == $field && Tools::strlen($zipcode) > $maxSize) {
+ $this->errors[] = sprintf(
+ Tools::displayError('The Hotel zip code is too long (%1$d chars max).'),
+ $maxSize
+ );
+ } else if (($value = Tools::getValue($field)) && Tools::strlen($value) > $maxSize) {
+ $this->errors[] = sprintf(
+ Tools::displayError('The Hotel %1$s field is too long (%2$d chars max).'),
+ $field,
+ $maxSize
+ );
+ }
}
if ($idHotel) {
@@ -381,13 +413,13 @@ class AdminAddHotelController extends ModuleAdminController
$linkRewriteArray = array();
foreach ($languages as $lang) {
if (!trim(Tools::getValue('hotel_name_'.$lang['id_lang']))) {
- $objHotelBranch->hotel_name[$lang['id_lang']] = Tools::getValue(
+ $objHotelBranch->hotel_name[$lang['id_lang']] = trim(Tools::getValue(
'hotel_name_'.$defaultLangId
- );
+ ));
} else {
- $objHotelBranch->hotel_name[$lang['id_lang']] = Tools::getValue(
+ $objHotelBranch->hotel_name[$lang['id_lang']] = trim(Tools::getValue(
'hotel_name_'.$lang['id_lang']
- );
+ ));
}
if (!trim(Tools::getValue('link_rewrite_'.$lang['id_lang']))) {
@@ -476,19 +508,32 @@ class AdminAddHotelController extends ModuleAdminController
} else {
$objAddress = new Address();
}
+
$objAddress->id_hotel = $newIdHotel;
$objAddress->id_country = $country;
$objAddress->id_state = $state;
$objAddress->city = $city;
$objAddress->postcode = $zipcode;
$hotelName = $objHotelBranch->hotel_name[$defaultLangId];
- $objAddress->alias = $hotelName;
- $hotelName = preg_replace('/[0-9!<>,;?=+()@#"°{}_$%:]*$/u', '', $hotelName);
- $objAddress->lastname = $hotelName;
- $objAddress->firstname = $hotelName;
+ $hotelName = trim(preg_replace('/[0-9!<>,;?=+()@#"°{}_$%:]*$/u', '', $hotelName));
+ $objAddress->alias = trim(substr($hotelName, 0, 32));
+ $addressFirstName = $hotelName;
+ $addressLastName = $hotelName;
+ // If hotel name is length is greater than 32 then we split it into two
+ if (Tools::strlen($hotelName) > 32) {
+ // Slicing and removing the extra spaces after slicing
+ $addressFirstName = trim(substr($hotelName, 0, 32));
+ // To remove the excess space from last name
+ if (!$addressLastName = trim(substr($hotelName, 32, 32))) {
+ // since the last name can also be an empty space we will then use first name as last name
+ $addressLastName = $addressFirstName;
+ }
+ }
+
+ $objAddress->firstname = $addressFirstName;
+ $objAddress->lastname = $addressLastName;
$objAddress->address1 = $address;
$objAddress->phone = $phone;
-
$objAddress->save();
// Save refund rules of the hotels
@@ -537,6 +582,7 @@ class AdminAddHotelController extends ModuleAdminController
if ($objHotelBranch->id_category) {
$objCategory = new Category($objHotelBranch->id_category);
$objCategory->name = $objHotelBranch->hotel_name;
+ $objCategory->link_rewrite = $linkRewriteArray;
$objCategory->id_parent = $catCity;
$objCategory->save();
Category::regenerateEntireNtree();
diff --git a/modules/hotelreservationsystem/controllers/admin/AdminOrderRefundRequestsController.php b/modules/hotelreservationsystem/controllers/admin/AdminOrderRefundRequestsController.php
index 0145d2006..d9664b18e 100644
--- a/modules/hotelreservationsystem/controllers/admin/AdminOrderRefundRequestsController.php
+++ b/modules/hotelreservationsystem/controllers/admin/AdminOrderRefundRequestsController.php
@@ -128,6 +128,7 @@ class AdminOrderRefundRequestsController extends ModuleAdminController
$this->fields_list['total_pending_requests'] = array(
'title' => $this->l('Pending Requests'),
'align' => 'center',
+ 'type' => 'range',
'havingFilter' => true,
);
}
diff --git a/modules/hotelreservationsystem/hotelreservationsystem.php b/modules/hotelreservationsystem/hotelreservationsystem.php
index f5294a76d..9ece7fe79 100644
--- a/modules/hotelreservationsystem/hotelreservationsystem.php
+++ b/modules/hotelreservationsystem/hotelreservationsystem.php
@@ -54,6 +54,7 @@ class HotelReservationSystem extends Module
'bookings' => array('description' => 'Order bookings', 'class' => 'HotelBookingDetail'),
'booking_extra_demands' => array('description' => 'Booking extra demands', 'class' => 'HotelBookingDemands'),
'extra_demands' => array('description' => 'Extra demands', 'class' => 'HotelRoomTypeGlobalDemand'),
+ 'extra_services' => array('description' => 'Extra services', 'class' => 'Product', 'parameters_attribute' => 'webserviceRoomTypeServicesParameters'),
'demand_advance_options' => array('description' => 'Extra demand advance options', 'class' => 'HotelRoomTypeGlobalDemandAdvanceOption'),
'hotel_ari' => array('description' => 'Search availability, rates and inventory', 'specific_management' => true),
'qlo' => array('description' => 'qlo API', 'specific_management' => true),
@@ -557,9 +558,8 @@ class HotelReservationSystem extends Module
public function callInstallTab()
{
$this->installTab('AdminHotelReservationSystemManagement', 'Hotel Reservation System');
- $this->installTab('AdminHotelRoomsBooking', 'Book Now', 'AdminHotelReservationSystemManagement');
- $this->installTab('AdminHotelConfigurationSetting', 'Settings', 'AdminHotelReservationSystemManagement');
$this->installTab('AdminAddHotel', 'Manage Hotel', 'AdminHotelReservationSystemManagement');
+ $this->installTab('AdminHotelRoomsBooking', 'Book Now', 'AdminHotelReservationSystemManagement');
$this->installTab('AdminHotelFeatures', 'Manage Hotel Features', 'AdminHotelReservationSystemManagement');
$this->installTab(
'AdminOrderRefundRules',
@@ -572,6 +572,7 @@ class HotelReservationSystem extends Module
'AdminHotelReservationSystemManagement'
);
+ $this->installTab('AdminHotelConfigurationSetting', 'General Settings', 'AdminHotelReservationSystemManagement');
// Controllers without tabs
$this->installTab('AdminHotelGeneralSettings', 'Hotel General Configuration', 'AdminHotelConfigurationSetting', false);
$this->installTab('AdminHotelFeaturePricesSettings', 'Advanced Price Rules', 'AdminHotelConfigurationSetting', false);
diff --git a/modules/qlocleaner/qlocleaner.php b/modules/qlocleaner/qlocleaner.php
index c934346dd..adfe64e51 100644
--- a/modules/qlocleaner/qlocleaner.php
+++ b/modules/qlocleaner/qlocleaner.php
@@ -50,6 +50,28 @@ class QloCleaner extends Module
$this->secure_key = Tools::encrypt($this->name);
}
+ public function install()
+ {
+ if (!parent::install()
+ || !$this->registerHook('actionAdminControllerSetMedia')
+ ) {
+ return false;
+ }
+ return true;
+ }
+
+ public function hookActionAdminControllerSetMedia()
+ {
+ if (Tools::getValue('controller') == 'AdminModules'
+ && Tools::getValue('configure') == $this->name
+ ) {
+ Media::addJsDef(array(
+ 'confirm_txt' => $this->l('Are you sure, you want to perform the following action?')
+ ));
+ $this->context->controller->addJS($this->_path.'views/js/qlocleaner_config.js');
+ }
+ }
+
public function getContent()
{
$html = '
'.$this->l('Be really careful with this tool - There is no possible rollback!').' ';
@@ -61,6 +83,7 @@ class QloCleaner extends Module
} else {
$conf = $this->l('Nothing that need to be fixed please run database cleaning to clean your database');
}
+ Hook::exec('actionCleanData', array('method' => 'checkAndFix'));
$html .= $this->displayConfirmation($conf);
} elseif (Tools::isSubmit('submitCleanAndOptimize')) {
$logs = self::cleanAndOptimize();
@@ -70,12 +93,15 @@ class QloCleaner extends Module
} else {
$conf = $this->l('Nothing that need to be cleaned');
}
+ Hook::exec('actionCleanData', array('method' => 'cleanAndOptimize'));
$html .= $this->displayConfirmation($conf);
} elseif (Tools::getValue('submitTruncateCatalog') && Tools::getValue('checkTruncateCatalog')) {
self::truncate('catalog');
+ Hook::exec('actionCleanData', array('method' => 'catalog'));
$html .= $this->displayConfirmation($this->l('Catalog truncated successfuly, please run functional Integrity constraints to clean the database.'));
} elseif (Tools::getValue('submitTruncateSales') && Tools::getValue('checkTruncateSales')) {
self::truncate('sales');
+ Hook::exec('actionCleanData', array('method' => 'sales'));
$html .= $this->displayConfirmation($this->l('Orders and customers truncated successfuly, please run functional Integrity constraints to clean the database'));
}
@@ -244,6 +270,11 @@ class QloCleaner extends Module
}
}
+ Image::deleteAllImages(_PS_HOTEL_IMG_DIR_);
+ if (!file_exists(_PS_HOTEL_IMG_DIR_)) {
+ mkdir(_PS_HOTEL_IMG_DIR_);
+ }
+
// Delete qlo modules's images
QcCleanerHelper::deleteFolderImages(
_PS_MODULE_DIR_.'wkabouthotelblock/views/img/hotel_interior/'
@@ -314,21 +345,6 @@ class QloCleaner extends Module
}
}
- // Delete Qlo tables
- $query = 'DELETE FROM `'._DB_PREFIX_.'htl_order_refund_rules`';
- if (Db::getInstance()->Execute($query)) {
- if ($affected_rows = Db::getInstance()->Affected_Rows()) {
- $logs[$query] = $affected_rows;
- }
- }
-
- $query = 'DELETE FROM `'._DB_PREFIX_.'htl_order_refund_rules_lang`';
- if (Db::getInstance()->Execute($query)) {
- if ($affected_rows = Db::getInstance()->Affected_Rows()) {
- $logs[$query] = $affected_rows;
- }
- }
-
$parents = Db::getInstance()->ExecuteS('SELECT DISTINCT id_parent FROM '._DB_PREFIX_.'tab');
foreach ($parents as $parent) {
$children = Db::getInstance()->ExecuteS('SELECT id_tab FROM '._DB_PREFIX_.'tab WHERE id_parent = '.(int)$parent['id_parent'].' ORDER BY IF(class_name IN ("AdminHome", "AdminDashboard"), 1, 2), position ASC');
@@ -753,12 +769,7 @@ class QloCleaner extends Module
'customization_field',
'customization_field_lang',
'customized_data',
- 'feature',
- 'feature_lang',
'feature_product',
- 'feature_shop',
- 'feature_value',
- 'feature_value_lang',
'pack',
'search_index',
'search_word',
@@ -778,8 +789,6 @@ class QloCleaner extends Module
'htl_branch_info_lang',
'htl_image',
'htl_branch_features',
- 'htl_features',
- 'htl_features_lang',
'htl_advance_payment',
'htl_branch_refund_rules',
'htl_order_restrict_date',
@@ -845,6 +854,8 @@ class QloCleaner extends Module
'htl_room_type_service_product_order_detail',
'htl_room_type_service_product_cart_detail',
'htl_hotel_service_product_cart_detail',
+ 'htl_order_refund_rules',
+ 'htl_order_refund_rules_lang',
);
}
}
diff --git a/modules/qlocleaner/views/js/index.php b/modules/qlocleaner/views/js/index.php
new file mode 100644
index 000000000..16488e369
--- /dev/null
+++ b/modules/qlocleaner/views/js/index.php
@@ -0,0 +1,29 @@
+
+* @copyright Since 2010 Webkul IN
+* @license https://store.webkul.com/license.html
+*/
+
+header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
+header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
+
+header('Cache-Control: no-store, no-cache, must-revalidate');
+header('Cache-Control: post-check=0, pre-check=0', false);
+header('Pragma: no-cache');
+
+header('Location: ../');
+exit;
diff --git a/modules/qlocleaner/views/js/qlocleaner_config.js b/modules/qlocleaner/views/js/qlocleaner_config.js
new file mode 100644
index 000000000..ebd5ce3f4
--- /dev/null
+++ b/modules/qlocleaner/views/js/qlocleaner_config.js
@@ -0,0 +1,24 @@
+/**
+* Since 2010 Webkul.
+*
+* NOTICE OF LICENSE
+*
+* All right is reserved,
+* Please go through this link for complete license : https://store.webkul.com/license.html
+*
+* DISCLAIMER
+*
+* Do not edit or add to this file if you wish to upgrade this module to newer
+* versions in the future. If you wish to customize this module for your
+* needs please refer to https://store.webkul.com/customisation-guidelines/ for more information.
+*
+* @author Webkul IN
+* @copyright Since 2010 Webkul IN
+* @license https://store.webkul.com/license.html
+*/
+
+$(document).ready(function () {
+ $('#module_form').on('submit', function() {
+ return confirm(confirm_txt);
+ })
+});
\ No newline at end of file
diff --git a/modules/qlohotelreview/classes/QhrHotelReviewDb.php b/modules/qlohotelreview/classes/QhrHotelReviewDb.php
index de1b60694..d45ec4074 100644
--- a/modules/qlohotelreview/classes/QhrHotelReviewDb.php
+++ b/modules/qlohotelreview/classes/QhrHotelReviewDb.php
@@ -134,6 +134,20 @@ class QhrHotelReviewDb
);
}
+ public static function truncateUserData()
+ {
+ $userTables = array('qhr_hotel_review',
+ 'qhr_review_category_rating',
+ 'qhr_review_usefulness',
+ 'qhr_review_report',
+ 'qhr_review_reply'
+ );
+ foreach ($userTables as $table) {
+ DB::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.bqSQL($table).'`');
+ }
+ QhrHotelReview::cleanImagesDirectory();
+ }
+
public static function getModuleDefaultConfig()
{
return array(
diff --git a/modules/qlohotelreview/qlohotelreview.php b/modules/qlohotelreview/qlohotelreview.php
index 9bd269f98..e20a25ee1 100644
--- a/modules/qlohotelreview/qlohotelreview.php
+++ b/modules/qlohotelreview/qlohotelreview.php
@@ -72,6 +72,7 @@ class QloHotelReview extends Module
'displayBookingAction',
'displayBackOfficeHeader',
'displayAdminAfterHeader',
+ 'actionCleanData',
)
);
}
@@ -279,6 +280,13 @@ class QloHotelReview extends Module
return $this->display(__FILE__, 'product-tab-content.tpl');
}
+ public function hookActionCleanData($params)
+ {
+ if ($params['method'] == 'catalog' || $params['method'] == 'sales') {
+ QhrHotelReviewDb::truncateUserData();
+ }
+ }
+
public function installModuleTabs()
{
$tabs = array(
diff --git a/modules/qlohotelreview/views/css/front/review-list.css b/modules/qlohotelreview/views/css/front/review-list.css
index 42f9a3efb..cd768e1e7 100644
--- a/modules/qlohotelreview/views/css/front/review-list.css
+++ b/modules/qlohotelreview/views/css/front/review-list.css
@@ -271,9 +271,15 @@
margin-right: 5px;
}
+#hotel-reviews .review-sort-by-container {
+ display: inline-block;
+ position: relative;
+}
+
#hotel-reviews .review-sort-by button {
text-align: left;
min-width: 170px;
+ position: relative;
}
#hotel-reviews .dropdown-menu {
@@ -285,3 +291,12 @@
top: 15px;
right: 12px;
}
+
+#hotel-reviews.rtl .sort-by {
+ margin-left: 5px;
+ margin-right: unset;
+}
+
+#hotel-reviews.rtl [class*=col]{
+ float: right !important;
+}
\ No newline at end of file
diff --git a/modules/qlohotelreview/views/templates/hook/_partials/list-actions.tpl b/modules/qlohotelreview/views/templates/hook/_partials/list-actions.tpl
index f470ca833..03cd074b5 100644
--- a/modules/qlohotelreview/views/templates/hook/_partials/list-actions.tpl
+++ b/modules/qlohotelreview/views/templates/hook/_partials/list-actions.tpl
@@ -23,17 +23,19 @@
{l s='SORT BY' mod='qlohotelreview'}
-
- {l s='Newest First' mod='qlohotelreview'}
-
-
-
+
+
+ {l s='Newest First' mod='qlohotelreview'}
+
+
+
+
diff --git a/modules/qlohotelreview/views/templates/hook/product-tab-content.tpl b/modules/qlohotelreview/views/templates/hook/product-tab-content.tpl
index c64bdd966..96e43341f 100644
--- a/modules/qlohotelreview/views/templates/hook/product-tab-content.tpl
+++ b/modules/qlohotelreview/views/templates/hook/product-tab-content.tpl
@@ -17,7 +17,7 @@
* @license LICENSE.txt
*}
-
+
{if is_array($reviews) && count($reviews)}
{include file='./_partials/review-summary.tpl'}
{include file='./_partials/media-list.tpl'}
diff --git a/modules/wkhotelroom/classes/WkHotelRoomDb.php b/modules/wkhotelroom/classes/WkHotelRoomDb.php
index a21f82dae..740811ab9 100644
--- a/modules/wkhotelroom/classes/WkHotelRoomDb.php
+++ b/modules/wkhotelroom/classes/WkHotelRoomDb.php
@@ -56,4 +56,11 @@ class WkHotelRoomDb
`'._DB_PREFIX_.'htl_room_block_data`;
');
}
+
+ public static function truncateTables()
+ {
+ return DB::getInstance()->execute(
+ 'TRUNCATE TABLE `'._DB_PREFIX_.'htl_room_block_data`;
+ ');
+ }
}
diff --git a/modules/wkhotelroom/wkhotelroom.php b/modules/wkhotelroom/wkhotelroom.php
index 2df6101fd..de73facb0 100644
--- a/modules/wkhotelroom/wkhotelroom.php
+++ b/modules/wkhotelroom/wkhotelroom.php
@@ -65,14 +65,32 @@ class WkHotelRoom extends Module
ImageType::getFormatedName('large')
);
}
- $productPriceWithoutReduction = $product->getPriceWithoutReduct(!$useTax, false, 6, 1);
+ $productPriceWithoutReduction = HotelRoomTypeFeaturePricing::getRoomTypeTotalPrice(
+ $idProduct,
+ $dateFrom,
+ $dateTo,
+ $useTax,
+ 0,
+ 0,
+ 0,
+ 0,
+ 1,
+ 0
+ );
+
+ if ($useTax) {
+ $priceWithoutReduction = $productPriceWithoutReduction['total_price_tax_incl'];
+ } else {
+ $priceWithoutReduction = $productPriceWithoutReduction['total_price_tax_excl'];
+ }
+
$product_price = Product::getPriceStatic($idProduct, $useTax);
$htlRoom['image'] = $prodImg;
$htlRoom['description'] = $product->description_short;
$htlRoom['name'] = $product->name;
$htlRoom['show_price'] = $product->show_price;
$htlRoom['price'] = $product_price;
- $htlRoom['price_without_reduction'] = $productPriceWithoutReduction;
+ $htlRoom['price_without_reduction'] = $priceWithoutReduction;
$featurePrice = HotelRoomTypeFeaturePricing::getRoomTypeFeaturePricesPerDay(
$idProduct,
$dateFrom,
@@ -80,7 +98,7 @@ class WkHotelRoom extends Module
$useTax
);
$htlRoom['feature_price'] = $featurePrice;
- $htlRoom['feature_price_diff'] = (float)($productPriceWithoutReduction - $featurePrice);
+ $htlRoom['feature_price_diff'] = (float)($priceWithoutReduction - $featurePrice);
}
}
$this->context->smarty->assign(
@@ -141,6 +159,13 @@ class WkHotelRoom extends Module
}
}
+ public function hookActionCleanData($params)
+ {
+ if ($params['method'] == 'catalog') {
+ WkHotelRoomDb::truncateTables();
+ }
+ }
+
public function callInstallTab()
{
//Controllers which are to be used in this modules but we have not to create tab for those controllers...
@@ -198,7 +223,8 @@ class WkHotelRoom extends Module
'actionProductDelete',
'displayFooterExploreSectionHook',
'actionProductSave',
- 'actionObjectLanguageAddAfter'
+ 'actionObjectLanguageAddAfter',
+ 'actionCleanData',
)
);
}
@@ -220,7 +246,7 @@ class WkHotelRoom extends Module
}
return true;
}
-
+
public function deleteConfigKeys()
{
$configVars = array(
diff --git a/modules/wkroomsearchblock/views/css/chosen.css b/modules/wkroomsearchblock/views/css/chosen.css
index 779c5e4c7..a3df25799 100644
--- a/modules/wkroomsearchblock/views/css/chosen.css
+++ b/modules/wkroomsearchblock/views/css/chosen.css
@@ -41,6 +41,12 @@
border-top: 0;
box-shadow: 0 4px 5px rgba(0, 0, 0, 0.15);
}
+.rtl .chosen-container .chosen-drop {
+ right: -9999px;
+}
+.rtl .chosen-container.chosen-with-drop .chosen-drop {
+ right: 0;
+}
.chosen-container.chosen-container-single-nosearch .chosen-drop {
top: 100%;
}
@@ -173,6 +179,10 @@
left: -9999px;
}
+.rtl .chosen-container-single.chosen-container-single-nosearch .chosen-search {
+ display:none;
+}
+
/* @end */
/* @group Results */
.chosen-container .chosen-results {
diff --git a/modules/wkroomsearchblock/views/css/wk-global-search.css b/modules/wkroomsearchblock/views/css/wk-global-search.css
index 3949a7c10..83edd356b 100644
--- a/modules/wkroomsearchblock/views/css/wk-global-search.css
+++ b/modules/wkroomsearchblock/views/css/wk-global-search.css
@@ -215,9 +215,7 @@
border-radius: 4px;}
.submit_occupancy_btn {
background-color: #1292FF;
- font-size: 13px;
border: none;
- padding: 5px 20px;
border-radius: 4px;}
@@ -229,7 +227,7 @@
overflow: auto;
box-shadow: 0 8px 25px -4px rgba(0,0,0,0.39);
left: 0px;
- padding: 12px 20px;}
+ padding: 15px 20px;}
#search_occupancy_wrapper.top {
top: unset;
bottom: 100%; }
@@ -253,8 +251,11 @@
font-weight: bold;
text-decoration: none;
font-size: 14px;
- color: #0000FF;
- line-height: 24px;}
+ color: #0000FF;}
+ #search_occupancy_wrapper .occupancy_block_actions {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;}
#search_occupancy_wrapper .add_new_occupancy_btn:active, #search_occupancy_wrapper .add_new_occupancy_btn:focus, #search_occupancy_wrapper .add_new_occupancy_btn:hover {
text-decoration: none;
color: #0000FF;}
diff --git a/modules/wkroomsearchblock/views/templates/hook/searchForm.tpl b/modules/wkroomsearchblock/views/templates/hook/searchForm.tpl
index 8bd27f7fc..a5a6e0bc9 100644
--- a/modules/wkroomsearchblock/views/templates/hook/searchForm.tpl
+++ b/modules/wkroomsearchblock/views/templates/hook/searchForm.tpl
@@ -40,7 +40,7 @@
-
-
diff --git a/pdf/invoice.addresses-tab.tpl b/pdf/invoice.addresses-tab.tpl
index d4d9f0701..0b743c4f0 100644
--- a/pdf/invoice.addresses-tab.tpl
+++ b/pdf/invoice.addresses-tab.tpl
@@ -22,7 +22,6 @@
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*}
-{if $invoice_address}
- {l s='Customer Address' pdf='true'}
+
+ {l s='Customer Detail' pdf='true'}
+ {if $invoice_address}
{$invoice_address}
+ {else}
+ {$customer->firstname} {$customer->lastname}
+
+ {$customer->phone}
+ {/if}
-
-{/if}
\ No newline at end of file
+