diff --git a/controllers/admin/AdminOrderPreferencesController.php b/controllers/admin/AdminOrderPreferencesController.php index 4f17df8e0..c9f6e80fa 100644 --- a/controllers/admin/AdminOrderPreferencesController.php +++ b/controllers/admin/AdminOrderPreferencesController.php @@ -82,23 +82,21 @@ class AdminOrderPreferencesControllerCore extends AdminController ) ); - $maxOrderDate = (Tools::getValue('MAX_GLOBAL_BOOKING_DATE'))? Tools::getValue('MAX_GLOBAL_BOOKING_DATE') : Configuration::get('MAX_GLOBAL_BOOKING_DATE'); + $maxOrderDate = Tools::getValue('MAX_GLOBAL_BOOKING_DATE', Configuration::get('MAX_GLOBAL_BOOKING_DATE')); $this->fields_options = array( 'order_restrict' => array( 'title' => $this->l('Order Restrict'), 'icon' => 'icon-cogs', 'fields' => array( - 'max_global_booking_date_formatted' => array( + 'MAX_GLOBAL_BOOKING_DATE' => array( 'title' => $this->l('Maximum Global Check-out Date to book a room'), 'hint' => $this->l('Maximum date of check-out for which rooms of your hotels can be booked.'), - 'defaultValue' => date('d-m-Y', strtotime($maxOrderDate)), 'type' => 'text', 'id' => 'max_global_book_date', + 'auto_value' => false, + 'value' => date('d-m-Y', strtotime($maxOrderDate)), 'class' => 'fixed-width-xxl readonly', ), - 'MAX_GLOBAL_BOOKING_DATE' => array( - 'type' => 'hidden', - ), 'GLOBAL_PREPARATION_TIME' => array( 'title' => $this->l('Preparation time'), 'hint' => $this->l('Number of days required to prepare a room for a guest\'s stay. For example, if you set this value to 3 and someone is booking on 2nd of March he can only book rooms for dates from and after 3 days, i.e, 5th of March.'), @@ -334,8 +332,6 @@ class AdminOrderPreferencesControllerCore extends AdminController $this->errors[] = Tools::displayError('Please assign a valid CMS page for Terms and Conditions.'); } - // To prevent this from saving in the configuration table - unset($_POST['max_global_booking_date_formatted']); $_POST['MAX_GLOBAL_BOOKING_DATE'] = date('Y-m-d', strtotime(Tools::getValue('MAX_GLOBAL_BOOKING_DATE'))); $maxGlobalBookingDate = Tools::getValue('MAX_GLOBAL_BOOKING_DATE'); $globalPreparationTime = Tools::getValue('GLOBAL_PREPARATION_TIME'); diff --git a/modules/hotelreservationsystem/controllers/admin/AdminAddHotelController.php b/modules/hotelreservationsystem/controllers/admin/AdminAddHotelController.php index 4ec3f3dbc..15196c989 100644 --- a/modules/hotelreservationsystem/controllers/admin/AdminAddHotelController.php +++ b/modules/hotelreservationsystem/controllers/admin/AdminAddHotelController.php @@ -162,9 +162,9 @@ class AdminAddHotelController extends ModuleAdminController $restrictDateInfo = HotelOrderRestrictDate::getDataByHotelId($idHotel); if ($restrictDateInfo) { if ($restrictDateInfo['max_order_date'] == '0000-00-00') { - $restrictDateInfo['max_order_date'] = date('Y-m-d', strtotime('1 year')); + $restrictDateInfo['max_order_date'] = date('d-m-Y', strtotime('1 year')); } else { - $restrictDateInfo['max_order_date'] = date('Y-m-d', strtotime($restrictDateInfo['max_order_date'])); + $restrictDateInfo['max_order_date'] = date('d-m-Y', strtotime($restrictDateInfo['max_order_date'])); } } $smartyVars['order_restrict_date_info'] = $restrictDateInfo; diff --git a/modules/hotelreservationsystem/views/js/HotelReservationAdmin.js b/modules/hotelreservationsystem/views/js/HotelReservationAdmin.js index 4919ee928..c923b0eea 100644 --- a/modules/hotelreservationsystem/views/js/HotelReservationAdmin.js +++ b/modules/hotelreservationsystem/views/js/HotelReservationAdmin.js @@ -556,8 +556,6 @@ $(document).ready(function() { $("#max_global_book_date").datepicker({ defaultDate: new Date(), dateFormat: 'dd-mm-yy', - altFormat: 'yy-mm-dd', - altField: 'input[name="MAX_GLOBAL_BOOKING_DATE"]', minDate: 0, }); @@ -803,19 +801,17 @@ $(document).ready(function() { } // manage hotel page - $('#maximum_booking_date_formatted').datepicker({ + $('#maximum_booking_date').datepicker({ defaultDate: new Date(), dateFormat: 'dd-mm-yy', - altFormat: 'yy-mm-dd', - altField: 'input[name="maximum_booking_date"]', minDate: 0, }); $('input[name="enable_use_global_max_order_date"]').on('change', function () { if (parseInt($(this).val())) { - $('input[name="maximum_booking_date_formatted"]').closest('.form-group').hide(200); + $('input[name="maximum_booking_date"]').closest('.form-group').hide(200); } else { - $('input[name="maximum_booking_date_formatted"]').closest('.form-group').show(200); + $('input[name="maximum_booking_date"]').closest('.form-group').show(200); } }); diff --git a/modules/hotelreservationsystem/views/templates/admin/add_hotel/helpers/form/form.tpl b/modules/hotelreservationsystem/views/templates/admin/add_hotel/helpers/form/form.tpl index 196df0efd..a7231f196 100644 --- a/modules/hotelreservationsystem/views/templates/admin/add_hotel/helpers/form/form.tpl +++ b/modules/hotelreservationsystem/views/templates/admin/add_hotel/helpers/form/form.tpl @@ -363,8 +363,7 @@