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