Added missing validations in the back office
This commit is contained in:
@@ -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.');
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user