From fdc635b56f296fc66a972006fb72dd82d1276d06 Mon Sep 17 00:00:00 2001 From: abhishek-webkul <84142535+abhishek-webkul@users.noreply.github.com> Date: Wed, 21 Feb 2024 16:38:05 +0530 Subject: [PATCH] Add comments --- .../classes/RoomTypeServiceProduct.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/modules/hotelreservationsystem/classes/RoomTypeServiceProduct.php b/modules/hotelreservationsystem/classes/RoomTypeServiceProduct.php index 4b38b4c9b..b73c190d4 100644 --- a/modules/hotelreservationsystem/classes/RoomTypeServiceProduct.php +++ b/modules/hotelreservationsystem/classes/RoomTypeServiceProduct.php @@ -47,6 +47,9 @@ class RoomTypeServiceProduct extends ObjectModel ) ); + /** + * This method deletes passed associations and cleans positions of remaining associations + */ public static function deleteRoomProductLink($idProduct, $elementType = 0, $idElement = 0) { $where = '`id_product`='.(int)$idProduct; @@ -59,6 +62,7 @@ class RoomTypeServiceProduct extends ObjectModel $where .= ' AND `id_element` = '.(int) $idElement; } + // Get the list of elements before deleting associations to clean positions of remaining associations $elements = Db::getInstance()->executeS( 'SELECT rsp.`id_element`, rsp.`element_type` FROM `'._DB_PREFIX_.'htl_room_type_service_product` rsp @@ -71,6 +75,7 @@ class RoomTypeServiceProduct extends ObjectModel $where ); + // Clean positions of remaining associations after deletion $result &= self::cleanPositions($elements); return $result;