3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.7 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2017 |
7 +--------------------------------------------------------------------+
8 | This file is a part of CiviCRM. |
10 | CiviCRM is free software; you can copy, modify, and distribute it |
11 | under the terms of the GNU Affero General Public License |
12 | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
14 | CiviCRM is distributed in the hope that it will be useful, but |
15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
17 | See the GNU Affero General Public License for more details. |
19 | You should have received a copy of the GNU Affero General Public |
20 | License and the CiviCRM Licensing Exception along |
21 | with this program; if not, contact CiviCRM LLC |
22 | at info[AT]civicrm[DOT]org. If you have questions about the |
23 | GNU Affero General Public License or the licensing of CiviCRM, |
24 | see the CiviCRM license FAQ at http://civicrm.org/licensing |
25 +--------------------------------------------------------------------+
29 * @copyright CiviCRM LLC (c) 2004-2017
31 * Generated from xml/schema/CRM/Contact/Contact.xml
32 * DO NOT EDIT. Generated by CRM_Core_CodeGen
33 * (GenCodeChecksum:b16421c318c1224c65e18a9e2aa15a5e)
35 require_once 'CRM/Core/DAO.php';
36 require_once 'CRM/Utils/Type.php';
38 * CRM_Contact_DAO_Contact constructor.
40 class CRM_Contact_DAO_Contact
extends CRM_Core_DAO
{
42 * Static instance to hold the table name.
46 static $_tableName = 'civicrm_contact';
48 * Should CiviCRM log any modifications to this table in the civicrm_log table.
66 * May be used to over-ride contact view and edit templates.
70 public $contact_sub_type;
97 * Has the contact opted out from receiving all bulk email from the organization or site domain?
103 * May be used for SSN, EIN/TIN, Household ID (census) or other applicable unique legal/government ID.
107 public $legal_identifier;
109 * Unique trusted external ID (generally from a legacy app/datasource). Particularly useful for deduping operations.
113 public $external_identifier;
115 * Name used for sorting different contact types
121 * Formatted name representing preferred format for display/print/other output.
125 public $display_name;
139 * optional URL for preferred image (photo, logo, etc.) to display for this contact.
145 * What is the preferred mode of communication.
149 public $preferred_communication_method;
151 * Which language is preferred for communication. FK to languages in civicrm_option_value.
155 public $preferred_language;
157 * What is the preferred mode of sending an email.
161 public $preferred_mail_format;
163 * Key for validating requests related to this contact.
169 * API Key for validating requests related to this contact.
175 * where contact come from, e.g. import, donate module insert...
199 * Prefix or Title for name (Ms, Mr...). FK to prefix ID
205 * 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;
217 * Communication style (e.g. formal vs. familiar) to use with this contact. FK to communication styles in civicrm_option_value.
221 public $communication_style_id;
223 * FK to civicrm_option_value.id, that has to be valid registered Email Greeting.
227 public $email_greeting_id;
229 * Custom Email Greeting.
233 public $email_greeting_custom;
235 * Cache Email Greeting.
239 public $email_greeting_display;
241 * FK to civicrm_option_value.id, that has to be valid registered Postal Greeting.
245 public $postal_greeting_id;
247 * Custom Postal greeting.
251 public $postal_greeting_custom;
253 * Cache Postal greeting.
257 public $postal_greeting_display;
259 * FK to civicrm_option_value.id, that has to be valid registered Addressee.
263 public $addressee_id;
269 public $addressee_custom;
275 public $addressee_display;
304 public $deceased_date;
310 public $household_name;
312 * Optional FK to Primary Contact for this household.
316 public $primary_contact_id;
322 public $organization_name;
324 * Standard Industry Classification Code.
330 * the OpenID (or OpenID-style http://username.domain/) unique identifier for this contact mainly used for logging in to CiviCRM
334 public $user_unique_id;
336 * OPTIONAL FK to civicrm_contact record.
347 * When was the contact was created.
351 public $created_date;
353 * When was the contact (or closely related entity) was created or modified or deleted.
357 public $modified_date;
361 function __construct() {
362 $this->__table
= 'civicrm_contact';
363 parent
::__construct();
366 * Returns foreign keys and entity references.
369 * [CRM_Core_Reference_Interface]
371 static function getReferenceColumns() {
372 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
373 Civi
::$statics[__CLASS__
]['links'] = static ::createReferenceColumns(__CLASS__
);
374 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName() , 'primary_contact_id', 'civicrm_contact', 'id');
375 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName() , 'employer_id', 'civicrm_contact', 'id');
376 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
378 return Civi
::$statics[__CLASS__
]['links'];
381 * Returns all the column names of this table
385 static function &fields() {
386 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
387 Civi
::$statics[__CLASS__
]['fields'] = array(
390 'type' => CRM_Utils_Type
::T_INT
,
391 'title' => ts('Contact ID') ,
392 'description' => 'Unique Contact ID',
395 'where' => 'civicrm_contact.id',
396 'headerPattern' => '/internal|contact?|id$/i',
399 'table_name' => 'civicrm_contact',
400 'entity' => 'Contact',
401 'bao' => 'CRM_Contact_BAO_Contact',
403 'contact_type' => array(
404 'name' => 'contact_type',
405 'type' => CRM_Utils_Type
::T_STRING
,
406 'title' => ts('Contact Type') ,
407 'description' => 'Type of Contact.',
409 'size' => CRM_Utils_Type
::BIG
,
411 'where' => 'civicrm_contact.contact_type',
412 'headerPattern' => '',
414 'table_name' => 'civicrm_contact',
415 'entity' => 'Contact',
416 'bao' => 'CRM_Contact_BAO_Contact',
420 'pseudoconstant' => array(
421 'table' => 'civicrm_contact_type',
422 'keyColumn' => 'name',
423 'labelColumn' => 'label',
424 'condition' => 'parent_id IS NULL',
427 'contact_sub_type' => array(
428 'name' => 'contact_sub_type',
429 'type' => CRM_Utils_Type
::T_STRING
,
430 'title' => ts('Contact Subtype') ,
431 'description' => 'May be used to over-ride contact view and edit templates.',
433 'size' => CRM_Utils_Type
::HUGE
,
435 'where' => 'civicrm_contact.contact_sub_type',
436 'headerPattern' => '/C(ontact )?(subtype|sub-type|sub type)/i',
439 'table_name' => 'civicrm_contact',
440 'entity' => 'Contact',
441 'bao' => 'CRM_Contact_BAO_Contact',
445 'pseudoconstant' => array(
446 'table' => 'civicrm_contact_type',
447 'keyColumn' => 'name',
448 'labelColumn' => 'label',
449 'condition' => 'parent_id IS NOT NULL',
452 'do_not_email' => array(
453 'name' => 'do_not_email',
454 'type' => CRM_Utils_Type
::T_BOOLEAN
,
455 'title' => ts('Do Not Email') ,
457 'where' => 'civicrm_contact.do_not_email',
458 'headerPattern' => '/d(o )?(not )?(email)/i',
459 'dataPattern' => '/^\d{1,}$/',
461 'table_name' => 'civicrm_contact',
462 'entity' => 'Contact',
463 'bao' => 'CRM_Contact_BAO_Contact',
465 'type' => 'CheckBox',
468 'do_not_phone' => array(
469 'name' => 'do_not_phone',
470 'type' => CRM_Utils_Type
::T_BOOLEAN
,
471 'title' => ts('Do Not Phone') ,
473 'where' => 'civicrm_contact.do_not_phone',
474 'headerPattern' => '/d(o )?(not )?(call|phone)/i',
475 'dataPattern' => '/^\d{1,}$/',
477 'table_name' => 'civicrm_contact',
478 'entity' => 'Contact',
479 'bao' => 'CRM_Contact_BAO_Contact',
481 'type' => 'CheckBox',
484 'do_not_mail' => array(
485 'name' => 'do_not_mail',
486 'type' => CRM_Utils_Type
::T_BOOLEAN
,
487 'title' => ts('Do Not Mail') ,
489 'where' => 'civicrm_contact.do_not_mail',
490 'headerPattern' => '/^(d(o\s)?n(ot\s)?mail)|(\w*)?bulk\s?(\w*)$/i',
491 'dataPattern' => '/^\d{1,}$/',
493 'table_name' => 'civicrm_contact',
494 'entity' => 'Contact',
495 'bao' => 'CRM_Contact_BAO_Contact',
497 'type' => 'CheckBox',
500 'do_not_sms' => array(
501 'name' => 'do_not_sms',
502 'type' => CRM_Utils_Type
::T_BOOLEAN
,
503 'title' => ts('Do Not Sms') ,
505 'where' => 'civicrm_contact.do_not_sms',
506 'headerPattern' => '/d(o )?(not )?(sms)/i',
507 'dataPattern' => '/^\d{1,}$/',
509 'table_name' => 'civicrm_contact',
510 'entity' => 'Contact',
511 'bao' => 'CRM_Contact_BAO_Contact',
513 'type' => 'CheckBox',
516 'do_not_trade' => array(
517 'name' => 'do_not_trade',
518 'type' => CRM_Utils_Type
::T_BOOLEAN
,
519 'title' => ts('Do Not Trade') ,
521 'where' => 'civicrm_contact.do_not_trade',
522 'headerPattern' => '/d(o )?(not )?(trade)/i',
523 'dataPattern' => '/^\d{1,}$/',
525 'table_name' => 'civicrm_contact',
526 'entity' => 'Contact',
527 'bao' => 'CRM_Contact_BAO_Contact',
529 'type' => 'CheckBox',
532 'is_opt_out' => array(
533 'name' => 'is_opt_out',
534 'type' => CRM_Utils_Type
::T_BOOLEAN
,
535 'title' => ts('No Bulk Emails (User Opt Out)') ,
536 'description' => 'Has the contact opted out from receiving all bulk email from the organization or site domain?',
539 'where' => 'civicrm_contact.is_opt_out',
540 'headerPattern' => '',
543 'table_name' => 'civicrm_contact',
544 'entity' => 'Contact',
545 'bao' => 'CRM_Contact_BAO_Contact',
547 'type' => 'CheckBox',
550 'legal_identifier' => array(
551 'name' => 'legal_identifier',
552 'type' => CRM_Utils_Type
::T_STRING
,
553 'title' => ts('Legal Identifier') ,
554 'description' => 'May be used for SSN, EIN/TIN, Household ID (census) or other applicable unique legal/government ID.
557 'size' => CRM_Utils_Type
::MEDIUM
,
559 'where' => 'civicrm_contact.legal_identifier',
560 'headerPattern' => '/legal\s?id/i',
561 'dataPattern' => '/\w+?\d{5,}/',
563 'table_name' => 'civicrm_contact',
564 'entity' => 'Contact',
565 'bao' => 'CRM_Contact_BAO_Contact',
570 'external_identifier' => array(
571 'name' => 'external_identifier',
572 'type' => CRM_Utils_Type
::T_STRING
,
573 'title' => ts('External Identifier') ,
574 'description' => 'Unique trusted external ID (generally from a legacy app/datasource). Particularly useful for deduping operations.',
578 'where' => 'civicrm_contact.external_identifier',
579 'headerPattern' => '/external\s?id/i',
580 'dataPattern' => '/^\d{11,}$/',
582 'table_name' => 'civicrm_contact',
583 'entity' => 'Contact',
584 'bao' => 'CRM_Contact_BAO_Contact',
589 'sort_name' => array(
590 'name' => 'sort_name',
591 'type' => CRM_Utils_Type
::T_STRING
,
592 'title' => ts('Sort Name') ,
593 'description' => 'Name used for sorting different contact types',
597 'where' => 'civicrm_contact.sort_name',
598 'headerPattern' => '',
600 'table_name' => 'civicrm_contact',
601 'entity' => 'Contact',
602 'bao' => 'CRM_Contact_BAO_Contact',
607 'display_name' => array(
608 'name' => 'display_name',
609 'type' => CRM_Utils_Type
::T_STRING
,
610 'title' => ts('Display Name') ,
611 'description' => 'Formatted name representing preferred format for display/print/other output.',
615 'where' => 'civicrm_contact.display_name',
616 'headerPattern' => '',
618 'table_name' => 'civicrm_contact',
619 'entity' => 'Contact',
620 'bao' => 'CRM_Contact_BAO_Contact',
625 'nick_name' => array(
626 'name' => 'nick_name',
627 'type' => CRM_Utils_Type
::T_STRING
,
628 'title' => ts('Nickname') ,
629 'description' => 'Nickname.',
633 'where' => 'civicrm_contact.nick_name',
634 'headerPattern' => '/n(ick\s)name|nick$/i',
635 'dataPattern' => '/^\w+$/',
637 'table_name' => 'civicrm_contact',
638 'entity' => 'Contact',
639 'bao' => 'CRM_Contact_BAO_Contact',
644 'legal_name' => array(
645 'name' => 'legal_name',
646 'type' => CRM_Utils_Type
::T_STRING
,
647 'title' => ts('Legal Name') ,
648 'description' => 'Legal Name.',
652 'where' => 'civicrm_contact.legal_name',
653 'headerPattern' => '/^legal|(l(egal\s)?name)$/i',
656 'table_name' => 'civicrm_contact',
657 'entity' => 'Contact',
658 'bao' => 'CRM_Contact_BAO_Contact',
663 'image_URL' => array(
664 'name' => 'image_URL',
665 'type' => CRM_Utils_Type
::T_TEXT
,
666 'title' => ts('Image Url') ,
667 'description' => 'optional URL for preferred image (photo, logo, etc.) to display for this contact.',
669 'where' => 'civicrm_contact.image_URL',
670 'headerPattern' => '',
673 'table_name' => 'civicrm_contact',
674 'entity' => 'Contact',
675 'bao' => 'CRM_Contact_BAO_Contact',
680 'preferred_communication_method' => array(
681 'name' => 'preferred_communication_method',
682 'type' => CRM_Utils_Type
::T_STRING
,
683 'title' => ts('Preferred Communication Method') ,
684 'description' => 'What is the preferred mode of communication.',
686 'size' => CRM_Utils_Type
::HUGE
,
688 'where' => 'civicrm_contact.preferred_communication_method',
689 'headerPattern' => '/^p(ref\w*\s)?c(omm\w*)|( meth\w*)$/i',
690 'dataPattern' => '/^\w+$/',
692 'table_name' => 'civicrm_contact',
693 'entity' => 'Contact',
694 'bao' => 'CRM_Contact_BAO_Contact',
698 'pseudoconstant' => array(
699 'optionGroupName' => 'preferred_communication_method',
700 'optionEditPath' => 'civicrm/admin/options/preferred_communication_method',
703 'preferred_language' => array(
704 'name' => 'preferred_language',
705 'type' => CRM_Utils_Type
::T_STRING
,
706 'title' => ts('Preferred Language') ,
707 'description' => 'Which language is preferred for communication. FK to languages in civicrm_option_value.',
709 'size' => CRM_Utils_Type
::SIX
,
711 'where' => 'civicrm_contact.preferred_language',
712 'headerPattern' => '/^lang/i',
715 'table_name' => 'civicrm_contact',
716 'entity' => 'Contact',
717 'bao' => 'CRM_Contact_BAO_Contact',
721 'pseudoconstant' => array(
722 'optionGroupName' => 'languages',
723 'keyColumn' => 'name',
724 'optionEditPath' => 'civicrm/admin/options/languages',
727 'preferred_mail_format' => array(
728 'name' => 'preferred_mail_format',
729 'type' => CRM_Utils_Type
::T_STRING
,
730 'title' => ts('Preferred Mail Format') ,
731 'description' => 'What is the preferred mode of sending an email.',
733 'size' => CRM_Utils_Type
::EIGHT
,
735 'where' => 'civicrm_contact.preferred_mail_format',
736 'headerPattern' => '/^p(ref\w*\s)?m(ail\s)?f(orm\w*)$/i',
740 'table_name' => 'civicrm_contact',
741 'entity' => 'Contact',
742 'bao' => 'CRM_Contact_BAO_Contact',
746 'pseudoconstant' => array(
747 'callback' => 'CRM_Core_SelectValues::pmf',
752 'type' => CRM_Utils_Type
::T_STRING
,
753 'title' => ts('Contact Hash') ,
754 'description' => 'Key for validating requests related to this contact.',
756 'size' => CRM_Utils_Type
::MEDIUM
,
758 'where' => 'civicrm_contact.hash',
759 'headerPattern' => '',
761 'table_name' => 'civicrm_contact',
762 'entity' => 'Contact',
763 'bao' => 'CRM_Contact_BAO_Contact',
767 'type' => CRM_Utils_Type
::T_STRING
,
768 'title' => ts('Api Key') ,
769 'description' => 'API Key for validating requests related to this contact.',
771 'size' => CRM_Utils_Type
::MEDIUM
,
772 'table_name' => 'civicrm_contact',
773 'entity' => 'Contact',
774 'bao' => 'CRM_Contact_BAO_Contact',
776 'contact_source' => array(
778 'type' => CRM_Utils_Type
::T_STRING
,
779 'title' => ts('Contact Source') ,
780 'description' => 'where contact come from, e.g. import, donate module insert...',
784 'where' => 'civicrm_contact.source',
785 'headerPattern' => '/(C(ontact\s)?Source)$/i',
788 'table_name' => 'civicrm_contact',
789 'entity' => 'Contact',
790 'bao' => 'CRM_Contact_BAO_Contact',
795 'first_name' => array(
796 'name' => 'first_name',
797 'type' => CRM_Utils_Type
::T_STRING
,
798 'title' => ts('First Name') ,
799 'description' => 'First Name.',
803 'where' => 'civicrm_contact.first_name',
804 'headerPattern' => '/^first|(f(irst\s)?name)$/i',
805 'dataPattern' => '/^\w+$/',
807 'table_name' => 'civicrm_contact',
808 'entity' => 'Contact',
809 'bao' => 'CRM_Contact_BAO_Contact',
814 'middle_name' => array(
815 'name' => 'middle_name',
816 'type' => CRM_Utils_Type
::T_STRING
,
817 'title' => ts('Middle Name') ,
818 'description' => 'Middle Name.',
822 'where' => 'civicrm_contact.middle_name',
823 'headerPattern' => '/^middle|(m(iddle\s)?name)$/i',
824 'dataPattern' => '/^\w+$/',
826 'table_name' => 'civicrm_contact',
827 'entity' => 'Contact',
828 'bao' => 'CRM_Contact_BAO_Contact',
833 'last_name' => array(
834 'name' => 'last_name',
835 'type' => CRM_Utils_Type
::T_STRING
,
836 'title' => ts('Last Name') ,
837 'description' => 'Last Name.',
841 'where' => 'civicrm_contact.last_name',
842 'headerPattern' => '/^last|(l(ast\s)?name)$/i',
843 'dataPattern' => '/^\w+(\s\w+)?+$/',
845 'table_name' => 'civicrm_contact',
846 'entity' => 'Contact',
847 'bao' => 'CRM_Contact_BAO_Contact',
852 'prefix_id' => array(
853 'name' => 'prefix_id',
854 'type' => CRM_Utils_Type
::T_INT
,
855 'title' => ts('Individual Prefix') ,
856 'description' => 'Prefix or Title for name (Ms, Mr...). FK to prefix ID',
858 'where' => 'civicrm_contact.prefix_id',
859 'headerPattern' => '/^(prefix|title)/i',
860 'dataPattern' => '/^(mr|ms|mrs|sir|dr)\.?$/i',
862 'table_name' => 'civicrm_contact',
863 'entity' => 'Contact',
864 'bao' => 'CRM_Contact_BAO_Contact',
868 'pseudoconstant' => array(
869 'optionGroupName' => 'individual_prefix',
870 'optionEditPath' => 'civicrm/admin/options/individual_prefix',
873 'suffix_id' => array(
874 'name' => 'suffix_id',
875 'type' => CRM_Utils_Type
::T_INT
,
876 'title' => ts('Individual Suffix') ,
877 'description' => 'Suffix for name (Jr, Sr...). FK to suffix ID',
879 'where' => 'civicrm_contact.suffix_id',
880 'headerPattern' => '/^suffix$/i',
881 'dataPattern' => '/^(sr|jr)\.?|i{2,}$/',
883 'table_name' => 'civicrm_contact',
884 'entity' => 'Contact',
885 'bao' => 'CRM_Contact_BAO_Contact',
889 'pseudoconstant' => array(
890 'optionGroupName' => 'individual_suffix',
891 'optionEditPath' => 'civicrm/admin/options/individual_suffix',
894 'formal_title' => array(
895 'name' => 'formal_title',
896 'type' => CRM_Utils_Type
::T_STRING
,
897 'title' => ts('Formal Title') ,
898 'description' => 'Formal (academic or similar) title in front of name. (Prof., Dr. etc.)',
900 'size' => CRM_Utils_Type
::BIG
,
902 'where' => 'civicrm_contact.formal_title',
903 'headerPattern' => '/^title/i',
906 'table_name' => 'civicrm_contact',
907 'entity' => 'Contact',
908 'bao' => 'CRM_Contact_BAO_Contact',
913 'communication_style_id' => array(
914 'name' => 'communication_style_id',
915 'type' => CRM_Utils_Type
::T_INT
,
916 'title' => ts('Communication Style') ,
917 'description' => 'Communication style (e.g. formal vs. familiar) to use with this contact. FK to communication styles in civicrm_option_value.',
919 'where' => 'civicrm_contact.communication_style_id',
920 'headerPattern' => '',
922 'table_name' => 'civicrm_contact',
923 'entity' => 'Contact',
924 'bao' => 'CRM_Contact_BAO_Contact',
928 'pseudoconstant' => array(
929 'optionGroupName' => 'communication_style',
930 'optionEditPath' => 'civicrm/admin/options/communication_style',
933 'email_greeting_id' => array(
934 'name' => 'email_greeting_id',
935 'type' => CRM_Utils_Type
::T_INT
,
936 'title' => ts('Email Greeting ID') ,
937 'description' => 'FK to civicrm_option_value.id, that has to be valid registered Email Greeting.',
938 'table_name' => 'civicrm_contact',
939 'entity' => 'Contact',
940 'bao' => 'CRM_Contact_BAO_Contact',
942 'email_greeting_custom' => array(
943 'name' => 'email_greeting_custom',
944 'type' => CRM_Utils_Type
::T_STRING
,
945 'title' => ts('Email Greeting Custom') ,
946 'description' => 'Custom Email Greeting.',
948 'size' => CRM_Utils_Type
::HUGE
,
950 'where' => 'civicrm_contact.email_greeting_custom',
951 'headerPattern' => '',
954 'table_name' => 'civicrm_contact',
955 'entity' => 'Contact',
956 'bao' => 'CRM_Contact_BAO_Contact',
961 'email_greeting_display' => array(
962 'name' => 'email_greeting_display',
963 'type' => CRM_Utils_Type
::T_STRING
,
964 'title' => ts('Email Greeting') ,
965 'description' => 'Cache Email Greeting.',
967 'size' => CRM_Utils_Type
::HUGE
,
968 'table_name' => 'civicrm_contact',
969 'entity' => 'Contact',
970 'bao' => 'CRM_Contact_BAO_Contact',
975 'postal_greeting_id' => array(
976 'name' => 'postal_greeting_id',
977 'type' => CRM_Utils_Type
::T_INT
,
978 'title' => ts('Postal Greeting ID') ,
979 'description' => 'FK to civicrm_option_value.id, that has to be valid registered Postal Greeting.',
980 'table_name' => 'civicrm_contact',
981 'entity' => 'Contact',
982 'bao' => 'CRM_Contact_BAO_Contact',
987 'postal_greeting_custom' => array(
988 'name' => 'postal_greeting_custom',
989 'type' => CRM_Utils_Type
::T_STRING
,
990 'title' => ts('Postal Greeting Custom') ,
991 'description' => 'Custom Postal greeting.',
993 'size' => CRM_Utils_Type
::HUGE
,
995 'where' => 'civicrm_contact.postal_greeting_custom',
996 'headerPattern' => '',
999 'table_name' => 'civicrm_contact',
1000 'entity' => 'Contact',
1001 'bao' => 'CRM_Contact_BAO_Contact',
1006 'postal_greeting_display' => array(
1007 'name' => 'postal_greeting_display',
1008 'type' => CRM_Utils_Type
::T_STRING
,
1009 'title' => ts('Postal Greeting') ,
1010 'description' => 'Cache Postal greeting.',
1012 'size' => CRM_Utils_Type
::HUGE
,
1013 'table_name' => 'civicrm_contact',
1014 'entity' => 'Contact',
1015 'bao' => 'CRM_Contact_BAO_Contact',
1020 'addressee_id' => array(
1021 'name' => 'addressee_id',
1022 'type' => CRM_Utils_Type
::T_INT
,
1023 'title' => ts('Addressee ID') ,
1024 'description' => 'FK to civicrm_option_value.id, that has to be valid registered Addressee.',
1025 'table_name' => 'civicrm_contact',
1026 'entity' => 'Contact',
1027 'bao' => 'CRM_Contact_BAO_Contact',
1029 'addressee_custom' => array(
1030 'name' => 'addressee_custom',
1031 'type' => CRM_Utils_Type
::T_STRING
,
1032 'title' => ts('Addressee Custom') ,
1033 'description' => 'Custom Addressee.',
1035 'size' => CRM_Utils_Type
::HUGE
,
1037 'where' => 'civicrm_contact.addressee_custom',
1038 'headerPattern' => '',
1039 'dataPattern' => '',
1041 'table_name' => 'civicrm_contact',
1042 'entity' => 'Contact',
1043 'bao' => 'CRM_Contact_BAO_Contact',
1048 'addressee_display' => array(
1049 'name' => 'addressee_display',
1050 'type' => CRM_Utils_Type
::T_STRING
,
1051 'title' => ts('Addressee') ,
1052 'description' => 'Cache Addressee.',
1054 'size' => CRM_Utils_Type
::HUGE
,
1055 'table_name' => 'civicrm_contact',
1056 'entity' => 'Contact',
1057 'bao' => 'CRM_Contact_BAO_Contact',
1062 'job_title' => array(
1063 'name' => 'job_title',
1064 'type' => CRM_Utils_Type
::T_STRING
,
1065 'title' => ts('Job Title') ,
1066 'description' => 'Job Title',
1070 'where' => 'civicrm_contact.job_title',
1071 'headerPattern' => '/^job|(j(ob\s)?title)$/i',
1072 'dataPattern' => '//',
1074 'table_name' => 'civicrm_contact',
1075 'entity' => 'Contact',
1076 'bao' => 'CRM_Contact_BAO_Contact',
1081 'gender_id' => array(
1082 'name' => 'gender_id',
1083 'type' => CRM_Utils_Type
::T_INT
,
1084 'title' => ts('Gender') ,
1085 'description' => 'FK to gender ID',
1087 'where' => 'civicrm_contact.gender_id',
1088 'headerPattern' => '/^gender$/i',
1089 'dataPattern' => '',
1091 'table_name' => 'civicrm_contact',
1092 'entity' => 'Contact',
1093 'bao' => 'CRM_Contact_BAO_Contact',
1097 'pseudoconstant' => array(
1098 'optionGroupName' => 'gender',
1099 'optionEditPath' => 'civicrm/admin/options/gender',
1102 'birth_date' => array(
1103 'name' => 'birth_date',
1104 'type' => CRM_Utils_Type
::T_DATE
,
1105 'title' => ts('Birth Date') ,
1106 'description' => 'Date of birth',
1108 'where' => 'civicrm_contact.birth_date',
1109 'headerPattern' => '/^birth|(b(irth\s)?date)|D(\W*)O(\W*)B(\W*)$/i',
1110 'dataPattern' => '/\d{4}-?\d{2}-?\d{2}/',
1112 'table_name' => 'civicrm_contact',
1113 'entity' => 'Contact',
1114 'bao' => 'CRM_Contact_BAO_Contact',
1116 'type' => 'Select Date',
1117 'formatType' => 'birth',
1120 'is_deceased' => array(
1121 'name' => 'is_deceased',
1122 'type' => CRM_Utils_Type
::T_BOOLEAN
,
1123 'title' => ts('Deceased') ,
1125 'where' => 'civicrm_contact.is_deceased',
1126 'headerPattern' => '/i(s\s)?d(eceased)$/i',
1127 'dataPattern' => '',
1129 'table_name' => 'civicrm_contact',
1130 'entity' => 'Contact',
1131 'bao' => 'CRM_Contact_BAO_Contact',
1133 'type' => 'CheckBox',
1136 'deceased_date' => array(
1137 'name' => 'deceased_date',
1138 'type' => CRM_Utils_Type
::T_DATE
,
1139 'title' => ts('Deceased Date') ,
1140 'description' => 'Date of deceased',
1142 'where' => 'civicrm_contact.deceased_date',
1143 'headerPattern' => '/^deceased|(d(eceased\s)?date)$/i',
1144 'dataPattern' => '',
1146 'table_name' => 'civicrm_contact',
1147 'entity' => 'Contact',
1148 'bao' => 'CRM_Contact_BAO_Contact',
1150 'type' => 'Select Date',
1151 'formatType' => 'birth',
1154 'household_name' => array(
1155 'name' => 'household_name',
1156 'type' => CRM_Utils_Type
::T_STRING
,
1157 'title' => ts('Household Name') ,
1158 'description' => 'Household Name.',
1162 'where' => 'civicrm_contact.household_name',
1163 'headerPattern' => '/^household|(h(ousehold\s)?name)$/i',
1164 'dataPattern' => '/^\w+$/',
1166 'table_name' => 'civicrm_contact',
1167 'entity' => 'Contact',
1168 'bao' => 'CRM_Contact_BAO_Contact',
1173 'primary_contact_id' => array(
1174 'name' => 'primary_contact_id',
1175 'type' => CRM_Utils_Type
::T_INT
,
1176 'title' => ts('Household Primary Contact ID') ,
1177 'description' => 'Optional FK to Primary Contact for this household.',
1178 'table_name' => 'civicrm_contact',
1179 'entity' => 'Contact',
1180 'bao' => 'CRM_Contact_BAO_Contact',
1181 'FKClassName' => 'CRM_Contact_DAO_Contact',
1186 'organization_name' => array(
1187 'name' => 'organization_name',
1188 'type' => CRM_Utils_Type
::T_STRING
,
1189 'title' => ts('Organization Name') ,
1190 'description' => 'Organization Name.',
1194 'where' => 'civicrm_contact.organization_name',
1195 'headerPattern' => '/^organization|(o(rganization\s)?name)$/i',
1196 'dataPattern' => '/^\w+$/',
1198 'table_name' => 'civicrm_contact',
1199 'entity' => 'Contact',
1200 'bao' => 'CRM_Contact_BAO_Contact',
1205 'sic_code' => array(
1206 'name' => 'sic_code',
1207 'type' => CRM_Utils_Type
::T_STRING
,
1208 'title' => ts('Sic Code') ,
1209 'description' => 'Standard Industry Classification Code.',
1211 'size' => CRM_Utils_Type
::EIGHT
,
1213 'where' => 'civicrm_contact.sic_code',
1214 'headerPattern' => '/^sic|(s(ic\s)?code)$/i',
1215 'dataPattern' => '',
1217 'table_name' => 'civicrm_contact',
1218 'entity' => 'Contact',
1219 'bao' => 'CRM_Contact_BAO_Contact',
1224 'user_unique_id' => array(
1225 'name' => 'user_unique_id',
1226 'type' => CRM_Utils_Type
::T_STRING
,
1227 'title' => ts('Unique ID (OpenID)') ,
1228 'description' => 'the OpenID (or OpenID-style http://username.domain/) unique identifier for this contact mainly used for logging in to CiviCRM',
1230 'size' => CRM_Utils_Type
::HUGE
,
1232 'where' => 'civicrm_contact.user_unique_id',
1233 'headerPattern' => '/^Open\s?ID|u(niq\w*)?\s?ID/i',
1234 'dataPattern' => '/^[\w\/\:\.]+$/',
1237 'table_name' => 'civicrm_contact',
1238 'entity' => 'Contact',
1239 'bao' => 'CRM_Contact_BAO_Contact',
1244 'current_employer_id' => array(
1245 'name' => 'employer_id',
1246 'type' => CRM_Utils_Type
::T_INT
,
1247 'title' => ts('Current Employer') ,
1248 'description' => 'OPTIONAL FK to civicrm_contact record.',
1250 'where' => 'civicrm_contact.employer_id',
1251 'headerPattern' => '',
1252 'dataPattern' => '',
1253 'table_name' => 'civicrm_contact',
1254 'entity' => 'Contact',
1255 'bao' => 'CRM_Contact_BAO_Contact',
1256 'FKClassName' => 'CRM_Contact_DAO_Contact',
1258 'type' => 'EntityRef',
1261 'contact_is_deleted' => array(
1262 'name' => 'is_deleted',
1263 'type' => CRM_Utils_Type
::T_BOOLEAN
,
1264 'title' => ts('Contact is in Trash') ,
1267 'where' => 'civicrm_contact.is_deleted',
1268 'headerPattern' => '',
1269 'dataPattern' => '',
1270 'table_name' => 'civicrm_contact',
1271 'entity' => 'Contact',
1272 'bao' => 'CRM_Contact_BAO_Contact',
1274 'type' => 'CheckBox',
1277 'created_date' => array(
1278 'name' => 'created_date',
1279 'type' => CRM_Utils_Type
::T_TIMESTAMP
,
1280 'title' => ts('Created Date') ,
1281 'description' => 'When was the contact was created.',
1282 'required' => false,
1284 'where' => 'civicrm_contact.created_date',
1285 'headerPattern' => '',
1286 'dataPattern' => '',
1287 'default' => 'NULL',
1288 'table_name' => 'civicrm_contact',
1289 'entity' => 'Contact',
1290 'bao' => 'CRM_Contact_BAO_Contact',
1292 'modified_date' => array(
1293 'name' => 'modified_date',
1294 'type' => CRM_Utils_Type
::T_TIMESTAMP
,
1295 'title' => ts('Modified Date') ,
1296 'description' => 'When was the contact (or closely related entity) was created or modified or deleted.',
1297 'required' => false,
1299 'where' => 'civicrm_contact.modified_date',
1300 'headerPattern' => '',
1301 'dataPattern' => '',
1302 'default' => 'CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP',
1303 'table_name' => 'civicrm_contact',
1304 'entity' => 'Contact',
1305 'bao' => 'CRM_Contact_BAO_Contact',
1308 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
1310 return Civi
::$statics[__CLASS__
]['fields'];
1313 * Return a mapping from field-name to the corresponding key (as used in fields()).
1316 * Array(string $name => string $uniqueName).
1318 static function &fieldKeys() {
1319 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
1320 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
1322 return Civi
::$statics[__CLASS__
]['fieldKeys'];
1325 * Returns the names of this table
1329 static function getTableName() {
1330 return self
::$_tableName;
1333 * Returns if this table needs to be logged
1341 * Returns the list of fields that can be imported
1343 * @param bool $prefix
1347 static function &import($prefix = false) {
1348 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'contact', $prefix, array());
1352 * Returns the list of fields that can be exported
1354 * @param bool $prefix
1358 static function &export($prefix = false) {
1359 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'contact', $prefix, array());