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/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/HotelCartBookingData.php b/modules/hotelreservationsystem/classes/HotelCartBookingData.php
index df5c6c616..1ea42986b 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,
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/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..b8ffa8a88 100644
--- a/modules/hotelreservationsystem/classes/HotelRoomTypeFeaturePricing.php
+++ b/modules/hotelreservationsystem/classes/HotelRoomTypeFeaturePricing.php
@@ -647,15 +647,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 +679,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 +729,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 +743,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 +774,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 +788,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'];
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/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/hotelreservationsystem.php b/modules/hotelreservationsystem/hotelreservationsystem.php
index f5294a76d..757825c77 100644
--- a/modules/hotelreservationsystem/hotelreservationsystem.php
+++ b/modules/hotelreservationsystem/hotelreservationsystem.php
@@ -557,9 +557,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 +571,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/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/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
+ |