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