diff --git a/admin-dev/themes/default/sass/controllers/_login.sass b/admin-dev/themes/default/sass/controllers/_login.sass index 40e4e8406..5898ac75b 100644 --- a/admin-dev/themes/default/sass/controllers/_login.sass +++ b/admin-dev/themes/default/sass/controllers/_login.sass @@ -1,3 +1,11 @@ +@font-face + font-family: 'FontAwesomePlaceholder' + src: url('#{$fa-font-path}/fontawesome-webfont.eot?v=#{$fa-version}') + src: url('#{$fa-font-path}/fontawesome-webfont.eot?#iefix&v=#{$fa-version}') format('embedded-opentype'), url('#{$fa-font-path}/fontawesome-webfont.woff2?v=#{$fa-version}') format('woff2'), url('#{$fa-font-path}/fontawesome-webfont.woff?v=#{$fa-version}') format('woff'), url('#{$fa-font-path}/fontawesome-webfont.ttf?v=#{$fa-version}') format('truetype'), url('#{$fa-font-path}/fontawesome-webfont.svg?v=#{$fa-version}#fontawesomeregular') format('svg') + font-weight: normal + font-style: normal + unicode-range: U+f000-f2ff + @mixin background-image-with-ms($image) @include background-image($image) // Compass default version, for everything but IE 10. background-image: -ms-#{$image} // Vendor prefixes for IE 10. @@ -29,6 +37,16 @@ .form-control height: inherit !important padding: 10px 8px !important + &::-webkit-input-placeholder + font-family: 'FontAwesomePlaceholder', $font-family-sans-serif + &:-moz-placeholder + font-family: 'FontAwesomePlaceholder', $font-family-sans-serif + &::-moz-placeholder + font-family: 'FontAwesomePlaceholder', $font-family-sans-serif + &:-ms-input-placeholder + font-family: 'FontAwesomePlaceholder', $font-family-sans-serif + &::placeholder + font-family: 'FontAwesomePlaceholder', $font-family-sans-serif @media (max-width: $screen-phone) width: 90% diff --git a/admin-dev/themes/default/template/controllers/orders/modals/_add_order_extra_services_tab_content.tpl b/admin-dev/themes/default/template/controllers/orders/modals/_add_order_extra_services_tab_content.tpl index febccf64a..138d27e3b 100644 --- a/admin-dev/themes/default/template/controllers/orders/modals/_add_order_extra_services_tab_content.tpl +++ b/admin-dev/themes/default/template/controllers/orders/modals/_add_order_extra_services_tab_content.tpl @@ -108,13 +108,6 @@ {$cartCurrency->sign} - {if Product::getServicePriceBillableDays( - $product['price_calculation_method'], - $selectedRoomServiceProduct['date_from'], - $selectedRoomServiceProduct['date_to'] - ) > 1} - {l s='/ night'} - {/if} {/if} diff --git a/admin-dev/themes/default/template/controllers/orders/modals/_extra_services_service_products_tab_content.tpl b/admin-dev/themes/default/template/controllers/orders/modals/_extra_services_service_products_tab_content.tpl index d688ff7ea..16d509e92 100644 --- a/admin-dev/themes/default/template/controllers/orders/modals/_extra_services_service_products_tab_content.tpl +++ b/admin-dev/themes/default/template/controllers/orders/modals/_extra_services_service_products_tab_content.tpl @@ -100,13 +100,6 @@
{$currencySign} - {if Product::getServicePriceBillableDays( - $service.price_calculation_method, - $additionalServices['date_from'], - $additionalServices['date_to'] - ) > 1} - {l s='/ night'} - {/if}
{displayPrice price=$service['total_price_tax_excl']|escape:'html':'UTF-8' currency=$orderCurrency} @@ -188,13 +181,6 @@
{$currencySign} - {if Product::getServicePriceBillableDays( - $product['price_calculation_method'], - $additionalServices['date_from'], - $additionalServices['date_to'] - ) > 1} - {l s='/ night'} - {/if}
@@ -368,13 +354,6 @@ {displayPrice price=$service['unit_price_tax_excl'] currency=$orderCurrency} - {if Product::getServicePriceBillableDays( - $service['price_calculation_method'], - $additionalServices['date_from'], - $additionalServices['date_to'] - ) > 1} - {l s='/ night'} - {/if} {displayPrice price=$service['total_price_tax_excl'] currency=$orderCurrency} diff --git a/classes/Cart.php b/classes/Cart.php index 76cd45ce9..33f00e5c5 100644 --- a/classes/Cart.php +++ b/classes/Cart.php @@ -1895,6 +1895,11 @@ class CartCore extends ObjectModel (int)$product['price_addition_type'] )) { foreach ($servicesWithRoom as $service) { + + if (isset($product['id_hotel']) && $service['id_room_type_hotel'] != $product['id_hotel']) { + continue; + } + if(!empty($service['id_hotel_cart_booking']) && empty($service['id_hotel'])) { if ($with_taxes) { $servicePrice = $service['total_price_tax_incl']; diff --git a/classes/Language.php b/classes/Language.php index e4a61b0a4..f59fcfa16 100644 --- a/classes/Language.php +++ b/classes/Language.php @@ -689,7 +689,11 @@ class LanguageCore extends ObjectModel $key = 'Language::getIdByIso_'.$iso_code; if ($no_cache || !Cache::isStored($key)) { $id_lang = Db::getInstance()->getValue('SELECT `id_lang` FROM `'._DB_PREFIX_.'lang` WHERE `iso_code` = \''.pSQL(strtolower($iso_code)).'\''); - + + if (empty($id_lang)) { + return null; + } + Cache::store($key, $id_lang); return $id_lang; } @@ -796,7 +800,7 @@ class LanguageCore extends ObjectModel public static function checkAndAddLanguage($iso_code, $lang_pack = false, $only_add = false, $params_lang = null) { - if (Language::getIdByIso($iso_code)) { + if (Language::getIdByIso($iso_code, true)) { return true; } diff --git a/classes/Product.php b/classes/Product.php index 73f423a3e..573ab13d9 100644 --- a/classes/Product.php +++ b/classes/Product.php @@ -6868,8 +6868,8 @@ class ProductCore extends ObjectModel } if ($includeTourismTax && ($idTourismTaxRulesGroup = Product::getIdTourismTaxRulesGroupByIdProduct($idProduct))) { - $priceCalcNumDays = $isPerDay ? HotelHelper::getNumberOfDays($dateFrom, $dateTo) : 1; - $unitPriceExcl = ($useTax ? Product::getServiceProductPrice($idProduct, $idProductOption, $idHotel, $idProductRoomType, false, 1, $dateFrom, $dateTo, $idCart, $idAddress, $useReduc, $idGroup, $idCartBooking) : $price / (int) $quantity) / $priceCalcNumDays; + + $unitPriceExcl = ($useTax ? Product::getServiceProductPrice($idProduct, $idProductOption, $idHotel, $idProductRoomType, false, 1, $dateFrom, $dateTo, $idCart, $idAddress, $useReduc, $idGroup, $idCartBooking) : $price / (int) $quantity) / max(1, $numdays); $fallbackAddress = new Address(Cart::getIdAddressForTaxCalculation($idProduct)); if ($numAdults === null) { diff --git a/classes/Tools.php b/classes/Tools.php index 60b8d69fd..b9c0c2234 100644 --- a/classes/Tools.php +++ b/classes/Tools.php @@ -1885,6 +1885,8 @@ class ToolsCore public static function math_round($value, $places, $mode = PS_ROUND_HALF_UP) { + $value = (float) $value; + //If PHP_ROUND_HALF_UP exist (PHP 5.3) use it and pass correct mode value (PrestaShop define - 1) if (defined('PHP_ROUND_HALF_UP')) { return round($value, $places, $mode - 1); diff --git a/classes/order/OrderDetail.php b/classes/order/OrderDetail.php index 683cc7dfd..96f932f3a 100644 --- a/classes/order/OrderDetail.php +++ b/classes/order/OrderDetail.php @@ -592,7 +592,7 @@ class OrderDetailCore extends ObjectModel { $this->setContext((int)$this->id_shop); $address = new Address((int)$order->id_address_tax); - $tax_manager = TaxManagerFactory::getManager($address, (int)Product::getIdTaxRulesGroupByIdProduct((int)$this->product_id, $this->context)); + $tax_manager = TaxManagerFactory::getManager($address, (int)$this->id_tax_rules_group); $this->tax_calculator = $tax_manager->getTaxCalculator(); $result = $this->saveTaxCalculator($order, true); diff --git a/controllers/admin/AdminCustomersController.php b/controllers/admin/AdminCustomersController.php index bb2fd3fc4..c6d161a63 100644 --- a/controllers/admin/AdminCustomersController.php +++ b/controllers/admin/AdminCustomersController.php @@ -1217,6 +1217,14 @@ class AdminCustomersControllerCore extends AdminController $objCustomerGuestDetail->email = $objCustomer->email; $objCustomerGuestDetail->save(); } + + if ($threads = CustomerThread::getCustomerMessages($objCustomer->id)) { + foreach ($threads as $thread) { + $objThread = new CustomerThread($thread['id_customer_thread']); + $objThread->email = $objCustomer->email; + $objThread->save(); + } + } } $this->redirect_after = self::$currentIndex.'&conf=1&token='.$this->token; diff --git a/controllers/admin/AdminOrdersController.php b/controllers/admin/AdminOrdersController.php index 416783575..f2893601e 100644 --- a/controllers/admin/AdminOrdersController.php +++ b/controllers/admin/AdminOrdersController.php @@ -4066,7 +4066,9 @@ class AdminOrdersControllerCore extends AdminController $this->errors[] = $this->l('Uploaded file size is too large.'); } else { $objHotelBookingDocument->setFileType(); - if (!$objHotelBookingDocument->file_type) { + if ($objHotelBookingDocument->isUnsafePdf) { + $this->errors[] = $this->l('This PDF file is invalid or contains unsafe content and cannot be uploaded.'); + } elseif (!$objHotelBookingDocument->file_type) { $this->errors[] = $this->l('Please upload an image or a PDF file only. Allowed image formats: .gif, .jpg, .jpeg and .png'); } } diff --git a/controllers/admin/AdminProductsController.php b/controllers/admin/AdminProductsController.php index bd8a07335..fadff8717 100644 --- a/controllers/admin/AdminProductsController.php +++ b/controllers/admin/AdminProductsController.php @@ -937,6 +937,7 @@ class AdminProductsControllerCore extends AdminController && Product::duplicateCustomizationFields($id_product_old, $product->id) && Product::duplicateTags($id_product_old, $product->id) && Product::duplicateDownload($id_product_old, $product->id) + && HotelAdvancedPayment::duplicateAdvancePayment($id_product_old, $product->id) ) { $obj_hotel_room_type = new HotelRoomType(); $room_type_info = $obj_hotel_room_type->getRoomTypeInfoByIdProduct($id_product_old); @@ -1249,6 +1250,10 @@ class AdminProductsControllerCore extends AdminController if ($payment_type == 1) { $adv_pay_value = Tools::getValue('adv_pay_percent'); + if ($adv_pay_value > 100) { + $this->errors[] = Tools::displayError('Advance payment percentage cannot be more than 100.'); + return false; + } } elseif ($payment_type == 2) { $adv_pay_value = Tools::getValue('adv_pay_amount'); } diff --git a/controllers/front/CartController.php b/controllers/front/CartController.php index afb25f0c4..42d6a8c0f 100644 --- a/controllers/front/CartController.php +++ b/controllers/front/CartController.php @@ -781,7 +781,19 @@ class CartControllerCore extends FrontController ); $currentQty = $qty * $numDays; $finalQty = (int)$cartTotalQty + $currentQty; - if ($objProduct->max_quantity && $finalQty > $objProduct->max_quantity) { + // max quantity limit applies per room, not on the whole cart + $serviceQtyInRoom = (int) $qty; + if ($roomServices = (new ServiceProductCartDetail())->getServiceProductsInCart( + (int) $this->context->cart->id, + [], + null, + (int) $idCartBooking, + null, + (int) $idServiceProduct + )) { + $serviceQtyInRoom += (int) array_sum(array_column($roomServices, 'quantity')); + } + if ($objProduct->max_quantity && $serviceQtyInRoom > $objProduct->max_quantity) { $this->errors[] = Tools::displayError(sprintf('cannot add more than %d quantity.', $objProduct->max_quantity)); } else if (!Product::isAvailableWhenOutOfStock($objProduct->out_of_stock) && !$objProduct->checkQty($finalQty)) { $this->errors[] = Tools::displayError('There isn\'t enough product in stock.'); diff --git a/footer.php b/footer.php index bed167bc6..91799dc4d 100644 --- a/footer.php +++ b/footer.php @@ -24,6 +24,10 @@ * International Registered Trademark & Property of PrestaShop SA */ +if (!defined('_PS_VERSION_')) { + exit; +} + if (isset(Context::getContext()->controller)) { $controller = Context::getContext()->controller; } else { diff --git a/header.php b/header.php index 7e8a2ee81..74710f478 100644 --- a/header.php +++ b/header.php @@ -24,6 +24,10 @@ * International Registered Trademark & Property of PrestaShop SA */ +if (!defined('_PS_VERSION_')) { + exit; +} + if (isset(Context::getContext()->controller)) { $controller = Context::getContext()->controller; } else { diff --git a/img/admin/preview_fr.jpg b/img/admin/preview_fr.jpg deleted file mode 100644 index d67306a20..000000000 Binary files a/img/admin/preview_fr.jpg and /dev/null differ diff --git a/img/c/3-0_thumb.jpg b/img/c/3-0_thumb.jpg deleted file mode 100644 index b529daf3a..000000000 Binary files a/img/c/3-0_thumb.jpg and /dev/null differ diff --git a/img/c/3-1_thumb.jpg b/img/c/3-1_thumb.jpg deleted file mode 100644 index b8c451b86..000000000 Binary files a/img/c/3-1_thumb.jpg and /dev/null differ diff --git a/img/logo_stores.png b/img/logo_stores.png index 1f247bb51..45c75a339 100644 Binary files a/img/logo_stores.png and b/img/logo_stores.png differ diff --git a/img/prestashop-avatar.png b/img/prestashop-avatar.png deleted file mode 100644 index 86f3a159c..000000000 Binary files a/img/prestashop-avatar.png and /dev/null differ diff --git a/init.php b/init.php index aa572eff3..1c9c1c37c 100644 --- a/init.php +++ b/init.php @@ -24,6 +24,10 @@ * International Registered Trademark & Property of PrestaShop SA */ +if (!defined('_PS_VERSION_')) { + exit; +} + if (isset(Context::getContext()->controller)) { $controller = Context::getContext()->controller; } else { diff --git a/js/admin/modules.js b/js/admin/modules.js index e2d40bf04..deab7930c 100644 --- a/js/admin/modules.js +++ b/js/admin/modules.js @@ -70,7 +70,9 @@ $('document').ready( function() { }); $('#proceed-install-anyway').on('click', function(e) { - e.preventDefault(); + if ($(this).attr('href') === '#') { + e.preventDefault(); + } }) function displayErrors(response, module) diff --git a/js/admin/price.js b/js/admin/price.js index 872028722..de5ebc623 100644 --- a/js/admin/price.js +++ b/js/admin/price.js @@ -97,7 +97,7 @@ function removeTaxes(price) function getEcotaxTaxIncluded() { - return ps_round(ecotax_tax_excl * (1 + ecotaxTaxRate), 2); + return ps_round((isNaN(ecotax_tax_excl) ? 0 : ecotax_tax_excl) * (1 + ecotaxTaxRate), 2); } @@ -187,7 +187,9 @@ function calcPriceTI() function calcPriceTE() { - ecotax_tax_excl = $('#ecotax').val() / (1 + ecotaxTaxRate); + if ($('#ecotax').length) { + ecotax_tax_excl = $('#ecotax').val() / (1 + ecotaxTaxRate); + } var priceTI = parseFloat($('#priceTI').val().replace(/,/g, '.')); var newPrice = removeTaxes(ps_round(priceTI - getEcotaxTaxIncluded(), priceDisplayPrecision)); var tourismTaxIncluded = getTourismTaxIncluded(newPrice); diff --git a/modules/hotelreservationsystem/classes/HotelAdvancedPayment.php b/modules/hotelreservationsystem/classes/HotelAdvancedPayment.php index f9ea3d060..289ec1b2b 100644 --- a/modules/hotelreservationsystem/classes/HotelAdvancedPayment.php +++ b/modules/hotelreservationsystem/classes/HotelAdvancedPayment.php @@ -79,6 +79,31 @@ class HotelAdvancedPayment extends ObjectModel return false; } + /** + * Duplicate the advance payment configuration of a room type for its duplicate + * + * @param int $id_product_old Id of the room type (product) being duplicated + * @param int $id_product_new Id of the newly duplicated room type (product) + * @return bool + */ + public static function duplicateAdvancePayment($id_product_old, $id_product_new) + { + $row = Db::getInstance()->getRow( + 'SELECT * FROM `'._DB_PREFIX_.'htl_advance_payment` WHERE `id_product` = '.(int)$id_product_old + ); + + if (!$row) { + return true; + } + + unset($row['id']); + $row['id_product'] = (int)$id_product_new; + $row['date_add'] = date('Y-m-d H:i:s'); + $row['date_upd'] = date('Y-m-d H:i:s'); + + return Db::getInstance()->insert('htl_advance_payment', $row); + } + /** * Get the advance payment amount of the room type in the cart * @param [int] $idCart : cart id diff --git a/modules/hotelreservationsystem/classes/HotelBookingDetail.php b/modules/hotelreservationsystem/classes/HotelBookingDetail.php index 623f58783..e8707f901 100644 --- a/modules/hotelreservationsystem/classes/HotelBookingDetail.php +++ b/modules/hotelreservationsystem/classes/HotelBookingDetail.php @@ -604,7 +604,7 @@ class HotelBookingDetail extends ObjectModel $sql[] = 'SELECT hri.`id` AS `id_room`, hri.`id_product`, hri.`id_hotel`, hri.`room_num`, hri.`comment` AS `room_comment`, hri.`id_status`, hrdd.`date_from` AS `date_from`, hrdd.`date_to` AS `date_to` FROM `'._DB_PREFIX_.'htl_room_information` AS hri INNER JOIN `'._DB_PREFIX_.'htl_room_disable_dates` AS hrdd ON (hrdd.`id_room_type` = hri.`id_product` AND hrdd. id_room = hri.`id`) - WHERE hri.`id_hotel`='.$idHotel.' AND hri.`id_status` = '. HotelRoomInformation::STATUS_TEMPORARY_INACTIVE .' AND ( + WHERE hri.`id_hotel`='.(int) $idHotel.' AND hri.`id_status` = '. HotelRoomInformation::STATUS_TEMPORARY_INACTIVE .' AND ( (hrdd.`date_from` <= \''.pSQL($dateFrom).'\' AND hrdd.`date_to` > \''.pSQL($dateFrom).'\' AND hrdd.`date_to` <= \''.pSQL($dateTo).'\') OR (hrdd.`date_from` >= \''.pSQL($dateFrom).'\' AND hrdd.`date_to` > \''.pSQL($dateFrom).'\' AND hrdd.`date_to` <= \''.pSQL($dateTo).'\') OR (hrdd.`date_from` >= \''.pSQL($dateFrom).'\' AND hrdd.`date_from` < \''.pSQL($dateTo).'\' AND hrdd.`date_to` >= \''.pSQL($dateTo).'\') OR diff --git a/modules/hotelreservationsystem/classes/HotelBookingDocument.php b/modules/hotelreservationsystem/classes/HotelBookingDocument.php index 3567440e7..8437b0e85 100644 --- a/modules/hotelreservationsystem/classes/HotelBookingDocument.php +++ b/modules/hotelreservationsystem/classes/HotelBookingDocument.php @@ -30,6 +30,9 @@ class HotelBookingDocument extends ObjectModel public $file_name; public $date_add; + /** @var bool True when the file is a PDF but was rejected for unsafe content. */ + public $isUnsafePdf = false; + const FILE_TYPE_IMAGE = 1; const FILE_TYPE_PDF = 2; @@ -139,16 +142,28 @@ class HotelBookingDocument extends ObjectModel public function setFileType() { $content = @file_get_contents($this->fileInfo['tmp_name']); - $activeContentPattern = '/\/(JavaScript|JS|OpenAction|AA|Launch|SubmitForm|ImportData)\b/i'; + // PDF names can hide keywords with hex escapes (/J#53 is /JS), so decode them before matching. + $decodedContent = ($content === false) ? '' : preg_replace_callback('/#([0-9a-f]{2})/i', function ($match) { + return chr(hexdec($match[1])); + }, $content); + + // A complete PDF ends with startxref %%EOF; anything else is truncated or corrupt. + // Encrypted PDFs cannot be scanned, so /Encrypt is blocked too. + // /OpenAction followed by '[' is a plain page destination (zoom/fit). + // for every generated PDF. Any other /OpenAction value is an action and stays blocked. + $activeContentPattern = '/\/(JavaScript|JS|AA|Launch|SubmitForm|ImportData|GoToR|GoToE|EmbeddedFile|RichMedia|XFA|Encrypt)\b|\/OpenAction\b(?!\s*\[)/i'; + + $this->isUnsafePdf = false; $this->imageInfo = @getimagesize($this->fileInfo['tmp_name']); if ($this->imageInfo && ImageManager::isRealImage($this->fileInfo['tmp_name'])) { $this->file_type = self::FILE_TYPE_IMAGE; - } elseif ($content !== false && substr($content, 0, 5) === '%PDF-' && !preg_match($activeContentPattern, $content)) { + } elseif ($content !== false && substr($content, 0, 5) === '%PDF-' && preg_match('/startxref\s+\d+\s+%%EOF\s*$/', substr($content, -1024)) && !preg_match($activeContentPattern, $decodedContent)) { $this->file_type = self::FILE_TYPE_PDF; } else { $this->file_type = 0; + $this->isUnsafePdf = ($content !== false && substr($content, 0, 5) === '%PDF-'); } } diff --git a/modules/hotelreservationsystem/classes/HotelRoomTypeFeaturePricing.php b/modules/hotelreservationsystem/classes/HotelRoomTypeFeaturePricing.php index b5a50ef12..c86d07afe 100644 --- a/modules/hotelreservationsystem/classes/HotelRoomTypeFeaturePricing.php +++ b/modules/hotelreservationsystem/classes/HotelRoomTypeFeaturePricing.php @@ -385,17 +385,20 @@ class HotelRoomTypeFeaturePricing extends ObjectModel $numNights = max(1, (int) HotelHelper::getNumberOfDays($date_from, $date_to)); $unitPriceTe = (float) $totalPrice['total_price_tax_excl'] / $numNights; $taxCalculator = TaxManagerFactory::getManager($objAddress, $idTourismTaxRulesGroup)->getTaxCalculator(); - $childAges = !empty($occupancy[0]['child_ages']) ? (array) $occupancy[0]['child_ages'] : array(); - $totalPrice['total_price_tax_incl'] += $taxCalculator->getTaxesTotalAmount( - $unitPriceTe, - $date_from, - $numNights, - $occupancy[0]['adults'], - $childAges, - $collectionType, - 1, - $id_currency - ); + $roomsTourismTax = 0; + foreach ($occupancy as $roomOccupancy) { + $roomsTourismTax += $taxCalculator->getTaxesTotalAmount( + $unitPriceTe, + $date_from, + $numNights, + isset($roomOccupancy['adults']) ? (int) $roomOccupancy['adults'] : 0, + !empty($roomOccupancy['child_ages']) ? (array) $roomOccupancy['child_ages'] : array(), + $collectionType, + 1, + $id_currency + ); + } + $totalPrice['total_price_tax_incl'] += $roomsTourismTax / count($occupancy); } } diff --git a/modules/hotelreservationsystem/classes/ServiceProductCartDetail.php b/modules/hotelreservationsystem/classes/ServiceProductCartDetail.php index b132f797e..ea8e6d002 100644 --- a/modules/hotelreservationsystem/classes/ServiceProductCartDetail.php +++ b/modules/hotelreservationsystem/classes/ServiceProductCartDetail.php @@ -173,7 +173,7 @@ class ServiceProductCartDetail extends ObjectModel $language = new Language($idLang); } - $sql = 'SELECT spc.*, p.`selling_preference_type`, hcbd.`date_from`, spc.`id_cart` as service_id_cart, hcbd.`date_to`, p.`price_calculation_method`, hcbd.`id_product` as `id_product_room_type`'; + $sql = 'SELECT spc.*, p.`selling_preference_type`, hcbd.`date_from`, spc.`id_cart` as service_id_cart, hcbd.`date_to`, p.`price_calculation_method`, hcbd.`id_product` as `id_product_room_type`, hcbd.`id_hotel` as `id_room_type_hotel`'; if (!$getTotalPrice) { $sql .= ', hbil.`hotel_name`, p.`auto_add_to_cart`, p.`price_addition_type` '; } diff --git a/modules/hotelreservationsystem/controllers/admin/AdminHotelRoomsBookingController.php b/modules/hotelreservationsystem/controllers/admin/AdminHotelRoomsBookingController.php index 9a9cde107..7fb561c28 100644 --- a/modules/hotelreservationsystem/controllers/admin/AdminHotelRoomsBookingController.php +++ b/modules/hotelreservationsystem/controllers/admin/AdminHotelRoomsBookingController.php @@ -134,13 +134,16 @@ class AdminHotelRoomsBookingController extends ModuleAdminController $date_from = date('Y-m-d'); } } - if (Tools::getValue('date_to')) { - $date_to = Tools::getValue('date_to'); - } else { + if (!Validate::isDate($date_from)) { + $date_from = date('Y-m-d'); + } + $date_to = Tools::getValue('date_to'); + if (!$date_to || !Validate::isDate($date_to)) { $date_to = date('Y-m-d'); - if (strtotime($date_from) >= strtotime($date_to)) { - $date_to = date('Y-m-d', strtotime('+1 day', strtotime($date_to))); - } + } + // Check-out date must always be after check-in date + if (strtotime($date_from) >= strtotime($date_to)) { + $date_to = date('Y-m-d', strtotime('+1 day', strtotime($date_from))); } if (Tools::getValue('id_hotel')) { diff --git a/modules/hotelreservationsystem/controllers/admin/AdminOrderRefundRequestsController.php b/modules/hotelreservationsystem/controllers/admin/AdminOrderRefundRequestsController.php index a2d7f1299..3abcf36bb 100644 --- a/modules/hotelreservationsystem/controllers/admin/AdminOrderRefundRequestsController.php +++ b/modules/hotelreservationsystem/controllers/admin/AdminOrderRefundRequestsController.php @@ -510,33 +510,23 @@ class AdminOrderRefundRequestsController extends ModuleAdminController $objHtlBooking = new HotelBookingDetail($idHtlBooking); $idOrderDetail = $objHtlBooking->id_order_detail; - // split the admin's single tax-incl entry using the booking's - // own tax ratio; (float) cast since DB decimals come back as - // strings like "0.000000", which PHP treats as truthy - $refundedAmountTaxExcl = (float) $objHtlBooking->total_price_tax_incl - ? $refundedAmount * ($objHtlBooking->total_price_tax_excl / $objHtlBooking->total_price_tax_incl) - : $refundedAmount; - + // $refundedAmount is already tax-incl. (see the "tax incl." $bookingList[$idRetDetail] = array( 'id_htl_booking' => $idHtlBooking, 'id_order_detail' => $idOrderDetail, 'quantity' => $numDays, 'num_days' => $numDays, - 'unit_price' => $refundedAmountTaxExcl / $numDays, + 'unit_price' => $refundedAmount / $numDays, ); } elseif ($idServiceProductOrder = $objOrderReturnDetail->id_service_product_order_detail) { $objServiceProductOrderDetail = new ServiceProductOrderDetail($idServiceProductOrder); // same reasoning as the booking branch above - $refundedAmountTaxExcl = (float) $objServiceProductOrderDetail->total_price_tax_incl - ? $refundedAmount * ($objServiceProductOrderDetail->total_price_tax_excl / $objServiceProductOrderDetail->total_price_tax_incl) - : $refundedAmount; - $bookingList[$idRetDetail] = array( 'id_service_product_order_detail' => $idServiceProductOrder, 'id_order_detail' => $objServiceProductOrderDetail->id_order_detail, 'quantity' => $objServiceProductOrderDetail->quantity, - 'unit_price' => $refundedAmountTaxExcl / $objServiceProductOrderDetail->quantity, + 'unit_price' => $refundedAmount / $objServiceProductOrderDetail->quantity, ); } } diff --git a/modules/hotelreservationsystem/hotelreservationsystem.php b/modules/hotelreservationsystem/hotelreservationsystem.php index 2db0ae932..f3530c665 100644 --- a/modules/hotelreservationsystem/hotelreservationsystem.php +++ b/modules/hotelreservationsystem/hotelreservationsystem.php @@ -444,7 +444,6 @@ class HotelReservationSystem extends Module $langTables = array( 'htl_room_type_feature_pricing', 'htl_branch_info', - 'htl_features', 'htl_amenity', 'htl_order_refund_rules', 'htl_settings_link' diff --git a/modules/wkhotelroom/wkhotelroom.php b/modules/wkhotelroom/wkhotelroom.php index b6d56fa61..190f3bcc9 100644 --- a/modules/wkhotelroom/wkhotelroom.php +++ b/modules/wkhotelroom/wkhotelroom.php @@ -106,7 +106,7 @@ class WkHotelRoom extends Module 0, 0, 1, - 0, + 1, array(array('adults' => 1, 'children' => 0, 'child_ages' => array())) ); $htlRoom['feature_price'] = $featurePrice; diff --git a/themes/hotel-reservation-theme/_partials/cart_booking_services.tpl b/themes/hotel-reservation-theme/_partials/cart_booking_services.tpl index 6561ccd3b..f9f437596 100644 --- a/themes/hotel-reservation-theme/_partials/cart_booking_services.tpl +++ b/themes/hotel-reservation-theme/_partials/cart_booking_services.tpl @@ -96,16 +96,7 @@
{if ($product.show_price && !isset($restricted_country_mode)) || isset($groups)} - {if !$priceDisplay}{convertPrice price=$product.price_tax_incl}{else}{convertPrice price=$product.price_tax_exc}{/if} - {if Product::getServicePriceBillableDays( - $product.price_calculation_method, - $product.date_from|default:$date_from|default:'', - $product.date_to|default:$date_to|default:'' - ) > 1} - {l s='/Night'} - {/if} - - + {if !$priceDisplay}{convertPrice price=$product.price_tax_incl}{else}{convertPrice price=$product.price_tax_exc}{/if} {/if}
diff --git a/themes/hotel-reservation-theme/_partials/service-products-list-row.tpl b/themes/hotel-reservation-theme/_partials/service-products-list-row.tpl index 876a525c7..f82b7c8b4 100644 --- a/themes/hotel-reservation-theme/_partials/service-products-list-row.tpl +++ b/themes/hotel-reservation-theme/_partials/service-products-list-row.tpl @@ -68,13 +68,6 @@
{block name='service_product_price'} {if !$priceDisplay}{convertPrice price=$service_product.price_tax_incl}{else}{convertPrice price=$service_product.price_tax_exc}{/if} - {if Product::getServicePriceBillableDays( - $service_product.price_calculation_method, - $service_product.date_from|default:$date_from|default:'', - $service_product.date_to|default:$date_to|default:'' - ) > 1} - {l s='/Night'} - {/if} {/block} {if $service_product.allow_multiple_quantity && $service_product.available_for_order && $service_product.max_quantity > 0}