/** * function to remove/ rejoin the group * * @param int $groupContactId id of crm_group_contact * @param string $status this is the status that should be updated. * * $access public */ function del($groupContactId, $status, $contactID) { $groupId = CRM_Contact_BAO_GroupContact::getGroupId($groupContactId); switch ($status) { case 'i': $groupStatus = 'Added'; break; case 'p': $groupStatus = 'Pending'; break; case 'o': $groupStatus = 'Removed'; break; } $groupNum = CRM_Contact_BAO_GroupContact::getContactGroup($this->_contactId, 'Added', null, true, true); if (defined('CIVICRM_MULTISITE') && CIVICRM_MULTISITE && $groupNum == 1 && $groupStatus == 'Removed') { CRM_Core_Session::setStatus('make sure at least one contact group association is maintained.'); return false; } $ids = array($contactID); $method = 'Admin'; $session =& CRM_Core_Session::singleton(); $userID = $session->get('userID'); if ($userID == $contactID) { $method = 'Web'; } CRM_Contact_BAO_GroupContact::removeContactsFromGroup($ids, $groupId, $method, $groupStatus); }
/** * function to remove/ rejoin the group * * @param int $groupContactId id of crm_group_contact * @param string $status this is the status that should be updated. * * $access public */ function del($groupContactId, $status) { $groupContact =& new CRM_Contact_DAO_GroupContact(); $groupId = CRM_Contact_BAO_GroupContact::getGroupId($groupContactId); switch ($status) { case 'i': $groupStatus = 'Added'; break; case 'p': $groupStatus = 'Pending'; break; case 'o': $groupStatus = 'Removed'; break; } $contactID = array($this->_contactId); $method = 'Admin'; CRM_Contact_BAO_GroupContact::removeContactsFromGroup($contactID, $groupId, $method, $groupStatus); }
/** * function to remove/ rejoin the group * * @param int $groupContactId id of crm_group_contact * @param string $status this is the status that should be updated. * * $access public */ static function del($groupContactId, $status, $contactID) { $groupId = CRM_Contact_BAO_GroupContact::getGroupId($groupContactId); switch ($status) { case 'i': $groupStatus = 'Added'; break; case 'p': $groupStatus = 'Pending'; break; case 'o': $groupStatus = 'Removed'; break; case 'd': $groupStatus = 'Deleted'; break; } $groupNum = CRM_Contact_BAO_GroupContact::getContactGroup($contactID, 'Added', NULL, TRUE, TRUE); if ($groupNum == 1 && $groupStatus == 'Removed' && CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::MULTISITE_PREFERENCES_NAME, 'is_enabled')) { CRM_Core_Session::setStatus(ts('Please ensure at least one contact group association is maintained.'), ts('Could Not Remove')); return FALSE; } $ids = array($contactID); $method = 'Admin'; $session = CRM_Core_Session::singleton(); $userID = $session->get('userID'); if ($userID == $contactID) { $method = 'Web'; } CRM_Contact_BAO_GroupContact::removeContactsFromGroup($ids, $groupId, $method, $groupStatus); }