<?php
/*
+--------------------------------------------------------------------+
- | CiviCRM version 4.5 |
+ | CiviCRM version 4.6 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2014 |
+--------------------------------------------------------------------+
/**
* Class constructor
*
- * @access public
* @return \CRM_Contact_DAO_Contact
*/
/**
*
*/
- function __construct() {
+ public function __construct() {
parent::__construct();
}
* @param array $params (reference ) an assoc array of name/value pairs
*
* @return CRM_Contact_BAO_Contact object
- * @access public
* @static
*/
- static function add(&$params) {
+ public static function add(&$params) {
$contact = new CRM_Contact_DAO_Contact();
if (empty($params)) {
*
* @throws Exception
* @return CRM_Contact_BAO_Contact object
- * @access public
* @static
*/
- static function &create(&$params, $fixAddress = TRUE, $invokeHooks = TRUE, $skipDelete = FALSE) {
+ public static function &create(&$params, $fixAddress = TRUE, $invokeHooks = TRUE, $skipDelete = FALSE) {
$contact = NULL;
if (empty($params['contact_type']) && empty($params['contact_id'])) {
return $contact;
* @param bool $type
*
* @return array the displayName and contactImage for this contact
- * @access public
* @static
*/
- static function getDisplayAndImage($id, $type = FALSE) {
+ public static function getDisplayAndImage($id, $type = FALSE) {
//CRM-14276 added the * on the civicrm_contact table so that we have all the contact info available
$sql = "
SELECT civicrm_contact.*,
* @param boolean $reverse true if we want to resolve the values in the reverse direction (value -> name)
*
* @return void
- * @access public
* @static
*/
- static function resolveDefaults(&$defaults, $reverse = FALSE) {
+ public static function resolveDefaults(&$defaults, $reverse = FALSE) {
// hack for birth_date
if (!empty($defaults['birth_date'])) {
if (is_array($defaults['birth_date'])) {
* @param boolean $microformat for location in microformat
*
* @return CRM_Contact_BAO_Contact object
- * @access public
* @static
*/
- static function &retrieve(&$params, &$defaults, $microformat = FALSE) {
+ public static function &retrieve(&$params, &$defaults, $microformat = FALSE) {
if (array_key_exists('contact_id', $params)) {
$params['id'] = $params['contact_id'];
}
*
* @return null|string display name of the contact if found
* @static
- * @access public
*/
- static function displayName($id) {
+ public static function displayName($id) {
$displayName = NULL;
if ($id) {
$displayName = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $id, 'display_name');
* @param bool $skipUndelete whether to force contact delete or not
*
* @return boolean true if contact deleted, false otherwise
- * @access public
* @static
*/
- static function deleteContact($id, $restore = FALSE, $skipUndelete = FALSE) {
+ public static function deleteContact($id, $restore = FALSE, $skipUndelete = FALSE) {
if (!$id) {
return FALSE;
//delete the contact id from recently view
CRM_Utils_Recent::delContact($id);
- // reset the group contact cache for this group
- CRM_Contact_BAO_GroupContactCache::remove();
+ // Update the group contact cache
+ if ($restore) {
+ CRM_Contact_BAO_GroupContactCache::remove();
+ }
+ else {
+ CRM_Contact_BAO_GroupContactCache::removeContact($id);
+ }
// delete any dupe cache entry
CRM_Core_BAO_PrevNextCache::deleteItem($id);
* @return void
* @static
*/
- static function contactTrashRestore($contact, $restore = FALSE) {
+ public static function contactTrashRestore($contact, $restore = FALSE) {
$op = ($restore ? 'restore' : 'trash');
CRM_Utils_Hook::pre($op, $contact->contact_type, $contact->id, CRM_Core_DAO::$_nullArray);
*
* @return string contact_type if $id found else null ""
*
- * @access public
*
* @static
*
*
* @return string contact_sub_type if $id found else null ""
*
- * @access public
*
* @static
*/
*
* @return array
*
- * @access public
*
* @static
*
* @param bool $withMultiCustomFields
*
* @return array array of importable Fields
- * @access public
* @static
*/
static function importableFields($contactType = 'Individual',
* @param bool $withMultiRecord
*
* @return array array of exportable Fields
- * @access public
* @static
*/
- static function &exportableFields($contactType = 'Individual', $status = FALSE, $export = FALSE, $search = FALSE, $withMultiRecord = FALSE) {
+ public static function &exportableFields($contactType = 'Individual', $status = FALSE, $export = FALSE, $search = FALSE, $withMultiRecord = FALSE) {
if (empty($contactType)) {
$contactType = 'All';
}
*
* @return $values array contains the contact details
* @static
- * @access public
*/
- static function getHierContactDetails($contactId, &$fields) {
+ public static function getHierContactDetails($contactId, &$fields) {
$params = array(array('contact_id', '=', $contactId, 0, 0));
$options = array();
* @param int $contactId contact id
*
* @return array a hierarchical property tree if appropriate
- * @access public
* @static
*/
- static function &makeHierReturnProperties($fields, $contactId = NULL) {
+ public static function &makeHierReturnProperties($fields, $contactId = NULL) {
$locationTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id');
$returnProperties = array();
* @param null $block
*
* @return int $locationType location_type_id
- * @access public
* @static
*/
- static function getPrimaryLocationType($contactId, $skipDefaultPriamry = FALSE, $block = NULL) {
+ public static function getPrimaryLocationType($contactId, $skipDefaultPriamry = FALSE, $block = NULL) {
if($block){
$entityBlock = array('contact_id' => $contactId);
$blocks = CRM_Core_BAO_Location::getValues($entityBlock);
*
* @return array of display_name, email if found, do_not_email or (null,null,null)
* @static
- * @access public
*/
- static function getContactDetails($id) {
+ public static function getContactDetails($id) {
// check if the contact type
$contactType = self::getContactType($id);
*
* @return int contact id created/edited
* @static
- * @access public
*/
static function createProfileContact(
&$params,
* @return object $dao contact details
* @static
*/
- static function &matchContactOnEmail($mail, $ctype = NULL) {
+ public static function &matchContactOnEmail($mail, $ctype = NULL) {
$strtolower = function_exists('mb_strtolower') ? 'mb_strtolower' : 'strtolower';
$mail = $strtolower(trim($mail));
$query = "
* @return object $dao contact details
* @static
*/
- static function &matchContactOnOpenId($openId, $ctype = NULL) {
+ public static function &matchContactOnOpenId($openId, $ctype = NULL) {
$strtolower = function_exists('mb_strtolower') ? 'mb_strtolower' : 'strtolower';
$openId = $strtolower(trim($openId));
$query = "
*
* @return string $dao->email email address if present else null
* @static
- * @access public
*/
public static function getPrimaryEmail($contactID) {
// fetch the primary email
*
* @return string $dao->openid OpenID if present else null
* @static
- * @access public
*/
public static function getPrimaryOpenId($contactID) {
// fetch the primary OpenID
* @param array $values output values of the object
*
* @return CRM_Contact_BAO_Contact|null the found object or null
- * @access public
* @static
*/
public static function getValues(&$params, &$values) {
* @param string $tableName optional tableName if component is custom group
*
* @return total number of count of occurence in database
- * @access public
* @static
*/
- static function getCountComponent($component, $contactId, $tableName = NULL) {
+ public static function getCountComponent($component, $contactId, $tableName = NULL) {
$object = NULL;
switch ($component) {
case 'tag':
* @param boolean $useDefaults use default greeting values
*
* @return void
- * @access public
* @static
*/
- static function processGreetings(&$contact, $useDefaults = FALSE) {
+ public static function processGreetings(&$contact, $useDefaults = FALSE) {
if ($useDefaults) {
//retrieve default greetings
$defaultGreetings = CRM_Core_PseudoConstant::greetingDefaults();
* @return array $locBlockIds loc block ids which fulfill condition.
* @static
*/
- static function getLocBlockIds($contactId, $criteria = array(), $condOperator = 'AND') {
+ public static function getLocBlockIds($contactId, $criteria = array(), $condOperator = 'AND') {
$locBlockIds = array();
if (!$contactId) {
return $locBlockIds;
* @return array of context menu for logged in user.
* @static
*/
- static function contextMenu($contactId = NULL) {
+ public static function contextMenu($contactId = NULL) {
$menu = array(
'view' => array(
'title' => ts('View Contact'),
* @param int $contactId contact id.
*
* @return display name |null the found display name or null.
- * @access public
* @static
*/
- static function getMasterDisplayName($masterAddressId = NULL, $contactId = NULL) {
+ public static function getMasterDisplayName($masterAddressId = NULL, $contactId = NULL) {
$masterDisplayName = NULL;
$sql = NULL;
if (!$masterAddressId && !$contactId) {
*
* @return array('created_date' => $, 'modified_date' => $)
*/
- static function getTimestamps($contactId) {
+ public static function getTimestamps($contactId) {
$timestamps = CRM_Core_DAO::executeQuery(
'SELECT created_date, modified_date
FROM civicrm_contact
*
* @link https://issues.civicrm.org/jira/browse/CRM-15602
* @see triggerInfo
- * @access public
* @static
*/
- static function generateTimestampTriggers(&$info, $reqTableName, $relatedTableNames, $contactRefColumn) {
+ public static function generateTimestampTriggers(&$info, $reqTableName, $relatedTableNames, $contactRefColumn) {
// Safety
$contactRefColumn = CRM_Core_DAO::escapeString($contactRefColumn);
// If specific related table requested, just process that one
* @see CRM_Core_DAO::triggerRebuild
* @see http://issues.civicrm.org/jira/browse/CRM-10554
*/
- static function triggerInfo(&$info, $tableName = NULL) {
+ public static function triggerInfo(&$info, $tableName = NULL) {
//during upgrade, first check for valid version and then create triggers
//i.e the columns created_date and modified_date are introduced in 4.3.alpha1 so dont create triggers for older version
if (CRM_Core_Config::isUpgradeMode()) {
* @param int $contactId contact id.
*
* @return bool true if present else false.
- * @access public
* @static
*/
- static function checkDomainContact($contactId) {
+ public static function checkDomainContact($contactId) {
if (!$contactId)
return FALSE;
$domainId = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_Domain', $contactId, 'id', 'contact_id');
$params['condition'] = "parent_id = (SELECT id FROM civicrm_contact_type WHERE name='{$props['contact_type']}')";
}
break;
+ case 'contact_type':
+ if ($context == 'search') {
+ // CRM-15495 - EntityRef filters and basic search forms expect this format
+ // FIXME: Search builder does not
+ return CRM_Contact_BAO_ContactType::getSelectElements();
+ }
+ break;
}
return CRM_Core_PseudoConstant::get(__CLASS__, $fieldName, $params, $context);
}