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