From 2f27aa8fba63ffca645e2b5ee2bc27a9415822d2 Mon Sep 17 00:00:00 2001 From: Shreesh Arora Date: Mon, 9 Sep 2024 11:02:41 +0530 Subject: [PATCH 1/2] Fixed: service not visible in booking when service is deleted from catalog --- .../classes/RoomTypeServiceProductOrderDetail.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/hotelreservationsystem/classes/RoomTypeServiceProductOrderDetail.php b/modules/hotelreservationsystem/classes/RoomTypeServiceProductOrderDetail.php index 8692ee1e4..20f29fc5c 100644 --- a/modules/hotelreservationsystem/classes/RoomTypeServiceProductOrderDetail.php +++ b/modules/hotelreservationsystem/classes/RoomTypeServiceProductOrderDetail.php @@ -213,7 +213,7 @@ class RoomTypeServiceProductOrderDetail extends ObjectModel INNER JOIN `'._DB_PREFIX_.'htl_room_type_service_product_order_detail` rsod ON(rsod.`id_htl_booking_detail` = hbd.`id`)'; $sql .= ' LEFT JOIN `'._DB_PREFIX_.'order_detail` od ON(od.`id_order_detail` = rsod.`id_order_detail`)'; - $sql .= ' INNER JOIN `'._DB_PREFIX_.'product` p ON (p.`id_product` = rsod.`id_product`)'; + $sql .= ' LEFT JOIN `'._DB_PREFIX_.'product` p ON (p.`id_product` = rsod.`id_product`)'; $sql .= ' WHERE hbd.`id` = '.(int)$idHotelBookingDetail; From 5618e63ac439acd19046025a38003254632d17f2 Mon Sep 17 00:00:00 2001 From: Shreesh Arora Date: Mon, 9 Sep 2024 20:24:17 +0530 Subject: [PATCH 2/2] Fixed price calculation issue --- .../_extra_services_service_products_tab_content.tpl | 8 +++++--- controllers/admin/AdminOrdersController.php | 2 +- .../classes/RoomTypeServiceProductOrderDetail.php | 4 +++- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/admin/themes/default/template/controllers/orders/modals/_extra_services_service_products_tab_content.tpl b/admin/themes/default/template/controllers/orders/modals/_extra_services_service_products_tab_content.tpl index ac4ce1231..ffeba9c2c 100644 --- a/admin/themes/default/template/controllers/orders/modals/_extra_services_service_products_tab_content.tpl +++ b/admin/themes/default/template/controllers/orders/modals/_extra_services_service_products_tab_content.tpl @@ -57,9 +57,11 @@ {if $service['allow_multiple_quantity']}
-

- {l s='Maximum allowed quantity: %s' sprintf=$service['max_quantity']} -

+ {if $service['max_quantity']} +

+ {l s='Maximum allowed quantity: %s' sprintf=$service['max_quantity']} +

+ {/if}
{else} -- diff --git a/controllers/admin/AdminOrdersController.php b/controllers/admin/AdminOrdersController.php index 9bfd6affa..fe2e2ef5c 100644 --- a/controllers/admin/AdminOrdersController.php +++ b/controllers/admin/AdminOrdersController.php @@ -5028,7 +5028,7 @@ class AdminOrdersControllerCore extends AdminController && count($orderServiceProduct['additional_services']) ) { foreach ($orderServiceProduct['additional_services'] as $serviceProduct) { - if (Product::getProductPriceCalculation($serviceProduct['id_product']) == Product::PRICE_CALCULATION_METHOD_PER_DAY) { + if ($serviceProduct['price_calculation_method'] == Product::PRICE_CALCULATION_METHOD_PER_DAY) { $newNumDays = HotelHelper::getNumberOfDays($new_date_from, $new_date_to); $objRoomTypeServiceProductOrderDetail = new RoomTypeServiceProductOrderDetail((int) $serviceProduct['id_room_type_service_product_order_detail']); $unitPriceTaxExcl = $objRoomTypeServiceProductOrderDetail->unit_price_tax_excl; diff --git a/modules/hotelreservationsystem/classes/RoomTypeServiceProductOrderDetail.php b/modules/hotelreservationsystem/classes/RoomTypeServiceProductOrderDetail.php index 20f29fc5c..d8a236f66 100644 --- a/modules/hotelreservationsystem/classes/RoomTypeServiceProductOrderDetail.php +++ b/modules/hotelreservationsystem/classes/RoomTypeServiceProductOrderDetail.php @@ -78,7 +78,7 @@ class RoomTypeServiceProductOrderDetail extends ObjectModel $sql = 'SELECT rsod.*'; if (!$getTotalPrice) { - $sql .= ', hbd.`id_product` as `room_type_id_product`, od.`product_allow_multiple_quantity`, hbd.`id_room`, hbd.`adults`, hbd.`children`'; + $sql .= ', hbd.`id_product` as `room_type_id_product`, od.`product_allow_multiple_quantity`, od.`product_price_calculation_method`, hbd.`id_room`, hbd.`adults`, hbd.`children`'; } $sql .= ' FROM `'._DB_PREFIX_.'htl_booking_detail` hbd LEFT JOIN `'._DB_PREFIX_.'htl_room_type_service_product_order_detail` rsod ON(rsod.`id_htl_booking_detail` = hbd.`id`)'; @@ -152,6 +152,7 @@ class RoomTypeServiceProductOrderDetail extends ObjectModel 'product_tax' => $product_tax, 'product_tax_label' => $product_tax_label, 'allow_multiple_quantity' => $product['product_allow_multiple_quantity'], + 'price_calculation_method' => $product['product_price_calculation_method'], 'total_price_tax_excl' => $product['total_price_tax_excl'], 'total_price_tax_incl' => $product['total_price_tax_incl'], ); @@ -175,6 +176,7 @@ class RoomTypeServiceProductOrderDetail extends ObjectModel 'name' => $product['name'], 'quantity' => $product['quantity'], 'allow_multiple_quantity' => $product['product_allow_multiple_quantity'], + 'price_calculation_method' => $product['product_price_calculation_method'], 'product_tax' => $product_tax, 'product_tax_label' => $product_tax_label, 'total_price_tax_excl' => $product['total_price_tax_excl'],