diff --git a/controllers/admin/AdminProductsController.php b/controllers/admin/AdminProductsController.php index dacb1a554..85e16f6aa 100644 --- a/controllers/admin/AdminProductsController.php +++ b/controllers/admin/AdminProductsController.php @@ -2024,11 +2024,12 @@ class AdminProductsControllerCore extends AdminController $this->errors[] = $error; } if(!count($this->errors)){ - $objHotelRoomType = new HotelRoomType(); - $roomTypeInfo = $objHotelRoomType->getRoomTypeInfoByIdProduct($this->object->id); - $objHotelBranchInformation = new HotelBranchInformation((int)$roomTypeInfo['id_hotel']); - if(!$objHotelBranchInformation->active){ - $this->errors[] = $this->l('Enable the hotel first to update status.'); + $objHotelRoomType = new HotelRoomType(); + if($roomTypeInfo = $objHotelRoomType->getRoomTypeInfoByIdProduct($this->object->id)){ + $objHotelBranchInformation = new HotelBranchInformation((int)$roomTypeInfo['id_hotel']); + if(!$objHotelBranchInformation->active){ + $this->errors[] = $this->l('Please enable the hotel "'.$roomTypeInfo['hotel_name'].'" first in order to update the status.'); + } } } @@ -2049,6 +2050,24 @@ class AdminProductsControllerCore extends AdminController return $res; } + public function processBulkStatusSelection($status) + { + if (is_array($this->boxes) && !empty($this->boxes)) { + foreach ($this->boxes as $id) { + $objHotelRoomType = new HotelRoomType(); + if($roomTypeInfo = $objHotelRoomType->getRoomTypeInfoByIdProduct($id)){ + $objHotelBranchInformation = new HotelBranchInformation((int)$roomTypeInfo['id_hotel']); + if(!$objHotelBranchInformation->active){ + $this->errors[] = $this->l('Please enable the hotel "'.$roomTypeInfo['hotel_name'].'" first in order to update the status.'); + } + } + } + } + if (!count($this->errors)) { + parent::processBulkStatusSelection($status); + } + } + public function processToggleShowAtFront() { if (!$this->loadObject()) {