5 * @copyright CiviCRM LLC https://civicrm.org/licensing
7 * Generated from xml/schema/CRM/Contact/Contact.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:254705f91b182cf2ded06a3caf578f6e)
13 * Database access object for the Contact entity.
15 class CRM_Contact_DAO_Contact
extends CRM_Core_DAO
{
16 const EXT
= 'civicrm';
17 const TABLE_ADDED
= '1.1';
20 * Static instance to hold the table name.
24 public static $_tableName = 'civicrm_contact';
27 * Icon associated with this entity.
31 public static $_icon = 'fa-address-book-o';
34 * Should CiviCRM log any modifications to this table in the civicrm_log table.
38 public static $_log = TRUE;
55 * May be used to over-ride contact view and edit templates.
59 public $contact_sub_type;
87 * Has the contact opted out from receiving all bulk email from the organization or site domain?
94 * May be used for SSN, EIN/TIN, Household ID (census) or other applicable unique legal/government ID.
98 public $legal_identifier;
101 * Unique trusted external ID (generally from a legacy app/datasource). Particularly useful for deduping operations.
105 public $external_identifier;
108 * Name used for sorting different contact types
115 * Formatted name representing preferred format for display/print/other output.
119 public $display_name;
136 * optional URL for preferred image (photo, logo, etc.) to display for this contact.
143 * What is the preferred mode of communication.
147 public $preferred_communication_method;
150 * Which language is preferred for communication. FK to languages in civicrm_option_value.
154 public $preferred_language;
157 * What is the preferred mode of sending an email.
161 public $preferred_mail_format;
164 * Key for validating requests related to this contact.
171 * API Key for validating requests related to this contact.
178 * where contact come from, e.g. import, donate module insert...
206 * Prefix or Title for name (Ms, Mr...). FK to prefix ID
213 * Suffix for name (Jr, Sr...). FK to suffix ID
220 * Formal (academic or similar) title in front of name. (Prof., Dr. etc.)
224 public $formal_title;
227 * Communication style (e.g. formal vs. familiar) to use with this contact. FK to communication styles in civicrm_option_value.
231 public $communication_style_id;
234 * FK to civicrm_option_value.id, that has to be valid registered Email Greeting.
238 public $email_greeting_id;
241 * Custom Email Greeting.
245 public $email_greeting_custom;
248 * Cache Email Greeting.
252 public $email_greeting_display;
255 * FK to civicrm_option_value.id, that has to be valid registered Postal Greeting.
259 public $postal_greeting_id;
262 * Custom Postal greeting.
266 public $postal_greeting_custom;
269 * Cache Postal greeting.
273 public $postal_greeting_display;
276 * FK to civicrm_option_value.id, that has to be valid registered Addressee.
280 public $addressee_id;
287 public $addressee_custom;
294 public $addressee_display;
327 public $deceased_date;
334 public $household_name;
337 * Optional FK to Primary Contact for this household.
341 public $primary_contact_id;
348 public $organization_name;
351 * Standard Industry Classification Code.
358 * the OpenID (or OpenID-style http://username.domain/) unique identifier for this contact mainly used for logging in to CiviCRM
362 public $user_unique_id;
365 * OPTIONAL FK to civicrm_contact record.
377 * When was the contact was created.
381 public $created_date;
384 * When was the contact (or closely related entity) was created or modified or deleted.
388 public $modified_date;
393 public function __construct() {
394 $this->__table
= 'civicrm_contact';
395 parent
::__construct();
399 * Returns localized title of this entity.
401 public static function getEntityTitle() {
402 return ts('Contacts');
406 * Returns foreign keys and entity references.
409 * [CRM_Core_Reference_Interface]
411 public static function getReferenceColumns() {
412 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
413 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
414 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'primary_contact_id', 'civicrm_contact', 'id');
415 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'employer_id', 'civicrm_contact', 'id');
416 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
418 return Civi
::$statics[__CLASS__
]['links'];
422 * Returns all the column names of this table
426 public static function &fields() {
427 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
428 Civi
::$statics[__CLASS__
]['fields'] = [
431 'type' => CRM_Utils_Type
::T_INT
,
432 'title' => ts('Contact ID'),
433 'description' => ts('Unique Contact ID'),
436 'where' => 'civicrm_contact.id',
437 'headerPattern' => '/internal|contact?|id$/i',
439 'table_name' => 'civicrm_contact',
440 'entity' => 'Contact',
441 'bao' => 'CRM_Contact_BAO_Contact',
446 'name' => 'contact_type',
447 'type' => CRM_Utils_Type
::T_STRING
,
448 'title' => ts('Contact Type'),
449 'description' => ts('Type of Contact.'),
451 'size' => CRM_Utils_Type
::BIG
,
452 'where' => 'civicrm_contact.contact_type',
454 'contactType' => NULL,
455 'table_name' => 'civicrm_contact',
456 'entity' => 'Contact',
457 'bao' => 'CRM_Contact_BAO_Contact',
462 'pseudoconstant' => [
463 'table' => 'civicrm_contact_type',
464 'keyColumn' => 'name',
465 'labelColumn' => 'label',
466 'condition' => 'parent_id IS NULL',
470 'contact_sub_type' => [
471 'name' => 'contact_sub_type',
472 'type' => CRM_Utils_Type
::T_STRING
,
473 'title' => ts('Contact Subtype'),
474 'description' => ts('May be used to over-ride contact view and edit templates.'),
476 'size' => CRM_Utils_Type
::HUGE
,
478 'where' => 'civicrm_contact.contact_sub_type',
479 'headerPattern' => '/C(ontact )?(subtype|sub-type|sub type)/i',
481 'table_name' => 'civicrm_contact',
482 'entity' => 'Contact',
483 'bao' => 'CRM_Contact_BAO_Contact',
485 'serialize' => self
::SERIALIZE_SEPARATOR_BOOKEND
,
489 'pseudoconstant' => [
490 'table' => 'civicrm_contact_type',
491 'keyColumn' => 'name',
492 'labelColumn' => 'label',
493 'condition' => 'parent_id IS NOT NULL',
498 'name' => 'do_not_email',
499 'type' => CRM_Utils_Type
::T_BOOLEAN
,
500 'title' => ts('Do Not Email'),
502 'where' => 'civicrm_contact.do_not_email',
503 'headerPattern' => '/d(o )?(not )?(email)/i',
504 'dataPattern' => '/^\d{1,}$/',
507 'table_name' => 'civicrm_contact',
508 'entity' => 'Contact',
509 'bao' => 'CRM_Contact_BAO_Contact',
512 'type' => 'CheckBox',
517 'name' => 'do_not_phone',
518 'type' => CRM_Utils_Type
::T_BOOLEAN
,
519 'title' => ts('Do Not Phone'),
521 'where' => 'civicrm_contact.do_not_phone',
522 'headerPattern' => '/d(o )?(not )?(call|phone)/i',
523 'dataPattern' => '/^\d{1,}$/',
526 'table_name' => 'civicrm_contact',
527 'entity' => 'Contact',
528 'bao' => 'CRM_Contact_BAO_Contact',
531 'type' => 'CheckBox',
536 'name' => 'do_not_mail',
537 'type' => CRM_Utils_Type
::T_BOOLEAN
,
538 'title' => ts('Do Not Mail'),
540 'where' => 'civicrm_contact.do_not_mail',
541 'headerPattern' => '/^(d(o\s)?n(ot\s)?mail)|(\w*)?bulk\s?(\w*)$/i',
542 'dataPattern' => '/^\d{1,}$/',
545 'table_name' => 'civicrm_contact',
546 'entity' => 'Contact',
547 'bao' => 'CRM_Contact_BAO_Contact',
550 'type' => 'CheckBox',
555 'name' => 'do_not_sms',
556 'type' => CRM_Utils_Type
::T_BOOLEAN
,
557 'title' => ts('Do Not Sms'),
559 'where' => 'civicrm_contact.do_not_sms',
560 'headerPattern' => '/d(o )?(not )?(sms)/i',
561 'dataPattern' => '/^\d{1,}$/',
564 'table_name' => 'civicrm_contact',
565 'entity' => 'Contact',
566 'bao' => 'CRM_Contact_BAO_Contact',
569 'type' => 'CheckBox',
574 'name' => 'do_not_trade',
575 'type' => CRM_Utils_Type
::T_BOOLEAN
,
576 'title' => ts('Do Not Trade'),
578 'where' => 'civicrm_contact.do_not_trade',
579 'headerPattern' => '/d(o )?(not )?(trade)/i',
580 'dataPattern' => '/^\d{1,}$/',
583 'table_name' => 'civicrm_contact',
584 'entity' => 'Contact',
585 'bao' => 'CRM_Contact_BAO_Contact',
588 'type' => 'CheckBox',
593 'name' => 'is_opt_out',
594 'type' => CRM_Utils_Type
::T_BOOLEAN
,
595 'title' => ts('No Bulk Emails (User Opt Out)'),
596 'description' => ts('Has the contact opted out from receiving all bulk email from the organization or site domain?'),
599 'where' => 'civicrm_contact.is_opt_out',
602 'table_name' => 'civicrm_contact',
603 'entity' => 'Contact',
604 'bao' => 'CRM_Contact_BAO_Contact',
607 'type' => 'CheckBox',
611 'legal_identifier' => [
612 'name' => 'legal_identifier',
613 'type' => CRM_Utils_Type
::T_STRING
,
614 'title' => ts('Legal Identifier'),
615 'description' => ts('May be used for SSN, EIN/TIN, Household ID (census) or other applicable unique legal/government ID.'),
617 'size' => CRM_Utils_Type
::MEDIUM
,
619 'where' => 'civicrm_contact.legal_identifier',
620 'headerPattern' => '/legal\s?id/i',
621 'dataPattern' => '/\w+?\d{5,}/',
623 'table_name' => 'civicrm_contact',
624 'entity' => 'Contact',
625 'bao' => 'CRM_Contact_BAO_Contact',
632 'external_identifier' => [
633 'name' => 'external_identifier',
634 'type' => CRM_Utils_Type
::T_STRING
,
635 'title' => ts('External Identifier'),
636 'description' => ts('Unique trusted external ID (generally from a legacy app/datasource). Particularly useful for deduping operations.'),
640 'where' => 'civicrm_contact.external_identifier',
641 'headerPattern' => '/external\s?id/i',
642 'dataPattern' => '/^\d{11,}$/',
644 'table_name' => 'civicrm_contact',
645 'entity' => 'Contact',
646 'bao' => 'CRM_Contact_BAO_Contact',
654 'name' => 'sort_name',
655 'type' => CRM_Utils_Type
::T_STRING
,
656 'title' => ts('Sort Name'),
657 'description' => ts('Name used for sorting different contact types'),
660 'where' => 'civicrm_contact.sort_name',
662 'table_name' => 'civicrm_contact',
663 'entity' => 'Contact',
664 'bao' => 'CRM_Contact_BAO_Contact',
672 'name' => 'display_name',
673 'type' => CRM_Utils_Type
::T_STRING
,
674 'title' => ts('Display Name'),
675 'description' => ts('Formatted name representing preferred format for display/print/other output.'),
678 'where' => 'civicrm_contact.display_name',
680 'table_name' => 'civicrm_contact',
681 'entity' => 'Contact',
682 'bao' => 'CRM_Contact_BAO_Contact',
690 'name' => 'nick_name',
691 'type' => CRM_Utils_Type
::T_STRING
,
692 'title' => ts('Nickname'),
693 'description' => ts('Nickname.'),
697 'where' => 'civicrm_contact.nick_name',
698 'headerPattern' => '/n(ick\s)name|nick$/i',
699 'dataPattern' => '/^\w+$/',
701 'table_name' => 'civicrm_contact',
702 'entity' => 'Contact',
703 'bao' => 'CRM_Contact_BAO_Contact',
711 'name' => 'legal_name',
712 'type' => CRM_Utils_Type
::T_STRING
,
713 'title' => ts('Legal Name'),
714 'description' => ts('Legal Name.'),
718 'where' => 'civicrm_contact.legal_name',
719 'headerPattern' => '/^legal|(l(egal\s)?name)$/i',
721 'contactType' => 'Organization',
722 'table_name' => 'civicrm_contact',
723 'entity' => 'Contact',
724 'bao' => 'CRM_Contact_BAO_Contact',
732 'name' => 'image_URL',
733 'type' => CRM_Utils_Type
::T_TEXT
,
734 'title' => ts('Image Url'),
735 'description' => ts('optional URL for preferred image (photo, logo, etc.) to display for this contact.'),
737 'where' => 'civicrm_contact.image_URL',
739 'table_name' => 'civicrm_contact',
740 'entity' => 'Contact',
741 'bao' => 'CRM_Contact_BAO_Contact',
748 'preferred_communication_method' => [
749 'name' => 'preferred_communication_method',
750 'type' => CRM_Utils_Type
::T_STRING
,
751 'title' => ts('Preferred Communication Method'),
752 'description' => ts('What is the preferred mode of communication.'),
754 'size' => CRM_Utils_Type
::HUGE
,
756 'where' => 'civicrm_contact.preferred_communication_method',
757 'headerPattern' => '/^p(ref\w*\s)?c(omm\w*)|( meth\w*)$/i',
758 'dataPattern' => '/^\w+$/',
760 'table_name' => 'civicrm_contact',
761 'entity' => 'Contact',
762 'bao' => 'CRM_Contact_BAO_Contact',
764 'serialize' => self
::SERIALIZE_SEPARATOR_BOOKEND
,
768 'pseudoconstant' => [
769 'optionGroupName' => 'preferred_communication_method',
770 'optionEditPath' => 'civicrm/admin/options/preferred_communication_method',
774 'preferred_language' => [
775 'name' => 'preferred_language',
776 'type' => CRM_Utils_Type
::T_STRING
,
777 'title' => ts('Preferred Language'),
778 'description' => ts('Which language is preferred for communication. FK to languages in civicrm_option_value.'),
780 'size' => CRM_Utils_Type
::SIX
,
782 'where' => 'civicrm_contact.preferred_language',
783 'headerPattern' => '/^lang/i',
785 'table_name' => 'civicrm_contact',
786 'entity' => 'Contact',
787 'bao' => 'CRM_Contact_BAO_Contact',
792 'pseudoconstant' => [
793 'optionGroupName' => 'languages',
794 'keyColumn' => 'name',
795 'optionEditPath' => 'civicrm/admin/options/languages',
799 'preferred_mail_format' => [
800 'name' => 'preferred_mail_format',
801 'type' => CRM_Utils_Type
::T_STRING
,
802 'title' => ts('Preferred Mail Format'),
803 'description' => ts('What is the preferred mode of sending an email.'),
805 'size' => CRM_Utils_Type
::EIGHT
,
807 'where' => 'civicrm_contact.preferred_mail_format',
808 'headerPattern' => '/^p(ref\w*\s)?m(ail\s)?f(orm\w*)$/i',
811 'table_name' => 'civicrm_contact',
812 'entity' => 'Contact',
813 'bao' => 'CRM_Contact_BAO_Contact',
818 'pseudoconstant' => [
819 'callback' => 'CRM_Core_SelectValues::pmf',
825 'type' => CRM_Utils_Type
::T_STRING
,
826 'title' => ts('Contact Hash'),
827 'description' => ts('Key for validating requests related to this contact.'),
829 'size' => CRM_Utils_Type
::MEDIUM
,
830 'where' => 'civicrm_contact.hash',
832 'table_name' => 'civicrm_contact',
833 'entity' => 'Contact',
834 'bao' => 'CRM_Contact_BAO_Contact',
840 'type' => CRM_Utils_Type
::T_STRING
,
841 'title' => ts('Api Key'),
842 'description' => ts('API Key for validating requests related to this contact.'),
844 'size' => CRM_Utils_Type
::MEDIUM
,
845 'where' => 'civicrm_contact.api_key',
848 'administer CiviCRM',
852 'table_name' => 'civicrm_contact',
853 'entity' => 'Contact',
854 'bao' => 'CRM_Contact_BAO_Contact',
858 'contact_source' => [
860 'type' => CRM_Utils_Type
::T_STRING
,
861 'title' => ts('Contact Source'),
862 'description' => ts('where contact come from, e.g. import, donate module insert...'),
866 'where' => 'civicrm_contact.source',
867 'headerPattern' => '/(C(ontact\s)?Source)$/i',
869 'table_name' => 'civicrm_contact',
870 'entity' => 'Contact',
871 'bao' => 'CRM_Contact_BAO_Contact',
879 'name' => 'first_name',
880 'type' => CRM_Utils_Type
::T_STRING
,
881 'title' => ts('First Name'),
882 'description' => ts('First Name.'),
886 'where' => 'civicrm_contact.first_name',
887 'headerPattern' => '/^first|(f(irst\s)?name)$/i',
888 'dataPattern' => '/^\w+$/',
890 'contactType' => 'Individual',
891 'table_name' => 'civicrm_contact',
892 'entity' => 'Contact',
893 'bao' => 'CRM_Contact_BAO_Contact',
901 'name' => 'middle_name',
902 'type' => CRM_Utils_Type
::T_STRING
,
903 'title' => ts('Middle Name'),
904 'description' => ts('Middle Name.'),
908 'where' => 'civicrm_contact.middle_name',
909 'headerPattern' => '/^middle|(m(iddle\s)?name)$/i',
910 'dataPattern' => '/^\w+$/',
912 'contactType' => 'Individual',
913 'table_name' => 'civicrm_contact',
914 'entity' => 'Contact',
915 'bao' => 'CRM_Contact_BAO_Contact',
923 'name' => 'last_name',
924 'type' => CRM_Utils_Type
::T_STRING
,
925 'title' => ts('Last Name'),
926 'description' => ts('Last Name.'),
930 'where' => 'civicrm_contact.last_name',
931 'headerPattern' => '/^last|(l(ast\s)?name)$/i',
932 'dataPattern' => '/^\w+(\s\w+)?+$/',
934 'contactType' => 'Individual',
935 'table_name' => 'civicrm_contact',
936 'entity' => 'Contact',
937 'bao' => 'CRM_Contact_BAO_Contact',
945 'name' => 'prefix_id',
946 'type' => CRM_Utils_Type
::T_INT
,
947 'title' => ts('Individual Prefix'),
948 'description' => ts('Prefix or Title for name (Ms, Mr...). FK to prefix ID'),
950 'where' => 'civicrm_contact.prefix_id',
951 'headerPattern' => '/^(prefix|title)/i',
952 'dataPattern' => '/^(mr|ms|mrs|sir|dr)\.?$/i',
954 'contactType' => 'Individual',
955 'table_name' => 'civicrm_contact',
956 'entity' => 'Contact',
957 'bao' => 'CRM_Contact_BAO_Contact',
962 'pseudoconstant' => [
963 'optionGroupName' => 'individual_prefix',
964 'optionEditPath' => 'civicrm/admin/options/individual_prefix',
969 'name' => 'suffix_id',
970 'type' => CRM_Utils_Type
::T_INT
,
971 'title' => ts('Individual Suffix'),
972 'description' => ts('Suffix for name (Jr, Sr...). FK to suffix ID'),
974 'where' => 'civicrm_contact.suffix_id',
975 'headerPattern' => '/^suffix$/i',
976 'dataPattern' => '/^(sr|jr)\.?|i{2,}$/',
978 'contactType' => 'Individual',
979 'table_name' => 'civicrm_contact',
980 'entity' => 'Contact',
981 'bao' => 'CRM_Contact_BAO_Contact',
986 'pseudoconstant' => [
987 'optionGroupName' => 'individual_suffix',
988 'optionEditPath' => 'civicrm/admin/options/individual_suffix',
993 'name' => 'formal_title',
994 'type' => CRM_Utils_Type
::T_STRING
,
995 'title' => ts('Formal Title'),
996 'description' => ts('Formal (academic or similar) title in front of name. (Prof., Dr. etc.)'),
998 'size' => CRM_Utils_Type
::BIG
,
1000 'where' => 'civicrm_contact.formal_title',
1001 'headerPattern' => '/^title/i',
1003 'contactType' => 'Individual',
1004 'table_name' => 'civicrm_contact',
1005 'entity' => 'Contact',
1006 'bao' => 'CRM_Contact_BAO_Contact',
1013 'communication_style_id' => [
1014 'name' => 'communication_style_id',
1015 'type' => CRM_Utils_Type
::T_INT
,
1016 'title' => ts('Communication Style'),
1017 'description' => ts('Communication style (e.g. formal vs. familiar) to use with this contact. FK to communication styles in civicrm_option_value.'),
1019 'where' => 'civicrm_contact.communication_style_id',
1020 'headerPattern' => '/style/i',
1022 'table_name' => 'civicrm_contact',
1023 'entity' => 'Contact',
1024 'bao' => 'CRM_Contact_BAO_Contact',
1029 'pseudoconstant' => [
1030 'optionGroupName' => 'communication_style',
1031 'optionEditPath' => 'civicrm/admin/options/communication_style',
1035 'email_greeting_id' => [
1036 'name' => 'email_greeting_id',
1037 'type' => CRM_Utils_Type
::T_INT
,
1038 'title' => ts('Email Greeting ID'),
1039 'description' => ts('FK to civicrm_option_value.id, that has to be valid registered Email Greeting.'),
1040 'where' => 'civicrm_contact.email_greeting_id',
1042 'table_name' => 'civicrm_contact',
1043 'entity' => 'Contact',
1044 'bao' => 'CRM_Contact_BAO_Contact',
1049 'pseudoconstant' => [
1050 'optionGroupName' => 'email_greeting',
1051 'optionEditPath' => 'civicrm/admin/options/email_greeting',
1055 'email_greeting_custom' => [
1056 'name' => 'email_greeting_custom',
1057 'type' => CRM_Utils_Type
::T_STRING
,
1058 'title' => ts('Email Greeting Custom'),
1059 'description' => ts('Custom Email Greeting.'),
1061 'size' => CRM_Utils_Type
::HUGE
,
1063 'where' => 'civicrm_contact.email_greeting_custom',
1065 'table_name' => 'civicrm_contact',
1066 'entity' => 'Contact',
1067 'bao' => 'CRM_Contact_BAO_Contact',
1074 'email_greeting_display' => [
1075 'name' => 'email_greeting_display',
1076 'type' => CRM_Utils_Type
::T_STRING
,
1077 'title' => ts('Email Greeting'),
1078 'description' => ts('Cache Email Greeting.'),
1080 'size' => CRM_Utils_Type
::HUGE
,
1081 'where' => 'civicrm_contact.email_greeting_display',
1082 'table_name' => 'civicrm_contact',
1083 'entity' => 'Contact',
1084 'bao' => 'CRM_Contact_BAO_Contact',
1088 'postal_greeting_id' => [
1089 'name' => 'postal_greeting_id',
1090 'type' => CRM_Utils_Type
::T_INT
,
1091 'title' => ts('Postal Greeting ID'),
1092 'description' => ts('FK to civicrm_option_value.id, that has to be valid registered Postal Greeting.'),
1093 'where' => 'civicrm_contact.postal_greeting_id',
1095 'table_name' => 'civicrm_contact',
1096 'entity' => 'Contact',
1097 'bao' => 'CRM_Contact_BAO_Contact',
1102 'pseudoconstant' => [
1103 'optionGroupName' => 'postal_greeting',
1104 'optionEditPath' => 'civicrm/admin/options/postal_greeting',
1108 'postal_greeting_custom' => [
1109 'name' => 'postal_greeting_custom',
1110 'type' => CRM_Utils_Type
::T_STRING
,
1111 'title' => ts('Postal Greeting Custom'),
1112 'description' => ts('Custom Postal greeting.'),
1114 'size' => CRM_Utils_Type
::HUGE
,
1116 'where' => 'civicrm_contact.postal_greeting_custom',
1118 'table_name' => 'civicrm_contact',
1119 'entity' => 'Contact',
1120 'bao' => 'CRM_Contact_BAO_Contact',
1127 'postal_greeting_display' => [
1128 'name' => 'postal_greeting_display',
1129 'type' => CRM_Utils_Type
::T_STRING
,
1130 'title' => ts('Postal Greeting'),
1131 'description' => ts('Cache Postal greeting.'),
1133 'size' => CRM_Utils_Type
::HUGE
,
1134 'where' => 'civicrm_contact.postal_greeting_display',
1135 'table_name' => 'civicrm_contact',
1136 'entity' => 'Contact',
1137 'bao' => 'CRM_Contact_BAO_Contact',
1142 'name' => 'addressee_id',
1143 'type' => CRM_Utils_Type
::T_INT
,
1144 'title' => ts('Addressee ID'),
1145 'description' => ts('FK to civicrm_option_value.id, that has to be valid registered Addressee.'),
1146 'where' => 'civicrm_contact.addressee_id',
1148 'table_name' => 'civicrm_contact',
1149 'entity' => 'Contact',
1150 'bao' => 'CRM_Contact_BAO_Contact',
1155 'pseudoconstant' => [
1156 'optionGroupName' => 'addressee',
1157 'optionEditPath' => 'civicrm/admin/options/addressee',
1161 'addressee_custom' => [
1162 'name' => 'addressee_custom',
1163 'type' => CRM_Utils_Type
::T_STRING
,
1164 'title' => ts('Addressee Custom'),
1165 'description' => ts('Custom Addressee.'),
1167 'size' => CRM_Utils_Type
::HUGE
,
1169 'where' => 'civicrm_contact.addressee_custom',
1171 'table_name' => 'civicrm_contact',
1172 'entity' => 'Contact',
1173 'bao' => 'CRM_Contact_BAO_Contact',
1180 'addressee_display' => [
1181 'name' => 'addressee_display',
1182 'type' => CRM_Utils_Type
::T_STRING
,
1183 'title' => ts('Addressee'),
1184 'description' => ts('Cache Addressee.'),
1186 'size' => CRM_Utils_Type
::HUGE
,
1187 'where' => 'civicrm_contact.addressee_display',
1188 'table_name' => 'civicrm_contact',
1189 'entity' => 'Contact',
1190 'bao' => 'CRM_Contact_BAO_Contact',
1195 'name' => 'job_title',
1196 'type' => CRM_Utils_Type
::T_STRING
,
1197 'title' => ts('Job Title'),
1198 'description' => ts('Job Title'),
1202 'where' => 'civicrm_contact.job_title',
1203 'headerPattern' => '/^job|(j(ob\s)?title)$/i',
1204 'dataPattern' => '//',
1206 'contactType' => 'Individual',
1207 'table_name' => 'civicrm_contact',
1208 'entity' => 'Contact',
1209 'bao' => 'CRM_Contact_BAO_Contact',
1217 'name' => 'gender_id',
1218 'type' => CRM_Utils_Type
::T_INT
,
1219 'title' => ts('Gender ID'),
1220 'description' => ts('FK to gender ID'),
1222 'where' => 'civicrm_contact.gender_id',
1223 'headerPattern' => '/^gender$/i',
1225 'contactType' => 'Individual',
1226 'table_name' => 'civicrm_contact',
1227 'entity' => 'Contact',
1228 'bao' => 'CRM_Contact_BAO_Contact',
1232 'label' => ts("Gender"),
1234 'pseudoconstant' => [
1235 'optionGroupName' => 'gender',
1236 'optionEditPath' => 'civicrm/admin/options/gender',
1241 'name' => 'birth_date',
1242 'type' => CRM_Utils_Type
::T_DATE
,
1243 'title' => ts('Birth Date'),
1244 'description' => ts('Date of birth'),
1246 'where' => 'civicrm_contact.birth_date',
1247 'headerPattern' => '/^birth|(b(irth\s)?date)|D(\W*)O(\W*)B(\W*)$/i',
1248 'dataPattern' => '/\d{4}-?\d{2}-?\d{2}/',
1250 'contactType' => 'Individual',
1251 'table_name' => 'civicrm_contact',
1252 'entity' => 'Contact',
1253 'bao' => 'CRM_Contact_BAO_Contact',
1256 'type' => 'Select Date',
1257 'formatType' => 'birth',
1262 'name' => 'is_deceased',
1263 'type' => CRM_Utils_Type
::T_BOOLEAN
,
1264 'title' => ts('Deceased'),
1267 'where' => 'civicrm_contact.is_deceased',
1268 'headerPattern' => '/i(s\s)?d(eceased)$/i',
1270 'contactType' => 'Individual',
1272 'table_name' => 'civicrm_contact',
1273 'entity' => 'Contact',
1274 'bao' => 'CRM_Contact_BAO_Contact',
1277 'type' => 'CheckBox',
1281 'deceased_date' => [
1282 'name' => 'deceased_date',
1283 'type' => CRM_Utils_Type
::T_DATE
,
1284 'title' => ts('Deceased Date'),
1285 'description' => ts('Date of deceased'),
1287 'where' => 'civicrm_contact.deceased_date',
1288 'headerPattern' => '/^deceased|(d(eceased\s)?date)$/i',
1290 'contactType' => 'Individual',
1291 'table_name' => 'civicrm_contact',
1292 'entity' => 'Contact',
1293 'bao' => 'CRM_Contact_BAO_Contact',
1296 'type' => 'Select Date',
1297 'formatType' => 'birth',
1301 'household_name' => [
1302 'name' => 'household_name',
1303 'type' => CRM_Utils_Type
::T_STRING
,
1304 'title' => ts('Household Name'),
1305 'description' => ts('Household Name.'),
1309 'where' => 'civicrm_contact.household_name',
1310 'headerPattern' => '/^household|(h(ousehold\s)?name)$/i',
1311 'dataPattern' => '/^\w+$/',
1313 'contactType' => 'Household',
1314 'table_name' => 'civicrm_contact',
1315 'entity' => 'Contact',
1316 'bao' => 'CRM_Contact_BAO_Contact',
1323 'primary_contact_id' => [
1324 'name' => 'primary_contact_id',
1325 'type' => CRM_Utils_Type
::T_INT
,
1326 'title' => ts('Household Primary Contact ID'),
1327 'description' => ts('Optional FK to Primary Contact for this household.'),
1328 'where' => 'civicrm_contact.primary_contact_id',
1329 'contactType' => 'Household',
1330 'table_name' => 'civicrm_contact',
1331 'entity' => 'Contact',
1332 'bao' => 'CRM_Contact_BAO_Contact',
1334 'FKClassName' => 'CRM_Contact_DAO_Contact',
1337 'organization_name' => [
1338 'name' => 'organization_name',
1339 'type' => CRM_Utils_Type
::T_STRING
,
1340 'title' => ts('Organization Name'),
1341 'description' => ts('Organization Name.'),
1345 'where' => 'civicrm_contact.organization_name',
1346 'headerPattern' => '/^organization|(o(rganization\s)?name)$/i',
1347 'dataPattern' => '/^\w+$/',
1349 'contactType' => 'Organization',
1350 'table_name' => 'civicrm_contact',
1351 'entity' => 'Contact',
1352 'bao' => 'CRM_Contact_BAO_Contact',
1360 'name' => 'sic_code',
1361 'type' => CRM_Utils_Type
::T_STRING
,
1362 'title' => ts('Sic Code'),
1363 'description' => ts('Standard Industry Classification Code.'),
1365 'size' => CRM_Utils_Type
::EIGHT
,
1367 'where' => 'civicrm_contact.sic_code',
1368 'headerPattern' => '/^sic|(s(ic\s)?code)$/i',
1370 'contactType' => 'Organization',
1371 'table_name' => 'civicrm_contact',
1372 'entity' => 'Contact',
1373 'bao' => 'CRM_Contact_BAO_Contact',
1380 'user_unique_id' => [
1381 'name' => 'user_unique_id',
1382 'type' => CRM_Utils_Type
::T_STRING
,
1383 'title' => ts('Unique ID (OpenID)'),
1384 'description' => ts('the OpenID (or OpenID-style http://username.domain/) unique identifier for this contact mainly used for logging in to CiviCRM'),
1386 'size' => CRM_Utils_Type
::HUGE
,
1388 'where' => 'civicrm_contact.user_unique_id',
1389 'headerPattern' => '/^Open\s?ID|u(niq\w*)?\s?ID/i',
1390 'dataPattern' => '/^[\w\/\:\.]+$/',
1393 'table_name' => 'civicrm_contact',
1394 'entity' => 'Contact',
1395 'bao' => 'CRM_Contact_BAO_Contact',
1402 'current_employer_id' => [
1403 'name' => 'employer_id',
1404 'type' => CRM_Utils_Type
::T_INT
,
1405 'title' => ts('Current Employer'),
1406 'description' => ts('OPTIONAL FK to civicrm_contact record.'),
1407 'where' => 'civicrm_contact.employer_id',
1409 'contactType' => 'Individual',
1410 'table_name' => 'civicrm_contact',
1411 'entity' => 'Contact',
1412 'bao' => 'CRM_Contact_BAO_Contact',
1414 'FKClassName' => 'CRM_Contact_DAO_Contact',
1416 'type' => 'EntityRef',
1420 'contact_is_deleted' => [
1421 'name' => 'is_deleted',
1422 'type' => CRM_Utils_Type
::T_BOOLEAN
,
1423 'title' => ts('Contact is in Trash'),
1425 'where' => 'civicrm_contact.is_deleted',
1428 'access deleted contacts',
1431 'table_name' => 'civicrm_contact',
1432 'entity' => 'Contact',
1433 'bao' => 'CRM_Contact_BAO_Contact',
1436 'type' => 'CheckBox',
1441 'name' => 'created_date',
1442 'type' => CRM_Utils_Type
::T_TIMESTAMP
,
1443 'title' => ts('Created Date'),
1444 'description' => ts('When was the contact was created.'),
1445 'required' => FALSE,
1446 'where' => 'civicrm_contact.created_date',
1448 'default' => 'NULL',
1449 'table_name' => 'civicrm_contact',
1450 'entity' => 'Contact',
1451 'bao' => 'CRM_Contact_BAO_Contact',
1455 'modified_date' => [
1456 'name' => 'modified_date',
1457 'type' => CRM_Utils_Type
::T_TIMESTAMP
,
1458 'title' => ts('Modified Date'),
1459 'description' => ts('When was the contact (or closely related entity) was created or modified or deleted.'),
1460 'required' => FALSE,
1461 'where' => 'civicrm_contact.modified_date',
1463 'default' => 'CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP',
1464 'table_name' => 'civicrm_contact',
1465 'entity' => 'Contact',
1466 'bao' => 'CRM_Contact_BAO_Contact',
1471 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
1473 return Civi
::$statics[__CLASS__
]['fields'];
1477 * Return a mapping from field-name to the corresponding key (as used in fields()).
1480 * Array(string $name => string $uniqueName).
1482 public static function &fieldKeys() {
1483 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
1484 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
1486 return Civi
::$statics[__CLASS__
]['fieldKeys'];
1490 * Returns the names of this table
1494 public static function getTableName() {
1495 return self
::$_tableName;
1499 * Returns if this table needs to be logged
1503 public function getLog() {
1508 * Returns the list of fields that can be imported
1510 * @param bool $prefix
1514 public static function &import($prefix = FALSE) {
1515 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'contact', $prefix, []);
1520 * Returns the list of fields that can be exported
1522 * @param bool $prefix
1526 public static function &export($prefix = FALSE) {
1527 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'contact', $prefix, []);
1532 * Returns the list of indices
1534 * @param bool $localize
1538 public static function indices($localize = TRUE) {
1540 'index_contact_type' => [
1541 'name' => 'index_contact_type',
1543 0 => 'contact_type',
1545 'localizable' => FALSE,
1546 'sig' => 'civicrm_contact::0::contact_type',
1548 'index_contact_sub_type' => [
1549 'name' => 'index_contact_sub_type',
1551 0 => 'contact_sub_type',
1553 'localizable' => FALSE,
1554 'sig' => 'civicrm_contact::0::contact_sub_type',
1556 'UI_external_identifier' => [
1557 'name' => 'UI_external_identifier',
1559 0 => 'external_identifier',
1561 'localizable' => FALSE,
1563 'sig' => 'civicrm_contact::1::external_identifier',
1565 'index_sort_name' => [
1566 'name' => 'index_sort_name',
1570 'localizable' => FALSE,
1571 'sig' => 'civicrm_contact::0::sort_name',
1573 'index_preferred_communication_method' => [
1574 'name' => 'index_preferred_communication_method',
1576 0 => 'preferred_communication_method',
1578 'localizable' => FALSE,
1579 'sig' => 'civicrm_contact::0::preferred_communication_method',
1582 'name' => 'index_hash',
1586 'localizable' => FALSE,
1587 'sig' => 'civicrm_contact::0::hash',
1589 'index_api_key' => [
1590 'name' => 'index_api_key',
1594 'localizable' => FALSE,
1595 'sig' => 'civicrm_contact::0::api_key',
1597 'index_first_name' => [
1598 'name' => 'index_first_name',
1602 'localizable' => FALSE,
1603 'sig' => 'civicrm_contact::0::first_name',
1605 'index_last_name' => [
1606 'name' => 'index_last_name',
1610 'localizable' => FALSE,
1611 'sig' => 'civicrm_contact::0::last_name',
1614 'name' => 'UI_prefix',
1618 'localizable' => FALSE,
1619 'sig' => 'civicrm_contact::0::prefix_id',
1622 'name' => 'UI_suffix',
1626 'localizable' => FALSE,
1627 'sig' => 'civicrm_contact::0::suffix_id',
1629 'index_communication_style_id' => [
1630 'name' => 'index_communication_style_id',
1632 0 => 'communication_style_id',
1634 'localizable' => FALSE,
1635 'sig' => 'civicrm_contact::0::communication_style_id',
1638 'name' => 'UI_gender',
1642 'localizable' => FALSE,
1643 'sig' => 'civicrm_contact::0::gender_id',
1645 'index_is_deceased' => [
1646 'name' => 'index_is_deceased',
1650 'localizable' => FALSE,
1651 'sig' => 'civicrm_contact::0::is_deceased',
1653 'index_household_name' => [
1654 'name' => 'index_household_name',
1656 0 => 'household_name',
1658 'localizable' => FALSE,
1659 'sig' => 'civicrm_contact::0::household_name',
1661 'index_organization_name' => [
1662 'name' => 'index_organization_name',
1664 0 => 'organization_name',
1666 'localizable' => FALSE,
1667 'sig' => 'civicrm_contact::0::organization_name',
1669 'index_is_deleted_sort_name' => [
1670 'name' => 'index_is_deleted_sort_name',
1676 'localizable' => FALSE,
1677 'sig' => 'civicrm_contact::0::is_deleted::sort_name::id',
1679 'index_created_date' => [
1680 'name' => 'index_created_date',
1682 0 => 'created_date',
1684 'localizable' => FALSE,
1685 'sig' => 'civicrm_contact::0::created_date',
1687 'index_modified_date' => [
1688 'name' => 'index_modified_date',
1690 0 => 'modified_date',
1692 'localizable' => FALSE,
1693 'sig' => 'civicrm_contact::0::modified_date',
1696 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;