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

This commit is contained in:
vishalsingh.qlo325
2024-10-08 17:14:29 +05:30
parent 8714b918f6
commit d70f41740e
3 changed files with 9 additions and 3 deletions

View File

@@ -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

View File

@@ -64,7 +64,7 @@
</div>
</div>
</div>
<div class="form-group col-sm-7 col-xs-6 occupancy_count_block">
<div class="form-group col-sm-7 col-xs-6 occupancy_count_block {if !$room_type_info['max_children']} hide {/if}">
<div class="row">
<label class="col-sm-12">{l s='Children'}</label>
<div class="col-sm-12 clearfix">
@@ -139,7 +139,7 @@
</div>
</div>
</div>
<div class="form-group col-sm-7 col-xs-6 occupancy_count_block">
<div class="form-group col-sm-7 col-xs-6 occupancy_count_block {if !$room_type_info['max_children']} hide {/if}">
<div class="row">
<label class="col-sm-12">{l s='Children'}</label>
<div class="col-sm-12 clearfix">

View File

@@ -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 += '</div>';
occupancy_block += '</div>';
occupancy_block += '</div>';
occupancy_block += '<div class="form-group col-sm-7 col-xs-6 occupancy_count_block">';
occupancy_block += '<div class="form-group col-sm-7 col-xs-6 occupancy_count_block ' + (!max_children ? 'hide' : '') +' ">';
occupancy_block += '<div class="row">';
occupancy_block += '<label class="col-sm-12">' + children_txt + '</label>';
occupancy_block += '<div class="col-sm-12 clearfix">';