diff --git a/admin/themes/default/template/controllers/orders/form.tpl b/admin/themes/default/template/controllers/orders/form.tpl index 0451cd31d..f3ef08023 100644 --- a/admin/themes/default/template/controllers/orders/form.tpl +++ b/admin/themes/default/template/controllers/orders/form.tpl @@ -2430,7 +2430,6 @@ {strip} {addJsDef max_child_age=$max_child_age} - {addJsDef max_child_in_room=$max_child_in_room} {addJsDefL name='select_age_txt'}{l s='Select age' js=1}{/addJsDefL} {addJsDefL name='under_1_age'}{l s='Under 1' js=1}{/addJsDefL} {addJsDefL name='room_txt'}{l s='Room' js=1}{/addJsDefL} 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 c0c841758..7f9046cdf 100644 --- a/admin/themes/default/template/controllers/orders/helpers/view/view.tpl +++ b/admin/themes/default/template/controllers/orders/helpers/view/view.tpl @@ -1335,7 +1335,6 @@ {addJsDefL name='invalid_occupancy_txt'}{l s='Invalid occupancy(adults/children) found.' js=1}{/addJsDefL} {addJsDefL name='select_room_txt'}{l s='Select room' js=1}{/addJsDefL} {addJsDef max_child_age=$max_child_age|escape:'quotes':'UTF-8'} - {addJsDef max_child_in_room=$max_child_in_room|escape:'quotes':'UTF-8'} {addJsDef ROOM_STATUS_CHECKED_IN=$ROOM_STATUS_CHECKED_IN|escape:'quotes':'UTF-8'} {addJsDef ROOM_STATUS_CHECKED_OUT=$ROOM_STATUS_CHECKED_OUT|escape:'quotes':'UTF-8'} {addJsDef ALLOTMENT_MANUAL=$ALLOTMENT_MANUAL|escape:'quotes':'UTF-8'} diff --git a/cache/smarty/cache/index.php b/cache/smarty/cache/index.php index 369a7a3f3..ffdebb428 100644 --- a/cache/smarty/cache/index.php +++ b/cache/smarty/cache/index.php @@ -1,6 +1,6 @@ -* @copyright 2007-2014 PrestaShop SA +* @copyright 2007-2015 PrestaShop SA * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ diff --git a/cache/smarty/compile/index.php b/cache/smarty/compile/index.php index 369a7a3f3..ffdebb428 100644 --- a/cache/smarty/compile/index.php +++ b/cache/smarty/compile/index.php @@ -1,6 +1,6 @@ -* @copyright 2007-2014 PrestaShop SA +* @copyright 2007-2015 PrestaShop SA * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ diff --git a/classes/controller/FrontController.php b/classes/controller/FrontController.php index 6885395fc..5252400ca 100644 --- a/classes/controller/FrontController.php +++ b/classes/controller/FrontController.php @@ -498,7 +498,6 @@ class FrontControllerCore extends Controller 'is_occupancy_wise_search' => $isOccupancyWiseSearch, 'occupancy_required_for_booking' => $occupancyRequiredForBooking, 'max_child_age' => Configuration::get('WK_GLOBAL_CHILD_MAX_AGE'), - 'max_child_in_room' => Configuration::get('WK_GLOBAL_MAX_CHILD_IN_ROOM'), 'show_full_date' => $this->show_full_date )); diff --git a/config/defines.inc.php b/config/defines.inc.php index f16e93903..d78f92763 100644 --- a/config/defines.inc.php +++ b/config/defines.inc.php @@ -26,7 +26,7 @@ /* Debug only */ if (!defined('_PS_MODE_DEV_')) { - define('_PS_MODE_DEV_', false); + define('_PS_MODE_DEV_', true); } /* Compatibility warning */ define('_PS_DISPLAY_COMPATIBILITY_WARNING_', false); diff --git a/controllers/admin/AdminOrdersController.php b/controllers/admin/AdminOrdersController.php index 30026bcca..438490de3 100644 --- a/controllers/admin/AdminOrdersController.php +++ b/controllers/admin/AdminOrdersController.php @@ -443,7 +443,6 @@ class AdminOrdersControllerCore extends AdminController 'payment_types' => $paymentTypes, 'PAYMENT_TYPE_PAY_AT_HOTEL' => OrderPayment::PAYMENT_TYPE_PAY_AT_HOTEL, 'currency' => new Currency((int)$cart->id_currency), - 'max_child_in_room' => Configuration::get('WK_GLOBAL_MAX_CHILD_IN_ROOM'), 'max_child_age' => Configuration::get('WK_GLOBAL_CHILD_MAX_AGE'), 'occupancy_required_for_booking' => $occupancyRequiredForBooking, )); @@ -3626,7 +3625,6 @@ class AdminOrdersControllerCore extends AdminController 'htl_booking_order_data' => $bookingOrderInfo, 'hotel_order_status' => $htlOrderStatus, 'order_detail_data' => $order_detail_data, - 'max_child_in_room' => Configuration::get('WK_GLOBAL_MAX_CHILD_IN_ROOM'), 'max_child_age' => Configuration::get('WK_GLOBAL_CHILD_MAX_AGE'), 'hotel_service_products' => $orderHotelServiceProducts, 'standalone_service_products' => $orderStandaloneServiceProducts, diff --git a/controllers/admin/AdminProductsController.php b/controllers/admin/AdminProductsController.php index 0a7acb76f..6c6b7fc4e 100644 --- a/controllers/admin/AdminProductsController.php +++ b/controllers/admin/AdminProductsController.php @@ -3407,10 +3407,6 @@ class AdminProductsControllerCore extends AdminController } if ($baseChildren == '' || !Validate::isUnsignedInt($baseChildren)) { $this->errors[] = Tools::displayError('Invalid base children'); - } else if (Configuration::get('WK_GLOBAL_MAX_CHILD_IN_ROOM')) { - if ($baseChildren > Configuration::get('WK_GLOBAL_MAX_CHILD_IN_ROOM')) { - $this->errors[] = sprintf(Tools::displayError('Base children cannot be greater than max childern allowed in the room of this room type (Max: %s)'), Configuration::get('WK_GLOBAL_MAX_CHILD_IN_ROOM')); - } } if (!$maxAdults || !Validate::isUnsignedInt($maxAdults)) { $this->errors[] = Tools::displayError('Invalid maximum number of adults'); @@ -3425,10 +3421,6 @@ class AdminProductsControllerCore extends AdminController $this->errors[] = Tools::displayError('Maximum number of children cannot be less than base children'); } elseif ($maxChildren >= $maxGuests) { $this->errors[] = Tools::displayError('Maximum number of children cannot be more or equal than maximum number of guests.(1 adult is mandatory in a room)'); - } else if (Configuration::get('WK_GLOBAL_MAX_CHILD_IN_ROOM')) { - if ($maxChildren > Configuration::get('WK_GLOBAL_MAX_CHILD_IN_ROOM')) { - $this->errors[] = sprintf(Tools::displayError('Maximum number of children cannot be greater than max childern allowed in the room of this room type (Max: %s)'), Configuration::get('WK_GLOBAL_MAX_CHILD_IN_ROOM')); - } } if (!$maxGuests || !Validate::isUnsignedInt($maxGuests)) { $this->errors[] = Tools::displayError('Invalid maximum number of guests'); diff --git a/modules/hotelreservationsystem/classes/HotelHelper.php b/modules/hotelreservationsystem/classes/HotelHelper.php index a196694f5..0070f18e8 100644 --- a/modules/hotelreservationsystem/classes/HotelHelper.php +++ b/modules/hotelreservationsystem/classes/HotelHelper.php @@ -1063,7 +1063,7 @@ class HotelHelper Configuration::updateValue('WK_ADVANCED_PAYMENT_INC_TAX', 1); Configuration::updateValue('WK_GLOBAL_CHILD_MAX_AGE', 15); - Configuration::updateValue('WK_GLOBAL_MAX_CHILD_IN_ROOM', 0); + Configuration::updateValue('QLO_GLOBAL_MAX_INFANT_AGE', 1); Configuration::updateValue('PS_MAX_CHECKOUT_OFFSET', 365); Configuration::updateValue('PS_MIN_BOOKING_OFFSET', 0); diff --git a/modules/hotelreservationsystem/controllers/admin/AdminHotelGeneralSettingsController.php b/modules/hotelreservationsystem/controllers/admin/AdminHotelGeneralSettingsController.php index e18ab1f4a..75f2bca2d 100644 --- a/modules/hotelreservationsystem/controllers/admin/AdminHotelGeneralSettingsController.php +++ b/modules/hotelreservationsystem/controllers/admin/AdminHotelGeneralSettingsController.php @@ -378,13 +378,12 @@ class AdminHotelGeneralSettingsController extends ModuleAdminController 'hint' => $this->l('Enter the age of the guest, which that guest will be considered as child.'), 'class' => 'fixed-width-xxl', ), - 'WK_GLOBAL_MAX_CHILD_IN_ROOM' => array( - 'title' => $this->l('Maximum children allowed in a room'), + 'QLO_GLOBAL_MAX_INFANT_AGE' => array( + 'title' => $this->l('Consider guest as Infant below age'), 'type' => 'text', 'required' => true, 'validation' => 'isUnsignedInt', - 'hint' => $this->l('Enter number of the child allowed in a room.'), - 'desc' => $this->l('Set as 0 if you do not want to limit children in a room.'), + 'hint' => $this->l('Enter number of the infant age.'), 'class' => 'fixed-width-xxl', ), ), @@ -531,13 +530,25 @@ class AdminHotelGeneralSettingsController extends ModuleAdminController // Validation for the occupancy settings // 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'); + $globalInfantAge = Tools::getValue('QLO_GLOBAL_MAX_INFANT_AGE'); + 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.'); } + if ($globalInfantAge) { + if (!Validate::isUnsignedInt($globalInfantAge)) { + $this->context->controller->errors[] = $this->l('Invalid infant age'); + } elseif ($globalInfantAge >= Configuration::get('WK_GLOBAL_CHILD_MAX_AGE')) { + $this->context->controller->errors[] = sprintf($this->l('The infant age cannot be greater than the Global child age (%s years)'), Configuration::get('WK_GLOBAL_CHILD_MAX_AGE')); + } else { + Configuration::updateValue('QLO_GLOBAL_MAX_INFANT_AGE', $globalInfantAge); + } + } else { + $this->context->controller->errors[] = $this->l('Infant age is required'); + } // End occupancy fields validation if (!$hotelNameSearchThreshold && $hotelNameSearchThreshold !== '0') { diff --git a/modules/hotelreservationsystem/controllers/admin/AdminHotelRoomsBookingController.php b/modules/hotelreservationsystem/controllers/admin/AdminHotelRoomsBookingController.php index fac60d468..87c31f89b 100644 --- a/modules/hotelreservationsystem/controllers/admin/AdminHotelRoomsBookingController.php +++ b/modules/hotelreservationsystem/controllers/admin/AdminHotelRoomsBookingController.php @@ -384,7 +384,6 @@ class AdminHotelRoomsBookingController extends ModuleAdminController 'date_to' => $this->date_to, 'occupancy_required_for_booking' => $occupancyRequiredForBooking, 'max_child_age' => Configuration::get('WK_GLOBAL_CHILD_MAX_AGE'), - 'max_child_in_room' => Configuration::get('WK_GLOBAL_MAX_CHILD_IN_ROOM'), 'link' => $this->context->link, 'ALLOTMENT_MANUAL' => HotelBookingDetail::ALLOTMENT_MANUAL, )); @@ -981,7 +980,6 @@ class AdminHotelRoomsBookingController extends ModuleAdminController 'SELLING_PREFERENCE_WITH_ROOM_TYPE' => Product::SELLING_PREFERENCE_WITH_ROOM_TYPE, 'SELLING_PREFERENCE_STANDALONE' => Product::SELLING_PREFERENCE_STANDALONE, 'max_child_age' => Configuration::get('WK_GLOBAL_CHILD_MAX_AGE'), - 'max_child_in_room' => Configuration::get('WK_GLOBAL_MAX_CHILD_IN_ROOM'), 'occupancy_required_for_booking' => $occupancyRequiredForBooking, 'rooms_reallocation_url' => $this->context->link->getAdminLink('AdminHotelRoomsBooking'), 'rooms_booking_url' => $this->context->link->getAdminLink('AdminHotelRoomsBooking'), diff --git a/modules/hotelreservationsystem/views/templates/admin/hotel_rooms_booking/helpers/view/_partials/booking-rooms.tpl b/modules/hotelreservationsystem/views/templates/admin/hotel_rooms_booking/helpers/view/_partials/booking-rooms.tpl index 7c68db350..00e73e233 100644 --- a/modules/hotelreservationsystem/views/templates/admin/hotel_rooms_booking/helpers/view/_partials/booking-rooms.tpl +++ b/modules/hotelreservationsystem/views/templates/admin/hotel_rooms_booking/helpers/view/_partials/booking-rooms.tpl @@ -74,7 +74,7 @@
- + ({l s='Below' mod='hotelreservationsystem'} {$max_child_age|escape:'htmlall':'UTF-8'} {l s='years' mod='hotelreservationsystem'})
@@ -163,7 +163,7 @@
- + ({l s='Below'} {$max_child_age|escape:'htmlall':'UTF-8'} {l s='years' mod='hotelreservationsystem'})
diff --git a/modules/hotelreservationsystem/views/templates/admin/hotel_rooms_booking/helpers/view/view.tpl b/modules/hotelreservationsystem/views/templates/admin/hotel_rooms_booking/helpers/view/view.tpl index 6dfd81da5..2557827b9 100644 --- a/modules/hotelreservationsystem/views/templates/admin/hotel_rooms_booking/helpers/view/view.tpl +++ b/modules/hotelreservationsystem/views/templates/admin/hotel_rooms_booking/helpers/view/view.tpl @@ -84,7 +84,7 @@
- + ({l s='Below' mod='hotelreservationsystem'} {$max_child_age|escape:'htmlall':'UTF-8'} {l s='years' mod='hotelreservationsystem'})
@@ -126,7 +126,7 @@
- + ({l s='Below' mod='hotelreservationsystem'} {$max_child_age|escape:'htmlall':'UTF-8'} {l s='years' mod='hotelreservationsystem'})
diff --git a/modules/wkroomsearchblock/views/js/wk-room-search-block.js b/modules/wkroomsearchblock/views/js/wk-room-search-block.js index aacaa38b0..3066b6250 100644 --- a/modules/wkroomsearchblock/views/js/wk-room-search-block.js +++ b/modules/wkroomsearchblock/views/js/wk-room-search-block.js @@ -696,37 +696,26 @@ $(document).ready(function() { if (childElement) { var totalChilds = $(this).closest('.occupancy_info_block').find('.guest_child_age').length; - if (max_child_in_room == 0 || totalChilds < max_child_in_room) { - element.val(elementVal); - $(this).closest('.occupancy_info_block').find('.children_age_info_block').show(); + element.val(elementVal); + $(this).closest('.occupancy_info_block').find('.children_age_info_block').show(); - var roomBlockIndex = parseInt($(this).closest('.occupancy_info_block').attr('occ_block_index')); + var roomBlockIndex = parseInt($(this).closest('.occupancy_info_block').attr('occ_block_index')); - var childAgeSelect = '
'; - childAgeSelect += ''; - childAgeSelect += '
'; - - $(this).closest('.occupancy_info_block').find('.children_ages').append(childAgeSelect); - - // set input field value - $(this).closest('.occupancy_count_block').find('.occupancy_count > span').text(elementVal); - } else { - if (elementVal >= max_child_in_room) { - if (elementVal == 0) { - showOccupancyError(no_children_allowed_txt, $(this).closest(".occupancy_info_block")); - } else { - showOccupancyError(max_children_txt, $(this).closest(".occupancy_info_block")); + var childAgeSelect = '
'; + childAgeSelect += ''; + childAgeSelect += '
'; + + $(this).closest('.occupancy_info_block').find('.children_ages').append(childAgeSelect); + + // set input field value + $(this).closest('.occupancy_count_block').find('.occupancy_count > span').text(elementVal); + } else { element.val(elementVal); @@ -934,19 +923,21 @@ $(document).ready(function() { // set positions of popups when required if (page_name == 'index') { - $('#hotel_location, #id_hotel_button, #guest_occupancy').focus(function () { + $('#hotel_location, #id_hotel_button_chosen, #guest_occupancy').focus(function () { setBookingSearchPositions(); + console.log('11111'); }); - // after chosen has been initialized $('select#id_hotel_button').on('chosen:ready', function() { $('#id_hotel_button_chosen .chosen-search input').focus(function () { setBookingSearchPositions(); + console.log('2222'); }); }); $('#daterange_value').click(function () { setBookingSearchPositions(); + console.log('3333'); }); } }); @@ -987,8 +978,8 @@ function setGuestOccupancy() // position dropdowns function setBookingSearchPositions() { // calculate available spaces + console.log("Aradhana"); let searchForm = $('#search_hotel_block_form'); - let inputFieldsAndDropdowns = [ { input: $('#hotel_location'), dropdown: $('.location_search_results_ul')}, { input: $('.hotel-selector-wrap'), dropdown: $('#id_hotel_button_chosen .chosen-drop')}, @@ -1018,7 +1009,8 @@ function setBookingSearchPositions() { positionClass = 'top'; } } - + console.log(positionClass); + console.log(inputFieldsAndDropdowns); // position dropdowns $(inputFieldsAndDropdowns).each(function (i, inputFieldAndDropdown) { inputFieldAndDropdown.dropdown.removeClass('top bottom').addClass(positionClass); diff --git a/themes/hotel-reservation-theme/global.tpl b/themes/hotel-reservation-theme/global.tpl index 55a1cdd44..eaa7cd71a 100644 --- a/themes/hotel-reservation-theme/global.tpl +++ b/themes/hotel-reservation-theme/global.tpl @@ -62,7 +62,6 @@ {addJsDef is_occupancy_wise_search=$is_occupancy_wise_search|boolval} {addJsDef occupancy_required_for_booking=$occupancy_required_for_booking|boolval} {addJsDef max_child_age=$max_child_age} -{addJsDef max_child_in_room=$max_child_in_room} {addJsDefL name='max_occupancy_reached_txt'}{l s='Maximum room occupancy reached' js=1}{/addJsDefL} {addJsDefL name='max_adults_txt'}{l s='Maximum adult occupancy reached' js=1}{/addJsDefL} diff --git a/themes/hotel-reservation-theme/js/occupancy.js b/themes/hotel-reservation-theme/js/occupancy.js index fddb7006f..56b59edea 100644 --- a/themes/hotel-reservation-theme/js/occupancy.js +++ b/themes/hotel-reservation-theme/js/occupancy.js @@ -58,8 +58,6 @@ $(document).ready(function(){ let max_child_in_room; if ($(this).closest(".booking_occupancy_wrapper").find('.max_children').val()) { max_child_in_room = $(this).closest(".booking_occupancy_wrapper").find('.max_children').val(); - } else { - max_child_in_room = window.max_child_in_room; } if (elementVal < max_child_in_room && elementVal < max_allowed_for_current) { element.val(elementVal + 1);