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