From d70f41740e6b5bd6cbd4f9c48e13d5eeacf5e761 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Tue, 8 Oct 2024 17:14:29 +0530 Subject: [PATCH] Fixed: Admin is able to save the 'Consider guest as child below age' as 0, also removed child ages from the occupancy field in case 'Maximum children' for a room type is 0 --- .../admin/AdminHotelGeneralSettingsController.php | 5 +++++ themes/hotel-reservation-theme/_partials/occupancy_field.tpl | 4 ++-- themes/hotel-reservation-theme/js/occupancy.js | 3 ++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/modules/hotelreservationsystem/controllers/admin/AdminHotelGeneralSettingsController.php b/modules/hotelreservationsystem/controllers/admin/AdminHotelGeneralSettingsController.php index f75670fd7..f105d2420 100644 --- a/modules/hotelreservationsystem/controllers/admin/AdminHotelGeneralSettingsController.php +++ b/modules/hotelreservationsystem/controllers/admin/AdminHotelGeneralSettingsController.php @@ -349,6 +349,11 @@ class AdminHotelGeneralSettingsController extends ModuleAdminController // max age of infant after which guest will considered as child // below 18 $globalChildMaxAge = Tools::getValue('WK_GLOBAL_CHILD_MAX_AGE'); $globalMaxChildInRoom = Tools::getValue('WK_GLOBAL_MAX_CHILD_IN_ROOM'); + if (!Validate::isUnsignedInt($globalChildMaxAge)) { + $this->errors[] = $this->l('Invalid value for "Consider guest as child below age".'); + } else if ($globalChildMaxAge <= 0) { + $this->errors[] = $this->l('The value for "Consider guest as child below age" must be at least 1.'); + } // End occupancy fields validation diff --git a/themes/hotel-reservation-theme/_partials/occupancy_field.tpl b/themes/hotel-reservation-theme/_partials/occupancy_field.tpl index 1ffa6f022..9b9c77142 100644 --- a/themes/hotel-reservation-theme/_partials/occupancy_field.tpl +++ b/themes/hotel-reservation-theme/_partials/occupancy_field.tpl @@ -64,7 +64,7 @@ -
+
@@ -139,7 +139,7 @@
-
+
diff --git a/themes/hotel-reservation-theme/js/occupancy.js b/themes/hotel-reservation-theme/js/occupancy.js index 031a37904..b292e430c 100644 --- a/themes/hotel-reservation-theme/js/occupancy.js +++ b/themes/hotel-reservation-theme/js/occupancy.js @@ -241,6 +241,7 @@ $(document).ready(function(){ var roomBlockIndex = parseInt($(booking_occupancy_wrapper).find(".occupancy_info_block").last().attr('occ_block_index')); roomBlockIndex += 1; + var max_children = parseInt($(booking_occupancy_wrapper).find('.max_children').val()); var countRooms = parseInt($(booking_occupancy_wrapper).find('.occupancy_info_block').length); countRooms += 1 @@ -269,7 +270,7 @@ $(document).ready(function(){ occupancy_block += '
'; occupancy_block += '
'; occupancy_block += '
'; - occupancy_block += '
'; + occupancy_block += '
'; occupancy_block += '
'; occupancy_block += ''; occupancy_block += '
';