From 6d5aa4f1a22ad2c448d2cab53581005afbb96ac5 Mon Sep 17 00:00:00 2001 From: amit sharma Date: Wed, 28 Oct 2026 12:27:46 +0530 Subject: [PATCH] Fixed: Fatal error when reinstalling QloApps --- modules/hotelreservationsystem/classes/HotelAmenities.php | 2 ++ .../classes/HotelReservationSystemDb.php | 6 ++---- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/hotelreservationsystem/classes/HotelAmenities.php b/modules/hotelreservationsystem/classes/HotelAmenities.php index f517d891d..786c530b4 100644 --- a/modules/hotelreservationsystem/classes/HotelAmenities.php +++ b/modules/hotelreservationsystem/classes/HotelAmenities.php @@ -63,6 +63,8 @@ class HotelAmenities extends ObjectModel if (file_exists($imgFile)) { unlink($imgFile); } + Db::getInstance()->delete('htl_branch_amenity', '`amenity_id` = '.(int)$id); + Db::getInstance()->delete('htl_room_type_amenity', '`amenity_id` = '.(int)$id); return parent::delete(); } return false; diff --git a/modules/hotelreservationsystem/classes/HotelReservationSystemDb.php b/modules/hotelreservationsystem/classes/HotelReservationSystemDb.php index 5b3126d7b..32542bc30 100644 --- a/modules/hotelreservationsystem/classes/HotelReservationSystemDb.php +++ b/modules/hotelreservationsystem/classes/HotelReservationSystemDb.php @@ -152,8 +152,7 @@ class HotelReservationSystemDb `date_add` datetime NOT NULL, `date_upd` datetime NOT NULL, PRIMARY KEY (`id_branch_amenity`), - CONSTRAINT `fk_htl_branch_amenity_amenity` FOREIGN KEY (`amenity_id`) - REFERENCES `"._DB_PREFIX_."htl_amenity` (`id_amenity`) ON DELETE CASCADE + KEY `amenity_id` (`amenity_id`) ) ENGINE="._MYSQL_ENGINE_." DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;", "CREATE TABLE IF NOT EXISTS `"._DB_PREFIX_."htl_room_type_amenity` ( @@ -165,8 +164,7 @@ class HotelReservationSystemDb `date_upd` datetime NOT NULL, PRIMARY KEY (`id_room_type_amenity`), KEY `id_product` (`id_product`), - CONSTRAINT `fk_htl_room_type_amenity_amenity` FOREIGN KEY (`amenity_id`) - REFERENCES `"._DB_PREFIX_."htl_amenity` (`id_amenity`) ON DELETE CASCADE + KEY `amenity_id` (`amenity_id`) ) ENGINE="._MYSQL_ENGINE_." DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;", "CREATE TABLE IF NOT EXISTS `"._DB_PREFIX_."htl_cart_booking_data` (