Skip to content

Commit

Permalink
Merge pull request #964 from shreesh-webkul/gli-1616
Browse files Browse the repository at this point in the history
Fixed: Room type categories were not updated when hotel name or location is updated
  • Loading branch information
rohit053 authored Apr 3, 2024
2 parents 4dad3a9 + a30ed89 commit 3ed9976
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
16 changes: 16 additions & 0 deletions modules/hotelreservationsystem/classes/HotelBranchInformation.php
Original file line number Diff line number Diff line change
Expand Up @@ -825,6 +825,22 @@ public function deleteUnusedHotelCategories($idHotel)
return true;
}

public function updateRoomTypeCategories()
{
if (!Validate::isLoadedObject($this)) {
return false;
}

$hotelCategories = $this->getAllHotelCategories();
$objHotelRoomType = new HotelRoomType();
if ($roomTypes = $objHotelRoomType->getRoomTypeByHotelId($this->id, Context::getContext()->language->id)) {
foreach ($roomTypes as $roomType) {
$objProduct = new Product($roomType['id_product']);
$objProduct->updateCategories($hotelCategories);
}
}
}

public function isRefundable()
{
return (Configuration::get('WK_ORDER_REFUND_ALLOWED') && $this->active_refund);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,9 @@ public function processSave()
if ($objHotelBranch->id_category) {
$objCategory = new Category($objHotelBranch->id_category);
$objCategory->name = $objHotelBranch->hotel_name;
$objCategory->id_parent = $catCity;
$objCategory->save();
Category::regenerateEntireNtree();
} else {
if ($catHotel = $objHotelBranch->addCategory(
$hotelCatName, $catCity, $groupIds, 1, $newIdHotel, $linkRewriteArray
Expand Down Expand Up @@ -566,6 +568,9 @@ public function processSave()
}
}

// update room types association after category update
$objHotelBranch->updateRoomTypeCategories();

if ($idHotel) {
// save maximum booking date and preparation time
$objHotelOrderRestrictDate = new HotelOrderRestrictDate();
Expand Down

0 comments on commit 3ed9976

Please sign in to comment.