Пример #1
0
/** 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 ...");
}
Пример #2
0
/** 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 ...");
}
Пример #3
0
 /**
  * Function to delete the group
  * @param <Settings_Groups_Record_Model> $transferToGroup
  */
 public function delete($transferToGroup)
 {
     $db = PearDatabase::getInstance();
     $groupId = $this->getId();
     $transferGroupId = $transferToGroup->getId();
     $em = new VTEventsManager($db);
     // Initialize Event trigger cache
     $em->initTriggerCache();
     $entityData = array();
     $entityData['groupid'] = $groupId;
     $entityData['transferToId'] = $transferGroupId;
     $em->triggerEvent("vtiger.entity.beforegroupdelete", $entityData);
     $this->transferOwnership($transferToGroup);
     deleteGroupRelatedSharingRules($groupId);
     $db->pquery('DELETE FROM vtiger_group2grouprel WHERE groupid=?', array($groupId));
     $db->pquery('DELETE FROM vtiger_group2role WHERE groupid=?', array($groupId));
     $db->pquery('DELETE FROM vtiger_group2rs WHERE groupid=?', array($groupId));
     $db->pquery('DELETE FROM vtiger_users2group WHERE groupid=?', array($groupId));
     $db->pquery("DELETE FROM vtiger_reportsharing WHERE shareid=? AND setype='groups'", array($groupId));
     $db->pquery('DELETE FROM vtiger_group2modules WHERE groupid=?', array($groupId));
     $db->pquery('DELETE FROM vtiger_groups WHERE groupid=?', array($groupId));
 }