Merge pull request #23038 from eileenmcnaughton/assign3
[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:1ed20aff22fc1effbd05ea8411e48139)
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|null
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|null
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|null
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|null
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|null
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 'import' => TRUE,
642 'where' => 'civicrm_contact.do_not_email',
643 'headerPattern' => '/d(o )?(not )?(email)/i',
644 'dataPattern' => '/^\d{1,}$/',
645 'export' => TRUE,
646 'default' => '0',
647 'table_name' => 'civicrm_contact',
648 'entity' => 'Contact',
649 'bao' => 'CRM_Contact_BAO_Contact',
650 'localizable' => 0,
651 'html' => [
652 'type' => 'CheckBox',
653 'label' => ts("Do Not Email"),
654 ],
655 'add' => '1.1',
656 ],
657 'do_not_phone' => [
658 'name' => 'do_not_phone',
659 'type' => CRM_Utils_Type::T_BOOLEAN,
660 'title' => ts('Do Not Phone'),
661 'import' => TRUE,
662 'where' => 'civicrm_contact.do_not_phone',
663 'headerPattern' => '/d(o )?(not )?(call|phone)/i',
664 'dataPattern' => '/^\d{1,}$/',
665 'export' => TRUE,
666 'default' => '0',
667 'table_name' => 'civicrm_contact',
668 'entity' => 'Contact',
669 'bao' => 'CRM_Contact_BAO_Contact',
670 'localizable' => 0,
671 'html' => [
672 'type' => 'CheckBox',
673 'label' => ts("Do Not Phone"),
674 ],
675 'add' => '1.1',
676 ],
677 'do_not_mail' => [
678 'name' => 'do_not_mail',
679 'type' => CRM_Utils_Type::T_BOOLEAN,
680 'title' => ts('Do Not Mail'),
681 'import' => TRUE,
682 'where' => 'civicrm_contact.do_not_mail',
683 'headerPattern' => '/^(d(o\s)?n(ot\s)?mail)|(\w*)?bulk\s?(\w*)$/i',
684 'dataPattern' => '/^\d{1,}$/',
685 'export' => TRUE,
686 'default' => '0',
687 'table_name' => 'civicrm_contact',
688 'entity' => 'Contact',
689 'bao' => 'CRM_Contact_BAO_Contact',
690 'localizable' => 0,
691 'html' => [
692 'type' => 'CheckBox',
693 'label' => ts("Do Not Mail"),
694 ],
695 'add' => '1.1',
696 ],
697 'do_not_sms' => [
698 'name' => 'do_not_sms',
699 'type' => CRM_Utils_Type::T_BOOLEAN,
700 'title' => ts('Do Not Sms'),
701 'import' => TRUE,
702 'where' => 'civicrm_contact.do_not_sms',
703 'headerPattern' => '/d(o )?(not )?(sms)/i',
704 'dataPattern' => '/^\d{1,}$/',
705 'export' => TRUE,
706 'default' => '0',
707 'table_name' => 'civicrm_contact',
708 'entity' => 'Contact',
709 'bao' => 'CRM_Contact_BAO_Contact',
710 'localizable' => 0,
711 'html' => [
712 'type' => 'CheckBox',
713 'label' => ts("Do Not Sms"),
714 ],
715 'add' => '3.0',
716 ],
717 'do_not_trade' => [
718 'name' => 'do_not_trade',
719 'type' => CRM_Utils_Type::T_BOOLEAN,
720 'title' => ts('Do Not Trade'),
721 'import' => TRUE,
722 'where' => 'civicrm_contact.do_not_trade',
723 'headerPattern' => '/d(o )?(not )?(trade)/i',
724 'dataPattern' => '/^\d{1,}$/',
725 'export' => TRUE,
726 'default' => '0',
727 'table_name' => 'civicrm_contact',
728 'entity' => 'Contact',
729 'bao' => 'CRM_Contact_BAO_Contact',
730 'localizable' => 0,
731 'html' => [
732 'type' => 'CheckBox',
733 'label' => ts("Do Not Trade"),
734 ],
735 'add' => '1.1',
736 ],
737 'is_opt_out' => [
738 'name' => 'is_opt_out',
739 'type' => CRM_Utils_Type::T_BOOLEAN,
740 'title' => ts('No Bulk Emails (User Opt Out)'),
741 'description' => ts('Has the contact opted out from receiving all bulk email from the organization or site domain?'),
742 'required' => TRUE,
743 'import' => TRUE,
744 'where' => 'civicrm_contact.is_opt_out',
745 'export' => TRUE,
746 'default' => '0',
747 'table_name' => 'civicrm_contact',
748 'entity' => 'Contact',
749 'bao' => 'CRM_Contact_BAO_Contact',
750 'localizable' => 0,
751 'html' => [
752 'type' => 'CheckBox',
753 'label' => ts("Is Opt Out"),
754 ],
755 'add' => '1.1',
756 ],
757 'legal_identifier' => [
758 'name' => 'legal_identifier',
759 'type' => CRM_Utils_Type::T_STRING,
760 'title' => ts('Legal Identifier'),
761 'description' => ts('May be used for SSN, EIN/TIN, Household ID (census) or other applicable unique legal/government ID.'),
762 'maxlength' => 32,
763 'size' => CRM_Utils_Type::MEDIUM,
764 'import' => TRUE,
765 'where' => 'civicrm_contact.legal_identifier',
766 'headerPattern' => '/legal\s?id/i',
767 'dataPattern' => '/\w+?\d{5,}/',
768 'export' => TRUE,
769 'table_name' => 'civicrm_contact',
770 'entity' => 'Contact',
771 'bao' => 'CRM_Contact_BAO_Contact',
772 'localizable' => 0,
773 'html' => [
774 'type' => 'Text',
775 'label' => ts("Legal Identifier"),
776 ],
777 'add' => '1.1',
778 ],
779 'external_identifier' => [
780 'name' => 'external_identifier',
781 'type' => CRM_Utils_Type::T_STRING,
782 'title' => ts('External Identifier'),
783 'description' => ts('Unique trusted external ID (generally from a legacy app/datasource). Particularly useful for deduping operations.'),
784 'maxlength' => 64,
785 'size' => 8,
786 'import' => TRUE,
787 'where' => 'civicrm_contact.external_identifier',
788 'headerPattern' => '/external\s?id/i',
789 'dataPattern' => '/^\d{11,}$/',
790 'export' => TRUE,
791 'table_name' => 'civicrm_contact',
792 'entity' => 'Contact',
793 'bao' => 'CRM_Contact_BAO_Contact',
794 'localizable' => 0,
795 'html' => [
796 'type' => 'Text',
797 'label' => ts("External Identifier"),
798 ],
799 'add' => '1.1',
800 ],
801 'sort_name' => [
802 'name' => 'sort_name',
803 'type' => CRM_Utils_Type::T_STRING,
804 'title' => ts('Sort Name'),
805 'description' => ts('Name used for sorting different contact types'),
806 'maxlength' => 128,
807 'size' => 30,
808 'where' => 'civicrm_contact.sort_name',
809 'export' => TRUE,
810 'table_name' => 'civicrm_contact',
811 'entity' => 'Contact',
812 'bao' => 'CRM_Contact_BAO_Contact',
813 'localizable' => 0,
814 'html' => [
815 'type' => 'Text',
816 ],
817 'readonly' => TRUE,
818 'add' => '1.1',
819 ],
820 'display_name' => [
821 'name' => 'display_name',
822 'type' => CRM_Utils_Type::T_STRING,
823 'title' => ts('Display Name'),
824 'description' => ts('Formatted name representing preferred format for display/print/other output.'),
825 'maxlength' => 128,
826 'size' => 30,
827 'where' => 'civicrm_contact.display_name',
828 'export' => TRUE,
829 'table_name' => 'civicrm_contact',
830 'entity' => 'Contact',
831 'bao' => 'CRM_Contact_BAO_Contact',
832 'localizable' => 0,
833 'html' => [
834 'type' => 'Text',
835 ],
836 'readonly' => TRUE,
837 'add' => '1.1',
838 ],
839 'nick_name' => [
840 'name' => 'nick_name',
841 'type' => CRM_Utils_Type::T_STRING,
842 'title' => ts('Nickname'),
843 'description' => ts('Nickname.'),
844 'maxlength' => 128,
845 'size' => 30,
846 'import' => TRUE,
847 'where' => 'civicrm_contact.nick_name',
848 'headerPattern' => '/n(ick\s)name|nick$/i',
849 'dataPattern' => '/^\w+$/',
850 'export' => TRUE,
851 'table_name' => 'civicrm_contact',
852 'entity' => 'Contact',
853 'bao' => 'CRM_Contact_BAO_Contact',
854 'localizable' => 0,
855 'html' => [
856 'type' => 'Text',
857 ],
858 'add' => '1.1',
859 ],
860 'legal_name' => [
861 'name' => 'legal_name',
862 'type' => CRM_Utils_Type::T_STRING,
863 'title' => ts('Legal Name'),
864 'description' => ts('Legal Name.'),
865 'maxlength' => 128,
866 'size' => 30,
867 'import' => TRUE,
868 'where' => 'civicrm_contact.legal_name',
869 'headerPattern' => '/^legal|(l(egal\s)?name)$/i',
870 'export' => TRUE,
871 'contactType' => 'Organization',
872 'table_name' => 'civicrm_contact',
873 'entity' => 'Contact',
874 'bao' => 'CRM_Contact_BAO_Contact',
875 'localizable' => 0,
876 'html' => [
877 'type' => 'Text',
878 'label' => ts("Legal Name"),
879 ],
880 'add' => '1.1',
881 ],
882 'image_URL' => [
883 'name' => 'image_URL',
884 'type' => CRM_Utils_Type::T_TEXT,
885 'title' => ts('Image Url'),
886 'description' => ts('optional URL for preferred image (photo, logo, etc.) to display for this contact.'),
887 'import' => TRUE,
888 'where' => 'civicrm_contact.image_URL',
889 'export' => TRUE,
890 'table_name' => 'civicrm_contact',
891 'entity' => 'Contact',
892 'bao' => 'CRM_Contact_BAO_Contact',
893 'localizable' => 0,
894 'html' => [
895 'type' => 'File',
896 'label' => ts("Image URL"),
897 ],
898 'add' => '1.1',
899 ],
900 'preferred_communication_method' => [
901 'name' => 'preferred_communication_method',
902 'type' => CRM_Utils_Type::T_STRING,
903 'title' => ts('Preferred Communication Method'),
904 'description' => ts('What is the preferred mode of communication.'),
905 'maxlength' => 255,
906 'size' => CRM_Utils_Type::HUGE,
907 'import' => TRUE,
908 'where' => 'civicrm_contact.preferred_communication_method',
909 'headerPattern' => '/^p(ref\w*\s)?c(omm\w*)|( meth\w*)$/i',
910 'dataPattern' => '/^\w+$/',
911 'export' => TRUE,
912 'table_name' => 'civicrm_contact',
913 'entity' => 'Contact',
914 'bao' => 'CRM_Contact_BAO_Contact',
915 'localizable' => 0,
916 'serialize' => self::SERIALIZE_SEPARATOR_BOOKEND,
917 'html' => [
918 'type' => 'Select',
919 ],
920 'pseudoconstant' => [
921 'optionGroupName' => 'preferred_communication_method',
922 'optionEditPath' => 'civicrm/admin/options/preferred_communication_method',
923 ],
924 'add' => '1.1',
925 ],
926 'preferred_language' => [
927 'name' => 'preferred_language',
928 'type' => CRM_Utils_Type::T_STRING,
929 'title' => ts('Preferred Language'),
930 'description' => ts('Which language is preferred for communication. FK to languages in civicrm_option_value.'),
931 'maxlength' => 5,
932 'size' => CRM_Utils_Type::SIX,
933 'import' => TRUE,
934 'where' => 'civicrm_contact.preferred_language',
935 'headerPattern' => '/^lang/i',
936 'export' => TRUE,
937 'table_name' => 'civicrm_contact',
938 'entity' => 'Contact',
939 'bao' => 'CRM_Contact_BAO_Contact',
940 'localizable' => 0,
941 'html' => [
942 'type' => 'Select',
943 ],
944 'pseudoconstant' => [
945 'optionGroupName' => 'languages',
946 'keyColumn' => 'name',
947 'optionEditPath' => 'civicrm/admin/options/languages',
948 ],
949 'add' => '3.2',
950 ],
951 'preferred_mail_format' => [
952 'name' => 'preferred_mail_format',
953 'type' => CRM_Utils_Type::T_STRING,
954 'title' => ts('Preferred Mail Format'),
955 'description' => ts('What is the preferred mode of sending an email.'),
956 'maxlength' => 8,
957 'size' => CRM_Utils_Type::EIGHT,
958 'import' => TRUE,
959 'where' => 'civicrm_contact.preferred_mail_format',
960 'headerPattern' => '/^p(ref\w*\s)?m(ail\s)?f(orm\w*)$/i',
961 'export' => TRUE,
962 'default' => 'Both',
963 'table_name' => 'civicrm_contact',
964 'entity' => 'Contact',
965 'bao' => 'CRM_Contact_BAO_Contact',
966 'localizable' => 0,
967 'html' => [
968 'type' => 'Select',
969 'label' => ts("Preferred Mail Format"),
970 ],
971 'pseudoconstant' => [
972 'callback' => 'CRM_Core_SelectValues::pmf',
973 ],
974 'add' => '1.1',
975 ],
976 'hash' => [
977 'name' => 'hash',
978 'type' => CRM_Utils_Type::T_STRING,
979 'title' => ts('Contact Hash'),
980 'description' => ts('Key for validating requests related to this contact.'),
981 'maxlength' => 32,
982 'size' => CRM_Utils_Type::MEDIUM,
983 'where' => 'civicrm_contact.hash',
984 'export' => TRUE,
985 'table_name' => 'civicrm_contact',
986 'entity' => 'Contact',
987 'bao' => 'CRM_Contact_BAO_Contact',
988 'localizable' => 0,
989 'readonly' => TRUE,
990 'add' => '1.1',
991 ],
992 'api_key' => [
993 'name' => 'api_key',
994 'type' => CRM_Utils_Type::T_STRING,
995 'title' => ts('Api Key'),
996 'description' => ts('API Key for validating requests related to this contact.'),
997 'maxlength' => 32,
998 'size' => CRM_Utils_Type::MEDIUM,
999 'where' => 'civicrm_contact.api_key',
1000 'permission' => [
1001 [
1002 'administer CiviCRM',
1003 'edit api keys',
1004 ],
1005 ],
1006 'table_name' => 'civicrm_contact',
1007 'entity' => 'Contact',
1008 'bao' => 'CRM_Contact_BAO_Contact',
1009 'localizable' => 0,
1010 'html' => [
1011 'label' => ts("API KEY"),
1012 ],
1013 'readonly' => TRUE,
1014 'add' => '2.2',
1015 ],
1016 'contact_source' => [
1017 'name' => 'source',
1018 'type' => CRM_Utils_Type::T_STRING,
1019 'title' => ts('Contact Source'),
1020 'description' => ts('where contact come from, e.g. import, donate module insert...'),
1021 'maxlength' => 255,
1022 'size' => 30,
1023 'import' => TRUE,
1024 'where' => 'civicrm_contact.source',
1025 'headerPattern' => '/(C(ontact\s)?Source)$/i',
1026 'export' => TRUE,
1027 'table_name' => 'civicrm_contact',
1028 'entity' => 'Contact',
1029 'bao' => 'CRM_Contact_BAO_Contact',
1030 'localizable' => 0,
1031 'html' => [
1032 'type' => 'Text',
1033 ],
1034 'add' => '1.1',
1035 ],
1036 'first_name' => [
1037 'name' => 'first_name',
1038 'type' => CRM_Utils_Type::T_STRING,
1039 'title' => ts('First Name'),
1040 'description' => ts('First Name.'),
1041 'maxlength' => 64,
1042 'size' => 30,
1043 'import' => TRUE,
1044 'where' => 'civicrm_contact.first_name',
1045 'headerPattern' => '/^first|(f(irst\s)?name)$/i',
1046 'dataPattern' => '/^\w+$/',
1047 'export' => TRUE,
1048 'contactType' => 'Individual',
1049 'table_name' => 'civicrm_contact',
1050 'entity' => 'Contact',
1051 'bao' => 'CRM_Contact_BAO_Contact',
1052 'localizable' => 0,
1053 'html' => [
1054 'type' => 'Text',
1055 'label' => ts("First Name"),
1056 ],
1057 'add' => '1.1',
1058 ],
1059 'middle_name' => [
1060 'name' => 'middle_name',
1061 'type' => CRM_Utils_Type::T_STRING,
1062 'title' => ts('Middle Name'),
1063 'description' => ts('Middle Name.'),
1064 'maxlength' => 64,
1065 'size' => 30,
1066 'import' => TRUE,
1067 'where' => 'civicrm_contact.middle_name',
1068 'headerPattern' => '/^middle|(m(iddle\s)?name)$/i',
1069 'dataPattern' => '/^\w+$/',
1070 'export' => TRUE,
1071 'contactType' => 'Individual',
1072 'table_name' => 'civicrm_contact',
1073 'entity' => 'Contact',
1074 'bao' => 'CRM_Contact_BAO_Contact',
1075 'localizable' => 0,
1076 'html' => [
1077 'type' => 'Text',
1078 'label' => ts("Middle Name"),
1079 ],
1080 'add' => '1.1',
1081 ],
1082 'last_name' => [
1083 'name' => 'last_name',
1084 'type' => CRM_Utils_Type::T_STRING,
1085 'title' => ts('Last Name'),
1086 'description' => ts('Last Name.'),
1087 'maxlength' => 64,
1088 'size' => 30,
1089 'import' => TRUE,
1090 'where' => 'civicrm_contact.last_name',
1091 'headerPattern' => '/^last|(l(ast\s)?name)$/i',
1092 'dataPattern' => '/^\w+(\s\w+)?+$/',
1093 'export' => TRUE,
1094 'contactType' => 'Individual',
1095 'table_name' => 'civicrm_contact',
1096 'entity' => 'Contact',
1097 'bao' => 'CRM_Contact_BAO_Contact',
1098 'localizable' => 0,
1099 'html' => [
1100 'type' => 'Text',
1101 'label' => ts("Last Name"),
1102 ],
1103 'add' => '1.1',
1104 ],
1105 'prefix_id' => [
1106 'name' => 'prefix_id',
1107 'type' => CRM_Utils_Type::T_INT,
1108 'title' => ts('Individual Prefix'),
1109 'description' => ts('Prefix or Title for name (Ms, Mr...). FK to prefix ID'),
1110 'import' => TRUE,
1111 'where' => 'civicrm_contact.prefix_id',
1112 'headerPattern' => '/^(prefix|title)/i',
1113 'dataPattern' => '/^(mr|ms|mrs|sir|dr)\.?$/i',
1114 'export' => TRUE,
1115 'contactType' => 'Individual',
1116 'table_name' => 'civicrm_contact',
1117 'entity' => 'Contact',
1118 'bao' => 'CRM_Contact_BAO_Contact',
1119 'localizable' => 0,
1120 'html' => [
1121 'type' => 'Select',
1122 ],
1123 'pseudoconstant' => [
1124 'optionGroupName' => 'individual_prefix',
1125 'optionEditPath' => 'civicrm/admin/options/individual_prefix',
1126 ],
1127 'add' => '1.2',
1128 ],
1129 'suffix_id' => [
1130 'name' => 'suffix_id',
1131 'type' => CRM_Utils_Type::T_INT,
1132 'title' => ts('Individual Suffix'),
1133 'description' => ts('Suffix for name (Jr, Sr...). FK to suffix ID'),
1134 'import' => TRUE,
1135 'where' => 'civicrm_contact.suffix_id',
1136 'headerPattern' => '/^suffix$/i',
1137 'dataPattern' => '/^(sr|jr)\.?|i{2,}$/',
1138 'export' => TRUE,
1139 'contactType' => 'Individual',
1140 'table_name' => 'civicrm_contact',
1141 'entity' => 'Contact',
1142 'bao' => 'CRM_Contact_BAO_Contact',
1143 'localizable' => 0,
1144 'html' => [
1145 'type' => 'Select',
1146 ],
1147 'pseudoconstant' => [
1148 'optionGroupName' => 'individual_suffix',
1149 'optionEditPath' => 'civicrm/admin/options/individual_suffix',
1150 ],
1151 'add' => '1.2',
1152 ],
1153 'formal_title' => [
1154 'name' => 'formal_title',
1155 'type' => CRM_Utils_Type::T_STRING,
1156 'title' => ts('Formal Title'),
1157 'description' => ts('Formal (academic or similar) title in front of name. (Prof., Dr. etc.)'),
1158 'maxlength' => 64,
1159 'size' => CRM_Utils_Type::BIG,
1160 'import' => TRUE,
1161 'where' => 'civicrm_contact.formal_title',
1162 'headerPattern' => '/^title/i',
1163 'export' => TRUE,
1164 'contactType' => 'Individual',
1165 'table_name' => 'civicrm_contact',
1166 'entity' => 'Contact',
1167 'bao' => 'CRM_Contact_BAO_Contact',
1168 'localizable' => 0,
1169 'html' => [
1170 'type' => 'Text',
1171 'label' => ts("Formal Title"),
1172 ],
1173 'add' => '4.5',
1174 ],
1175 'communication_style_id' => [
1176 'name' => 'communication_style_id',
1177 'type' => CRM_Utils_Type::T_INT,
1178 'title' => ts('Communication Style'),
1179 'description' => ts('Communication style (e.g. formal vs. familiar) to use with this contact. FK to communication styles in civicrm_option_value.'),
1180 'import' => TRUE,
1181 'where' => 'civicrm_contact.communication_style_id',
1182 'headerPattern' => '/style/i',
1183 'export' => TRUE,
1184 'table_name' => 'civicrm_contact',
1185 'entity' => 'Contact',
1186 'bao' => 'CRM_Contact_BAO_Contact',
1187 'localizable' => 0,
1188 'html' => [
1189 'type' => 'Select',
1190 ],
1191 'pseudoconstant' => [
1192 'optionGroupName' => 'communication_style',
1193 'optionEditPath' => 'civicrm/admin/options/communication_style',
1194 ],
1195 'add' => '4.4',
1196 ],
1197 'email_greeting_id' => [
1198 'name' => 'email_greeting_id',
1199 'type' => CRM_Utils_Type::T_INT,
1200 'title' => ts('Email Greeting ID'),
1201 'description' => ts('FK to civicrm_option_value.id, that has to be valid registered Email Greeting.'),
1202 'where' => 'civicrm_contact.email_greeting_id',
1203 'export' => TRUE,
1204 'table_name' => 'civicrm_contact',
1205 'entity' => 'Contact',
1206 'bao' => 'CRM_Contact_BAO_Contact',
1207 'localizable' => 0,
1208 'html' => [
1209 'type' => 'Select',
1210 ],
1211 'pseudoconstant' => [
1212 'optionGroupName' => 'email_greeting',
1213 'optionEditPath' => 'civicrm/admin/options/email_greeting',
1214 ],
1215 'add' => '3.0',
1216 ],
1217 'email_greeting_custom' => [
1218 'name' => 'email_greeting_custom',
1219 'type' => CRM_Utils_Type::T_STRING,
1220 'title' => ts('Email Greeting Custom'),
1221 'description' => ts('Custom Email Greeting.'),
1222 'maxlength' => 128,
1223 'size' => CRM_Utils_Type::HUGE,
1224 'import' => TRUE,
1225 'where' => 'civicrm_contact.email_greeting_custom',
1226 'export' => FALSE,
1227 'table_name' => 'civicrm_contact',
1228 'entity' => 'Contact',
1229 'bao' => 'CRM_Contact_BAO_Contact',
1230 'localizable' => 0,
1231 'html' => [
1232 'type' => 'Text',
1233 'label' => ts("Email Greeting Custom"),
1234 ],
1235 'add' => '3.0',
1236 ],
1237 'email_greeting_display' => [
1238 'name' => 'email_greeting_display',
1239 'type' => CRM_Utils_Type::T_STRING,
1240 'title' => ts('Email Greeting'),
1241 'description' => ts('Cache Email Greeting.'),
1242 'maxlength' => 255,
1243 'size' => CRM_Utils_Type::HUGE,
1244 'where' => 'civicrm_contact.email_greeting_display',
1245 'table_name' => 'civicrm_contact',
1246 'entity' => 'Contact',
1247 'bao' => 'CRM_Contact_BAO_Contact',
1248 'localizable' => 0,
1249 'readonly' => TRUE,
1250 'add' => '3.0',
1251 ],
1252 'postal_greeting_id' => [
1253 'name' => 'postal_greeting_id',
1254 'type' => CRM_Utils_Type::T_INT,
1255 'title' => ts('Postal Greeting ID'),
1256 'description' => ts('FK to civicrm_option_value.id, that has to be valid registered Postal Greeting.'),
1257 'where' => 'civicrm_contact.postal_greeting_id',
1258 'export' => TRUE,
1259 'table_name' => 'civicrm_contact',
1260 'entity' => 'Contact',
1261 'bao' => 'CRM_Contact_BAO_Contact',
1262 'localizable' => 0,
1263 'html' => [
1264 'type' => 'Select',
1265 ],
1266 'pseudoconstant' => [
1267 'optionGroupName' => 'postal_greeting',
1268 'optionEditPath' => 'civicrm/admin/options/postal_greeting',
1269 ],
1270 'add' => '3.0',
1271 ],
1272 'postal_greeting_custom' => [
1273 'name' => 'postal_greeting_custom',
1274 'type' => CRM_Utils_Type::T_STRING,
1275 'title' => ts('Postal Greeting Custom'),
1276 'description' => ts('Custom Postal greeting.'),
1277 'maxlength' => 128,
1278 'size' => CRM_Utils_Type::HUGE,
1279 'import' => TRUE,
1280 'where' => 'civicrm_contact.postal_greeting_custom',
1281 'export' => FALSE,
1282 'table_name' => 'civicrm_contact',
1283 'entity' => 'Contact',
1284 'bao' => 'CRM_Contact_BAO_Contact',
1285 'localizable' => 0,
1286 'html' => [
1287 'type' => 'Text',
1288 'label' => ts("Postal Greeting Custom"),
1289 ],
1290 'add' => '3.0',
1291 ],
1292 'postal_greeting_display' => [
1293 'name' => 'postal_greeting_display',
1294 'type' => CRM_Utils_Type::T_STRING,
1295 'title' => ts('Postal Greeting'),
1296 'description' => ts('Cache Postal greeting.'),
1297 'maxlength' => 255,
1298 'size' => CRM_Utils_Type::HUGE,
1299 'where' => 'civicrm_contact.postal_greeting_display',
1300 'table_name' => 'civicrm_contact',
1301 'entity' => 'Contact',
1302 'bao' => 'CRM_Contact_BAO_Contact',
1303 'localizable' => 0,
1304 'readonly' => TRUE,
1305 'add' => '3.0',
1306 ],
1307 'addressee_id' => [
1308 'name' => 'addressee_id',
1309 'type' => CRM_Utils_Type::T_INT,
1310 'title' => ts('Addressee ID'),
1311 'description' => ts('FK to civicrm_option_value.id, that has to be valid registered Addressee.'),
1312 'where' => 'civicrm_contact.addressee_id',
1313 'export' => TRUE,
1314 'table_name' => 'civicrm_contact',
1315 'entity' => 'Contact',
1316 'bao' => 'CRM_Contact_BAO_Contact',
1317 'localizable' => 0,
1318 'html' => [
1319 'type' => 'Select',
1320 ],
1321 'pseudoconstant' => [
1322 'optionGroupName' => 'addressee',
1323 'optionEditPath' => 'civicrm/admin/options/addressee',
1324 ],
1325 'add' => '3.0',
1326 ],
1327 'addressee_custom' => [
1328 'name' => 'addressee_custom',
1329 'type' => CRM_Utils_Type::T_STRING,
1330 'title' => ts('Addressee Custom'),
1331 'description' => ts('Custom Addressee.'),
1332 'maxlength' => 128,
1333 'size' => CRM_Utils_Type::HUGE,
1334 'import' => TRUE,
1335 'where' => 'civicrm_contact.addressee_custom',
1336 'export' => FALSE,
1337 'table_name' => 'civicrm_contact',
1338 'entity' => 'Contact',
1339 'bao' => 'CRM_Contact_BAO_Contact',
1340 'localizable' => 0,
1341 'html' => [
1342 'type' => 'Text',
1343 'label' => ts("Addressee Custom"),
1344 ],
1345 'add' => '3.0',
1346 ],
1347 'addressee_display' => [
1348 'name' => 'addressee_display',
1349 'type' => CRM_Utils_Type::T_STRING,
1350 'title' => ts('Addressee'),
1351 'description' => ts('Cache Addressee.'),
1352 'maxlength' => 255,
1353 'size' => CRM_Utils_Type::HUGE,
1354 'where' => 'civicrm_contact.addressee_display',
1355 'table_name' => 'civicrm_contact',
1356 'entity' => 'Contact',
1357 'bao' => 'CRM_Contact_BAO_Contact',
1358 'localizable' => 0,
1359 'readonly' => TRUE,
1360 'add' => '3.0',
1361 ],
1362 'job_title' => [
1363 'name' => 'job_title',
1364 'type' => CRM_Utils_Type::T_STRING,
1365 'title' => ts('Job Title'),
1366 'description' => ts('Job Title'),
1367 'maxlength' => 255,
1368 'size' => 30,
1369 'import' => TRUE,
1370 'where' => 'civicrm_contact.job_title',
1371 'headerPattern' => '/^job|(j(ob\s)?title)$/i',
1372 'dataPattern' => '//',
1373 'export' => TRUE,
1374 'contactType' => 'Individual',
1375 'table_name' => 'civicrm_contact',
1376 'entity' => 'Contact',
1377 'bao' => 'CRM_Contact_BAO_Contact',
1378 'localizable' => 0,
1379 'html' => [
1380 'type' => 'Text',
1381 'label' => ts("Job Title"),
1382 ],
1383 'add' => '1.1',
1384 ],
1385 'gender_id' => [
1386 'name' => 'gender_id',
1387 'type' => CRM_Utils_Type::T_INT,
1388 'title' => ts('Gender ID'),
1389 'description' => ts('FK to gender ID'),
1390 'import' => TRUE,
1391 'where' => 'civicrm_contact.gender_id',
1392 'headerPattern' => '/^gender$/i',
1393 'export' => TRUE,
1394 'contactType' => 'Individual',
1395 'table_name' => 'civicrm_contact',
1396 'entity' => 'Contact',
1397 'bao' => 'CRM_Contact_BAO_Contact',
1398 'localizable' => 0,
1399 'html' => [
1400 'type' => 'Select',
1401 'label' => ts("Gender"),
1402 ],
1403 'pseudoconstant' => [
1404 'optionGroupName' => 'gender',
1405 'optionEditPath' => 'civicrm/admin/options/gender',
1406 ],
1407 'add' => '1.2',
1408 ],
1409 'birth_date' => [
1410 'name' => 'birth_date',
1411 'type' => CRM_Utils_Type::T_DATE,
1412 'title' => ts('Birth Date'),
1413 'description' => ts('Date of birth'),
1414 'import' => TRUE,
1415 'where' => 'civicrm_contact.birth_date',
1416 'headerPattern' => '/^birth|(b(irth\s)?date)|D(\W*)O(\W*)B(\W*)$/i',
1417 'dataPattern' => '/\d{4}-?\d{2}-?\d{2}/',
1418 'export' => TRUE,
1419 'contactType' => 'Individual',
1420 'table_name' => 'civicrm_contact',
1421 'entity' => 'Contact',
1422 'bao' => 'CRM_Contact_BAO_Contact',
1423 'localizable' => 0,
1424 'html' => [
1425 'type' => 'Select Date',
1426 'formatType' => 'birth',
1427 'label' => ts("Birth Date"),
1428 ],
1429 'add' => '1.1',
1430 ],
1431 'is_deceased' => [
1432 'name' => 'is_deceased',
1433 'type' => CRM_Utils_Type::T_BOOLEAN,
1434 'title' => ts('Deceased'),
1435 'required' => TRUE,
1436 'import' => TRUE,
1437 'where' => 'civicrm_contact.is_deceased',
1438 'headerPattern' => '/i(s\s)?d(eceased)$/i',
1439 'export' => TRUE,
1440 'contactType' => 'Individual',
1441 'default' => '0',
1442 'table_name' => 'civicrm_contact',
1443 'entity' => 'Contact',
1444 'bao' => 'CRM_Contact_BAO_Contact',
1445 'localizable' => 0,
1446 'html' => [
1447 'type' => 'CheckBox',
1448 'label' => ts("Is Deceased"),
1449 ],
1450 'add' => '1.1',
1451 ],
1452 'deceased_date' => [
1453 'name' => 'deceased_date',
1454 'type' => CRM_Utils_Type::T_DATE,
1455 'title' => ts('Deceased Date'),
1456 'description' => ts('Date of deceased'),
1457 'import' => TRUE,
1458 'where' => 'civicrm_contact.deceased_date',
1459 'headerPattern' => '/^deceased|(d(eceased\s)?date)$/i',
1460 'export' => TRUE,
1461 'contactType' => 'Individual',
1462 'table_name' => 'civicrm_contact',
1463 'entity' => 'Contact',
1464 'bao' => 'CRM_Contact_BAO_Contact',
1465 'localizable' => 0,
1466 'html' => [
1467 'type' => 'Select Date',
1468 'formatType' => 'birth',
1469 'label' => ts("Deceased Date"),
1470 ],
1471 'add' => '1.5',
1472 ],
1473 'household_name' => [
1474 'name' => 'household_name',
1475 'type' => CRM_Utils_Type::T_STRING,
1476 'title' => ts('Household Name'),
1477 'description' => ts('Household Name.'),
1478 'maxlength' => 128,
1479 'size' => 30,
1480 'import' => TRUE,
1481 'where' => 'civicrm_contact.household_name',
1482 'headerPattern' => '/^household|(h(ousehold\s)?name)$/i',
1483 'dataPattern' => '/^\w+$/',
1484 'export' => TRUE,
1485 'contactType' => 'Household',
1486 'table_name' => 'civicrm_contact',
1487 'entity' => 'Contact',
1488 'bao' => 'CRM_Contact_BAO_Contact',
1489 'localizable' => 0,
1490 'html' => [
1491 'type' => 'Text',
1492 'label' => ts("Household Name"),
1493 ],
1494 'add' => '1.1',
1495 ],
1496 'primary_contact_id' => [
1497 'name' => 'primary_contact_id',
1498 'type' => CRM_Utils_Type::T_INT,
1499 'title' => ts('Household Primary Contact ID'),
1500 'description' => ts('Optional FK to Primary Contact for this household.'),
1501 'where' => 'civicrm_contact.primary_contact_id',
1502 'contactType' => 'Household',
1503 'table_name' => 'civicrm_contact',
1504 'entity' => 'Contact',
1505 'bao' => 'CRM_Contact_BAO_Contact',
1506 'localizable' => 0,
1507 'FKClassName' => 'CRM_Contact_DAO_Contact',
1508 'html' => [
1509 'label' => ts("Household Primary Contact"),
1510 ],
1511 'readonly' => TRUE,
1512 'add' => '1.1',
1513 ],
1514 'organization_name' => [
1515 'name' => 'organization_name',
1516 'type' => CRM_Utils_Type::T_STRING,
1517 'title' => ts('Organization Name'),
1518 'description' => ts('Organization Name.'),
1519 'maxlength' => 128,
1520 'size' => 30,
1521 'import' => TRUE,
1522 'where' => 'civicrm_contact.organization_name',
1523 'headerPattern' => '/^organization|(o(rganization\s)?name)$/i',
1524 'dataPattern' => '/^\w+$/',
1525 'export' => TRUE,
1526 'contactType' => 'Organization',
1527 'table_name' => 'civicrm_contact',
1528 'entity' => 'Contact',
1529 'bao' => 'CRM_Contact_BAO_Contact',
1530 'localizable' => 0,
1531 'html' => [
1532 'type' => 'Text',
1533 'label' => ts("Organization Name"),
1534 ],
1535 'add' => '1.1',
1536 ],
1537 'sic_code' => [
1538 'name' => 'sic_code',
1539 'type' => CRM_Utils_Type::T_STRING,
1540 'title' => ts('Sic Code'),
1541 'description' => ts('Standard Industry Classification Code.'),
1542 'maxlength' => 8,
1543 'size' => CRM_Utils_Type::EIGHT,
1544 'import' => TRUE,
1545 'where' => 'civicrm_contact.sic_code',
1546 'headerPattern' => '/^sic|(s(ic\s)?code)$/i',
1547 'export' => TRUE,
1548 'contactType' => 'Organization',
1549 'table_name' => 'civicrm_contact',
1550 'entity' => 'Contact',
1551 'bao' => 'CRM_Contact_BAO_Contact',
1552 'localizable' => 0,
1553 'html' => [
1554 'type' => 'Text',
1555 'label' => ts("SIC Code"),
1556 ],
1557 'add' => '1.1',
1558 ],
1559 'user_unique_id' => [
1560 'name' => 'user_unique_id',
1561 'type' => CRM_Utils_Type::T_STRING,
1562 'title' => ts('Unique ID (OpenID)'),
1563 'description' => ts('the OpenID (or OpenID-style http://username.domain/) unique identifier for this contact mainly used for logging in to CiviCRM'),
1564 'maxlength' => 255,
1565 'size' => CRM_Utils_Type::HUGE,
1566 'import' => TRUE,
1567 'where' => 'civicrm_contact.user_unique_id',
1568 'headerPattern' => '/^Open\s?ID|u(niq\w*)?\s?ID/i',
1569 'dataPattern' => '/^[\w\/\:\.]+$/',
1570 'export' => TRUE,
1571 'rule' => 'url',
1572 'table_name' => 'civicrm_contact',
1573 'entity' => 'Contact',
1574 'bao' => 'CRM_Contact_BAO_Contact',
1575 'localizable' => 0,
1576 'html' => [
1577 'type' => 'Text',
1578 ],
1579 'add' => '2.0',
1580 ],
1581 'current_employer_id' => [
1582 'name' => 'employer_id',
1583 'type' => CRM_Utils_Type::T_INT,
1584 'title' => ts('Current Employer ID'),
1585 'description' => ts('OPTIONAL FK to civicrm_contact record.'),
1586 'where' => 'civicrm_contact.employer_id',
1587 'export' => TRUE,
1588 'contactType' => 'Individual',
1589 'table_name' => 'civicrm_contact',
1590 'entity' => 'Contact',
1591 'bao' => 'CRM_Contact_BAO_Contact',
1592 'localizable' => 0,
1593 'FKClassName' => 'CRM_Contact_DAO_Contact',
1594 'html' => [
1595 'type' => 'EntityRef',
1596 'label' => ts("Current Employer"),
1597 ],
1598 'add' => '2.1',
1599 ],
1600 'contact_is_deleted' => [
1601 'name' => 'is_deleted',
1602 'type' => CRM_Utils_Type::T_BOOLEAN,
1603 'title' => ts('Contact is in Trash'),
1604 'required' => TRUE,
1605 'where' => 'civicrm_contact.is_deleted',
1606 'export' => TRUE,
1607 'default' => '0',
1608 'table_name' => 'civicrm_contact',
1609 'entity' => 'Contact',
1610 'bao' => 'CRM_Contact_BAO_Contact',
1611 'localizable' => 0,
1612 'html' => [
1613 'type' => 'CheckBox',
1614 ],
1615 'add' => '3.2',
1616 ],
1617 'created_date' => [
1618 'name' => 'created_date',
1619 'type' => CRM_Utils_Type::T_TIMESTAMP,
1620 'title' => ts('Created Date'),
1621 'description' => ts('When was the contact was created.'),
1622 'required' => FALSE,
1623 'where' => 'civicrm_contact.created_date',
1624 'export' => TRUE,
1625 'default' => NULL,
1626 'table_name' => 'civicrm_contact',
1627 'entity' => 'Contact',
1628 'bao' => 'CRM_Contact_BAO_Contact',
1629 'localizable' => 0,
1630 'html' => [
1631 'label' => ts("Created Date"),
1632 ],
1633 'add' => '4.3',
1634 ],
1635 'modified_date' => [
1636 'name' => 'modified_date',
1637 'type' => CRM_Utils_Type::T_TIMESTAMP,
1638 'title' => ts('Modified Date'),
1639 'description' => ts('When was the contact (or closely related entity) was created or modified or deleted.'),
1640 'required' => FALSE,
1641 'where' => 'civicrm_contact.modified_date',
1642 'export' => TRUE,
1643 'default' => 'CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP',
1644 'table_name' => 'civicrm_contact',
1645 'entity' => 'Contact',
1646 'bao' => 'CRM_Contact_BAO_Contact',
1647 'localizable' => 0,
1648 'html' => [
1649 'label' => ts("Modified Date"),
1650 ],
1651 'readonly' => TRUE,
1652 'add' => '4.3',
1653 ],
1654 ];
1655 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
1656 }
1657 return Civi::$statics[__CLASS__]['fields'];
1658 }
1659
1660 /**
1661 * Return a mapping from field-name to the corresponding key (as used in fields()).
1662 *
1663 * @return array
1664 * Array(string $name => string $uniqueName).
1665 */
1666 public static function &fieldKeys() {
1667 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
1668 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
1669 }
1670 return Civi::$statics[__CLASS__]['fieldKeys'];
1671 }
1672
1673 /**
1674 * Returns the names of this table
1675 *
1676 * @return string
1677 */
1678 public static function getTableName() {
1679 return self::$_tableName;
1680 }
1681
1682 /**
1683 * Returns if this table needs to be logged
1684 *
1685 * @return bool
1686 */
1687 public function getLog() {
1688 return self::$_log;
1689 }
1690
1691 /**
1692 * Returns the list of fields that can be imported
1693 *
1694 * @param bool $prefix
1695 *
1696 * @return array
1697 */
1698 public static function &import($prefix = FALSE) {
1699 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'contact', $prefix, []);
1700 return $r;
1701 }
1702
1703 /**
1704 * Returns the list of fields that can be exported
1705 *
1706 * @param bool $prefix
1707 *
1708 * @return array
1709 */
1710 public static function &export($prefix = FALSE) {
1711 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'contact', $prefix, []);
1712 return $r;
1713 }
1714
1715 /**
1716 * Returns the list of indices
1717 *
1718 * @param bool $localize
1719 *
1720 * @return array
1721 */
1722 public static function indices($localize = TRUE) {
1723 $indices = [
1724 'index_contact_type' => [
1725 'name' => 'index_contact_type',
1726 'field' => [
1727 0 => 'contact_type',
1728 ],
1729 'localizable' => FALSE,
1730 'sig' => 'civicrm_contact::0::contact_type',
1731 ],
1732 'index_contact_sub_type' => [
1733 'name' => 'index_contact_sub_type',
1734 'field' => [
1735 0 => 'contact_sub_type',
1736 ],
1737 'localizable' => FALSE,
1738 'sig' => 'civicrm_contact::0::contact_sub_type',
1739 ],
1740 'UI_external_identifier' => [
1741 'name' => 'UI_external_identifier',
1742 'field' => [
1743 0 => 'external_identifier',
1744 ],
1745 'localizable' => FALSE,
1746 'unique' => TRUE,
1747 'sig' => 'civicrm_contact::1::external_identifier',
1748 ],
1749 'index_sort_name' => [
1750 'name' => 'index_sort_name',
1751 'field' => [
1752 0 => 'sort_name',
1753 ],
1754 'localizable' => FALSE,
1755 'sig' => 'civicrm_contact::0::sort_name',
1756 ],
1757 'index_preferred_communication_method' => [
1758 'name' => 'index_preferred_communication_method',
1759 'field' => [
1760 0 => 'preferred_communication_method',
1761 ],
1762 'localizable' => FALSE,
1763 'sig' => 'civicrm_contact::0::preferred_communication_method',
1764 ],
1765 'index_hash' => [
1766 'name' => 'index_hash',
1767 'field' => [
1768 0 => 'hash',
1769 ],
1770 'localizable' => FALSE,
1771 'sig' => 'civicrm_contact::0::hash',
1772 ],
1773 'index_api_key' => [
1774 'name' => 'index_api_key',
1775 'field' => [
1776 0 => 'api_key',
1777 ],
1778 'localizable' => FALSE,
1779 'sig' => 'civicrm_contact::0::api_key',
1780 ],
1781 'index_first_name' => [
1782 'name' => 'index_first_name',
1783 'field' => [
1784 0 => 'first_name',
1785 ],
1786 'localizable' => FALSE,
1787 'sig' => 'civicrm_contact::0::first_name',
1788 ],
1789 'index_last_name' => [
1790 'name' => 'index_last_name',
1791 'field' => [
1792 0 => 'last_name',
1793 ],
1794 'localizable' => FALSE,
1795 'sig' => 'civicrm_contact::0::last_name',
1796 ],
1797 'UI_prefix' => [
1798 'name' => 'UI_prefix',
1799 'field' => [
1800 0 => 'prefix_id',
1801 ],
1802 'localizable' => FALSE,
1803 'sig' => 'civicrm_contact::0::prefix_id',
1804 ],
1805 'UI_suffix' => [
1806 'name' => 'UI_suffix',
1807 'field' => [
1808 0 => 'suffix_id',
1809 ],
1810 'localizable' => FALSE,
1811 'sig' => 'civicrm_contact::0::suffix_id',
1812 ],
1813 'index_communication_style_id' => [
1814 'name' => 'index_communication_style_id',
1815 'field' => [
1816 0 => 'communication_style_id',
1817 ],
1818 'localizable' => FALSE,
1819 'sig' => 'civicrm_contact::0::communication_style_id',
1820 ],
1821 'UI_gender' => [
1822 'name' => 'UI_gender',
1823 'field' => [
1824 0 => 'gender_id',
1825 ],
1826 'localizable' => FALSE,
1827 'sig' => 'civicrm_contact::0::gender_id',
1828 ],
1829 'index_is_deceased' => [
1830 'name' => 'index_is_deceased',
1831 'field' => [
1832 0 => 'is_deceased',
1833 ],
1834 'localizable' => FALSE,
1835 'sig' => 'civicrm_contact::0::is_deceased',
1836 ],
1837 'index_household_name' => [
1838 'name' => 'index_household_name',
1839 'field' => [
1840 0 => 'household_name',
1841 ],
1842 'localizable' => FALSE,
1843 'sig' => 'civicrm_contact::0::household_name',
1844 ],
1845 'index_organization_name' => [
1846 'name' => 'index_organization_name',
1847 'field' => [
1848 0 => 'organization_name',
1849 ],
1850 'localizable' => FALSE,
1851 'sig' => 'civicrm_contact::0::organization_name',
1852 ],
1853 'index_is_deleted_sort_name' => [
1854 'name' => 'index_is_deleted_sort_name',
1855 'field' => [
1856 0 => 'is_deleted',
1857 1 => 'sort_name',
1858 2 => 'id',
1859 ],
1860 'localizable' => FALSE,
1861 'sig' => 'civicrm_contact::0::is_deleted::sort_name::id',
1862 ],
1863 'index_created_date' => [
1864 'name' => 'index_created_date',
1865 'field' => [
1866 0 => 'created_date',
1867 ],
1868 'localizable' => FALSE,
1869 'sig' => 'civicrm_contact::0::created_date',
1870 ],
1871 'index_modified_date' => [
1872 'name' => 'index_modified_date',
1873 'field' => [
1874 0 => 'modified_date',
1875 ],
1876 'localizable' => FALSE,
1877 'sig' => 'civicrm_contact::0::modified_date',
1878 ],
1879 ];
1880 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
1881 }
1882
1883 }