/** Function to delete the specified group * @param $groupId -- Group Id :: Type integer * @param $transferId -- Id of the group/user to which record ownership is to be transferred:: Type integer * @param $transferType -- It can have only two values namely 'Groups' or 'Users'. This determines whether the owneship is to be transferred to a group or user :: Type varchar */ function deleteGroup($groupId, $transferId) { global $log; $log->debug("Entering deleteGroup(" . $groupId . ") method ..."); global $adb; $em = new VTEventsManager($adb); // Initialize Event trigger cache $em->initTriggerCache(); $entityData = array(); $entityData['groupid'] = $groupId; $entityData['transferToId'] = $transferId; $em->triggerEvent("vtiger.entity.beforegroupdelete", $entityData); tranferGroupOwnership($groupId, $transferId); deleteGroupRelatedSharingRules($groupId); $query = "delete from vtiger_groups where groupid=?"; $adb->pquery($query, array($groupId)); deleteGroupRelatedGroups($groupId); deleteGroupRelatedRoles($groupId); deleteGroupReportRelations($groupId); deleteGroupRelatedRolesAndSubordinates($groupId); deleteGroupRelatedUsers($groupId); $log->debug("Exiting deleteGroup method ..."); }
/** Function to delete the specified group * @param $groupId -- Group Id :: Type integer * @param $transferId -- Id of the group/user to which record ownership is to be transferred:: Type integer * @param $transferType -- It can have only two values namely 'Groups' or 'Users'. This determines whether the owneship is to be transferred to a group or user :: Type varchar */ function deleteGroup($groupId, $transferId) { global $log; $log->debug("Entering deleteGroup(" . $groupId . ") method ..."); global $adb; tranferGroupOwnership($groupId, $transferId); deleteGroupRelatedSharingRules($groupId); $query = "delete from vtiger_groups where groupid=?"; $adb->pquery($query, array($groupId)); deleteGroupRelatedGroups($groupId); deleteGroupRelatedRoles($groupId); deleteGroupReportRelations($groupId); deleteGroupRelatedRolesAndSubordinates($groupId); deleteGroupRelatedUsers($groupId); $log->debug("Exiting deleteGroup method ..."); }