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