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