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