From 15575f040dfa5dedaf44300bef08c65f0cd08ba2 Mon Sep 17 00:00:00 2001 From: Abhishek Kumar Date: Wed, 5 Jan 2022 16:27:47 +0530 Subject: [PATCH] Add profile access restriction when adding room types --- controllers/admin/AdminProductsController.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/controllers/admin/AdminProductsController.php b/controllers/admin/AdminProductsController.php index f53d8e948..c9ad78a71 100644 --- a/controllers/admin/AdminProductsController.php +++ b/controllers/admin/AdminProductsController.php @@ -4609,7 +4609,16 @@ class AdminProductsControllerCore extends AdminController $objRoomType = new HotelRoomType(); $objHotelInfo = new HotelBranchInformation(); - $data->assign('htl_info', $objHotelInfo->hotelsNameAndId()); + $idsHotel = $objHotelInfo->getProfileAccessedHotels($this->context->employee->id_profile, 1, 1); + $hotelsInfo = array(); + foreach ($idsHotel as $idHotel) { + $objHotelBranchInfo = new HotelBranchInformation($idHotel, $this->context->language->id); + $hotelsInfo[] = array( + 'id' => (int)$idHotel, + 'hotel_name' => $objHotelBranchInfo->hotel_name, + ); + } + $data->assign('htl_info', $hotelsInfo); if ($hotelRoomType = $objRoomType->getRoomTypeInfoByIdProduct($product->id)) { $data->assign('htl_room_type', $hotelRoomType); $hotelFullInfo = $objHotelInfo->hotelBranchInfoById($hotelRoomType['id_hotel']);