Fixed issue where a success message was displayed while changing room type status via bulk action even when the associated hotel was disabled.
This commit is contained in:
@@ -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()) {
|
||||
|
||||
Reference in New Issue
Block a user