5 * @copyright CiviCRM LLC (c) 2004-2019
7 * Generated from xml/schema/CRM/Contact/Contact.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:653579cbfa509d67ae7a39c78dd27bf2)
13 * Database access object for the Contact entity.
15 class CRM_Contact_DAO_Contact
extends CRM_Core_DAO
{
18 * Static instance to hold the table name.
22 public static $_tableName = 'civicrm_contact';
25 * Should CiviCRM log any modifications to this table in the civicrm_log table.
29 public static $_log = TRUE;
46 * May be used to over-ride contact view and edit templates.
50 public $contact_sub_type;
78 * Has the contact opted out from receiving all bulk email from the organization or site domain?
85 * May be used for SSN, EIN/TIN, Household ID (census) or other applicable unique legal/government ID.
89 public $legal_identifier;
92 * Unique trusted external ID (generally from a legacy app/datasource). Particularly useful for deduping operations.
96 public $external_identifier;
99 * Name used for sorting different contact types
106 * Formatted name representing preferred format for display/print/other output.
110 public $display_name;
127 * optional URL for preferred image (photo, logo, etc.) to display for this contact.
134 * What is the preferred mode of communication.
138 public $preferred_communication_method;
141 * Which language is preferred for communication. FK to languages in civicrm_option_value.
145 public $preferred_language;
148 * What is the preferred mode of sending an email.
152 public $preferred_mail_format;
155 * Key for validating requests related to this contact.
162 * API Key for validating requests related to this contact.
169 * where contact come from, e.g. import, donate module insert...
197 * Prefix or Title for name (Ms, Mr...). FK to prefix ID
204 * Suffix for name (Jr, Sr...). FK to suffix ID
211 * Formal (academic or similar) title in front of name. (Prof., Dr. etc.)
215 public $formal_title;
218 * Communication style (e.g. formal vs. familiar) to use with this contact. FK to communication styles in civicrm_option_value.
222 public $communication_style_id;
225 * FK to civicrm_option_value.id, that has to be valid registered Email Greeting.
229 public $email_greeting_id;
232 * Custom Email Greeting.
236 public $email_greeting_custom;
239 * Cache Email Greeting.
243 public $email_greeting_display;
246 * FK to civicrm_option_value.id, that has to be valid registered Postal Greeting.
250 public $postal_greeting_id;
253 * Custom Postal greeting.
257 public $postal_greeting_custom;
260 * Cache Postal greeting.
264 public $postal_greeting_display;
267 * FK to civicrm_option_value.id, that has to be valid registered Addressee.
271 public $addressee_id;
278 public $addressee_custom;
285 public $addressee_display;
318 public $deceased_date;
325 public $household_name;
328 * Optional FK to Primary Contact for this household.
332 public $primary_contact_id;
339 public $organization_name;
342 * Standard Industry Classification Code.
349 * the OpenID (or OpenID-style http://username.domain/) unique identifier for this contact mainly used for logging in to CiviCRM
353 public $user_unique_id;
356 * OPTIONAL FK to civicrm_contact record.
368 * When was the contact was created.
372 public $created_date;
375 * When was the contact (or closely related entity) was created or modified or deleted.
379 public $modified_date;
384 public function __construct() {
385 $this->__table
= 'civicrm_contact';
386 parent
::__construct();
390 * Returns foreign keys and entity references.
393 * [CRM_Core_Reference_Interface]
395 public static function getReferenceColumns() {
396 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
397 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
398 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'primary_contact_id', 'civicrm_contact', 'id');
399 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'employer_id', 'civicrm_contact', 'id');
400 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
402 return Civi
::$statics[__CLASS__
]['links'];
406 * Returns all the column names of this table
410 public static function &fields() {
411 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
412 Civi
::$statics[__CLASS__
]['fields'] = [
415 'type' => CRM_Utils_Type
::T_INT
,
416 'title' => ts('Contact ID'),
417 'description' => ts('Unique Contact ID'),
420 'where' => 'civicrm_contact.id',
421 'headerPattern' => '/internal|contact?|id$/i',
424 'table_name' => 'civicrm_contact',
425 'entity' => 'Contact',
426 'bao' => 'CRM_Contact_BAO_Contact',
430 'name' => 'contact_type',
431 'type' => CRM_Utils_Type
::T_STRING
,
432 'title' => ts('Contact Type'),
433 'description' => ts('Type of Contact.'),
435 'size' => CRM_Utils_Type
::BIG
,
437 'where' => 'civicrm_contact.contact_type',
438 'headerPattern' => '',
440 'table_name' => 'civicrm_contact',
441 'entity' => 'Contact',
442 'bao' => 'CRM_Contact_BAO_Contact',
447 'pseudoconstant' => [
448 'table' => 'civicrm_contact_type',
449 'keyColumn' => 'name',
450 'labelColumn' => 'label',
451 'condition' => 'parent_id IS NULL',
454 'contact_sub_type' => [
455 'name' => 'contact_sub_type',
456 'type' => CRM_Utils_Type
::T_STRING
,
457 'title' => ts('Contact Subtype'),
458 'description' => ts('May be used to over-ride contact view and edit templates.'),
460 'size' => CRM_Utils_Type
::HUGE
,
462 'where' => 'civicrm_contact.contact_sub_type',
463 'headerPattern' => '/C(ontact )?(subtype|sub-type|sub type)/i',
466 'table_name' => 'civicrm_contact',
467 'entity' => 'Contact',
468 'bao' => 'CRM_Contact_BAO_Contact',
470 'serialize' => self
::SERIALIZE_SEPARATOR_BOOKEND
,
474 'pseudoconstant' => [
475 'table' => 'civicrm_contact_type',
476 'keyColumn' => 'name',
477 'labelColumn' => 'label',
478 'condition' => 'parent_id IS NOT NULL',
482 'name' => 'do_not_email',
483 'type' => CRM_Utils_Type
::T_BOOLEAN
,
484 'title' => ts('Do Not Email'),
486 'where' => 'civicrm_contact.do_not_email',
487 'headerPattern' => '/d(o )?(not )?(email)/i',
488 'dataPattern' => '/^\d{1,}$/',
491 'table_name' => 'civicrm_contact',
492 'entity' => 'Contact',
493 'bao' => 'CRM_Contact_BAO_Contact',
496 'type' => 'CheckBox',
500 'name' => 'do_not_phone',
501 'type' => CRM_Utils_Type
::T_BOOLEAN
,
502 'title' => ts('Do Not Phone'),
504 'where' => 'civicrm_contact.do_not_phone',
505 'headerPattern' => '/d(o )?(not )?(call|phone)/i',
506 'dataPattern' => '/^\d{1,}$/',
509 'table_name' => 'civicrm_contact',
510 'entity' => 'Contact',
511 'bao' => 'CRM_Contact_BAO_Contact',
514 'type' => 'CheckBox',
518 'name' => 'do_not_mail',
519 'type' => CRM_Utils_Type
::T_BOOLEAN
,
520 'title' => ts('Do Not Mail'),
522 'where' => 'civicrm_contact.do_not_mail',
523 'headerPattern' => '/^(d(o\s)?n(ot\s)?mail)|(\w*)?bulk\s?(\w*)$/i',
524 'dataPattern' => '/^\d{1,}$/',
527 'table_name' => 'civicrm_contact',
528 'entity' => 'Contact',
529 'bao' => 'CRM_Contact_BAO_Contact',
532 'type' => 'CheckBox',
536 'name' => 'do_not_sms',
537 'type' => CRM_Utils_Type
::T_BOOLEAN
,
538 'title' => ts('Do Not Sms'),
540 'where' => 'civicrm_contact.do_not_sms',
541 'headerPattern' => '/d(o )?(not )?(sms)/i',
542 'dataPattern' => '/^\d{1,}$/',
545 'table_name' => 'civicrm_contact',
546 'entity' => 'Contact',
547 'bao' => 'CRM_Contact_BAO_Contact',
550 'type' => 'CheckBox',
554 'name' => 'do_not_trade',
555 'type' => CRM_Utils_Type
::T_BOOLEAN
,
556 'title' => ts('Do Not Trade'),
558 'where' => 'civicrm_contact.do_not_trade',
559 'headerPattern' => '/d(o )?(not )?(trade)/i',
560 'dataPattern' => '/^\d{1,}$/',
563 'table_name' => 'civicrm_contact',
564 'entity' => 'Contact',
565 'bao' => 'CRM_Contact_BAO_Contact',
568 'type' => 'CheckBox',
572 'name' => 'is_opt_out',
573 'type' => CRM_Utils_Type
::T_BOOLEAN
,
574 'title' => ts('No Bulk Emails (User Opt Out)'),
575 'description' => ts('Has the contact opted out from receiving all bulk email from the organization or site domain?'),
578 'where' => 'civicrm_contact.is_opt_out',
579 'headerPattern' => '',
583 'table_name' => 'civicrm_contact',
584 'entity' => 'Contact',
585 'bao' => 'CRM_Contact_BAO_Contact',
588 'type' => 'CheckBox',
591 'legal_identifier' => [
592 'name' => 'legal_identifier',
593 'type' => CRM_Utils_Type
::T_STRING
,
594 'title' => ts('Legal Identifier'),
595 'description' => ts('May be used for SSN, EIN/TIN, Household ID (census) or other applicable unique legal/government ID.
598 'size' => CRM_Utils_Type
::MEDIUM
,
600 'where' => 'civicrm_contact.legal_identifier',
601 'headerPattern' => '/legal\s?id/i',
602 'dataPattern' => '/\w+?\d{5,}/',
604 'table_name' => 'civicrm_contact',
605 'entity' => 'Contact',
606 'bao' => 'CRM_Contact_BAO_Contact',
612 'external_identifier' => [
613 'name' => 'external_identifier',
614 'type' => CRM_Utils_Type
::T_STRING
,
615 'title' => ts('External Identifier'),
616 'description' => ts('Unique trusted external ID (generally from a legacy app/datasource). Particularly useful for deduping operations.'),
620 'where' => 'civicrm_contact.external_identifier',
621 'headerPattern' => '/external\s?id/i',
622 'dataPattern' => '/^\d{11,}$/',
624 'table_name' => 'civicrm_contact',
625 'entity' => 'Contact',
626 'bao' => 'CRM_Contact_BAO_Contact',
633 'name' => 'sort_name',
634 'type' => CRM_Utils_Type
::T_STRING
,
635 'title' => ts('Sort Name'),
636 'description' => ts('Name used for sorting different contact types'),
640 'where' => 'civicrm_contact.sort_name',
641 'headerPattern' => '',
643 'table_name' => 'civicrm_contact',
644 'entity' => 'Contact',
645 'bao' => 'CRM_Contact_BAO_Contact',
652 'name' => 'display_name',
653 'type' => CRM_Utils_Type
::T_STRING
,
654 'title' => ts('Display Name'),
655 'description' => ts('Formatted name representing preferred format for display/print/other output.'),
659 'where' => 'civicrm_contact.display_name',
660 'headerPattern' => '',
662 'table_name' => 'civicrm_contact',
663 'entity' => 'Contact',
664 'bao' => 'CRM_Contact_BAO_Contact',
671 'name' => 'nick_name',
672 'type' => CRM_Utils_Type
::T_STRING
,
673 'title' => ts('Nickname'),
674 'description' => ts('Nickname.'),
678 'where' => 'civicrm_contact.nick_name',
679 'headerPattern' => '/n(ick\s)name|nick$/i',
680 'dataPattern' => '/^\w+$/',
682 'table_name' => 'civicrm_contact',
683 'entity' => 'Contact',
684 'bao' => 'CRM_Contact_BAO_Contact',
691 'name' => 'legal_name',
692 'type' => CRM_Utils_Type
::T_STRING
,
693 'title' => ts('Legal Name'),
694 'description' => ts('Legal Name.'),
698 'where' => 'civicrm_contact.legal_name',
699 'headerPattern' => '/^legal|(l(egal\s)?name)$/i',
702 'table_name' => 'civicrm_contact',
703 'entity' => 'Contact',
704 'bao' => 'CRM_Contact_BAO_Contact',
711 'name' => 'image_URL',
712 'type' => CRM_Utils_Type
::T_TEXT
,
713 'title' => ts('Image Url'),
714 'description' => ts('optional URL for preferred image (photo, logo, etc.) to display for this contact.'),
716 'where' => 'civicrm_contact.image_URL',
717 'headerPattern' => '',
720 'table_name' => 'civicrm_contact',
721 'entity' => 'Contact',
722 'bao' => 'CRM_Contact_BAO_Contact',
728 'preferred_communication_method' => [
729 'name' => 'preferred_communication_method',
730 'type' => CRM_Utils_Type
::T_STRING
,
731 'title' => ts('Preferred Communication Method'),
732 'description' => ts('What is the preferred mode of communication.'),
734 'size' => CRM_Utils_Type
::HUGE
,
736 'where' => 'civicrm_contact.preferred_communication_method',
737 'headerPattern' => '/^p(ref\w*\s)?c(omm\w*)|( meth\w*)$/i',
738 'dataPattern' => '/^\w+$/',
740 'table_name' => 'civicrm_contact',
741 'entity' => 'Contact',
742 'bao' => 'CRM_Contact_BAO_Contact',
744 'serialize' => self
::SERIALIZE_SEPARATOR_BOOKEND
,
748 'pseudoconstant' => [
749 'optionGroupName' => 'preferred_communication_method',
750 'optionEditPath' => 'civicrm/admin/options/preferred_communication_method',
753 'preferred_language' => [
754 'name' => 'preferred_language',
755 'type' => CRM_Utils_Type
::T_STRING
,
756 'title' => ts('Preferred Language'),
757 'description' => ts('Which language is preferred for communication. FK to languages in civicrm_option_value.'),
759 'size' => CRM_Utils_Type
::SIX
,
761 'where' => 'civicrm_contact.preferred_language',
762 'headerPattern' => '/^lang/i',
765 'table_name' => 'civicrm_contact',
766 'entity' => 'Contact',
767 'bao' => 'CRM_Contact_BAO_Contact',
772 'pseudoconstant' => [
773 'optionGroupName' => 'languages',
774 'keyColumn' => 'name',
775 'optionEditPath' => 'civicrm/admin/options/languages',
778 'preferred_mail_format' => [
779 'name' => 'preferred_mail_format',
780 'type' => CRM_Utils_Type
::T_STRING
,
781 'title' => ts('Preferred Mail Format'),
782 'description' => ts('What is the preferred mode of sending an email.'),
784 'size' => CRM_Utils_Type
::EIGHT
,
786 'where' => 'civicrm_contact.preferred_mail_format',
787 'headerPattern' => '/^p(ref\w*\s)?m(ail\s)?f(orm\w*)$/i',
791 'table_name' => 'civicrm_contact',
792 'entity' => 'Contact',
793 'bao' => 'CRM_Contact_BAO_Contact',
798 'pseudoconstant' => [
799 'callback' => 'CRM_Core_SelectValues::pmf',
804 'type' => CRM_Utils_Type
::T_STRING
,
805 'title' => ts('Contact Hash'),
806 'description' => ts('Key for validating requests related to this contact.'),
808 'size' => CRM_Utils_Type
::MEDIUM
,
810 'where' => 'civicrm_contact.hash',
811 'headerPattern' => '',
813 'table_name' => 'civicrm_contact',
814 'entity' => 'Contact',
815 'bao' => 'CRM_Contact_BAO_Contact',
820 'type' => CRM_Utils_Type
::T_STRING
,
821 'title' => ts('Api Key'),
822 'description' => ts('API Key for validating requests related to this contact.'),
824 'size' => CRM_Utils_Type
::MEDIUM
,
825 'table_name' => 'civicrm_contact',
826 'entity' => 'Contact',
827 'bao' => 'CRM_Contact_BAO_Contact',
830 'contact_source' => [
832 'type' => CRM_Utils_Type
::T_STRING
,
833 'title' => ts('Contact Source'),
834 'description' => ts('where contact come from, e.g. import, donate module insert...'),
838 'where' => 'civicrm_contact.source',
839 'headerPattern' => '/(C(ontact\s)?Source)$/i',
842 'table_name' => 'civicrm_contact',
843 'entity' => 'Contact',
844 'bao' => 'CRM_Contact_BAO_Contact',
851 'name' => 'first_name',
852 'type' => CRM_Utils_Type
::T_STRING
,
853 'title' => ts('First Name'),
854 'description' => ts('First Name.'),
858 'where' => 'civicrm_contact.first_name',
859 'headerPattern' => '/^first|(f(irst\s)?name)$/i',
860 'dataPattern' => '/^\w+$/',
862 'table_name' => 'civicrm_contact',
863 'entity' => 'Contact',
864 'bao' => 'CRM_Contact_BAO_Contact',
871 'name' => 'middle_name',
872 'type' => CRM_Utils_Type
::T_STRING
,
873 'title' => ts('Middle Name'),
874 'description' => ts('Middle Name.'),
878 'where' => 'civicrm_contact.middle_name',
879 'headerPattern' => '/^middle|(m(iddle\s)?name)$/i',
880 'dataPattern' => '/^\w+$/',
882 'table_name' => 'civicrm_contact',
883 'entity' => 'Contact',
884 'bao' => 'CRM_Contact_BAO_Contact',
891 'name' => 'last_name',
892 'type' => CRM_Utils_Type
::T_STRING
,
893 'title' => ts('Last Name'),
894 'description' => ts('Last Name.'),
898 'where' => 'civicrm_contact.last_name',
899 'headerPattern' => '/^last|(l(ast\s)?name)$/i',
900 'dataPattern' => '/^\w+(\s\w+)?+$/',
902 'table_name' => 'civicrm_contact',
903 'entity' => 'Contact',
904 'bao' => 'CRM_Contact_BAO_Contact',
911 'name' => 'prefix_id',
912 'type' => CRM_Utils_Type
::T_INT
,
913 'title' => ts('Individual Prefix'),
914 'description' => ts('Prefix or Title for name (Ms, Mr...). FK to prefix ID'),
916 'where' => 'civicrm_contact.prefix_id',
917 'headerPattern' => '/^(prefix|title)/i',
918 'dataPattern' => '/^(mr|ms|mrs|sir|dr)\.?$/i',
920 'table_name' => 'civicrm_contact',
921 'entity' => 'Contact',
922 'bao' => 'CRM_Contact_BAO_Contact',
927 'pseudoconstant' => [
928 'optionGroupName' => 'individual_prefix',
929 'optionEditPath' => 'civicrm/admin/options/individual_prefix',
933 'name' => 'suffix_id',
934 'type' => CRM_Utils_Type
::T_INT
,
935 'title' => ts('Individual Suffix'),
936 'description' => ts('Suffix for name (Jr, Sr...). FK to suffix ID'),
938 'where' => 'civicrm_contact.suffix_id',
939 'headerPattern' => '/^suffix$/i',
940 'dataPattern' => '/^(sr|jr)\.?|i{2,}$/',
942 'table_name' => 'civicrm_contact',
943 'entity' => 'Contact',
944 'bao' => 'CRM_Contact_BAO_Contact',
949 'pseudoconstant' => [
950 'optionGroupName' => 'individual_suffix',
951 'optionEditPath' => 'civicrm/admin/options/individual_suffix',
955 'name' => 'formal_title',
956 'type' => CRM_Utils_Type
::T_STRING
,
957 'title' => ts('Formal Title'),
958 'description' => ts('Formal (academic or similar) title in front of name. (Prof., Dr. etc.)'),
960 'size' => CRM_Utils_Type
::BIG
,
962 'where' => 'civicrm_contact.formal_title',
963 'headerPattern' => '/^title/i',
966 'table_name' => 'civicrm_contact',
967 'entity' => 'Contact',
968 'bao' => 'CRM_Contact_BAO_Contact',
974 'communication_style_id' => [
975 'name' => 'communication_style_id',
976 'type' => CRM_Utils_Type
::T_INT
,
977 'title' => ts('Communication Style'),
978 'description' => ts('Communication style (e.g. formal vs. familiar) to use with this contact. FK to communication styles in civicrm_option_value.'),
980 'where' => 'civicrm_contact.communication_style_id',
981 'headerPattern' => '',
983 'table_name' => 'civicrm_contact',
984 'entity' => 'Contact',
985 'bao' => 'CRM_Contact_BAO_Contact',
990 'pseudoconstant' => [
991 'optionGroupName' => 'communication_style',
992 'optionEditPath' => 'civicrm/admin/options/communication_style',
995 'email_greeting_id' => [
996 'name' => 'email_greeting_id',
997 'type' => CRM_Utils_Type
::T_INT
,
998 'title' => ts('Email Greeting ID'),
999 'description' => ts('FK to civicrm_option_value.id, that has to be valid registered Email Greeting.'),
1001 'where' => 'civicrm_contact.email_greeting_id',
1002 'headerPattern' => '',
1003 'dataPattern' => '',
1004 'table_name' => 'civicrm_contact',
1005 'entity' => 'Contact',
1006 'bao' => 'CRM_Contact_BAO_Contact',
1008 'pseudoconstant' => [
1009 'optionGroupName' => 'email_greeting',
1010 'optionEditPath' => 'civicrm/admin/options/email_greeting',
1013 'email_greeting_custom' => [
1014 'name' => 'email_greeting_custom',
1015 'type' => CRM_Utils_Type
::T_STRING
,
1016 'title' => ts('Email Greeting Custom'),
1017 'description' => ts('Custom Email Greeting.'),
1019 'size' => CRM_Utils_Type
::HUGE
,
1021 'where' => 'civicrm_contact.email_greeting_custom',
1022 'headerPattern' => '',
1023 'dataPattern' => '',
1025 'table_name' => 'civicrm_contact',
1026 'entity' => 'Contact',
1027 'bao' => 'CRM_Contact_BAO_Contact',
1033 'email_greeting_display' => [
1034 'name' => 'email_greeting_display',
1035 'type' => CRM_Utils_Type
::T_STRING
,
1036 'title' => ts('Email Greeting'),
1037 'description' => ts('Cache Email Greeting.'),
1039 'size' => CRM_Utils_Type
::HUGE
,
1040 'table_name' => 'civicrm_contact',
1041 'entity' => 'Contact',
1042 'bao' => 'CRM_Contact_BAO_Contact',
1048 'postal_greeting_id' => [
1049 'name' => 'postal_greeting_id',
1050 'type' => CRM_Utils_Type
::T_INT
,
1051 'title' => ts('Postal Greeting ID'),
1052 'description' => ts('FK to civicrm_option_value.id, that has to be valid registered Postal Greeting.'),
1054 'where' => 'civicrm_contact.postal_greeting_id',
1055 'headerPattern' => '',
1056 'dataPattern' => '',
1057 'table_name' => 'civicrm_contact',
1058 'entity' => 'Contact',
1059 'bao' => 'CRM_Contact_BAO_Contact',
1064 'pseudoconstant' => [
1065 'optionGroupName' => 'postal_greeting',
1066 'optionEditPath' => 'civicrm/admin/options/postal_greeting',
1069 'postal_greeting_custom' => [
1070 'name' => 'postal_greeting_custom',
1071 'type' => CRM_Utils_Type
::T_STRING
,
1072 'title' => ts('Postal Greeting Custom'),
1073 'description' => ts('Custom Postal greeting.'),
1075 'size' => CRM_Utils_Type
::HUGE
,
1077 'where' => 'civicrm_contact.postal_greeting_custom',
1078 'headerPattern' => '',
1079 'dataPattern' => '',
1081 'table_name' => 'civicrm_contact',
1082 'entity' => 'Contact',
1083 'bao' => 'CRM_Contact_BAO_Contact',
1089 'postal_greeting_display' => [
1090 'name' => 'postal_greeting_display',
1091 'type' => CRM_Utils_Type
::T_STRING
,
1092 'title' => ts('Postal Greeting'),
1093 'description' => ts('Cache Postal greeting.'),
1095 'size' => CRM_Utils_Type
::HUGE
,
1096 'table_name' => 'civicrm_contact',
1097 'entity' => 'Contact',
1098 'bao' => 'CRM_Contact_BAO_Contact',
1105 'name' => 'addressee_id',
1106 'type' => CRM_Utils_Type
::T_INT
,
1107 'title' => ts('Addressee ID'),
1108 'description' => ts('FK to civicrm_option_value.id, that has to be valid registered Addressee.'),
1110 'where' => 'civicrm_contact.addressee_id',
1111 'headerPattern' => '',
1112 'dataPattern' => '',
1113 'table_name' => 'civicrm_contact',
1114 'entity' => 'Contact',
1115 'bao' => 'CRM_Contact_BAO_Contact',
1117 'pseudoconstant' => [
1118 'optionGroupName' => 'addressee',
1119 'optionEditPath' => 'civicrm/admin/options/addressee',
1122 'addressee_custom' => [
1123 'name' => 'addressee_custom',
1124 'type' => CRM_Utils_Type
::T_STRING
,
1125 'title' => ts('Addressee Custom'),
1126 'description' => ts('Custom Addressee.'),
1128 'size' => CRM_Utils_Type
::HUGE
,
1130 'where' => 'civicrm_contact.addressee_custom',
1131 'headerPattern' => '',
1132 'dataPattern' => '',
1134 'table_name' => 'civicrm_contact',
1135 'entity' => 'Contact',
1136 'bao' => 'CRM_Contact_BAO_Contact',
1142 'addressee_display' => [
1143 'name' => 'addressee_display',
1144 'type' => CRM_Utils_Type
::T_STRING
,
1145 'title' => ts('Addressee'),
1146 'description' => ts('Cache Addressee.'),
1148 'size' => CRM_Utils_Type
::HUGE
,
1149 'table_name' => 'civicrm_contact',
1150 'entity' => 'Contact',
1151 'bao' => 'CRM_Contact_BAO_Contact',
1158 'name' => 'job_title',
1159 'type' => CRM_Utils_Type
::T_STRING
,
1160 'title' => ts('Job Title'),
1161 'description' => ts('Job Title'),
1165 'where' => 'civicrm_contact.job_title',
1166 'headerPattern' => '/^job|(j(ob\s)?title)$/i',
1167 'dataPattern' => '//',
1169 'table_name' => 'civicrm_contact',
1170 'entity' => 'Contact',
1171 'bao' => 'CRM_Contact_BAO_Contact',
1178 'name' => 'gender_id',
1179 'type' => CRM_Utils_Type
::T_INT
,
1180 'title' => ts('Gender'),
1181 'description' => ts('FK to gender ID'),
1183 'where' => 'civicrm_contact.gender_id',
1184 'headerPattern' => '/^gender$/i',
1185 'dataPattern' => '',
1187 'table_name' => 'civicrm_contact',
1188 'entity' => 'Contact',
1189 'bao' => 'CRM_Contact_BAO_Contact',
1194 'pseudoconstant' => [
1195 'optionGroupName' => 'gender',
1196 'optionEditPath' => 'civicrm/admin/options/gender',
1200 'name' => 'birth_date',
1201 'type' => CRM_Utils_Type
::T_DATE
,
1202 'title' => ts('Birth Date'),
1203 'description' => ts('Date of birth'),
1205 'where' => 'civicrm_contact.birth_date',
1206 'headerPattern' => '/^birth|(b(irth\s)?date)|D(\W*)O(\W*)B(\W*)$/i',
1207 'dataPattern' => '/\d{4}-?\d{2}-?\d{2}/',
1209 'table_name' => 'civicrm_contact',
1210 'entity' => 'Contact',
1211 'bao' => 'CRM_Contact_BAO_Contact',
1214 'type' => 'Select Date',
1215 'formatType' => 'birth',
1219 'name' => 'is_deceased',
1220 'type' => CRM_Utils_Type
::T_BOOLEAN
,
1221 'title' => ts('Deceased'),
1223 'where' => 'civicrm_contact.is_deceased',
1224 'headerPattern' => '/i(s\s)?d(eceased)$/i',
1225 'dataPattern' => '',
1228 'table_name' => 'civicrm_contact',
1229 'entity' => 'Contact',
1230 'bao' => 'CRM_Contact_BAO_Contact',
1233 'type' => 'CheckBox',
1236 'deceased_date' => [
1237 'name' => 'deceased_date',
1238 'type' => CRM_Utils_Type
::T_DATE
,
1239 'title' => ts('Deceased Date'),
1240 'description' => ts('Date of deceased'),
1242 'where' => 'civicrm_contact.deceased_date',
1243 'headerPattern' => '/^deceased|(d(eceased\s)?date)$/i',
1244 'dataPattern' => '',
1246 'table_name' => 'civicrm_contact',
1247 'entity' => 'Contact',
1248 'bao' => 'CRM_Contact_BAO_Contact',
1251 'type' => 'Select Date',
1252 'formatType' => 'birth',
1255 'household_name' => [
1256 'name' => 'household_name',
1257 'type' => CRM_Utils_Type
::T_STRING
,
1258 'title' => ts('Household Name'),
1259 'description' => ts('Household Name.'),
1263 'where' => 'civicrm_contact.household_name',
1264 'headerPattern' => '/^household|(h(ousehold\s)?name)$/i',
1265 'dataPattern' => '/^\w+$/',
1267 'table_name' => 'civicrm_contact',
1268 'entity' => 'Contact',
1269 'bao' => 'CRM_Contact_BAO_Contact',
1275 'primary_contact_id' => [
1276 'name' => 'primary_contact_id',
1277 'type' => CRM_Utils_Type
::T_INT
,
1278 'title' => ts('Household Primary Contact ID'),
1279 'description' => ts('Optional FK to Primary Contact for this household.'),
1280 'table_name' => 'civicrm_contact',
1281 'entity' => 'Contact',
1282 'bao' => 'CRM_Contact_BAO_Contact',
1284 'FKClassName' => 'CRM_Contact_DAO_Contact',
1289 'organization_name' => [
1290 'name' => 'organization_name',
1291 'type' => CRM_Utils_Type
::T_STRING
,
1292 'title' => ts('Organization Name'),
1293 'description' => ts('Organization Name.'),
1297 'where' => 'civicrm_contact.organization_name',
1298 'headerPattern' => '/^organization|(o(rganization\s)?name)$/i',
1299 'dataPattern' => '/^\w+$/',
1301 'table_name' => 'civicrm_contact',
1302 'entity' => 'Contact',
1303 'bao' => 'CRM_Contact_BAO_Contact',
1310 'name' => 'sic_code',
1311 'type' => CRM_Utils_Type
::T_STRING
,
1312 'title' => ts('Sic Code'),
1313 'description' => ts('Standard Industry Classification Code.'),
1315 'size' => CRM_Utils_Type
::EIGHT
,
1317 'where' => 'civicrm_contact.sic_code',
1318 'headerPattern' => '/^sic|(s(ic\s)?code)$/i',
1319 'dataPattern' => '',
1321 'table_name' => 'civicrm_contact',
1322 'entity' => 'Contact',
1323 'bao' => 'CRM_Contact_BAO_Contact',
1329 'user_unique_id' => [
1330 'name' => 'user_unique_id',
1331 'type' => CRM_Utils_Type
::T_STRING
,
1332 'title' => ts('Unique ID (OpenID)'),
1333 'description' => ts('the OpenID (or OpenID-style http://username.domain/) unique identifier for this contact mainly used for logging in to CiviCRM'),
1335 'size' => CRM_Utils_Type
::HUGE
,
1337 'where' => 'civicrm_contact.user_unique_id',
1338 'headerPattern' => '/^Open\s?ID|u(niq\w*)?\s?ID/i',
1339 'dataPattern' => '/^[\w\/\:\.]+$/',
1342 'table_name' => 'civicrm_contact',
1343 'entity' => 'Contact',
1344 'bao' => 'CRM_Contact_BAO_Contact',
1350 'current_employer_id' => [
1351 'name' => 'employer_id',
1352 'type' => CRM_Utils_Type
::T_INT
,
1353 'title' => ts('Current Employer'),
1354 'description' => ts('OPTIONAL FK to civicrm_contact record.'),
1356 'where' => 'civicrm_contact.employer_id',
1357 'headerPattern' => '',
1358 'dataPattern' => '',
1359 'table_name' => 'civicrm_contact',
1360 'entity' => 'Contact',
1361 'bao' => 'CRM_Contact_BAO_Contact',
1363 'FKClassName' => 'CRM_Contact_DAO_Contact',
1365 'type' => 'EntityRef',
1368 'contact_is_deleted' => [
1369 'name' => 'is_deleted',
1370 'type' => CRM_Utils_Type
::T_BOOLEAN
,
1371 'title' => ts('Contact is in Trash'),
1374 'where' => 'civicrm_contact.is_deleted',
1375 'headerPattern' => '',
1376 'dataPattern' => '',
1378 'table_name' => 'civicrm_contact',
1379 'entity' => 'Contact',
1380 'bao' => 'CRM_Contact_BAO_Contact',
1383 'type' => 'CheckBox',
1387 'name' => 'created_date',
1388 'type' => CRM_Utils_Type
::T_TIMESTAMP
,
1389 'title' => ts('Created Date'),
1390 'description' => ts('When was the contact was created.'),
1391 'required' => FALSE,
1393 'where' => 'civicrm_contact.created_date',
1394 'headerPattern' => '',
1395 'dataPattern' => '',
1396 'default' => 'NULL',
1397 'table_name' => 'civicrm_contact',
1398 'entity' => 'Contact',
1399 'bao' => 'CRM_Contact_BAO_Contact',
1402 'modified_date' => [
1403 'name' => 'modified_date',
1404 'type' => CRM_Utils_Type
::T_TIMESTAMP
,
1405 'title' => ts('Modified Date'),
1406 'description' => ts('When was the contact (or closely related entity) was created or modified or deleted.'),
1407 'required' => FALSE,
1409 'where' => 'civicrm_contact.modified_date',
1410 'headerPattern' => '',
1411 'dataPattern' => '',
1412 'default' => 'CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP',
1413 'table_name' => 'civicrm_contact',
1414 'entity' => 'Contact',
1415 'bao' => 'CRM_Contact_BAO_Contact',
1419 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
1421 return Civi
::$statics[__CLASS__
]['fields'];
1425 * Return a mapping from field-name to the corresponding key (as used in fields()).
1428 * Array(string $name => string $uniqueName).
1430 public static function &fieldKeys() {
1431 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
1432 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
1434 return Civi
::$statics[__CLASS__
]['fieldKeys'];
1438 * Returns the names of this table
1442 public static function getTableName() {
1443 return self
::$_tableName;
1447 * Returns if this table needs to be logged
1451 public function getLog() {
1456 * Returns the list of fields that can be imported
1458 * @param bool $prefix
1462 public static function &import($prefix = FALSE) {
1463 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'contact', $prefix, []);
1468 * Returns the list of fields that can be exported
1470 * @param bool $prefix
1474 public static function &export($prefix = FALSE) {
1475 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'contact', $prefix, []);
1480 * Returns the list of indices
1482 * @param bool $localize
1486 public static function indices($localize = TRUE) {
1488 'index_contact_type' => [
1489 'name' => 'index_contact_type',
1491 0 => 'contact_type',
1493 'localizable' => FALSE,
1494 'sig' => 'civicrm_contact::0::contact_type',
1496 'index_contact_sub_type' => [
1497 'name' => 'index_contact_sub_type',
1499 0 => 'contact_sub_type',
1501 'localizable' => FALSE,
1502 'sig' => 'civicrm_contact::0::contact_sub_type',
1504 'UI_external_identifier' => [
1505 'name' => 'UI_external_identifier',
1507 0 => 'external_identifier',
1509 'localizable' => FALSE,
1511 'sig' => 'civicrm_contact::1::external_identifier',
1513 'index_sort_name' => [
1514 'name' => 'index_sort_name',
1518 'localizable' => FALSE,
1519 'sig' => 'civicrm_contact::0::sort_name',
1521 'index_preferred_communication_method' => [
1522 'name' => 'index_preferred_communication_method',
1524 0 => 'preferred_communication_method',
1526 'localizable' => FALSE,
1527 'sig' => 'civicrm_contact::0::preferred_communication_method',
1530 'name' => 'index_hash',
1534 'localizable' => FALSE,
1535 'sig' => 'civicrm_contact::0::hash',
1537 'index_api_key' => [
1538 'name' => 'index_api_key',
1542 'localizable' => FALSE,
1543 'sig' => 'civicrm_contact::0::api_key',
1545 'index_first_name' => [
1546 'name' => 'index_first_name',
1550 'localizable' => FALSE,
1551 'sig' => 'civicrm_contact::0::first_name',
1553 'index_last_name' => [
1554 'name' => 'index_last_name',
1558 'localizable' => FALSE,
1559 'sig' => 'civicrm_contact::0::last_name',
1562 'name' => 'UI_prefix',
1566 'localizable' => FALSE,
1567 'sig' => 'civicrm_contact::0::prefix_id',
1570 'name' => 'UI_suffix',
1574 'localizable' => FALSE,
1575 'sig' => 'civicrm_contact::0::suffix_id',
1577 'index_communication_style_id' => [
1578 'name' => 'index_communication_style_id',
1580 0 => 'communication_style_id',
1582 'localizable' => FALSE,
1583 'sig' => 'civicrm_contact::0::communication_style_id',
1586 'name' => 'UI_gender',
1590 'localizable' => FALSE,
1591 'sig' => 'civicrm_contact::0::gender_id',
1593 'index_is_deceased' => [
1594 'name' => 'index_is_deceased',
1598 'localizable' => FALSE,
1599 'sig' => 'civicrm_contact::0::is_deceased',
1601 'index_household_name' => [
1602 'name' => 'index_household_name',
1604 0 => 'household_name',
1606 'localizable' => FALSE,
1607 'sig' => 'civicrm_contact::0::household_name',
1609 'index_organization_name' => [
1610 'name' => 'index_organization_name',
1612 0 => 'organization_name',
1614 'localizable' => FALSE,
1615 'sig' => 'civicrm_contact::0::organization_name',
1617 'index_is_deleted_sort_name' => [
1618 'name' => 'index_is_deleted_sort_name',
1624 'localizable' => FALSE,
1625 'sig' => 'civicrm_contact::0::is_deleted::sort_name::id',
1628 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;