Merge pull request #23178 from civicrm/5.49
[civicrm-core.git] / CRM / Contact / DAO / Contact.php
1 <?php
2
3 /**
4 * @package CRM
5 * @copyright CiviCRM LLC https://civicrm.org/licensing
6 *
7 * Generated from xml/schema/CRM/Contact/Contact.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:67196fefde2ec151c97d463869102e21)
10 */
11
12 /**
13 * Database access object for the Contact entity.
14 */
15 class CRM_Contact_DAO_Contact extends CRM_Core_DAO {
16 const EXT = 'civicrm';
17 const TABLE_ADDED = '1.1';
18
19 /**
20 * Static instance to hold the table name.
21 *
22 * @var string
23 */
24 public static $_tableName = 'civicrm_contact';
25
26 /**
27 * Icon associated with this entity.
28 *
29 * @var string
30 */
31 public static $_icon = 'fa-address-book-o';
32
33 /**
34 * Field to show when displaying a record.
35 *
36 * @var string
37 */
38 public static $_labelField = 'display_name';
39
40 /**
41 * Should CiviCRM log any modifications to this table in the civicrm_log table.
42 *
43 * @var bool
44 */
45 public static $_log = TRUE;
46
47 /**
48 * Paths for accessing this entity in the UI.
49 *
50 * @var string[]
51 */
52 protected static $_paths = [
53 'add' => 'civicrm/contact/add?reset=1&ct=[contact_type]',
54 'view' => 'civicrm/contact/view?reset=1&cid=[id]',
55 'update' => 'civicrm/contact/add?reset=1&action=update&cid=[id]',
56 'delete' => 'civicrm/contact/view/delete?reset=1&delete=1&cid=[id]',
57 ];
58
59 /**
60 * Unique Contact ID
61 *
62 * @var int|string|null
63 * (SQL type: int unsigned)
64 * Note that values will be retrieved from the database as a string.
65 */
66 public $id;
67
68 /**
69 * Type of Contact.
70 *
71 * @var string|null
72 * (SQL type: varchar(64))
73 * Note that values will be retrieved from the database as a string.
74 */
75 public $contact_type;
76
77 /**
78 * May be used to over-ride contact view and edit templates.
79 *
80 * @var string|null
81 * (SQL type: varchar(255))
82 * Note that values will be retrieved from the database as a string.
83 */
84 public $contact_sub_type;
85
86 /**
87 * @var bool|string
88 * (SQL type: tinyint)
89 * Note that values will be retrieved from the database as a string.
90 */
91 public $do_not_email;
92
93 /**
94 * @var bool|string
95 * (SQL type: tinyint)
96 * Note that values will be retrieved from the database as a string.
97 */
98 public $do_not_phone;
99
100 /**
101 * @var bool|string
102 * (SQL type: tinyint)
103 * Note that values will be retrieved from the database as a string.
104 */
105 public $do_not_mail;
106
107 /**
108 * @var bool|string
109 * (SQL type: tinyint)
110 * Note that values will be retrieved from the database as a string.
111 */
112 public $do_not_sms;
113
114 /**
115 * @var bool|string
116 * (SQL type: tinyint)
117 * Note that values will be retrieved from the database as a string.
118 */
119 public $do_not_trade;
120
121 /**
122 * Has the contact opted out from receiving all bulk email from the organization or site domain?
123 *
124 * @var bool|string
125 * (SQL type: tinyint)
126 * Note that values will be retrieved from the database as a string.
127 */
128 public $is_opt_out;
129
130 /**
131 * May be used for SSN, EIN/TIN, Household ID (census) or other applicable unique legal/government ID.
132 *
133 * @var string|null
134 * (SQL type: varchar(32))
135 * Note that values will be retrieved from the database as a string.
136 */
137 public $legal_identifier;
138
139 /**
140 * Unique trusted external ID (generally from a legacy app/datasource). Particularly useful for deduping operations.
141 *
142 * @var string|null
143 * (SQL type: varchar(64))
144 * Note that values will be retrieved from the database as a string.
145 */
146 public $external_identifier;
147
148 /**
149 * Name used for sorting different contact types
150 *
151 * @var string|null
152 * (SQL type: varchar(128))
153 * Note that values will be retrieved from the database as a string.
154 */
155 public $sort_name;
156
157 /**
158 * Formatted name representing preferred format for display/print/other output.
159 *
160 * @var string|null
161 * (SQL type: varchar(128))
162 * Note that values will be retrieved from the database as a string.
163 */
164 public $display_name;
165
166 /**
167 * Nickname.
168 *
169 * @var string|null
170 * (SQL type: varchar(128))
171 * Note that values will be retrieved from the database as a string.
172 */
173 public $nick_name;
174
175 /**
176 * Legal Name.
177 *
178 * @var string|null
179 * (SQL type: varchar(128))
180 * Note that values will be retrieved from the database as a string.
181 */
182 public $legal_name;
183
184 /**
185 * optional URL for preferred image (photo, logo, etc.) to display for this contact.
186 *
187 * @var string|null
188 * (SQL type: text)
189 * Note that values will be retrieved from the database as a string.
190 */
191 public $image_URL;
192
193 /**
194 * What is the preferred mode of communication.
195 *
196 * @var string|null
197 * (SQL type: varchar(255))
198 * Note that values will be retrieved from the database as a string.
199 */
200 public $preferred_communication_method;
201
202 /**
203 * Which language is preferred for communication. FK to languages in civicrm_option_value.
204 *
205 * @var string|null
206 * (SQL type: varchar(5))
207 * Note that values will be retrieved from the database as a string.
208 */
209 public $preferred_language;
210
211 /**
212 * What is the preferred mode of sending an email.
213 *
214 * @var string|null
215 * (SQL type: varchar(8))
216 * Note that values will be retrieved from the database as a string.
217 */
218 public $preferred_mail_format;
219
220 /**
221 * Key for validating requests related to this contact.
222 *
223 * @var string|null
224 * (SQL type: varchar(32))
225 * Note that values will be retrieved from the database as a string.
226 */
227 public $hash;
228
229 /**
230 * API Key for validating requests related to this contact.
231 *
232 * @var string|null
233 * (SQL type: varchar(32))
234 * Note that values will be retrieved from the database as a string.
235 */
236 public $api_key;
237
238 /**
239 * where contact come from, e.g. import, donate module insert...
240 *
241 * @var string|null
242 * (SQL type: varchar(255))
243 * Note that values will be retrieved from the database as a string.
244 */
245 public $source;
246
247 /**
248 * First Name.
249 *
250 * @var string|null
251 * (SQL type: varchar(64))
252 * Note that values will be retrieved from the database as a string.
253 */
254 public $first_name;
255
256 /**
257 * Middle Name.
258 *
259 * @var string|null
260 * (SQL type: varchar(64))
261 * Note that values will be retrieved from the database as a string.
262 */
263 public $middle_name;
264
265 /**
266 * Last Name.
267 *
268 * @var string|null
269 * (SQL type: varchar(64))
270 * Note that values will be retrieved from the database as a string.
271 */
272 public $last_name;
273
274 /**
275 * Prefix or Title for name (Ms, Mr...). FK to prefix ID
276 *
277 * @var int|string|null
278 * (SQL type: int unsigned)
279 * Note that values will be retrieved from the database as a string.
280 */
281 public $prefix_id;
282
283 /**
284 * Suffix for name (Jr, Sr...). FK to suffix ID
285 *
286 * @var int|string|null
287 * (SQL type: int unsigned)
288 * Note that values will be retrieved from the database as a string.
289 */
290 public $suffix_id;
291
292 /**
293 * Formal (academic or similar) title in front of name. (Prof., Dr. etc.)
294 *
295 * @var string|null
296 * (SQL type: varchar(64))
297 * Note that values will be retrieved from the database as a string.
298 */
299 public $formal_title;
300
301 /**
302 * Communication style (e.g. formal vs. familiar) to use with this contact. FK to communication styles in civicrm_option_value.
303 *
304 * @var int|string|null
305 * (SQL type: int unsigned)
306 * Note that values will be retrieved from the database as a string.
307 */
308 public $communication_style_id;
309
310 /**
311 * FK to civicrm_option_value.id, that has to be valid registered Email Greeting.
312 *
313 * @var int|string|null
314 * (SQL type: int unsigned)
315 * Note that values will be retrieved from the database as a string.
316 */
317 public $email_greeting_id;
318
319 /**
320 * Custom Email Greeting.
321 *
322 * @var string|null
323 * (SQL type: varchar(128))
324 * Note that values will be retrieved from the database as a string.
325 */
326 public $email_greeting_custom;
327
328 /**
329 * Cache Email Greeting.
330 *
331 * @var string|null
332 * (SQL type: varchar(255))
333 * Note that values will be retrieved from the database as a string.
334 */
335 public $email_greeting_display;
336
337 /**
338 * FK to civicrm_option_value.id, that has to be valid registered Postal Greeting.
339 *
340 * @var int|string|null
341 * (SQL type: int unsigned)
342 * Note that values will be retrieved from the database as a string.
343 */
344 public $postal_greeting_id;
345
346 /**
347 * Custom Postal greeting.
348 *
349 * @var string|null
350 * (SQL type: varchar(128))
351 * Note that values will be retrieved from the database as a string.
352 */
353 public $postal_greeting_custom;
354
355 /**
356 * Cache Postal greeting.
357 *
358 * @var string|null
359 * (SQL type: varchar(255))
360 * Note that values will be retrieved from the database as a string.
361 */
362 public $postal_greeting_display;
363
364 /**
365 * FK to civicrm_option_value.id, that has to be valid registered Addressee.
366 *
367 * @var int|string|null
368 * (SQL type: int unsigned)
369 * Note that values will be retrieved from the database as a string.
370 */
371 public $addressee_id;
372
373 /**
374 * Custom Addressee.
375 *
376 * @var string|null
377 * (SQL type: varchar(128))
378 * Note that values will be retrieved from the database as a string.
379 */
380 public $addressee_custom;
381
382 /**
383 * Cache Addressee.
384 *
385 * @var string|null
386 * (SQL type: varchar(255))
387 * Note that values will be retrieved from the database as a string.
388 */
389 public $addressee_display;
390
391 /**
392 * Job Title
393 *
394 * @var string|null
395 * (SQL type: varchar(255))
396 * Note that values will be retrieved from the database as a string.
397 */
398 public $job_title;
399
400 /**
401 * FK to gender ID
402 *
403 * @var int|string|null
404 * (SQL type: int unsigned)
405 * Note that values will be retrieved from the database as a string.
406 */
407 public $gender_id;
408
409 /**
410 * Date of birth
411 *
412 * @var string|null
413 * (SQL type: date)
414 * Note that values will be retrieved from the database as a string.
415 */
416 public $birth_date;
417
418 /**
419 * @var bool|string
420 * (SQL type: tinyint)
421 * Note that values will be retrieved from the database as a string.
422 */
423 public $is_deceased;
424
425 /**
426 * Date of deceased
427 *
428 * @var string|null
429 * (SQL type: date)
430 * Note that values will be retrieved from the database as a string.
431 */
432 public $deceased_date;
433
434 /**
435 * Household Name.
436 *
437 * @var string|null
438 * (SQL type: varchar(128))
439 * Note that values will be retrieved from the database as a string.
440 */
441 public $household_name;
442
443 /**
444 * Optional FK to Primary Contact for this household.
445 *
446 * @var int|string|null
447 * (SQL type: int unsigned)
448 * Note that values will be retrieved from the database as a string.
449 */
450 public $primary_contact_id;
451
452 /**
453 * Organization Name.
454 *
455 * @var string|null
456 * (SQL type: varchar(128))
457 * Note that values will be retrieved from the database as a string.
458 */
459 public $organization_name;
460
461 /**
462 * Standard Industry Classification Code.
463 *
464 * @var string|null
465 * (SQL type: varchar(8))
466 * Note that values will be retrieved from the database as a string.
467 */
468 public $sic_code;
469
470 /**
471 * the OpenID (or OpenID-style http://username.domain/) unique identifier for this contact mainly used for logging in to CiviCRM
472 *
473 * @var string|null
474 * (SQL type: varchar(255))
475 * Note that values will be retrieved from the database as a string.
476 */
477 public $user_unique_id;
478
479 /**
480 * OPTIONAL FK to civicrm_contact record.
481 *
482 * @var int|string|null
483 * (SQL type: int unsigned)
484 * Note that values will be retrieved from the database as a string.
485 */
486 public $employer_id;
487
488 /**
489 * @var bool|string
490 * (SQL type: tinyint)
491 * Note that values will be retrieved from the database as a string.
492 */
493 public $is_deleted;
494
495 /**
496 * When was the contact was created.
497 *
498 * @var string
499 * (SQL type: timestamp)
500 * Note that values will be retrieved from the database as a string.
501 */
502 public $created_date;
503
504 /**
505 * When was the contact (or closely related entity) was created or modified or deleted.
506 *
507 * @var string
508 * (SQL type: timestamp)
509 * Note that values will be retrieved from the database as a string.
510 */
511 public $modified_date;
512
513 /**
514 * Class constructor.
515 */
516 public function __construct() {
517 $this->__table = 'civicrm_contact';
518 parent::__construct();
519 }
520
521 /**
522 * Returns localized title of this entity.
523 *
524 * @param bool $plural
525 * Whether to return the plural version of the title.
526 */
527 public static function getEntityTitle($plural = FALSE) {
528 return $plural ? ts('Contacts') : ts('Contact');
529 }
530
531 /**
532 * Returns user-friendly description of this entity.
533 *
534 * @return string
535 */
536 public static function getEntityDescription() {
537 return ts('Individuals, organizations, households, etc.');
538 }
539
540 /**
541 * Returns foreign keys and entity references.
542 *
543 * @return array
544 * [CRM_Core_Reference_Interface]
545 */
546 public static function getReferenceColumns() {
547 if (!isset(Civi::$statics[__CLASS__]['links'])) {
548 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
549 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'primary_contact_id', 'civicrm_contact', 'id');
550 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'employer_id', 'civicrm_contact', 'id');
551 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
552 }
553 return Civi::$statics[__CLASS__]['links'];
554 }
555
556 /**
557 * Returns all the column names of this table
558 *
559 * @return array
560 */
561 public static function &fields() {
562 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
563 Civi::$statics[__CLASS__]['fields'] = [
564 'id' => [
565 'name' => 'id',
566 'type' => CRM_Utils_Type::T_INT,
567 'title' => ts('Contact ID'),
568 'description' => ts('Unique Contact ID'),
569 'required' => TRUE,
570 'import' => TRUE,
571 'where' => 'civicrm_contact.id',
572 'headerPattern' => '/internal|contact?|id$/i',
573 'export' => TRUE,
574 'table_name' => 'civicrm_contact',
575 'entity' => 'Contact',
576 'bao' => 'CRM_Contact_BAO_Contact',
577 'localizable' => 0,
578 'html' => [
579 'type' => 'Number',
580 ],
581 'readonly' => TRUE,
582 'add' => '1.1',
583 ],
584 'contact_type' => [
585 'name' => 'contact_type',
586 'type' => CRM_Utils_Type::T_STRING,
587 'title' => ts('Contact Type'),
588 'description' => ts('Type of Contact.'),
589 'maxlength' => 64,
590 'size' => CRM_Utils_Type::BIG,
591 'where' => 'civicrm_contact.contact_type',
592 'export' => TRUE,
593 'contactType' => NULL,
594 'table_name' => 'civicrm_contact',
595 'entity' => 'Contact',
596 'bao' => 'CRM_Contact_BAO_Contact',
597 'localizable' => 0,
598 'html' => [
599 'type' => 'Select',
600 ],
601 'pseudoconstant' => [
602 'table' => 'civicrm_contact_type',
603 'keyColumn' => 'name',
604 'labelColumn' => 'label',
605 'condition' => 'parent_id IS NULL',
606 ],
607 'readonly' => TRUE,
608 'add' => '1.1',
609 ],
610 'contact_sub_type' => [
611 'name' => 'contact_sub_type',
612 'type' => CRM_Utils_Type::T_STRING,
613 'title' => ts('Contact Subtype'),
614 'description' => ts('May be used to over-ride contact view and edit templates.'),
615 'maxlength' => 255,
616 'size' => CRM_Utils_Type::HUGE,
617 'import' => TRUE,
618 'where' => 'civicrm_contact.contact_sub_type',
619 'headerPattern' => '/C(ontact )?(subtype|sub-type|sub type)/i',
620 'export' => TRUE,
621 'table_name' => 'civicrm_contact',
622 'entity' => 'Contact',
623 'bao' => 'CRM_Contact_BAO_Contact',
624 'localizable' => 0,
625 'serialize' => self::SERIALIZE_SEPARATOR_BOOKEND,
626 'html' => [
627 'type' => 'Select',
628 ],
629 'pseudoconstant' => [
630 'table' => 'civicrm_contact_type',
631 'keyColumn' => 'name',
632 'labelColumn' => 'label',
633 'condition' => 'parent_id IS NOT NULL',
634 ],
635 'add' => '1.5',
636 ],
637 'do_not_email' => [
638 'name' => 'do_not_email',
639 'type' => CRM_Utils_Type::T_BOOLEAN,
640 'title' => ts('Do Not Email'),
641 'required' => TRUE,
642 'import' => TRUE,
643 'where' => 'civicrm_contact.do_not_email',
644 'headerPattern' => '/d(o )?(not )?(email)/i',
645 'dataPattern' => '/^\d{1,}$/',
646 'export' => TRUE,
647 'default' => '0',
648 'table_name' => 'civicrm_contact',
649 'entity' => 'Contact',
650 'bao' => 'CRM_Contact_BAO_Contact',
651 'localizable' => 0,
652 'html' => [
653 'type' => 'CheckBox',
654 'label' => ts("Do Not Email"),
655 ],
656 'add' => '1.1',
657 ],
658 'do_not_phone' => [
659 'name' => 'do_not_phone',
660 'type' => CRM_Utils_Type::T_BOOLEAN,
661 'title' => ts('Do Not Phone'),
662 'required' => TRUE,
663 'import' => TRUE,
664 'where' => 'civicrm_contact.do_not_phone',
665 'headerPattern' => '/d(o )?(not )?(call|phone)/i',
666 'dataPattern' => '/^\d{1,}$/',
667 'export' => TRUE,
668 'default' => '0',
669 'table_name' => 'civicrm_contact',
670 'entity' => 'Contact',
671 'bao' => 'CRM_Contact_BAO_Contact',
672 'localizable' => 0,
673 'html' => [
674 'type' => 'CheckBox',
675 'label' => ts("Do Not Phone"),
676 ],
677 'add' => '1.1',
678 ],
679 'do_not_mail' => [
680 'name' => 'do_not_mail',
681 'type' => CRM_Utils_Type::T_BOOLEAN,
682 'title' => ts('Do Not Mail'),
683 'required' => TRUE,
684 'import' => TRUE,
685 'where' => 'civicrm_contact.do_not_mail',
686 'headerPattern' => '/^(d(o\s)?n(ot\s)?mail)|(\w*)?bulk\s?(\w*)$/i',
687 'dataPattern' => '/^\d{1,}$/',
688 'export' => TRUE,
689 'default' => '0',
690 'table_name' => 'civicrm_contact',
691 'entity' => 'Contact',
692 'bao' => 'CRM_Contact_BAO_Contact',
693 'localizable' => 0,
694 'html' => [
695 'type' => 'CheckBox',
696 'label' => ts("Do Not Mail"),
697 ],
698 'add' => '1.1',
699 ],
700 'do_not_sms' => [
701 'name' => 'do_not_sms',
702 'type' => CRM_Utils_Type::T_BOOLEAN,
703 'title' => ts('Do Not Sms'),
704 'required' => TRUE,
705 'import' => TRUE,
706 'where' => 'civicrm_contact.do_not_sms',
707 'headerPattern' => '/d(o )?(not )?(sms)/i',
708 'dataPattern' => '/^\d{1,}$/',
709 'export' => TRUE,
710 'default' => '0',
711 'table_name' => 'civicrm_contact',
712 'entity' => 'Contact',
713 'bao' => 'CRM_Contact_BAO_Contact',
714 'localizable' => 0,
715 'html' => [
716 'type' => 'CheckBox',
717 'label' => ts("Do Not Sms"),
718 ],
719 'add' => '3.0',
720 ],
721 'do_not_trade' => [
722 'name' => 'do_not_trade',
723 'type' => CRM_Utils_Type::T_BOOLEAN,
724 'title' => ts('Do Not Trade'),
725 'required' => TRUE,
726 'import' => TRUE,
727 'where' => 'civicrm_contact.do_not_trade',
728 'headerPattern' => '/d(o )?(not )?(trade)/i',
729 'dataPattern' => '/^\d{1,}$/',
730 'export' => TRUE,
731 'default' => '0',
732 'table_name' => 'civicrm_contact',
733 'entity' => 'Contact',
734 'bao' => 'CRM_Contact_BAO_Contact',
735 'localizable' => 0,
736 'html' => [
737 'type' => 'CheckBox',
738 'label' => ts("Do Not Trade"),
739 ],
740 'add' => '1.1',
741 ],
742 'is_opt_out' => [
743 'name' => 'is_opt_out',
744 'type' => CRM_Utils_Type::T_BOOLEAN,
745 'title' => ts('No Bulk Emails (User Opt Out)'),
746 'description' => ts('Has the contact opted out from receiving all bulk email from the organization or site domain?'),
747 'required' => TRUE,
748 'import' => TRUE,
749 'where' => 'civicrm_contact.is_opt_out',
750 'export' => TRUE,
751 'default' => '0',
752 'table_name' => 'civicrm_contact',
753 'entity' => 'Contact',
754 'bao' => 'CRM_Contact_BAO_Contact',
755 'localizable' => 0,
756 'html' => [
757 'type' => 'CheckBox',
758 'label' => ts("Is Opt Out"),
759 ],
760 'add' => '1.1',
761 ],
762 'legal_identifier' => [
763 'name' => 'legal_identifier',
764 'type' => CRM_Utils_Type::T_STRING,
765 'title' => ts('Legal Identifier'),
766 'description' => ts('May be used for SSN, EIN/TIN, Household ID (census) or other applicable unique legal/government ID.'),
767 'maxlength' => 32,
768 'size' => CRM_Utils_Type::MEDIUM,
769 'import' => TRUE,
770 'where' => 'civicrm_contact.legal_identifier',
771 'headerPattern' => '/legal\s?id/i',
772 'dataPattern' => '/\w+?\d{5,}/',
773 'export' => TRUE,
774 'table_name' => 'civicrm_contact',
775 'entity' => 'Contact',
776 'bao' => 'CRM_Contact_BAO_Contact',
777 'localizable' => 0,
778 'html' => [
779 'type' => 'Text',
780 'label' => ts("Legal Identifier"),
781 ],
782 'add' => '1.1',
783 ],
784 'external_identifier' => [
785 'name' => 'external_identifier',
786 'type' => CRM_Utils_Type::T_STRING,
787 'title' => ts('External Identifier'),
788 'description' => ts('Unique trusted external ID (generally from a legacy app/datasource). Particularly useful for deduping operations.'),
789 'maxlength' => 64,
790 'size' => 8,
791 'import' => TRUE,
792 'where' => 'civicrm_contact.external_identifier',
793 'headerPattern' => '/external\s?id/i',
794 'dataPattern' => '/^\d{11,}$/',
795 'export' => TRUE,
796 'table_name' => 'civicrm_contact',
797 'entity' => 'Contact',
798 'bao' => 'CRM_Contact_BAO_Contact',
799 'localizable' => 0,
800 'html' => [
801 'type' => 'Text',
802 'label' => ts("External Identifier"),
803 ],
804 'add' => '1.1',
805 ],
806 'sort_name' => [
807 'name' => 'sort_name',
808 'type' => CRM_Utils_Type::T_STRING,
809 'title' => ts('Sort Name'),
810 'description' => ts('Name used for sorting different contact types'),
811 'maxlength' => 128,
812 'size' => 30,
813 'where' => 'civicrm_contact.sort_name',
814 'export' => TRUE,
815 'table_name' => 'civicrm_contact',
816 'entity' => 'Contact',
817 'bao' => 'CRM_Contact_BAO_Contact',
818 'localizable' => 0,
819 'html' => [
820 'type' => 'Text',
821 ],
822 'readonly' => TRUE,
823 'add' => '1.1',
824 ],
825 'display_name' => [
826 'name' => 'display_name',
827 'type' => CRM_Utils_Type::T_STRING,
828 'title' => ts('Display Name'),
829 'description' => ts('Formatted name representing preferred format for display/print/other output.'),
830 'maxlength' => 128,
831 'size' => 30,
832 'where' => 'civicrm_contact.display_name',
833 'export' => TRUE,
834 'table_name' => 'civicrm_contact',
835 'entity' => 'Contact',
836 'bao' => 'CRM_Contact_BAO_Contact',
837 'localizable' => 0,
838 'html' => [
839 'type' => 'Text',
840 ],
841 'readonly' => TRUE,
842 'add' => '1.1',
843 ],
844 'nick_name' => [
845 'name' => 'nick_name',
846 'type' => CRM_Utils_Type::T_STRING,
847 'title' => ts('Nickname'),
848 'description' => ts('Nickname.'),
849 'maxlength' => 128,
850 'size' => 30,
851 'import' => TRUE,
852 'where' => 'civicrm_contact.nick_name',
853 'headerPattern' => '/n(ick\s)name|nick$/i',
854 'dataPattern' => '/^\w+$/',
855 'export' => TRUE,
856 'table_name' => 'civicrm_contact',
857 'entity' => 'Contact',
858 'bao' => 'CRM_Contact_BAO_Contact',
859 'localizable' => 0,
860 'html' => [
861 'type' => 'Text',
862 ],
863 'add' => '1.1',
864 ],
865 'legal_name' => [
866 'name' => 'legal_name',
867 'type' => CRM_Utils_Type::T_STRING,
868 'title' => ts('Legal Name'),
869 'description' => ts('Legal Name.'),
870 'maxlength' => 128,
871 'size' => 30,
872 'import' => TRUE,
873 'where' => 'civicrm_contact.legal_name',
874 'headerPattern' => '/^legal|(l(egal\s)?name)$/i',
875 'export' => TRUE,
876 'contactType' => 'Organization',
877 'table_name' => 'civicrm_contact',
878 'entity' => 'Contact',
879 'bao' => 'CRM_Contact_BAO_Contact',
880 'localizable' => 0,
881 'html' => [
882 'type' => 'Text',
883 'label' => ts("Legal Name"),
884 ],
885 'add' => '1.1',
886 ],
887 'image_URL' => [
888 'name' => 'image_URL',
889 'type' => CRM_Utils_Type::T_TEXT,
890 'title' => ts('Image Url'),
891 'description' => ts('optional URL for preferred image (photo, logo, etc.) to display for this contact.'),
892 'import' => TRUE,
893 'where' => 'civicrm_contact.image_URL',
894 'export' => TRUE,
895 'table_name' => 'civicrm_contact',
896 'entity' => 'Contact',
897 'bao' => 'CRM_Contact_BAO_Contact',
898 'localizable' => 0,
899 'html' => [
900 'type' => 'File',
901 'label' => ts("Image URL"),
902 ],
903 'add' => '1.1',
904 ],
905 'preferred_communication_method' => [
906 'name' => 'preferred_communication_method',
907 'type' => CRM_Utils_Type::T_STRING,
908 'title' => ts('Preferred Communication Method'),
909 'description' => ts('What is the preferred mode of communication.'),
910 'maxlength' => 255,
911 'size' => CRM_Utils_Type::HUGE,
912 'import' => TRUE,
913 'where' => 'civicrm_contact.preferred_communication_method',
914 'headerPattern' => '/^p(ref\w*\s)?c(omm\w*)|( meth\w*)$/i',
915 'dataPattern' => '/^\w+$/',
916 'export' => TRUE,
917 'table_name' => 'civicrm_contact',
918 'entity' => 'Contact',
919 'bao' => 'CRM_Contact_BAO_Contact',
920 'localizable' => 0,
921 'serialize' => self::SERIALIZE_SEPARATOR_BOOKEND,
922 'html' => [
923 'type' => 'Select',
924 ],
925 'pseudoconstant' => [
926 'optionGroupName' => 'preferred_communication_method',
927 'optionEditPath' => 'civicrm/admin/options/preferred_communication_method',
928 ],
929 'add' => '1.1',
930 ],
931 'preferred_language' => [
932 'name' => 'preferred_language',
933 'type' => CRM_Utils_Type::T_STRING,
934 'title' => ts('Preferred Language'),
935 'description' => ts('Which language is preferred for communication. FK to languages in civicrm_option_value.'),
936 'maxlength' => 5,
937 'size' => CRM_Utils_Type::SIX,
938 'import' => TRUE,
939 'where' => 'civicrm_contact.preferred_language',
940 'headerPattern' => '/^lang/i',
941 'export' => TRUE,
942 'table_name' => 'civicrm_contact',
943 'entity' => 'Contact',
944 'bao' => 'CRM_Contact_BAO_Contact',
945 'localizable' => 0,
946 'html' => [
947 'type' => 'Select',
948 ],
949 'pseudoconstant' => [
950 'optionGroupName' => 'languages',
951 'keyColumn' => 'name',
952 'optionEditPath' => 'civicrm/admin/options/languages',
953 ],
954 'add' => '3.2',
955 ],
956 'preferred_mail_format' => [
957 'name' => 'preferred_mail_format',
958 'type' => CRM_Utils_Type::T_STRING,
959 'title' => ts('Preferred Mail Format'),
960 'description' => ts('What is the preferred mode of sending an email.'),
961 'maxlength' => 8,
962 'size' => CRM_Utils_Type::EIGHT,
963 'import' => TRUE,
964 'where' => 'civicrm_contact.preferred_mail_format',
965 'headerPattern' => '/^p(ref\w*\s)?m(ail\s)?f(orm\w*)$/i',
966 'export' => TRUE,
967 'default' => 'Both',
968 'table_name' => 'civicrm_contact',
969 'entity' => 'Contact',
970 'bao' => 'CRM_Contact_BAO_Contact',
971 'localizable' => 0,
972 'html' => [
973 'type' => 'Select',
974 'label' => ts("Preferred Mail Format"),
975 ],
976 'pseudoconstant' => [
977 'callback' => 'CRM_Core_SelectValues::pmf',
978 ],
979 'add' => '1.1',
980 ],
981 'hash' => [
982 'name' => 'hash',
983 'type' => CRM_Utils_Type::T_STRING,
984 'title' => ts('Contact Hash'),
985 'description' => ts('Key for validating requests related to this contact.'),
986 'maxlength' => 32,
987 'size' => CRM_Utils_Type::MEDIUM,
988 'where' => 'civicrm_contact.hash',
989 'export' => TRUE,
990 'table_name' => 'civicrm_contact',
991 'entity' => 'Contact',
992 'bao' => 'CRM_Contact_BAO_Contact',
993 'localizable' => 0,
994 'readonly' => TRUE,
995 'add' => '1.1',
996 ],
997 'api_key' => [
998 'name' => 'api_key',
999 'type' => CRM_Utils_Type::T_STRING,
1000 'title' => ts('Api Key'),
1001 'description' => ts('API Key for validating requests related to this contact.'),
1002 'maxlength' => 32,
1003 'size' => CRM_Utils_Type::MEDIUM,
1004 'where' => 'civicrm_contact.api_key',
1005 'permission' => [
1006 [
1007 'administer CiviCRM',
1008 'edit api keys',
1009 ],
1010 ],
1011 'table_name' => 'civicrm_contact',
1012 'entity' => 'Contact',
1013 'bao' => 'CRM_Contact_BAO_Contact',
1014 'localizable' => 0,
1015 'html' => [
1016 'label' => ts("API KEY"),
1017 ],
1018 'readonly' => TRUE,
1019 'add' => '2.2',
1020 ],
1021 'contact_source' => [
1022 'name' => 'source',
1023 'type' => CRM_Utils_Type::T_STRING,
1024 'title' => ts('Contact Source'),
1025 'description' => ts('where contact come from, e.g. import, donate module insert...'),
1026 'maxlength' => 255,
1027 'size' => 30,
1028 'import' => TRUE,
1029 'where' => 'civicrm_contact.source',
1030 'headerPattern' => '/(C(ontact\s)?Source)$/i',
1031 'export' => TRUE,
1032 'table_name' => 'civicrm_contact',
1033 'entity' => 'Contact',
1034 'bao' => 'CRM_Contact_BAO_Contact',
1035 'localizable' => 0,
1036 'html' => [
1037 'type' => 'Text',
1038 ],
1039 'add' => '1.1',
1040 ],
1041 'first_name' => [
1042 'name' => 'first_name',
1043 'type' => CRM_Utils_Type::T_STRING,
1044 'title' => ts('First Name'),
1045 'description' => ts('First Name.'),
1046 'maxlength' => 64,
1047 'size' => 30,
1048 'import' => TRUE,
1049 'where' => 'civicrm_contact.first_name',
1050 'headerPattern' => '/^first|(f(irst\s)?name)$/i',
1051 'dataPattern' => '/^\w+$/',
1052 'export' => TRUE,
1053 'contactType' => 'Individual',
1054 'table_name' => 'civicrm_contact',
1055 'entity' => 'Contact',
1056 'bao' => 'CRM_Contact_BAO_Contact',
1057 'localizable' => 0,
1058 'html' => [
1059 'type' => 'Text',
1060 'label' => ts("First Name"),
1061 ],
1062 'add' => '1.1',
1063 ],
1064 'middle_name' => [
1065 'name' => 'middle_name',
1066 'type' => CRM_Utils_Type::T_STRING,
1067 'title' => ts('Middle Name'),
1068 'description' => ts('Middle Name.'),
1069 'maxlength' => 64,
1070 'size' => 30,
1071 'import' => TRUE,
1072 'where' => 'civicrm_contact.middle_name',
1073 'headerPattern' => '/^middle|(m(iddle\s)?name)$/i',
1074 'dataPattern' => '/^\w+$/',
1075 'export' => TRUE,
1076 'contactType' => 'Individual',
1077 'table_name' => 'civicrm_contact',
1078 'entity' => 'Contact',
1079 'bao' => 'CRM_Contact_BAO_Contact',
1080 'localizable' => 0,
1081 'html' => [
1082 'type' => 'Text',
1083 'label' => ts("Middle Name"),
1084 ],
1085 'add' => '1.1',
1086 ],
1087 'last_name' => [
1088 'name' => 'last_name',
1089 'type' => CRM_Utils_Type::T_STRING,
1090 'title' => ts('Last Name'),
1091 'description' => ts('Last Name.'),
1092 'maxlength' => 64,
1093 'size' => 30,
1094 'import' => TRUE,
1095 'where' => 'civicrm_contact.last_name',
1096 'headerPattern' => '/^last|(l(ast\s)?name)$/i',
1097 'dataPattern' => '/^\w+(\s\w+)?+$/',
1098 'export' => TRUE,
1099 'contactType' => 'Individual',
1100 'table_name' => 'civicrm_contact',
1101 'entity' => 'Contact',
1102 'bao' => 'CRM_Contact_BAO_Contact',
1103 'localizable' => 0,
1104 'html' => [
1105 'type' => 'Text',
1106 'label' => ts("Last Name"),
1107 ],
1108 'add' => '1.1',
1109 ],
1110 'prefix_id' => [
1111 'name' => 'prefix_id',
1112 'type' => CRM_Utils_Type::T_INT,
1113 'title' => ts('Individual Prefix'),
1114 'description' => ts('Prefix or Title for name (Ms, Mr...). FK to prefix ID'),
1115 'import' => TRUE,
1116 'where' => 'civicrm_contact.prefix_id',
1117 'headerPattern' => '/^(prefix|title)/i',
1118 'dataPattern' => '/^(mr|ms|mrs|sir|dr)\.?$/i',
1119 'export' => TRUE,
1120 'contactType' => 'Individual',
1121 'table_name' => 'civicrm_contact',
1122 'entity' => 'Contact',
1123 'bao' => 'CRM_Contact_BAO_Contact',
1124 'localizable' => 0,
1125 'html' => [
1126 'type' => 'Select',
1127 ],
1128 'pseudoconstant' => [
1129 'optionGroupName' => 'individual_prefix',
1130 'optionEditPath' => 'civicrm/admin/options/individual_prefix',
1131 ],
1132 'add' => '1.2',
1133 ],
1134 'suffix_id' => [
1135 'name' => 'suffix_id',
1136 'type' => CRM_Utils_Type::T_INT,
1137 'title' => ts('Individual Suffix'),
1138 'description' => ts('Suffix for name (Jr, Sr...). FK to suffix ID'),
1139 'import' => TRUE,
1140 'where' => 'civicrm_contact.suffix_id',
1141 'headerPattern' => '/^suffix$/i',
1142 'dataPattern' => '/^(sr|jr)\.?|i{2,}$/',
1143 'export' => TRUE,
1144 'contactType' => 'Individual',
1145 'table_name' => 'civicrm_contact',
1146 'entity' => 'Contact',
1147 'bao' => 'CRM_Contact_BAO_Contact',
1148 'localizable' => 0,
1149 'html' => [
1150 'type' => 'Select',
1151 ],
1152 'pseudoconstant' => [
1153 'optionGroupName' => 'individual_suffix',
1154 'optionEditPath' => 'civicrm/admin/options/individual_suffix',
1155 ],
1156 'add' => '1.2',
1157 ],
1158 'formal_title' => [
1159 'name' => 'formal_title',
1160 'type' => CRM_Utils_Type::T_STRING,
1161 'title' => ts('Formal Title'),
1162 'description' => ts('Formal (academic or similar) title in front of name. (Prof., Dr. etc.)'),
1163 'maxlength' => 64,
1164 'size' => CRM_Utils_Type::BIG,
1165 'import' => TRUE,
1166 'where' => 'civicrm_contact.formal_title',
1167 'headerPattern' => '/^title/i',
1168 'export' => TRUE,
1169 'contactType' => 'Individual',
1170 'table_name' => 'civicrm_contact',
1171 'entity' => 'Contact',
1172 'bao' => 'CRM_Contact_BAO_Contact',
1173 'localizable' => 0,
1174 'html' => [
1175 'type' => 'Text',
1176 'label' => ts("Formal Title"),
1177 ],
1178 'add' => '4.5',
1179 ],
1180 'communication_style_id' => [
1181 'name' => 'communication_style_id',
1182 'type' => CRM_Utils_Type::T_INT,
1183 'title' => ts('Communication Style'),
1184 'description' => ts('Communication style (e.g. formal vs. familiar) to use with this contact. FK to communication styles in civicrm_option_value.'),
1185 'import' => TRUE,
1186 'where' => 'civicrm_contact.communication_style_id',
1187 'headerPattern' => '/style/i',
1188 'export' => TRUE,
1189 'table_name' => 'civicrm_contact',
1190 'entity' => 'Contact',
1191 'bao' => 'CRM_Contact_BAO_Contact',
1192 'localizable' => 0,
1193 'html' => [
1194 'type' => 'Select',
1195 ],
1196 'pseudoconstant' => [
1197 'optionGroupName' => 'communication_style',
1198 'optionEditPath' => 'civicrm/admin/options/communication_style',
1199 ],
1200 'add' => '4.4',
1201 ],
1202 'email_greeting_id' => [
1203 'name' => 'email_greeting_id',
1204 'type' => CRM_Utils_Type::T_INT,
1205 'title' => ts('Email Greeting ID'),
1206 'description' => ts('FK to civicrm_option_value.id, that has to be valid registered Email Greeting.'),
1207 'where' => 'civicrm_contact.email_greeting_id',
1208 'export' => TRUE,
1209 'table_name' => 'civicrm_contact',
1210 'entity' => 'Contact',
1211 'bao' => 'CRM_Contact_BAO_Contact',
1212 'localizable' => 0,
1213 'html' => [
1214 'type' => 'Select',
1215 ],
1216 'pseudoconstant' => [
1217 'optionGroupName' => 'email_greeting',
1218 'optionEditPath' => 'civicrm/admin/options/email_greeting',
1219 ],
1220 'add' => '3.0',
1221 ],
1222 'email_greeting_custom' => [
1223 'name' => 'email_greeting_custom',
1224 'type' => CRM_Utils_Type::T_STRING,
1225 'title' => ts('Email Greeting Custom'),
1226 'description' => ts('Custom Email Greeting.'),
1227 'maxlength' => 128,
1228 'size' => CRM_Utils_Type::HUGE,
1229 'import' => TRUE,
1230 'where' => 'civicrm_contact.email_greeting_custom',
1231 'export' => FALSE,
1232 'table_name' => 'civicrm_contact',
1233 'entity' => 'Contact',
1234 'bao' => 'CRM_Contact_BAO_Contact',
1235 'localizable' => 0,
1236 'html' => [
1237 'type' => 'Text',
1238 'label' => ts("Email Greeting Custom"),
1239 ],
1240 'add' => '3.0',
1241 ],
1242 'email_greeting_display' => [
1243 'name' => 'email_greeting_display',
1244 'type' => CRM_Utils_Type::T_STRING,
1245 'title' => ts('Email Greeting'),
1246 'description' => ts('Cache Email Greeting.'),
1247 'maxlength' => 255,
1248 'size' => CRM_Utils_Type::HUGE,
1249 'where' => 'civicrm_contact.email_greeting_display',
1250 'table_name' => 'civicrm_contact',
1251 'entity' => 'Contact',
1252 'bao' => 'CRM_Contact_BAO_Contact',
1253 'localizable' => 0,
1254 'readonly' => TRUE,
1255 'add' => '3.0',
1256 ],
1257 'postal_greeting_id' => [
1258 'name' => 'postal_greeting_id',
1259 'type' => CRM_Utils_Type::T_INT,
1260 'title' => ts('Postal Greeting ID'),
1261 'description' => ts('FK to civicrm_option_value.id, that has to be valid registered Postal Greeting.'),
1262 'where' => 'civicrm_contact.postal_greeting_id',
1263 'export' => TRUE,
1264 'table_name' => 'civicrm_contact',
1265 'entity' => 'Contact',
1266 'bao' => 'CRM_Contact_BAO_Contact',
1267 'localizable' => 0,
1268 'html' => [
1269 'type' => 'Select',
1270 ],
1271 'pseudoconstant' => [
1272 'optionGroupName' => 'postal_greeting',
1273 'optionEditPath' => 'civicrm/admin/options/postal_greeting',
1274 ],
1275 'add' => '3.0',
1276 ],
1277 'postal_greeting_custom' => [
1278 'name' => 'postal_greeting_custom',
1279 'type' => CRM_Utils_Type::T_STRING,
1280 'title' => ts('Postal Greeting Custom'),
1281 'description' => ts('Custom Postal greeting.'),
1282 'maxlength' => 128,
1283 'size' => CRM_Utils_Type::HUGE,
1284 'import' => TRUE,
1285 'where' => 'civicrm_contact.postal_greeting_custom',
1286 'export' => FALSE,
1287 'table_name' => 'civicrm_contact',
1288 'entity' => 'Contact',
1289 'bao' => 'CRM_Contact_BAO_Contact',
1290 'localizable' => 0,
1291 'html' => [
1292 'type' => 'Text',
1293 'label' => ts("Postal Greeting Custom"),
1294 ],
1295 'add' => '3.0',
1296 ],
1297 'postal_greeting_display' => [
1298 'name' => 'postal_greeting_display',
1299 'type' => CRM_Utils_Type::T_STRING,
1300 'title' => ts('Postal Greeting'),
1301 'description' => ts('Cache Postal greeting.'),
1302 'maxlength' => 255,
1303 'size' => CRM_Utils_Type::HUGE,
1304 'where' => 'civicrm_contact.postal_greeting_display',
1305 'table_name' => 'civicrm_contact',
1306 'entity' => 'Contact',
1307 'bao' => 'CRM_Contact_BAO_Contact',
1308 'localizable' => 0,
1309 'readonly' => TRUE,
1310 'add' => '3.0',
1311 ],
1312 'addressee_id' => [
1313 'name' => 'addressee_id',
1314 'type' => CRM_Utils_Type::T_INT,
1315 'title' => ts('Addressee ID'),
1316 'description' => ts('FK to civicrm_option_value.id, that has to be valid registered Addressee.'),
1317 'where' => 'civicrm_contact.addressee_id',
1318 'export' => TRUE,
1319 'table_name' => 'civicrm_contact',
1320 'entity' => 'Contact',
1321 'bao' => 'CRM_Contact_BAO_Contact',
1322 'localizable' => 0,
1323 'html' => [
1324 'type' => 'Select',
1325 ],
1326 'pseudoconstant' => [
1327 'optionGroupName' => 'addressee',
1328 'optionEditPath' => 'civicrm/admin/options/addressee',
1329 ],
1330 'add' => '3.0',
1331 ],
1332 'addressee_custom' => [
1333 'name' => 'addressee_custom',
1334 'type' => CRM_Utils_Type::T_STRING,
1335 'title' => ts('Addressee Custom'),
1336 'description' => ts('Custom Addressee.'),
1337 'maxlength' => 128,
1338 'size' => CRM_Utils_Type::HUGE,
1339 'import' => TRUE,
1340 'where' => 'civicrm_contact.addressee_custom',
1341 'export' => FALSE,
1342 'table_name' => 'civicrm_contact',
1343 'entity' => 'Contact',
1344 'bao' => 'CRM_Contact_BAO_Contact',
1345 'localizable' => 0,
1346 'html' => [
1347 'type' => 'Text',
1348 'label' => ts("Addressee Custom"),
1349 ],
1350 'add' => '3.0',
1351 ],
1352 'addressee_display' => [
1353 'name' => 'addressee_display',
1354 'type' => CRM_Utils_Type::T_STRING,
1355 'title' => ts('Addressee'),
1356 'description' => ts('Cache Addressee.'),
1357 'maxlength' => 255,
1358 'size' => CRM_Utils_Type::HUGE,
1359 'where' => 'civicrm_contact.addressee_display',
1360 'table_name' => 'civicrm_contact',
1361 'entity' => 'Contact',
1362 'bao' => 'CRM_Contact_BAO_Contact',
1363 'localizable' => 0,
1364 'readonly' => TRUE,
1365 'add' => '3.0',
1366 ],
1367 'job_title' => [
1368 'name' => 'job_title',
1369 'type' => CRM_Utils_Type::T_STRING,
1370 'title' => ts('Job Title'),
1371 'description' => ts('Job Title'),
1372 'maxlength' => 255,
1373 'size' => 30,
1374 'import' => TRUE,
1375 'where' => 'civicrm_contact.job_title',
1376 'headerPattern' => '/^job|(j(ob\s)?title)$/i',
1377 'dataPattern' => '//',
1378 'export' => TRUE,
1379 'contactType' => 'Individual',
1380 'table_name' => 'civicrm_contact',
1381 'entity' => 'Contact',
1382 'bao' => 'CRM_Contact_BAO_Contact',
1383 'localizable' => 0,
1384 'html' => [
1385 'type' => 'Text',
1386 'label' => ts("Job Title"),
1387 ],
1388 'add' => '1.1',
1389 ],
1390 'gender_id' => [
1391 'name' => 'gender_id',
1392 'type' => CRM_Utils_Type::T_INT,
1393 'title' => ts('Gender ID'),
1394 'description' => ts('FK to gender ID'),
1395 'import' => TRUE,
1396 'where' => 'civicrm_contact.gender_id',
1397 'headerPattern' => '/^gender$/i',
1398 'export' => TRUE,
1399 'contactType' => 'Individual',
1400 'table_name' => 'civicrm_contact',
1401 'entity' => 'Contact',
1402 'bao' => 'CRM_Contact_BAO_Contact',
1403 'localizable' => 0,
1404 'html' => [
1405 'type' => 'Select',
1406 'label' => ts("Gender"),
1407 ],
1408 'pseudoconstant' => [
1409 'optionGroupName' => 'gender',
1410 'optionEditPath' => 'civicrm/admin/options/gender',
1411 ],
1412 'add' => '1.2',
1413 ],
1414 'birth_date' => [
1415 'name' => 'birth_date',
1416 'type' => CRM_Utils_Type::T_DATE,
1417 'title' => ts('Birth Date'),
1418 'description' => ts('Date of birth'),
1419 'import' => TRUE,
1420 'where' => 'civicrm_contact.birth_date',
1421 'headerPattern' => '/^birth|(b(irth\s)?date)|D(\W*)O(\W*)B(\W*)$/i',
1422 'dataPattern' => '/\d{4}-?\d{2}-?\d{2}/',
1423 'export' => TRUE,
1424 'contactType' => 'Individual',
1425 'table_name' => 'civicrm_contact',
1426 'entity' => 'Contact',
1427 'bao' => 'CRM_Contact_BAO_Contact',
1428 'localizable' => 0,
1429 'html' => [
1430 'type' => 'Select Date',
1431 'formatType' => 'birth',
1432 'label' => ts("Birth Date"),
1433 ],
1434 'add' => '1.1',
1435 ],
1436 'is_deceased' => [
1437 'name' => 'is_deceased',
1438 'type' => CRM_Utils_Type::T_BOOLEAN,
1439 'title' => ts('Deceased'),
1440 'required' => TRUE,
1441 'import' => TRUE,
1442 'where' => 'civicrm_contact.is_deceased',
1443 'headerPattern' => '/i(s\s)?d(eceased)$/i',
1444 'export' => TRUE,
1445 'contactType' => 'Individual',
1446 'default' => '0',
1447 'table_name' => 'civicrm_contact',
1448 'entity' => 'Contact',
1449 'bao' => 'CRM_Contact_BAO_Contact',
1450 'localizable' => 0,
1451 'html' => [
1452 'type' => 'CheckBox',
1453 'label' => ts("Is Deceased"),
1454 ],
1455 'add' => '1.1',
1456 ],
1457 'deceased_date' => [
1458 'name' => 'deceased_date',
1459 'type' => CRM_Utils_Type::T_DATE,
1460 'title' => ts('Deceased Date'),
1461 'description' => ts('Date of deceased'),
1462 'import' => TRUE,
1463 'where' => 'civicrm_contact.deceased_date',
1464 'headerPattern' => '/^deceased|(d(eceased\s)?date)$/i',
1465 'export' => TRUE,
1466 'contactType' => 'Individual',
1467 'table_name' => 'civicrm_contact',
1468 'entity' => 'Contact',
1469 'bao' => 'CRM_Contact_BAO_Contact',
1470 'localizable' => 0,
1471 'html' => [
1472 'type' => 'Select Date',
1473 'formatType' => 'birth',
1474 'label' => ts("Deceased Date"),
1475 ],
1476 'add' => '1.5',
1477 ],
1478 'household_name' => [
1479 'name' => 'household_name',
1480 'type' => CRM_Utils_Type::T_STRING,
1481 'title' => ts('Household Name'),
1482 'description' => ts('Household Name.'),
1483 'maxlength' => 128,
1484 'size' => 30,
1485 'import' => TRUE,
1486 'where' => 'civicrm_contact.household_name',
1487 'headerPattern' => '/^household|(h(ousehold\s)?name)$/i',
1488 'dataPattern' => '/^\w+$/',
1489 'export' => TRUE,
1490 'contactType' => 'Household',
1491 'table_name' => 'civicrm_contact',
1492 'entity' => 'Contact',
1493 'bao' => 'CRM_Contact_BAO_Contact',
1494 'localizable' => 0,
1495 'html' => [
1496 'type' => 'Text',
1497 'label' => ts("Household Name"),
1498 ],
1499 'add' => '1.1',
1500 ],
1501 'primary_contact_id' => [
1502 'name' => 'primary_contact_id',
1503 'type' => CRM_Utils_Type::T_INT,
1504 'title' => ts('Household Primary Contact ID'),
1505 'description' => ts('Optional FK to Primary Contact for this household.'),
1506 'where' => 'civicrm_contact.primary_contact_id',
1507 'contactType' => 'Household',
1508 'table_name' => 'civicrm_contact',
1509 'entity' => 'Contact',
1510 'bao' => 'CRM_Contact_BAO_Contact',
1511 'localizable' => 0,
1512 'FKClassName' => 'CRM_Contact_DAO_Contact',
1513 'html' => [
1514 'label' => ts("Household Primary Contact"),
1515 ],
1516 'readonly' => TRUE,
1517 'add' => '1.1',
1518 ],
1519 'organization_name' => [
1520 'name' => 'organization_name',
1521 'type' => CRM_Utils_Type::T_STRING,
1522 'title' => ts('Organization Name'),
1523 'description' => ts('Organization Name.'),
1524 'maxlength' => 128,
1525 'size' => 30,
1526 'import' => TRUE,
1527 'where' => 'civicrm_contact.organization_name',
1528 'headerPattern' => '/^organization|(o(rganization\s)?name)$/i',
1529 'dataPattern' => '/^\w+$/',
1530 'export' => TRUE,
1531 'contactType' => 'Organization',
1532 'table_name' => 'civicrm_contact',
1533 'entity' => 'Contact',
1534 'bao' => 'CRM_Contact_BAO_Contact',
1535 'localizable' => 0,
1536 'html' => [
1537 'type' => 'Text',
1538 'label' => ts("Organization Name"),
1539 ],
1540 'add' => '1.1',
1541 ],
1542 'sic_code' => [
1543 'name' => 'sic_code',
1544 'type' => CRM_Utils_Type::T_STRING,
1545 'title' => ts('Sic Code'),
1546 'description' => ts('Standard Industry Classification Code.'),
1547 'maxlength' => 8,
1548 'size' => CRM_Utils_Type::EIGHT,
1549 'import' => TRUE,
1550 'where' => 'civicrm_contact.sic_code',
1551 'headerPattern' => '/^sic|(s(ic\s)?code)$/i',
1552 'export' => TRUE,
1553 'contactType' => 'Organization',
1554 'table_name' => 'civicrm_contact',
1555 'entity' => 'Contact',
1556 'bao' => 'CRM_Contact_BAO_Contact',
1557 'localizable' => 0,
1558 'html' => [
1559 'type' => 'Text',
1560 'label' => ts("SIC Code"),
1561 ],
1562 'add' => '1.1',
1563 ],
1564 'user_unique_id' => [
1565 'name' => 'user_unique_id',
1566 'type' => CRM_Utils_Type::T_STRING,
1567 'title' => ts('Unique ID (OpenID)'),
1568 'description' => ts('the OpenID (or OpenID-style http://username.domain/) unique identifier for this contact mainly used for logging in to CiviCRM'),
1569 'maxlength' => 255,
1570 'size' => CRM_Utils_Type::HUGE,
1571 'import' => TRUE,
1572 'where' => 'civicrm_contact.user_unique_id',
1573 'headerPattern' => '/^Open\s?ID|u(niq\w*)?\s?ID/i',
1574 'dataPattern' => '/^[\w\/\:\.]+$/',
1575 'export' => TRUE,
1576 'rule' => 'url',
1577 'table_name' => 'civicrm_contact',
1578 'entity' => 'Contact',
1579 'bao' => 'CRM_Contact_BAO_Contact',
1580 'localizable' => 0,
1581 'html' => [
1582 'type' => 'Text',
1583 ],
1584 'add' => '2.0',
1585 ],
1586 'current_employer_id' => [
1587 'name' => 'employer_id',
1588 'type' => CRM_Utils_Type::T_INT,
1589 'title' => ts('Current Employer ID'),
1590 'description' => ts('OPTIONAL FK to civicrm_contact record.'),
1591 'where' => 'civicrm_contact.employer_id',
1592 'export' => TRUE,
1593 'contactType' => 'Individual',
1594 'table_name' => 'civicrm_contact',
1595 'entity' => 'Contact',
1596 'bao' => 'CRM_Contact_BAO_Contact',
1597 'localizable' => 0,
1598 'FKClassName' => 'CRM_Contact_DAO_Contact',
1599 'html' => [
1600 'type' => 'EntityRef',
1601 'label' => ts("Current Employer"),
1602 ],
1603 'add' => '2.1',
1604 ],
1605 'contact_is_deleted' => [
1606 'name' => 'is_deleted',
1607 'type' => CRM_Utils_Type::T_BOOLEAN,
1608 'title' => ts('Contact is in Trash'),
1609 'required' => TRUE,
1610 'where' => 'civicrm_contact.is_deleted',
1611 'export' => TRUE,
1612 'default' => '0',
1613 'table_name' => 'civicrm_contact',
1614 'entity' => 'Contact',
1615 'bao' => 'CRM_Contact_BAO_Contact',
1616 'localizable' => 0,
1617 'html' => [
1618 'type' => 'CheckBox',
1619 ],
1620 'add' => '3.2',
1621 ],
1622 'created_date' => [
1623 'name' => 'created_date',
1624 'type' => CRM_Utils_Type::T_TIMESTAMP,
1625 'title' => ts('Created Date'),
1626 'description' => ts('When was the contact was created.'),
1627 'required' => FALSE,
1628 'where' => 'civicrm_contact.created_date',
1629 'export' => TRUE,
1630 'default' => NULL,
1631 'table_name' => 'civicrm_contact',
1632 'entity' => 'Contact',
1633 'bao' => 'CRM_Contact_BAO_Contact',
1634 'localizable' => 0,
1635 'html' => [
1636 'label' => ts("Created Date"),
1637 ],
1638 'add' => '4.3',
1639 ],
1640 'modified_date' => [
1641 'name' => 'modified_date',
1642 'type' => CRM_Utils_Type::T_TIMESTAMP,
1643 'title' => ts('Modified Date'),
1644 'description' => ts('When was the contact (or closely related entity) was created or modified or deleted.'),
1645 'required' => FALSE,
1646 'where' => 'civicrm_contact.modified_date',
1647 'export' => TRUE,
1648 'default' => 'CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP',
1649 'table_name' => 'civicrm_contact',
1650 'entity' => 'Contact',
1651 'bao' => 'CRM_Contact_BAO_Contact',
1652 'localizable' => 0,
1653 'html' => [
1654 'label' => ts("Modified Date"),
1655 ],
1656 'readonly' => TRUE,
1657 'add' => '4.3',
1658 ],
1659 ];
1660 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
1661 }
1662 return Civi::$statics[__CLASS__]['fields'];
1663 }
1664
1665 /**
1666 * Return a mapping from field-name to the corresponding key (as used in fields()).
1667 *
1668 * @return array
1669 * Array(string $name => string $uniqueName).
1670 */
1671 public static function &fieldKeys() {
1672 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
1673 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
1674 }
1675 return Civi::$statics[__CLASS__]['fieldKeys'];
1676 }
1677
1678 /**
1679 * Returns the names of this table
1680 *
1681 * @return string
1682 */
1683 public static function getTableName() {
1684 return self::$_tableName;
1685 }
1686
1687 /**
1688 * Returns if this table needs to be logged
1689 *
1690 * @return bool
1691 */
1692 public function getLog() {
1693 return self::$_log;
1694 }
1695
1696 /**
1697 * Returns the list of fields that can be imported
1698 *
1699 * @param bool $prefix
1700 *
1701 * @return array
1702 */
1703 public static function &import($prefix = FALSE) {
1704 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'contact', $prefix, []);
1705 return $r;
1706 }
1707
1708 /**
1709 * Returns the list of fields that can be exported
1710 *
1711 * @param bool $prefix
1712 *
1713 * @return array
1714 */
1715 public static function &export($prefix = FALSE) {
1716 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'contact', $prefix, []);
1717 return $r;
1718 }
1719
1720 /**
1721 * Returns the list of indices
1722 *
1723 * @param bool $localize
1724 *
1725 * @return array
1726 */
1727 public static function indices($localize = TRUE) {
1728 $indices = [
1729 'index_contact_type' => [
1730 'name' => 'index_contact_type',
1731 'field' => [
1732 0 => 'contact_type',
1733 ],
1734 'localizable' => FALSE,
1735 'sig' => 'civicrm_contact::0::contact_type',
1736 ],
1737 'index_contact_sub_type' => [
1738 'name' => 'index_contact_sub_type',
1739 'field' => [
1740 0 => 'contact_sub_type',
1741 ],
1742 'localizable' => FALSE,
1743 'sig' => 'civicrm_contact::0::contact_sub_type',
1744 ],
1745 'UI_external_identifier' => [
1746 'name' => 'UI_external_identifier',
1747 'field' => [
1748 0 => 'external_identifier',
1749 ],
1750 'localizable' => FALSE,
1751 'unique' => TRUE,
1752 'sig' => 'civicrm_contact::1::external_identifier',
1753 ],
1754 'index_sort_name' => [
1755 'name' => 'index_sort_name',
1756 'field' => [
1757 0 => 'sort_name',
1758 ],
1759 'localizable' => FALSE,
1760 'sig' => 'civicrm_contact::0::sort_name',
1761 ],
1762 'index_preferred_communication_method' => [
1763 'name' => 'index_preferred_communication_method',
1764 'field' => [
1765 0 => 'preferred_communication_method',
1766 ],
1767 'localizable' => FALSE,
1768 'sig' => 'civicrm_contact::0::preferred_communication_method',
1769 ],
1770 'index_hash' => [
1771 'name' => 'index_hash',
1772 'field' => [
1773 0 => 'hash',
1774 ],
1775 'localizable' => FALSE,
1776 'sig' => 'civicrm_contact::0::hash',
1777 ],
1778 'index_api_key' => [
1779 'name' => 'index_api_key',
1780 'field' => [
1781 0 => 'api_key',
1782 ],
1783 'localizable' => FALSE,
1784 'sig' => 'civicrm_contact::0::api_key',
1785 ],
1786 'index_first_name' => [
1787 'name' => 'index_first_name',
1788 'field' => [
1789 0 => 'first_name',
1790 ],
1791 'localizable' => FALSE,
1792 'sig' => 'civicrm_contact::0::first_name',
1793 ],
1794 'index_last_name' => [
1795 'name' => 'index_last_name',
1796 'field' => [
1797 0 => 'last_name',
1798 ],
1799 'localizable' => FALSE,
1800 'sig' => 'civicrm_contact::0::last_name',
1801 ],
1802 'UI_prefix' => [
1803 'name' => 'UI_prefix',
1804 'field' => [
1805 0 => 'prefix_id',
1806 ],
1807 'localizable' => FALSE,
1808 'sig' => 'civicrm_contact::0::prefix_id',
1809 ],
1810 'UI_suffix' => [
1811 'name' => 'UI_suffix',
1812 'field' => [
1813 0 => 'suffix_id',
1814 ],
1815 'localizable' => FALSE,
1816 'sig' => 'civicrm_contact::0::suffix_id',
1817 ],
1818 'index_communication_style_id' => [
1819 'name' => 'index_communication_style_id',
1820 'field' => [
1821 0 => 'communication_style_id',
1822 ],
1823 'localizable' => FALSE,
1824 'sig' => 'civicrm_contact::0::communication_style_id',
1825 ],
1826 'UI_gender' => [
1827 'name' => 'UI_gender',
1828 'field' => [
1829 0 => 'gender_id',
1830 ],
1831 'localizable' => FALSE,
1832 'sig' => 'civicrm_contact::0::gender_id',
1833 ],
1834 'index_is_deceased' => [
1835 'name' => 'index_is_deceased',
1836 'field' => [
1837 0 => 'is_deceased',
1838 ],
1839 'localizable' => FALSE,
1840 'sig' => 'civicrm_contact::0::is_deceased',
1841 ],
1842 'index_household_name' => [
1843 'name' => 'index_household_name',
1844 'field' => [
1845 0 => 'household_name',
1846 ],
1847 'localizable' => FALSE,
1848 'sig' => 'civicrm_contact::0::household_name',
1849 ],
1850 'index_organization_name' => [
1851 'name' => 'index_organization_name',
1852 'field' => [
1853 0 => 'organization_name',
1854 ],
1855 'localizable' => FALSE,
1856 'sig' => 'civicrm_contact::0::organization_name',
1857 ],
1858 'index_is_deleted_sort_name' => [
1859 'name' => 'index_is_deleted_sort_name',
1860 'field' => [
1861 0 => 'is_deleted',
1862 1 => 'sort_name',
1863 2 => 'id',
1864 ],
1865 'localizable' => FALSE,
1866 'sig' => 'civicrm_contact::0::is_deleted::sort_name::id',
1867 ],
1868 'index_created_date' => [
1869 'name' => 'index_created_date',
1870 'field' => [
1871 0 => 'created_date',
1872 ],
1873 'localizable' => FALSE,
1874 'sig' => 'civicrm_contact::0::created_date',
1875 ],
1876 'index_modified_date' => [
1877 'name' => 'index_modified_date',
1878 'field' => [
1879 0 => 'modified_date',
1880 ],
1881 'localizable' => FALSE,
1882 'sig' => 'civicrm_contact::0::modified_date',
1883 ],
1884 ];
1885 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
1886 }
1887
1888 }