Newer
Older
* @copyright CiviCRM LLC https://civicrm.org/licensing
*
* Generated from xml/schema/CRM/Contact/Contact.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
* (GenCodeChecksum:e34bde9c7a6fcbfdc33cd9cbc305f1fb)
* Database access object for the Contact entity.
public static $_tableName = 'civicrm_contact';
/**
* Icon associated with this entity.
*
* @var string
*/
public static $_icon = 'fa-address-book-o';
/**
* Field to show when displaying a record.
*
* @var string
*/
public static $_labelField = 'display_name';
* Should CiviCRM log any modifications to this table in the civicrm_log table.
public static $_log = TRUE;
/**
* Paths for accessing this entity in the UI.
*
* @var string[]
*/
protected static $_paths = [

colemanw
committed
'add' => 'civicrm/contact/add?reset=1&ct=[contact_type]',
'view' => 'civicrm/contact/view?reset=1&cid=[id]',

colemanw
committed
'update' => 'civicrm/contact/add?reset=1&action=update&cid=[id]',
'delete' => 'civicrm/contact/view/delete?reset=1&delete=1&cid=[id]',
];
/**
* Type of Contact.
*
* @var string
*/
public $contact_type;
/**
* May be used to over-ride contact view and edit templates.
*
* @var string
*/
public $contact_sub_type;
/**
* Has the contact opted out from receiving all bulk email from the organization or site domain?
*
/**
* May be used for SSN, EIN/TIN, Household ID (census) or other applicable unique legal/government ID.
*
* @var string
*/
public $legal_identifier;
/**
* Unique trusted external ID (generally from a legacy app/datasource). Particularly useful for deduping operations.
*
* @var string
*/
public $external_identifier;
/**
* Name used for sorting different contact types
*
* @var string
*/
public $sort_name;
/**
* Formatted name representing preferred format for display/print/other output.
*
* @var string
*/
public $display_name;
/**
* Nickname.
*
* @var string
*/
public $nick_name;
/**
* Legal Name.
*
* @var string
*/
public $legal_name;
/**
* optional URL for preferred image (photo, logo, etc.) to display for this contact.
*
* @var text
*/
public $image_URL;
/**
* What is the preferred mode of communication.
*
* @var string
*/
public $preferred_communication_method;
/**
* Which language is preferred for communication. FK to languages in civicrm_option_value.
*
* @var string
*/
public $preferred_language;
/**
* What is the preferred mode of sending an email.
*
* @var string
*/
public $preferred_mail_format;
/**
* Key for validating requests related to this contact.
*
* @var string
*/
public $hash;
/**
* API Key for validating requests related to this contact.
*
* @var string
*/
public $api_key;
/**
* where contact come from, e.g. import, donate module insert...
*
* @var string
*/
public $source;
/**
* First Name.
*
* @var string
*/
public $first_name;
/**
* Middle Name.
*
* @var string
*/
public $middle_name;
/**
* Last Name.
*
* @var string
*/
public $last_name;
/**
* Prefix or Title for name (Ms, Mr...). FK to prefix ID
*
/**
* Suffix for name (Jr, Sr...). FK to suffix ID
*
/**
* Formal (academic or similar) title in front of name. (Prof., Dr. etc.)
*
* @var string
*/
public $formal_title;
/**
* Communication style (e.g. formal vs. familiar) to use with this contact. FK to communication styles in civicrm_option_value.
*
/**
* FK to civicrm_option_value.id, that has to be valid registered Email Greeting.
*
/**
* Custom Email Greeting.
*
* @var string
*/
public $email_greeting_custom;
/**
* Cache Email Greeting.
*
* @var string
*/
public $email_greeting_display;
/**
* FK to civicrm_option_value.id, that has to be valid registered Postal Greeting.
*
/**
* Custom Postal greeting.
*
* @var string
*/
public $postal_greeting_custom;
/**
* Cache Postal greeting.
*
* @var string
*/
public $postal_greeting_display;
/**
* FK to civicrm_option_value.id, that has to be valid registered Addressee.
*
/**
* Custom Addressee.
*
* @var string
*/
public $addressee_custom;
/**
* Cache Addressee.
*
* @var string
*/
public $addressee_display;
/**
* Job Title
*
* @var string
*/
public $job_title;
/**
* Date of birth
*
* @var date
*/
public $birth_date;
/**
* Date of deceased
*
* @var date
*/
public $deceased_date;
/**
* Household Name.
*
* @var string
*/
public $household_name;
/**
* Optional FK to Primary Contact for this household.
*
/**
* Organization Name.
*
* @var string
*/
public $organization_name;
/**
* Standard Industry Classification Code.
*
* @var string
*/
public $sic_code;
/**
* the OpenID (or OpenID-style http://username.domain/) unique identifier for this contact mainly used for logging in to CiviCRM
*
* @var string
*/
public $user_unique_id;
/**
* OPTIONAL FK to civicrm_contact record.
*
/**
* When was the contact was created.
*
* @var timestamp
*/
public $created_date;
/**
* When was the contact (or closely related entity) was created or modified or deleted.
*
* @var timestamp
*/
public $modified_date;
public function __construct() {
$this->__table = 'civicrm_contact';
parent::__construct();
}
/**
* Returns localized title of this entity.
*
* @param bool $plural
* Whether to return the plural version of the title.
public static function getEntityTitle($plural = FALSE) {
return $plural ? ts('Contacts') : ts('Contact');
*
* @return array
* [CRM_Core_Reference_Interface]
*/
public static function getReferenceColumns() {
if (!isset(Civi::$statics[__CLASS__]['links'])) {
Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'primary_contact_id', 'civicrm_contact', 'id');
Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'employer_id', 'civicrm_contact', 'id');
CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
return Civi::$statics[__CLASS__]['links'];
/**
* Returns all the column names of this table
*
* @return array
*/
public static function &fields() {
if (!isset(Civi::$statics[__CLASS__]['fields'])) {
Civi::$statics[__CLASS__]['fields'] = [
'id' => [
'title' => ts('Contact ID'),
'required' => TRUE,
'import' => TRUE,
'where' => 'civicrm_contact.id',
'headerPattern' => '/internal|contact?|id$/i',
'export' => TRUE,
'table_name' => 'civicrm_contact',
'entity' => 'Contact',
'bao' => 'CRM_Contact_BAO_Contact',

colemanw
committed
'add' => '1.1',
],
'contact_type' => [
'name' => 'contact_type',
'type' => CRM_Utils_Type::T_STRING,
'title' => ts('Contact Type'),
'maxlength' => 64,
'size' => CRM_Utils_Type::BIG,
'where' => 'civicrm_contact.contact_type',
'contactType' => NULL,
'table_name' => 'civicrm_contact',
'entity' => 'Contact',
'bao' => 'CRM_Contact_BAO_Contact',
],
'pseudoconstant' => [
'table' => 'civicrm_contact_type',
'keyColumn' => 'name',
'labelColumn' => 'label',
'condition' => 'parent_id IS NULL',

colemanw
committed
'add' => '1.1',
],
'contact_sub_type' => [
'name' => 'contact_sub_type',
'type' => CRM_Utils_Type::T_STRING,
'title' => ts('Contact Subtype'),
'description' => ts('May be used to over-ride contact view and edit templates.'),
'maxlength' => 255,
'size' => CRM_Utils_Type::HUGE,
'import' => TRUE,
'where' => 'civicrm_contact.contact_sub_type',
'headerPattern' => '/C(ontact )?(subtype|sub-type|sub type)/i',
'export' => TRUE,
'table_name' => 'civicrm_contact',
'entity' => 'Contact',
'bao' => 'CRM_Contact_BAO_Contact',
'serialize' => self::SERIALIZE_SEPARATOR_BOOKEND,
],
'pseudoconstant' => [
'table' => 'civicrm_contact_type',
'keyColumn' => 'name',
'labelColumn' => 'label',
'condition' => 'parent_id IS NOT NULL',

colemanw
committed
'add' => '1.5',
],
'do_not_email' => [
'name' => 'do_not_email',
'type' => CRM_Utils_Type::T_BOOLEAN,
'title' => ts('Do Not Email'),
'import' => TRUE,
'where' => 'civicrm_contact.do_not_email',
'headerPattern' => '/d(o )?(not )?(email)/i',
'dataPattern' => '/^\d{1,}$/',
'export' => TRUE,
'table_name' => 'civicrm_contact',
'entity' => 'Contact',
'bao' => 'CRM_Contact_BAO_Contact',

colemanw
committed
'add' => '1.1',
],
'do_not_phone' => [
'name' => 'do_not_phone',
'type' => CRM_Utils_Type::T_BOOLEAN,
'title' => ts('Do Not Phone'),
'import' => TRUE,
'where' => 'civicrm_contact.do_not_phone',
'headerPattern' => '/d(o )?(not )?(call|phone)/i',
'dataPattern' => '/^\d{1,}$/',
'export' => TRUE,
'table_name' => 'civicrm_contact',
'entity' => 'Contact',
'bao' => 'CRM_Contact_BAO_Contact',

colemanw
committed
'add' => '1.1',
],
'do_not_mail' => [
'name' => 'do_not_mail',
'type' => CRM_Utils_Type::T_BOOLEAN,
'title' => ts('Do Not Mail'),
'import' => TRUE,
'where' => 'civicrm_contact.do_not_mail',
'headerPattern' => '/^(d(o\s)?n(ot\s)?mail)|(\w*)?bulk\s?(\w*)$/i',
'dataPattern' => '/^\d{1,}$/',
'export' => TRUE,
'table_name' => 'civicrm_contact',
'entity' => 'Contact',
'bao' => 'CRM_Contact_BAO_Contact',

colemanw
committed
'add' => '1.1',
],
'do_not_sms' => [
'name' => 'do_not_sms',
'type' => CRM_Utils_Type::T_BOOLEAN,
'title' => ts('Do Not Sms'),
'import' => TRUE,
'where' => 'civicrm_contact.do_not_sms',
'headerPattern' => '/d(o )?(not )?(sms)/i',
'dataPattern' => '/^\d{1,}$/',
'export' => TRUE,
'table_name' => 'civicrm_contact',
'entity' => 'Contact',
'bao' => 'CRM_Contact_BAO_Contact',

colemanw
committed
'add' => '3.0',
],
'do_not_trade' => [
'name' => 'do_not_trade',
'type' => CRM_Utils_Type::T_BOOLEAN,
'title' => ts('Do Not Trade'),
'import' => TRUE,
'where' => 'civicrm_contact.do_not_trade',
'headerPattern' => '/d(o )?(not )?(trade)/i',
'dataPattern' => '/^\d{1,}$/',
'export' => TRUE,
'table_name' => 'civicrm_contact',
'entity' => 'Contact',
'bao' => 'CRM_Contact_BAO_Contact',

colemanw
committed
'add' => '1.1',
],
'is_opt_out' => [
'name' => 'is_opt_out',
'type' => CRM_Utils_Type::T_BOOLEAN,
'title' => ts('No Bulk Emails (User Opt Out)'),
'description' => ts('Has the contact opted out from receiving all bulk email from the organization or site domain?'),
'required' => TRUE,
'import' => TRUE,
'export' => TRUE,
'table_name' => 'civicrm_contact',
'entity' => 'Contact',
'bao' => 'CRM_Contact_BAO_Contact',

colemanw
committed
'add' => '1.1',
],
'legal_identifier' => [
'name' => 'legal_identifier',
'type' => CRM_Utils_Type::T_STRING,
'title' => ts('Legal Identifier'),
'description' => ts('May be used for SSN, EIN/TIN, Household ID (census) or other applicable unique legal/government ID.'),
'maxlength' => 32,
'size' => CRM_Utils_Type::MEDIUM,
'import' => TRUE,
'where' => 'civicrm_contact.legal_identifier',
'headerPattern' => '/legal\s?id/i',
'dataPattern' => '/\w+?\d{5,}/',
'export' => TRUE,
'table_name' => 'civicrm_contact',
'entity' => 'Contact',
'bao' => 'CRM_Contact_BAO_Contact',

colemanw
committed
'add' => '1.1',
],
'external_identifier' => [
'name' => 'external_identifier',
'type' => CRM_Utils_Type::T_STRING,
'title' => ts('External Identifier'),
'description' => ts('Unique trusted external ID (generally from a legacy app/datasource). Particularly useful for deduping operations.'),
'import' => TRUE,
'where' => 'civicrm_contact.external_identifier',
'headerPattern' => '/external\s?id/i',
'dataPattern' => '/^\d{11,}$/',
'export' => TRUE,
'table_name' => 'civicrm_contact',
'entity' => 'Contact',
'bao' => 'CRM_Contact_BAO_Contact',

colemanw
committed
'add' => '1.1',
],
'sort_name' => [
'name' => 'sort_name',
'type' => CRM_Utils_Type::T_STRING,
'title' => ts('Sort Name'),
'description' => ts('Name used for sorting different contact types'),
'maxlength' => 128,
'size' => 30,
'where' => 'civicrm_contact.sort_name',
'table_name' => 'civicrm_contact',
'entity' => 'Contact',
'bao' => 'CRM_Contact_BAO_Contact',

colemanw
committed
'add' => '1.1',
],
'display_name' => [
'name' => 'display_name',
'type' => CRM_Utils_Type::T_STRING,
'title' => ts('Display Name'),
'description' => ts('Formatted name representing preferred format for display/print/other output.'),
'maxlength' => 128,
'size' => 30,
'where' => 'civicrm_contact.display_name',
'table_name' => 'civicrm_contact',
'entity' => 'Contact',
'bao' => 'CRM_Contact_BAO_Contact',

colemanw
committed
'add' => '1.1',
],
'nick_name' => [
'name' => 'nick_name',
'type' => CRM_Utils_Type::T_STRING,
'title' => ts('Nickname'),
'import' => TRUE,
'where' => 'civicrm_contact.nick_name',
'headerPattern' => '/n(ick\s)name|nick$/i',
'dataPattern' => '/^\w+$/',
'export' => TRUE,
'table_name' => 'civicrm_contact',
'entity' => 'Contact',
'bao' => 'CRM_Contact_BAO_Contact',

colemanw
committed
'add' => '1.1',
],
'legal_name' => [
'name' => 'legal_name',
'type' => CRM_Utils_Type::T_STRING,
'title' => ts('Legal Name'),
'import' => TRUE,
'where' => 'civicrm_contact.legal_name',
'headerPattern' => '/^legal|(l(egal\s)?name)$/i',
'export' => TRUE,
'contactType' => 'Organization',
'table_name' => 'civicrm_contact',
'entity' => 'Contact',
'bao' => 'CRM_Contact_BAO_Contact',

colemanw
committed
'add' => '1.1',
],
'image_URL' => [
'name' => 'image_URL',
'type' => CRM_Utils_Type::T_TEXT,
'title' => ts('Image Url'),
'description' => ts('optional URL for preferred image (photo, logo, etc.) to display for this contact.'),
'import' => TRUE,
'export' => TRUE,
'table_name' => 'civicrm_contact',
'entity' => 'Contact',
'bao' => 'CRM_Contact_BAO_Contact',

colemanw
committed
'add' => '1.1',
],
'preferred_communication_method' => [
'name' => 'preferred_communication_method',
'type' => CRM_Utils_Type::T_STRING,
'title' => ts('Preferred Communication Method'),
'description' => ts('What is the preferred mode of communication.'),
'maxlength' => 255,
'size' => CRM_Utils_Type::HUGE,
'import' => TRUE,
'where' => 'civicrm_contact.preferred_communication_method',
'headerPattern' => '/^p(ref\w*\s)?c(omm\w*)|( meth\w*)$/i',
'dataPattern' => '/^\w+$/',
'export' => TRUE,
'table_name' => 'civicrm_contact',
'entity' => 'Contact',
'bao' => 'CRM_Contact_BAO_Contact',
'serialize' => self::SERIALIZE_SEPARATOR_BOOKEND,
],
'pseudoconstant' => [
'optionGroupName' => 'preferred_communication_method',
'optionEditPath' => 'civicrm/admin/options/preferred_communication_method',

colemanw
committed
'add' => '1.1',
],
'preferred_language' => [
'name' => 'preferred_language',
'type' => CRM_Utils_Type::T_STRING,
'title' => ts('Preferred Language'),
'description' => ts('Which language is preferred for communication. FK to languages in civicrm_option_value.'),
'import' => TRUE,
'where' => 'civicrm_contact.preferred_language',
'headerPattern' => '/^lang/i',
'export' => TRUE,
'table_name' => 'civicrm_contact',
'entity' => 'Contact',
'bao' => 'CRM_Contact_BAO_Contact',
],
'pseudoconstant' => [
'optionGroupName' => 'languages',
'keyColumn' => 'name',
'optionEditPath' => 'civicrm/admin/options/languages',

colemanw
committed
'add' => '3.2',
],
'preferred_mail_format' => [
'name' => 'preferred_mail_format',
'type' => CRM_Utils_Type::T_STRING,
'title' => ts('Preferred Mail Format'),
'description' => ts('What is the preferred mode of sending an email.'),
'maxlength' => 8,
'size' => CRM_Utils_Type::EIGHT,
'import' => TRUE,
'where' => 'civicrm_contact.preferred_mail_format',
'headerPattern' => '/^p(ref\w*\s)?m(ail\s)?f(orm\w*)$/i',
'export' => TRUE,
'table_name' => 'civicrm_contact',
'entity' => 'Contact',
'bao' => 'CRM_Contact_BAO_Contact',
],
'pseudoconstant' => [

colemanw
committed
'add' => '1.1',
],
'hash' => [
'name' => 'hash',
'type' => CRM_Utils_Type::T_STRING,
'title' => ts('Contact Hash'),
'description' => ts('Key for validating requests related to this contact.'),
'maxlength' => 32,
'size' => CRM_Utils_Type::MEDIUM,
'where' => 'civicrm_contact.hash',
'table_name' => 'civicrm_contact',
'entity' => 'Contact',
'bao' => 'CRM_Contact_BAO_Contact',

colemanw
committed
'add' => '1.1',
],
'api_key' => [
'name' => 'api_key',
'type' => CRM_Utils_Type::T_STRING,
'title' => ts('Api Key'),
'description' => ts('API Key for validating requests related to this contact.'),
'maxlength' => 32,
'size' => CRM_Utils_Type::MEDIUM,
'where' => 'civicrm_contact.api_key',
'permission' => [
[
'administer CiviCRM',
'edit api keys',
],
],
'table_name' => 'civicrm_contact',
'entity' => 'Contact',
'bao' => 'CRM_Contact_BAO_Contact',

colemanw
committed
'add' => '2.2',
],
'contact_source' => [
'name' => 'source',
'type' => CRM_Utils_Type::T_STRING,
'title' => ts('Contact Source'),
'description' => ts('where contact come from, e.g. import, donate module insert...'),
'import' => TRUE,
'where' => 'civicrm_contact.source',
'headerPattern' => '/(C(ontact\s)?Source)$/i',
'export' => TRUE,
'table_name' => 'civicrm_contact',
'entity' => 'Contact',
'bao' => 'CRM_Contact_BAO_Contact',

colemanw
committed
'add' => '1.1',
],
'first_name' => [
'name' => 'first_name',
'type' => CRM_Utils_Type::T_STRING,
'title' => ts('First Name'),
'import' => TRUE,
'where' => 'civicrm_contact.first_name',
'headerPattern' => '/^first|(f(irst\s)?name)$/i',
'dataPattern' => '/^\w+$/',
'export' => TRUE,
'contactType' => 'Individual',
'table_name' => 'civicrm_contact',
'entity' => 'Contact',
'bao' => 'CRM_Contact_BAO_Contact',

colemanw
committed
'add' => '1.1',
],
'middle_name' => [
'name' => 'middle_name',
'type' => CRM_Utils_Type::T_STRING,
'title' => ts('Middle Name'),
'import' => TRUE,
'where' => 'civicrm_contact.middle_name',
'headerPattern' => '/^middle|(m(iddle\s)?name)$/i',
'dataPattern' => '/^\w+$/',
'export' => TRUE,
'contactType' => 'Individual',
'table_name' => 'civicrm_contact',
'entity' => 'Contact',
'bao' => 'CRM_Contact_BAO_Contact',

colemanw
committed
'add' => '1.1',
],
'last_name' => [
'name' => 'last_name',
'type' => CRM_Utils_Type::T_STRING,
'title' => ts('Last Name'),
'import' => TRUE,
'where' => 'civicrm_contact.last_name',
'headerPattern' => '/^last|(l(ast\s)?name)$/i',
'dataPattern' => '/^\w+(\s\w+)?+$/',
'export' => TRUE,
'contactType' => 'Individual',
'table_name' => 'civicrm_contact',
'entity' => 'Contact',
'bao' => 'CRM_Contact_BAO_Contact',

colemanw
committed
'add' => '1.1',
],
'prefix_id' => [
'name' => 'prefix_id',
'type' => CRM_Utils_Type::T_INT,
'title' => ts('Individual Prefix'),
'description' => ts('Prefix or Title for name (Ms, Mr...). FK to prefix ID'),
'import' => TRUE,
'where' => 'civicrm_contact.prefix_id',
'headerPattern' => '/^(prefix|title)/i',
'dataPattern' => '/^(mr|ms|mrs|sir|dr)\.?$/i',
'export' => TRUE,
'contactType' => 'Individual',
'table_name' => 'civicrm_contact',
'entity' => 'Contact',
'bao' => 'CRM_Contact_BAO_Contact',
],
'pseudoconstant' => [
'optionGroupName' => 'individual_prefix',
'optionEditPath' => 'civicrm/admin/options/individual_prefix',

colemanw
committed
'add' => '1.2',
],
'suffix_id' => [
'name' => 'suffix_id',
'type' => CRM_Utils_Type::T_INT,
'title' => ts('Individual Suffix'),
'description' => ts('Suffix for name (Jr, Sr...). FK to suffix ID'),
'import' => TRUE,
'where' => 'civicrm_contact.suffix_id',
'headerPattern' => '/^suffix$/i',
'dataPattern' => '/^(sr|jr)\.?|i{2,}$/',
'export' => TRUE,
'contactType' => 'Individual',