diff --git a/admin/themes/default/template/controllers/orders/_cart_booking_demands.tpl b/admin/themes/default/template/controllers/orders/_cart_booking_demands.tpl index fc7204f50..3ab29983b 100644 --- a/admin/themes/default/template/controllers/orders/_cart_booking_demands.tpl +++ b/admin/themes/default/template/controllers/orders/_cart_booking_demands.tpl @@ -135,7 +135,7 @@ {if $product.allow_multiple_quantity}
-

+

{l s='Maximum allowed quantity: %s' sprintf=$product.max_quantity}

diff --git a/admin/themes/default/template/controllers/orders/_room_services_block.tpl b/admin/themes/default/template/controllers/orders/_room_services_block.tpl index c0b3ef515..d096a0125 100644 --- a/admin/themes/default/template/controllers/orders/_room_services_block.tpl +++ b/admin/themes/default/template/controllers/orders/_room_services_block.tpl @@ -53,10 +53,13 @@ {l s='Convenience fee'} {/if} - + {if $service['allow_multiple_quantity']}
- + +

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

{else} -- diff --git a/admin/themes/default/template/controllers/orders/helpers/view/view.tpl b/admin/themes/default/template/controllers/orders/helpers/view/view.tpl index 57b1384ae..89d5a6fc3 100644 --- a/admin/themes/default/template/controllers/orders/helpers/view/view.tpl +++ b/admin/themes/default/template/controllers/orders/helpers/view/view.tpl @@ -1753,6 +1753,17 @@ $('#room_extra_demand_content #back_to_service_btn').hide(); }); + $(document).on('change', '#rooms_type_extra_demands .room_ordered_services .qty', function(e) { + let quantityInputField = this; + let maximumQuantity = parseInt($(quantityInputField).attr('data-max-quantity')); + let currentQuantity = parseInt($(quantityInputField).val()); + if (currentQuantity > maximumQuantity) { + $(quantityInputField).siblings('p').show(); + } else { + $(quantityInputField).siblings('p').hide(); + } + }); + $(document).on('focusout', '#rooms_type_extra_demands .room_ordered_services .qty', function(e) { var qty_wntd = $(this).val(); if (qty_wntd == '' || !$.isNumeric(qty_wntd) || qty_wntd < 1) { diff --git a/modules/hotelreservationsystem/classes/RoomTypeServiceProductOrderDetail.php b/modules/hotelreservationsystem/classes/RoomTypeServiceProductOrderDetail.php index 4557cb4f0..b26cf751d 100644 --- a/modules/hotelreservationsystem/classes/RoomTypeServiceProductOrderDetail.php +++ b/modules/hotelreservationsystem/classes/RoomTypeServiceProductOrderDetail.php @@ -196,13 +196,14 @@ class RoomTypeServiceProductOrderDetail extends ObjectModel $sql = 'SELECT rsod.*'; if (!$getTotalPrice) { - $sql .= ', hbd.`id_product` as `room_type_id_product`, hbd.`id_room`, od.`product_allow_multiple_quantity`, + $sql .= ', hbd.`id_product` as `room_type_id_product`, hbd.`id_room`, od.`product_allow_multiple_quantity`, p.`max_quantity`, od.`product_auto_add`, od.`product_price_calculation_method`, od.`product_price_addition_type`'; } $sql .= ' FROM `'._DB_PREFIX_.'htl_booking_detail` hbd 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 .= ' WHERE hbd.`id` = '.(int)$idHotelBookingDetail; @@ -229,6 +230,7 @@ class RoomTypeServiceProductOrderDetail extends ObjectModel 'name' => $product['name'], 'quantity' => $product['quantity'], 'allow_multiple_quantity' => $product['product_allow_multiple_quantity'], + 'max_quantity' => $product['max_quantity'], 'product_auto_add' => $product['product_auto_add'], 'product_price_addition_type' => $product['product_price_addition_type'], 'product_price_calculation_method' => $product['product_price_calculation_method'], @@ -253,6 +255,7 @@ class RoomTypeServiceProductOrderDetail extends ObjectModel 'name' => $product['name'], 'quantity' => $product['quantity'], 'allow_multiple_quantity' => $product['product_allow_multiple_quantity'], + 'max_quantity' => $product['max_quantity'], 'product_auto_add' => $product['product_auto_add'], 'product_price_addition_type' => $product['product_price_addition_type'], 'product_price_calculation_method' => $product['product_price_calculation_method'],