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