/** * Get the domain BAO * * @return null|object CRM_Core_BAO_Domain * @access public * @static */ static function &getDomain($reset = null) { static $domain = NULL; if (!$domain || $reset) { $domain = new CRM_Core_BAO_Domain(); $domain->id = CRM_Core_Config::domainID(); if (!$domain->find(TRUE)) { CRM_Core_Error::fatal(); } } return $domain; }
/** * Get the domain BAO * * @return null|object CRM_Core_BAO_Domain * @access public * @static */ static function &getDomain() { static $domain = null; if (!$domain) { $domain = new CRM_Core_BAO_Domain(); $domain->id = CRM_Core_Config::domainID(); if (!$domain->find(true)) { CRM_Core_Error::fatal(); } } return $domain; }
/** * Delete contact, ensuring it is not the domain contact * * @param int $contactID * Contact ID to delete */ public function contactDelete($contactID) { $domain = new CRM_Core_BAO_Domain(); $domain->contact_id = $contactID; if (!$domain->find(TRUE)) { $this->callAPISuccess('contact', 'delete', array('id' => $contactID, 'skip_undelete' => 1)); } }
/** * @param $contactID * * @return array|int */ function contactDelete($contactID) { $params = array('id' => $contactID, 'skip_undelete' => 1, 'debug' => 1); $domain = new CRM_Core_BAO_Domain(); $domain->contact_id = $contactID; if ($domain->find(TRUE)) { // we are finding tests trying to delete the domain contact in cleanup //since this is mainly for cleanup lets put a safeguard here return; } $result = $this->callAPISuccess('contact', 'delete', $params); return $result; }