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