Skip to content

Commit 427aa03

Browse files
authored
Merge pull request #1291 from vishal-singh-webkul/gli-2427
Updated: Validation for 'Consider guest as child below age' in the back-office and removed child ages from occupancy fields in case 'Maximum children' for a room type is 0 from front-office.
2 parents 52c808f + d70f417 commit 427aa03

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

modules/hotelreservationsystem/controllers/admin/AdminHotelGeneralSettingsController.php

+5
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,11 @@ public function postProcess()
349349
// max age of infant after which guest will considered as child // below 18
350350
$globalChildMaxAge = Tools::getValue('WK_GLOBAL_CHILD_MAX_AGE');
351351
$globalMaxChildInRoom = Tools::getValue('WK_GLOBAL_MAX_CHILD_IN_ROOM');
352+
if (!Validate::isUnsignedInt($globalChildMaxAge)) {
353+
$this->errors[] = $this->l('Invalid value for "Consider guest as child below age".');
354+
} else if ($globalChildMaxAge <= 0) {
355+
$this->errors[] = $this->l('The value for "Consider guest as child below age" must be at least 1.');
356+
}
352357

353358
// End occupancy fields validation
354359

themes/hotel-reservation-theme/_partials/occupancy_field.tpl

+2-2
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
</div>
6565
</div>
6666
</div>
67-
<div class="form-group col-sm-7 col-xs-6 occupancy_count_block">
67+
<div class="form-group col-sm-7 col-xs-6 occupancy_count_block {if !$room_type_info['max_children']} hide {/if}">
6868
<div class="row">
6969
<label class="col-sm-12">{l s='Children'}</label>
7070
<div class="col-sm-12 clearfix">
@@ -139,7 +139,7 @@
139139
</div>
140140
</div>
141141
</div>
142-
<div class="form-group col-sm-7 col-xs-6 occupancy_count_block">
142+
<div class="form-group col-sm-7 col-xs-6 occupancy_count_block {if !$room_type_info['max_children']} hide {/if}">
143143
<div class="row">
144144
<label class="col-sm-12">{l s='Children'}</label>
145145
<div class="col-sm-12 clearfix">

themes/hotel-reservation-theme/js/occupancy.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,7 @@ $(document).ready(function(){
241241
var roomBlockIndex = parseInt($(booking_occupancy_wrapper).find(".occupancy_info_block").last().attr('occ_block_index'));
242242
roomBlockIndex += 1;
243243

244+
var max_children = parseInt($(booking_occupancy_wrapper).find('.max_children').val());
244245

245246
var countRooms = parseInt($(booking_occupancy_wrapper).find('.occupancy_info_block').length);
246247
countRooms += 1
@@ -269,7 +270,7 @@ $(document).ready(function(){
269270
occupancy_block += '</div>';
270271
occupancy_block += '</div>';
271272
occupancy_block += '</div>';
272-
occupancy_block += '<div class="form-group col-sm-7 col-xs-6 occupancy_count_block">';
273+
occupancy_block += '<div class="form-group col-sm-7 col-xs-6 occupancy_count_block ' + (!max_children ? 'hide' : '') +' ">';
273274
occupancy_block += '<div class="row">';
274275
occupancy_block += '<label class="col-sm-12">' + children_txt + '</label>';
275276
occupancy_block += '<div class="col-sm-12 clearfix">';

0 commit comments

Comments
 (0)