diff --git a/admin-dev/themes/default/template/controllers/carts/helpers/view/view.tpl b/admin-dev/themes/default/template/controllers/carts/helpers/view/view.tpl index c22482496..0c8ab0c56 100644 --- a/admin-dev/themes/default/template/controllers/carts/helpers/view/view.tpl +++ b/admin-dev/themes/default/template/controllers/carts/helpers/view/view.tpl @@ -47,7 +47,7 @@
-

{displayWtPriceWithCurrency price=Tools::convertPrice($customer_stats.total_orders|floatval, $currency) currency=$currency}

+

{displayWtPriceWithCurrency price=Tools::convertPrice($customer_stats.total_spent|floatval, $currency) currency=$currency}

{else} @@ -102,7 +102,7 @@ {dateFormat date=$room['date_from'] full=$is_full_date} - {dateFormat date=$room['date_to'] full=$is_full_date} - {if $stay['adults']}{$stay['adults']}{/if} {if $stay['adults'] > 1}{l s='Adults'}{else}{l s='Adult'}{/if}{if {$stay['children']}}, {$stay['children']} {if $stay['children'] > 1}{l s='Children'}{else}{l s='Child'}{/if}{/if} + {if $room['adults']}{$room['adults']}{/if} {if $room['adults'] > 1}{l s='Adults'}{else}{l s='Adult'}{/if}{if {$room['children']}}, {$room['children']} {if $room['children'] > 1}{l s='Children'}{else}{l s='Child'}{/if}{/if} {displayWtPriceWithCurrency price=$room['feature_price_tax_excl'] currency=$currency} @@ -131,7 +131,7 @@
{if isset($room['selected_services']) && $room['selected_services']} diff --git a/admin-dev/themes/default/template/controllers/normal_products/informations.tpl b/admin-dev/themes/default/template/controllers/normal_products/informations.tpl index ab3a25191..d4e6f7609 100644 --- a/admin-dev/themes/default/template/controllers/normal_products/informations.tpl +++ b/admin-dev/themes/default/template/controllers/normal_products/informations.tpl @@ -255,7 +255,7 @@
diff --git a/admin-dev/themes/default/template/controllers/products/configuration.tpl b/admin-dev/themes/default/template/controllers/products/configuration.tpl index 8c5c1cc0e..2be7cecf2 100644 --- a/admin-dev/themes/default/template/controllers/products/configuration.tpl +++ b/admin-dev/themes/default/template/controllers/products/configuration.tpl @@ -1606,7 +1606,7 @@ $('#deactiveDatesModal').attr('data-room-row-index', roomRowIndex); $('#deactiveDatesModal').attr('data-id-room', idRoom); if ($.trim(roomNum) != '') { - roomNum = '( '+'{l s='%s No' sprintf=$htl_room_type['selling_object_plural_name']}'+' '+roomNum+')'; + roomNum = '( '+'{l s='%s No' sprintf=$htl_room_type['selling_object_name']}'+' '+roomNum+')'; } $('#deactiveDatesModal .disable_dates_room_num').text(roomNum); @@ -2005,7 +2005,7 @@ $('#connected_room_title').html(''); } } else { - alert(response.message); + showErrorMessage(response.message); } } }); @@ -2016,7 +2016,7 @@ var connectedRoomId = $row.find('.connect-room').val(); if (!connectedRoomId) { - alert(selectRoomText); + showErrorMessage(selectRoomText); return; } $.ajax({ @@ -2043,7 +2043,7 @@ $icon.text(response.connected_count); } } else { - alert(response.message); + showErrorMessage(response.message); } }, complete: function() { @@ -2132,7 +2132,7 @@ $icon.text(response.connected_count); } } else { - alert(response.message); + showErrorMessage(response.message); } } }); diff --git a/admin-dev/themes/default/template/helpers/tree/tree_node_folder_checkbox.tpl b/admin-dev/themes/default/template/helpers/tree/tree_node_folder_checkbox.tpl index ee107a6ab..87819b4d3 100644 --- a/admin-dev/themes/default/template/helpers/tree/tree_node_folder_checkbox.tpl +++ b/admin-dev/themes/default/template/helpers/tree/tree_node_folder_checkbox.tpl @@ -28,7 +28,7 @@ {/if} - + {if isset($node['badge'])} {$node['badge']['title']} diff --git a/classes/Cart.php b/classes/Cart.php index 33f00e5c5..43b51984d 100644 --- a/classes/Cart.php +++ b/classes/Cart.php @@ -4066,7 +4066,7 @@ class CartCore extends ObjectModel ) { if ($serviceProducts = $objServiceProductCartDetail->getServiceProductsInCart( $this->id, - [Product::SELLING_PREFERENCE_HOTEL_STANDALONE, Product::SELLING_PREFERENCE_WITH_HOTEL_AND_WITH_ROOM_TYPE], + [Product::SELLING_PREFERENCE_WITH_HOTEL, Product::SELLING_PREFERENCE_WITH_HOTEL_AND_WITH_ROOM_TYPE], null, 0, null, diff --git a/classes/PaymentModule.php b/classes/PaymentModule.php index 6c7b2df80..7a2018188 100644 --- a/classes/PaymentModule.php +++ b/classes/PaymentModule.php @@ -619,7 +619,7 @@ abstract class PaymentModuleCore extends Module $serviceProducts = $objServiceProductCartDetail->getServiceProductsInCart( $order->id_cart, [], - null, + isset($product['id_hotel']) ? (int) $product['id_hotel'] : null, 0, null, $product['id_product'] diff --git a/classes/pdf/HTMLTemplateOrderSlip.php b/classes/pdf/HTMLTemplateOrderSlip.php index c9856be17..f2a32ad35 100644 --- a/classes/pdf/HTMLTemplateOrderSlip.php +++ b/classes/pdf/HTMLTemplateOrderSlip.php @@ -121,7 +121,7 @@ class HTMLTemplateOrderSlipCore extends HTMLTemplateInvoice } } } else { - $this->order->products = null; + $this->order->products = array(); } unset($product); // remove reference diff --git a/controllers/admin/AdminCartsController.php b/controllers/admin/AdminCartsController.php index f895ba5ed..9080b4f46 100644 --- a/controllers/admin/AdminCartsController.php +++ b/controllers/admin/AdminCartsController.php @@ -270,12 +270,12 @@ class AdminCartsControllerCore extends AdminController if (!($cart = $this->loadObject(true))) { return; } + $this->context->cart = $cart; if ($this->tabAccess['kpi'] === 1) { $this->content .= $this->renderKpis(); } $customer = new Customer($cart->id_customer); $currency = new Currency($cart->id_currency); - $this->context->cart = $cart; $this->context->currency = $currency; $this->context->customer = $customer; $this->toolbar_title = sprintf($this->l('Cart #%06d'), $this->context->cart->id); @@ -1717,45 +1717,52 @@ class AdminCartsControllerCore extends AdminController $idCartBooking ))) { $originalPrice = Product::getPriceStatic($idServiceProduct, false); + $specificPriceInfo = SpecificPrice::getSpecificPrice( + (int)$idServiceProduct, + 0, + $objCart->id_currency, + 0, + 0, + 1, + 0, + 0, + $objCart->id, + 0, + $objHotelCartBookingData->id + ); // if price is different than the original service price then update the price - if ($canEdit && $operator == 'up' && $originalPrice != $unitPrice) { - if ($specificPriceInfo = SpecificPrice::getSpecificPrice( - (int)$idServiceProduct, - 0, - $objCart->id_currency, - 0, - 0, - 1, - 0, - 0, - $objCart->id, - 0, - $objHotelCartBookingData->id - )) { - $objSpecificPrice = new SpecificPrice($specificPriceInfo['id_specific_price']); - } else { - $objSpecificPrice = new SpecificPrice(); - } - $objSpecificPrice->id_shop = 0; - $objSpecificPrice->id_shop_group = 0; - $objSpecificPrice->id_cart = $objCart->id; - $objSpecificPrice->id_currency = $objCart->id_currency; - $objSpecificPrice->id_country = 0; - $objSpecificPrice->id_group = 0; - $objSpecificPrice->id_customer = 0; - $objSpecificPrice->id_product = $idServiceProduct; - $objSpecificPrice->id_product_attribute = 0; - $objSpecificPrice->price = $unitPrice; - $objSpecificPrice->from_quantity = 1; - $objSpecificPrice->reduction = 0; - $objSpecificPrice->id_htl_cart_booking = $objHotelCartBookingData->id; - $objSpecificPrice->reduction_type = 'amount'; - $objSpecificPrice->reduction_tax = 0; - $objSpecificPrice->from = '0000-00-00 00:00:00'; - $objSpecificPrice->to = '0000-00-00 00:00:00'; + if($canEdit && $operator == 'up'){ + if ($originalPrice != $unitPrice) { + if ($specificPriceInfo) { + $objSpecificPrice = new SpecificPrice($specificPriceInfo['id_specific_price']); + } else { + $objSpecificPrice = new SpecificPrice(); + } + $objSpecificPrice->id_shop = 0; + $objSpecificPrice->id_shop_group = 0; + $objSpecificPrice->id_cart = $objCart->id; + $objSpecificPrice->id_currency = $objCart->id_currency; + $objSpecificPrice->id_country = 0; + $objSpecificPrice->id_group = 0; + $objSpecificPrice->id_customer = 0; + $objSpecificPrice->id_product = $idServiceProduct; + $objSpecificPrice->id_product_attribute = 0; + $objSpecificPrice->price = $unitPrice; + $objSpecificPrice->from_quantity = 1; + $objSpecificPrice->reduction = 0; + $objSpecificPrice->id_htl_cart_booking = $objHotelCartBookingData->id; + $objSpecificPrice->reduction_type = 'amount'; + $objSpecificPrice->reduction_tax = 0; + $objSpecificPrice->from = '0000-00-00 00:00:00'; + $objSpecificPrice->to = '0000-00-00 00:00:00'; - $result &= $objSpecificPrice->save(); + $result &= $objSpecificPrice->save(); + } elseif ($specificPriceInfo) { + $objSpecificPrice = new SpecificPrice($specificPriceInfo['id_specific_price']); + $result &= $objSpecificPrice->delete(); + } } + } } diff --git a/controllers/admin/AdminProductsController.php b/controllers/admin/AdminProductsController.php index fadff8717..b971d2b27 100644 --- a/controllers/admin/AdminProductsController.php +++ b/controllers/admin/AdminProductsController.php @@ -5720,6 +5720,19 @@ class AdminProductsControllerCore extends AdminController $idHotel = (int) $objRoom->id_hotel; if ($mode === 'add') { + if (!Validate::isLoadedObject($objRoom)) { + die(json_encode(['success' => false, 'message' => $this->l('Invalid room selected.')])); + } + + $objConnectedRoom = new HotelRoomInformation($connectedRoomId); + if ( + $connectedRoomId === $roomId + || !Validate::isLoadedObject($objConnectedRoom) + || (int) $objConnectedRoom->id_hotel !== $idHotel + ) { + die(json_encode(['success' => false, 'message' => $this->l('Invalid room selected for connection.')])); + } + $connection = new HotelConnectedRoom(); $connection->id_room = $roomId; $connection->id_room_connected = $connectedRoomId; diff --git a/modules/hotelreservationsystem/classes/ServiceProductCartDetail.php b/modules/hotelreservationsystem/classes/ServiceProductCartDetail.php index ea8e6d002..c60f70675 100644 --- a/modules/hotelreservationsystem/classes/ServiceProductCartDetail.php +++ b/modules/hotelreservationsystem/classes/ServiceProductCartDetail.php @@ -232,6 +232,9 @@ class ServiceProductCartDetail extends ObjectModel $context = Context::getContext(); foreach ($serviceProducts as $product) { $objProduct = new Product($product['id_product'], false, $language->id); + if (!Validate::isLoadedObject($objProduct)) { + continue; + } if (!$objProduct->booking_product) { $quantity = $product['quantity'] ? (int) $product['quantity'] : 1; diff --git a/modules/hotelreservationsystem/controllers/admin/AdminHotelPropertyTypesController.php b/modules/hotelreservationsystem/controllers/admin/AdminHotelPropertyTypesController.php index 43f5d249c..d3485a680 100644 --- a/modules/hotelreservationsystem/controllers/admin/AdminHotelPropertyTypesController.php +++ b/modules/hotelreservationsystem/controllers/admin/AdminHotelPropertyTypesController.php @@ -57,6 +57,17 @@ class AdminHotelPropertyTypesController extends ModuleAdminController $this->addRowAction('edit'); $this->addRowAction('delete'); $this->bulk_actions = array( + 'enableSelection' => array( + 'text' => $this->l('Enable selected'), + 'icon' => 'icon-power-off text-success', + ), + 'disableSelection' => array( + 'text' => $this->l('Disable selected'), + 'icon' => 'icon-power-off text-danger', + ), + 'divider' => array( + 'text' => 'divider', + ), 'delete' => array( 'text' => $this->l('Delete selected'), 'confirm' => $this->l('Delete selected items?'), @@ -157,6 +168,13 @@ class AdminHotelPropertyTypesController extends ModuleAdminController $this->display = $idPropertyType ? 'edit' : 'add'; + if (!$this->errors && !Tools::getValue('active') && $idPropertyType) { + $objPropertyType = new HotelPropertyType((int) $idPropertyType); + if (Validate::isLoadedObject($objPropertyType) && $objPropertyType->active && $objPropertyType->isUsed()) { + $this->errors[] = $this->l('You cannot disable this property type because it is currently assigned to one or more properties.'); + } + } + if (!$this->errors) { parent::postProcess(); } @@ -165,6 +183,34 @@ class AdminHotelPropertyTypesController extends ModuleAdminController } } + public function processStatus() + { + $object = $this->loadObject(); + if (Validate::isLoadedObject($object) && $object->active && $object->isUsed()) { + $this->errors[] = $this->l('You cannot disable this property type because it is currently assigned to one or more properties.'); + + return false; + } + + return parent::processStatus(); + } + + protected function processBulkDisableSelection() + { + if (is_array($this->boxes) && !empty($this->boxes)) { + foreach ($this->boxes as $idPropertyType) { + $object = new HotelPropertyType((int) $idPropertyType); + if (Validate::isLoadedObject($object) && $object->isUsed()) { + $this->errors[] = $this->l('You cannot disable this property type because it is currently assigned to one or more properties.'); + + return false; + } + } + } + + return parent::processBulkDisableSelection(); + } + public function processDelete() { $object = $this->loadObject(); diff --git a/modules/hotelreservationsystem/views/css/qhrs_header_media.css b/modules/hotelreservationsystem/views/css/qhrs_header_media.css index 210a4d8d1..5645b2563 100644 --- a/modules/hotelreservationsystem/views/css/qhrs_header_media.css +++ b/modules/hotelreservationsystem/views/css/qhrs_header_media.css @@ -120,8 +120,8 @@ @keyframes wkZoomIn { from { opacity:0; transform:scale(0.88); } to { opacity:1; transform:scale(1); } } @keyframes wkBlurOut { from { opacity:1; filter:blur(0); } to { opacity:0; filter:blur(10px); } } @keyframes wkBlurIn { from { opacity:0; filter:blur(10px); } to { opacity:1; filter:blur(0); } } -@keyframes wkSlideOut { from { opacity:1; transform:translateX(0); } to { opacity:0; transform:translateX(-60px); } } -@keyframes wkSlideIn { from { opacity:0; transform:translateX(60px); } to { opacity:1; transform:translateX(0); } } +@keyframes wkSlideOut { from { transform:translateX(0); } to { transform:translateX(-100%); } } +@keyframes wkSlideIn { from { transform:translateX(100%); } to { transform:translateX(0); } } /* Description slide animation on slide change */ .js-header-description { diff --git a/themes/hotel-reservation-theme/_partials/booking-form.tpl b/themes/hotel-reservation-theme/_partials/booking-form.tpl index c19447241..2c0ae4253 100644 --- a/themes/hotel-reservation-theme/_partials/booking-form.tpl +++ b/themes/hotel-reservation-theme/_partials/booking-form.tpl @@ -228,12 +228,6 @@ {l s='Buy Standalone.'} - - {/if} {/block} @@ -241,7 +235,7 @@
{if isset($associated_hotels) && $associated_hotels}
- + +