diff --git a/admin/themes/default/template/controllers/products/booked_room_date_ranges_list.tpl b/admin/themes/default/template/controllers/products/booked_room_date_ranges_list.tpl index 2645f8dd8..ef41311ec 100644 --- a/admin/themes/default/template/controllers/products/booked_room_date_ranges_list.tpl +++ b/admin/themes/default/template/controllers/products/booked_room_date_ranges_list.tpl @@ -17,7 +17,7 @@ * @license LICENSE.txt *} -{l s='This room already has a booking for the selected date range.'} +{sprintf({l s='The room "%s" already has a booking for the selected date range.'}, $orderDetails->room_num)}
{l s='Order ID'}: #{$orderDetails->id_order|intval} diff --git a/admin/themes/default/template/controllers/products/configuration.tpl b/admin/themes/default/template/controllers/products/configuration.tpl index 0419331c0..a5680a24f 100644 --- a/admin/themes/default/template/controllers/products/configuration.tpl +++ b/admin/themes/default/template/controllers/products/configuration.tpl @@ -1238,6 +1238,7 @@ }; $('#page-loader').show(); + $('[name="submitBulkCreateRooms"]').attr('disabled', 'disable'); $.ajax({ url: prod_link, type: 'POST', @@ -1253,6 +1254,7 @@ }, complete: function() { $('#page-loader').hide(); + $('[name="submitBulkCreateRooms"]').attr('disabled', false); } }); }, diff --git a/controllers/admin/AdminLocalizationController.php b/controllers/admin/AdminLocalizationController.php index 49ad2c76c..7f1a8b745 100644 --- a/controllers/admin/AdminLocalizationController.php +++ b/controllers/admin/AdminLocalizationController.php @@ -401,8 +401,20 @@ class AdminLocalizationControllerCore extends AdminController public function beforeUpdateOptions() { - $lang = new Language((int)Tools::getValue('PS_LANG_DEFAULT')); + if (!trim(Tools::getValue('PS_WEIGHT_UNIT'))) { + $this->errors[] = sprintf(Tools::displayError('field %s is required.'), $this->l('Weight unit')); + } + if (!trim(Tools::getValue('PS_DISTANCE_UNIT'))) { + $this->errors[] = sprintf(Tools::displayError('field %s is required.'), $this->l('Distance unit')); + } + if (!trim(Tools::getValue('PS_DIMENSION_UNIT'))) { + $this->errors[] = sprintf(Tools::displayError('field %s is required.'), $this->l('Dimension unit')); + } + if (!trim(Tools::getValue('PS_VOLUME_UNIT'))) { + $this->errors[] = sprintf(Tools::displayError('field %s is required.'), $this->l('Volume unit')); + } + $lang = new Language((int)Tools::getValue('PS_LANG_DEFAULT')); if (!$lang->active) { $lang->active = 1; $lang->save(); diff --git a/controllers/admin/AdminProductsController.php b/controllers/admin/AdminProductsController.php index c65497b23..a9e30a0c5 100644 --- a/controllers/admin/AdminProductsController.php +++ b/controllers/admin/AdminProductsController.php @@ -5304,6 +5304,7 @@ class AdminProductsControllerCore extends AdminController if ($idRooms = Tools::getValue('id_rooms')) { $rowsToHighlight = array(); $room = array(); + $bookedRows = array(); if (trim($floor = Tools::getValue('floor'))) { $room['floor'] = $floor; if (!Validate::isGenericName($floor)) { @@ -5371,7 +5372,8 @@ class AdminProductsControllerCore extends AdminController } } else if ($room['id_status'] == HotelRoomInformation::STATUS_TEMPORARY_INACTIVE && $disableDates) { foreach ($disableDates as $key => $dateRange) { - if ($objHotelBookingDetail->chechRoomBooked($idRoom, $dateRange['date_from'], $dateRange['date_to'])) { + if ($bookingRow = $objHotelBookingDetail->chechRoomBooked($idRoom, $dateRange['date_from'], $dateRange['date_to'])) { + $bookedRows[$bookingRow['id']] = new HotelBookingDetail($bookingRow['id']); $rowsToHighlight[] = $key; } } @@ -5382,6 +5384,18 @@ class AdminProductsControllerCore extends AdminController Hook::exec('actionValidateRoomInformation', array('room_information' => $room)); } + + if (count($bookedRows)) { + foreach ($bookedRows as $bookedRow) { + $this->context->smarty->assign(array( + 'link' => $this->context->link, + 'orderDetails' => $bookedRow, + )); + + $this->errors[] = $this->context->smarty->fetch('controllers/products/booked_room_date_ranges_list.tpl'); + } + + } } if (empty($this->errors)) { @@ -5468,7 +5482,7 @@ class AdminProductsControllerCore extends AdminController if (!($roomQuantity = Tools::getValue('qty'))) { $this->errors[] = Tools::displayError('Number of rooms is required.'); - } else if ($roomQuantity < 1) { + } else if (!Validate::isUnsignedInt($roomQuantity) || $roomQuantity < 1) { $this->errors[] = Tools::displayError('Invalid value for number of rooms.'); } diff --git a/modules/hotelreservationsystem/controllers/admin/AdminHotelBedTypesController.php b/modules/hotelreservationsystem/controllers/admin/AdminHotelBedTypesController.php index adad61851..2088899a7 100644 --- a/modules/hotelreservationsystem/controllers/admin/AdminHotelBedTypesController.php +++ b/modules/hotelreservationsystem/controllers/admin/AdminHotelBedTypesController.php @@ -143,12 +143,25 @@ class AdminHotelBedTypesController extends ModuleAdminController return; } - if (!trim(Tools::getValue('width'))) { - $this->errors[] = $this->l('Field Width is required'); + $defaultLangId = Configuration::get('PS_LANG_DEFAULT'); + $objDefaultLanguage = Language::getLanguage((int) $defaultLangId); + $languages = Language::getLanguages(false); + if (!trim(Tools::getValue('name_'.$defaultLangId))) { + $this->errors[] = $this->l('Bed type name is required at least in ').$objDefaultLanguage['name']; + } else { + foreach ($languages as $lang) { + if (trim(Tools::getValue('name_'.$lang['id_lang'])) && !Validate::isGenericName(Tools::getValue('name_'.$lang['id_lang']))) { + $this->errors[] = $this->l('Invalid bed type name in ').$lang['name']; + } + } } - if (!trim(Tools::getValue('length'))) { - $this->errors[] = $this->l('Field Length is required'); + if (!(float) Tools::getValue('width')) { + $this->errors[] = $this->l('The width field is required'); + } + + if (!(float) Tools::getValue('length')) { + $this->errors[] = $this->l('The length field is required'); } return parent::processSave(); diff --git a/modules/hotelreservationsystem/hotelreservationsystem.php b/modules/hotelreservationsystem/hotelreservationsystem.php index 4c6c73680..7560cc9b5 100644 --- a/modules/hotelreservationsystem/hotelreservationsystem.php +++ b/modules/hotelreservationsystem/hotelreservationsystem.php @@ -510,6 +510,7 @@ class HotelReservationSystem extends Module 'htl_room_type_global_demand_advance_option', 'htl_order_refund_rules', 'htl_settings_link', + 'htl_bed_type' ); //If Admin update new language when we do entry in module all lang tables. HotelHelper::updateLangTables($newIdLang, $langTables);