From 30a01f7cc4bc6d14960bc1d4c9987ee5ce14e946 Mon Sep 17 00:00:00 2001 From: azhar bhat Date: Thu, 22 Jan 2026 16:48:47 +0530 Subject: [PATCH] Fixed issue where a success message was displayed while changing room type status via bulk action even when the associated hotel was disabled. --- controllers/admin/AdminProductsController.php | 29 +++++++++++++++---- 1 file changed, 24 insertions(+), 5 deletions(-) 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()) {