Merge pull request #14326 from civicrm/5.14
[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
fb607354 9 * (GenCodeChecksum:e2181ea97a3e309b7e74b636757b6aac)
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',
042043f1 808 'protected' => 'true',
522a26c9 809 'table_name' => 'civicrm_contact',
810 'entity' => 'Contact',
811 'bao' => 'CRM_Contact_BAO_Contact',
6a7e5e5d 812 'localizable' => 0,
c3fc2621
CW
813 ],
814 'contact_source' => [
e501603b
TO
815 'name' => 'source',
816 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 817 'title' => ts('Contact Source'),
215b423e 818 'description' => ts('where contact come from, e.g. import, donate module insert...'),
e501603b
TO
819 'maxlength' => 255,
820 'size' => 30,
c3fc2621 821 'import' => TRUE,
e501603b
TO
822 'where' => 'civicrm_contact.source',
823 'headerPattern' => '/(C(ontact\s)?Source)$/i',
c3fc2621 824 'export' => TRUE,
522a26c9 825 'table_name' => 'civicrm_contact',
826 'entity' => 'Contact',
827 'bao' => 'CRM_Contact_BAO_Contact',
6a7e5e5d 828 'localizable' => 0,
c3fc2621 829 'html' => [
e501603b 830 'type' => 'Text',
c3fc2621
CW
831 ],
832 ],
833 'first_name' => [
e501603b
TO
834 'name' => 'first_name',
835 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 836 'title' => ts('First Name'),
215b423e 837 'description' => ts('First Name.'),
e501603b
TO
838 'maxlength' => 64,
839 'size' => 30,
c3fc2621 840 'import' => TRUE,
e501603b
TO
841 'where' => 'civicrm_contact.first_name',
842 'headerPattern' => '/^first|(f(irst\s)?name)$/i',
843 'dataPattern' => '/^\w+$/',
c3fc2621 844 'export' => TRUE,
522a26c9 845 'table_name' => 'civicrm_contact',
846 'entity' => 'Contact',
847 'bao' => 'CRM_Contact_BAO_Contact',
6a7e5e5d 848 'localizable' => 0,
c3fc2621 849 'html' => [
e501603b 850 'type' => 'Text',
c3fc2621
CW
851 ],
852 ],
853 'middle_name' => [
e501603b
TO
854 'name' => 'middle_name',
855 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 856 'title' => ts('Middle Name'),
215b423e 857 'description' => ts('Middle Name.'),
e501603b
TO
858 'maxlength' => 64,
859 'size' => 30,
c3fc2621 860 'import' => TRUE,
e501603b
TO
861 'where' => 'civicrm_contact.middle_name',
862 'headerPattern' => '/^middle|(m(iddle\s)?name)$/i',
863 'dataPattern' => '/^\w+$/',
c3fc2621 864 'export' => TRUE,
522a26c9 865 'table_name' => 'civicrm_contact',
866 'entity' => 'Contact',
867 'bao' => 'CRM_Contact_BAO_Contact',
6a7e5e5d 868 'localizable' => 0,
c3fc2621 869 'html' => [
e501603b 870 'type' => 'Text',
c3fc2621
CW
871 ],
872 ],
873 'last_name' => [
e501603b
TO
874 'name' => 'last_name',
875 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 876 'title' => ts('Last Name'),
215b423e 877 'description' => ts('Last Name.'),
e501603b
TO
878 'maxlength' => 64,
879 'size' => 30,
c3fc2621 880 'import' => TRUE,
e501603b
TO
881 'where' => 'civicrm_contact.last_name',
882 'headerPattern' => '/^last|(l(ast\s)?name)$/i',
883 'dataPattern' => '/^\w+(\s\w+)?+$/',
c3fc2621 884 'export' => TRUE,
522a26c9 885 'table_name' => 'civicrm_contact',
886 'entity' => 'Contact',
887 'bao' => 'CRM_Contact_BAO_Contact',
6a7e5e5d 888 'localizable' => 0,
c3fc2621 889 'html' => [
e501603b 890 'type' => 'Text',
c3fc2621
CW
891 ],
892 ],
893 'prefix_id' => [
e501603b
TO
894 'name' => 'prefix_id',
895 'type' => CRM_Utils_Type::T_INT,
c3fc2621 896 'title' => ts('Individual Prefix'),
215b423e 897 'description' => ts('Prefix or Title for name (Ms, Mr...). FK to prefix ID'),
c3fc2621 898 'import' => TRUE,
e501603b
TO
899 'where' => 'civicrm_contact.prefix_id',
900 'headerPattern' => '/^(prefix|title)/i',
901 'dataPattern' => '/^(mr|ms|mrs|sir|dr)\.?$/i',
c3fc2621 902 'export' => TRUE,
522a26c9 903 'table_name' => 'civicrm_contact',
904 'entity' => 'Contact',
905 'bao' => 'CRM_Contact_BAO_Contact',
6a7e5e5d 906 'localizable' => 0,
c3fc2621 907 'html' => [
e501603b 908 'type' => 'Select',
c3fc2621
CW
909 ],
910 'pseudoconstant' => [
e501603b
TO
911 'optionGroupName' => 'individual_prefix',
912 'optionEditPath' => 'civicrm/admin/options/individual_prefix',
e6ca0a57 913 ],
c3fc2621
CW
914 ],
915 'suffix_id' => [
e501603b
TO
916 'name' => 'suffix_id',
917 'type' => CRM_Utils_Type::T_INT,
c3fc2621 918 'title' => ts('Individual Suffix'),
215b423e 919 'description' => ts('Suffix for name (Jr, Sr...). FK to suffix ID'),
c3fc2621 920 'import' => TRUE,
e501603b
TO
921 'where' => 'civicrm_contact.suffix_id',
922 'headerPattern' => '/^suffix$/i',
923 'dataPattern' => '/^(sr|jr)\.?|i{2,}$/',
c3fc2621 924 'export' => TRUE,
522a26c9 925 'table_name' => 'civicrm_contact',
926 'entity' => 'Contact',
927 'bao' => 'CRM_Contact_BAO_Contact',
6a7e5e5d 928 'localizable' => 0,
c3fc2621 929 'html' => [
e501603b 930 'type' => 'Select',
c3fc2621
CW
931 ],
932 'pseudoconstant' => [
e501603b
TO
933 'optionGroupName' => 'individual_suffix',
934 'optionEditPath' => 'civicrm/admin/options/individual_suffix',
e6ca0a57 935 ],
c3fc2621
CW
936 ],
937 'formal_title' => [
e501603b
TO
938 'name' => 'formal_title',
939 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 940 'title' => ts('Formal Title'),
215b423e 941 'description' => ts('Formal (academic or similar) title in front of name. (Prof., Dr. etc.)'),
e501603b
TO
942 'maxlength' => 64,
943 'size' => CRM_Utils_Type::BIG,
c3fc2621 944 'import' => TRUE,
e501603b
TO
945 'where' => 'civicrm_contact.formal_title',
946 'headerPattern' => '/^title/i',
c3fc2621 947 'export' => TRUE,
522a26c9 948 'table_name' => 'civicrm_contact',
949 'entity' => 'Contact',
950 'bao' => 'CRM_Contact_BAO_Contact',
6a7e5e5d 951 'localizable' => 0,
c3fc2621 952 'html' => [
e501603b 953 'type' => 'Text',
c3fc2621
CW
954 ],
955 ],
956 'communication_style_id' => [
e501603b
TO
957 'name' => 'communication_style_id',
958 'type' => CRM_Utils_Type::T_INT,
c3fc2621 959 'title' => ts('Communication Style'),
215b423e 960 'description' => ts('Communication style (e.g. formal vs. familiar) to use with this contact. FK to communication styles in civicrm_option_value.'),
e501603b 961 'where' => 'civicrm_contact.communication_style_id',
a36434b9 962 'export' => TRUE,
522a26c9 963 'table_name' => 'civicrm_contact',
964 'entity' => 'Contact',
965 'bao' => 'CRM_Contact_BAO_Contact',
6a7e5e5d 966 'localizable' => 0,
c3fc2621 967 'html' => [
e501603b 968 'type' => 'Select',
c3fc2621
CW
969 ],
970 'pseudoconstant' => [
e501603b
TO
971 'optionGroupName' => 'communication_style',
972 'optionEditPath' => 'civicrm/admin/options/communication_style',
e6ca0a57 973 ],
c3fc2621
CW
974 ],
975 'email_greeting_id' => [
e501603b
TO
976 'name' => 'email_greeting_id',
977 'type' => CRM_Utils_Type::T_INT,
c3fc2621 978 'title' => ts('Email Greeting ID'),
215b423e 979 'description' => ts('FK to civicrm_option_value.id, that has to be valid registered Email Greeting.'),
54e389ac 980 'where' => 'civicrm_contact.email_greeting_id',
a36434b9 981 'export' => TRUE,
522a26c9 982 'table_name' => 'civicrm_contact',
983 'entity' => 'Contact',
984 'bao' => 'CRM_Contact_BAO_Contact',
6a7e5e5d 985 'localizable' => 0,
c3fc2621 986 'pseudoconstant' => [
f4a9693e
SL
987 'optionGroupName' => 'email_greeting',
988 'optionEditPath' => 'civicrm/admin/options/email_greeting',
e6ca0a57 989 ],
c3fc2621
CW
990 ],
991 'email_greeting_custom' => [
e501603b
TO
992 'name' => 'email_greeting_custom',
993 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 994 'title' => ts('Email Greeting Custom'),
215b423e 995 'description' => ts('Custom Email Greeting.'),
e501603b
TO
996 'maxlength' => 128,
997 'size' => CRM_Utils_Type::HUGE,
c3fc2621 998 'import' => TRUE,
e501603b 999 'where' => 'civicrm_contact.email_greeting_custom',
c3fc2621 1000 'export' => FALSE,
522a26c9 1001 'table_name' => 'civicrm_contact',
1002 'entity' => 'Contact',
1003 'bao' => 'CRM_Contact_BAO_Contact',
6a7e5e5d 1004 'localizable' => 0,
c3fc2621 1005 'html' => [
e501603b 1006 'type' => 'Text',
c3fc2621
CW
1007 ],
1008 ],
1009 'email_greeting_display' => [
e501603b
TO
1010 'name' => 'email_greeting_display',
1011 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 1012 'title' => ts('Email Greeting'),
215b423e 1013 'description' => ts('Cache Email Greeting.'),
e501603b
TO
1014 'maxlength' => 255,
1015 'size' => CRM_Utils_Type::HUGE,
a36434b9 1016 'where' => 'civicrm_contact.email_greeting_display',
522a26c9 1017 'table_name' => 'civicrm_contact',
1018 'entity' => 'Contact',
1019 'bao' => 'CRM_Contact_BAO_Contact',
6a7e5e5d 1020 'localizable' => 0,
c3fc2621 1021 'html' => [
e501603b 1022 'type' => 'Text',
c3fc2621
CW
1023 ],
1024 ],
1025 'postal_greeting_id' => [
e501603b
TO
1026 'name' => 'postal_greeting_id',
1027 'type' => CRM_Utils_Type::T_INT,
c3fc2621 1028 'title' => ts('Postal Greeting ID'),
215b423e 1029 'description' => ts('FK to civicrm_option_value.id, that has to be valid registered Postal Greeting.'),
54e389ac 1030 'where' => 'civicrm_contact.postal_greeting_id',
a36434b9 1031 'export' => TRUE,
522a26c9 1032 'table_name' => 'civicrm_contact',
1033 'entity' => 'Contact',
1034 'bao' => 'CRM_Contact_BAO_Contact',
6a7e5e5d 1035 'localizable' => 0,
c3fc2621 1036 'html' => [
e501603b 1037 'type' => 'Text',
c3fc2621
CW
1038 ],
1039 'pseudoconstant' => [
f4a9693e
SL
1040 'optionGroupName' => 'postal_greeting',
1041 'optionEditPath' => 'civicrm/admin/options/postal_greeting',
e6ca0a57 1042 ],
c3fc2621
CW
1043 ],
1044 'postal_greeting_custom' => [
e501603b
TO
1045 'name' => 'postal_greeting_custom',
1046 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 1047 'title' => ts('Postal Greeting Custom'),
215b423e 1048 'description' => ts('Custom Postal greeting.'),
e501603b
TO
1049 'maxlength' => 128,
1050 'size' => CRM_Utils_Type::HUGE,
c3fc2621 1051 'import' => TRUE,
e501603b 1052 'where' => 'civicrm_contact.postal_greeting_custom',
c3fc2621 1053 'export' => FALSE,
522a26c9 1054 'table_name' => 'civicrm_contact',
1055 'entity' => 'Contact',
1056 'bao' => 'CRM_Contact_BAO_Contact',
6a7e5e5d 1057 'localizable' => 0,
c3fc2621 1058 'html' => [
e501603b 1059 'type' => 'Text',
c3fc2621
CW
1060 ],
1061 ],
1062 'postal_greeting_display' => [
e501603b
TO
1063 'name' => 'postal_greeting_display',
1064 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 1065 'title' => ts('Postal Greeting'),
215b423e 1066 'description' => ts('Cache Postal greeting.'),
e501603b
TO
1067 'maxlength' => 255,
1068 'size' => CRM_Utils_Type::HUGE,
a36434b9 1069 'where' => 'civicrm_contact.postal_greeting_display',
522a26c9 1070 'table_name' => 'civicrm_contact',
1071 'entity' => 'Contact',
1072 'bao' => 'CRM_Contact_BAO_Contact',
6a7e5e5d 1073 'localizable' => 0,
c3fc2621 1074 'html' => [
e501603b 1075 'type' => 'Text',
c3fc2621
CW
1076 ],
1077 ],
1078 'addressee_id' => [
e501603b
TO
1079 'name' => 'addressee_id',
1080 'type' => CRM_Utils_Type::T_INT,
c3fc2621 1081 'title' => ts('Addressee ID'),
215b423e 1082 'description' => ts('FK to civicrm_option_value.id, that has to be valid registered Addressee.'),
54e389ac 1083 'where' => 'civicrm_contact.addressee_id',
a36434b9 1084 'export' => TRUE,
522a26c9 1085 'table_name' => 'civicrm_contact',
1086 'entity' => 'Contact',
1087 'bao' => 'CRM_Contact_BAO_Contact',
6a7e5e5d 1088 'localizable' => 0,
c3fc2621 1089 'pseudoconstant' => [
a28e9198 1090 'optionGroupName' => 'addressee',
1091 'optionEditPath' => 'civicrm/admin/options/addressee',
e6ca0a57 1092 ],
c3fc2621
CW
1093 ],
1094 'addressee_custom' => [
e501603b
TO
1095 'name' => 'addressee_custom',
1096 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 1097 'title' => ts('Addressee Custom'),
215b423e 1098 'description' => ts('Custom Addressee.'),
e501603b
TO
1099 'maxlength' => 128,
1100 'size' => CRM_Utils_Type::HUGE,
c3fc2621 1101 'import' => TRUE,
e501603b 1102 'where' => 'civicrm_contact.addressee_custom',
c3fc2621 1103 'export' => FALSE,
522a26c9 1104 'table_name' => 'civicrm_contact',
1105 'entity' => 'Contact',
1106 'bao' => 'CRM_Contact_BAO_Contact',
6a7e5e5d 1107 'localizable' => 0,
c3fc2621 1108 'html' => [
e501603b 1109 'type' => 'Text',
c3fc2621
CW
1110 ],
1111 ],
1112 'addressee_display' => [
e501603b
TO
1113 'name' => 'addressee_display',
1114 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 1115 'title' => ts('Addressee'),
215b423e 1116 'description' => ts('Cache Addressee.'),
e501603b
TO
1117 'maxlength' => 255,
1118 'size' => CRM_Utils_Type::HUGE,
a36434b9 1119 'where' => 'civicrm_contact.addressee_display',
522a26c9 1120 'table_name' => 'civicrm_contact',
1121 'entity' => 'Contact',
1122 'bao' => 'CRM_Contact_BAO_Contact',
6a7e5e5d 1123 'localizable' => 0,
c3fc2621 1124 'html' => [
e501603b 1125 'type' => 'Text',
c3fc2621
CW
1126 ],
1127 ],
1128 'job_title' => [
e501603b
TO
1129 'name' => 'job_title',
1130 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 1131 'title' => ts('Job Title'),
215b423e 1132 'description' => ts('Job Title'),
e501603b
TO
1133 'maxlength' => 255,
1134 'size' => 30,
c3fc2621 1135 'import' => TRUE,
e501603b
TO
1136 'where' => 'civicrm_contact.job_title',
1137 'headerPattern' => '/^job|(j(ob\s)?title)$/i',
1138 'dataPattern' => '//',
c3fc2621 1139 'export' => TRUE,
522a26c9 1140 'table_name' => 'civicrm_contact',
1141 'entity' => 'Contact',
1142 'bao' => 'CRM_Contact_BAO_Contact',
6a7e5e5d 1143 'localizable' => 0,
c3fc2621 1144 'html' => [
e501603b 1145 'type' => 'Text',
c3fc2621
CW
1146 ],
1147 ],
1148 'gender_id' => [
e501603b
TO
1149 'name' => 'gender_id',
1150 'type' => CRM_Utils_Type::T_INT,
c3fc2621 1151 'title' => ts('Gender'),
215b423e 1152 'description' => ts('FK to gender ID'),
c3fc2621 1153 'import' => TRUE,
e501603b
TO
1154 'where' => 'civicrm_contact.gender_id',
1155 'headerPattern' => '/^gender$/i',
c3fc2621 1156 'export' => TRUE,
522a26c9 1157 'table_name' => 'civicrm_contact',
1158 'entity' => 'Contact',
1159 'bao' => 'CRM_Contact_BAO_Contact',
6a7e5e5d 1160 'localizable' => 0,
c3fc2621 1161 'html' => [
e501603b 1162 'type' => 'Select',
c3fc2621
CW
1163 ],
1164 'pseudoconstant' => [
e501603b
TO
1165 'optionGroupName' => 'gender',
1166 'optionEditPath' => 'civicrm/admin/options/gender',
e6ca0a57 1167 ],
c3fc2621
CW
1168 ],
1169 'birth_date' => [
e501603b
TO
1170 'name' => 'birth_date',
1171 'type' => CRM_Utils_Type::T_DATE,
c3fc2621 1172 'title' => ts('Birth Date'),
215b423e 1173 'description' => ts('Date of birth'),
c3fc2621 1174 'import' => TRUE,
e501603b
TO
1175 'where' => 'civicrm_contact.birth_date',
1176 'headerPattern' => '/^birth|(b(irth\s)?date)|D(\W*)O(\W*)B(\W*)$/i',
1177 'dataPattern' => '/\d{4}-?\d{2}-?\d{2}/',
c3fc2621 1178 'export' => TRUE,
522a26c9 1179 'table_name' => 'civicrm_contact',
1180 'entity' => 'Contact',
1181 'bao' => 'CRM_Contact_BAO_Contact',
6a7e5e5d 1182 'localizable' => 0,
c3fc2621 1183 'html' => [
e501603b 1184 'type' => 'Select Date',
24317d89 1185 'formatType' => 'birth',
c3fc2621
CW
1186 ],
1187 ],
1188 'is_deceased' => [
e501603b
TO
1189 'name' => 'is_deceased',
1190 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621
CW
1191 'title' => ts('Deceased'),
1192 'import' => TRUE,
e501603b
TO
1193 'where' => 'civicrm_contact.is_deceased',
1194 'headerPattern' => '/i(s\s)?d(eceased)$/i',
c3fc2621 1195 'export' => TRUE,
45a83e42 1196 'default' => '0',
522a26c9 1197 'table_name' => 'civicrm_contact',
1198 'entity' => 'Contact',
1199 'bao' => 'CRM_Contact_BAO_Contact',
6a7e5e5d 1200 'localizable' => 0,
c3fc2621 1201 'html' => [
e501603b 1202 'type' => 'CheckBox',
c3fc2621
CW
1203 ],
1204 ],
1205 'deceased_date' => [
e501603b
TO
1206 'name' => 'deceased_date',
1207 'type' => CRM_Utils_Type::T_DATE,
c3fc2621 1208 'title' => ts('Deceased Date'),
215b423e 1209 'description' => ts('Date of deceased'),
c3fc2621 1210 'import' => TRUE,
e501603b
TO
1211 'where' => 'civicrm_contact.deceased_date',
1212 'headerPattern' => '/^deceased|(d(eceased\s)?date)$/i',
c3fc2621 1213 'export' => TRUE,
522a26c9 1214 'table_name' => 'civicrm_contact',
1215 'entity' => 'Contact',
1216 'bao' => 'CRM_Contact_BAO_Contact',
6a7e5e5d 1217 'localizable' => 0,
c3fc2621 1218 'html' => [
e501603b 1219 'type' => 'Select Date',
24317d89 1220 'formatType' => 'birth',
c3fc2621
CW
1221 ],
1222 ],
1223 'household_name' => [
e501603b
TO
1224 'name' => 'household_name',
1225 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 1226 'title' => ts('Household Name'),
215b423e 1227 'description' => ts('Household Name.'),
e501603b
TO
1228 'maxlength' => 128,
1229 'size' => 30,
c3fc2621 1230 'import' => TRUE,
e501603b
TO
1231 'where' => 'civicrm_contact.household_name',
1232 'headerPattern' => '/^household|(h(ousehold\s)?name)$/i',
1233 'dataPattern' => '/^\w+$/',
c3fc2621 1234 'export' => TRUE,
522a26c9 1235 'table_name' => 'civicrm_contact',
1236 'entity' => 'Contact',
1237 'bao' => 'CRM_Contact_BAO_Contact',
6a7e5e5d 1238 'localizable' => 0,
c3fc2621 1239 'html' => [
e501603b 1240 'type' => 'Text',
c3fc2621
CW
1241 ],
1242 ],
1243 'primary_contact_id' => [
e501603b
TO
1244 'name' => 'primary_contact_id',
1245 'type' => CRM_Utils_Type::T_INT,
c3fc2621 1246 'title' => ts('Household Primary Contact ID'),
215b423e 1247 'description' => ts('Optional FK to Primary Contact for this household.'),
a36434b9 1248 'where' => 'civicrm_contact.primary_contact_id',
522a26c9 1249 'table_name' => 'civicrm_contact',
1250 'entity' => 'Contact',
1251 'bao' => 'CRM_Contact_BAO_Contact',
6a7e5e5d 1252 'localizable' => 0,
e501603b 1253 'FKClassName' => 'CRM_Contact_DAO_Contact',
c3fc2621 1254 'html' => [
e501603b 1255 'type' => 'Select',
c3fc2621
CW
1256 ],
1257 ],
1258 'organization_name' => [
e501603b
TO
1259 'name' => 'organization_name',
1260 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 1261 'title' => ts('Organization Name'),
215b423e 1262 'description' => ts('Organization Name.'),
e501603b
TO
1263 'maxlength' => 128,
1264 'size' => 30,
c3fc2621 1265 'import' => TRUE,
e501603b
TO
1266 'where' => 'civicrm_contact.organization_name',
1267 'headerPattern' => '/^organization|(o(rganization\s)?name)$/i',
1268 'dataPattern' => '/^\w+$/',
c3fc2621 1269 'export' => TRUE,
522a26c9 1270 'table_name' => 'civicrm_contact',
1271 'entity' => 'Contact',
1272 'bao' => 'CRM_Contact_BAO_Contact',
6a7e5e5d 1273 'localizable' => 0,
c3fc2621 1274 'html' => [
e501603b 1275 'type' => 'Text',
c3fc2621
CW
1276 ],
1277 ],
1278 'sic_code' => [
e501603b
TO
1279 'name' => 'sic_code',
1280 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 1281 'title' => ts('Sic Code'),
215b423e 1282 'description' => ts('Standard Industry Classification Code.'),
e501603b
TO
1283 'maxlength' => 8,
1284 'size' => CRM_Utils_Type::EIGHT,
c3fc2621 1285 'import' => TRUE,
e501603b
TO
1286 'where' => 'civicrm_contact.sic_code',
1287 'headerPattern' => '/^sic|(s(ic\s)?code)$/i',
c3fc2621 1288 'export' => TRUE,
522a26c9 1289 'table_name' => 'civicrm_contact',
1290 'entity' => 'Contact',
1291 'bao' => 'CRM_Contact_BAO_Contact',
6a7e5e5d 1292 'localizable' => 0,
c3fc2621 1293 'html' => [
e501603b 1294 'type' => 'Text',
c3fc2621
CW
1295 ],
1296 ],
1297 'user_unique_id' => [
e501603b
TO
1298 'name' => 'user_unique_id',
1299 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 1300 'title' => ts('Unique ID (OpenID)'),
215b423e 1301 'description' => ts('the OpenID (or OpenID-style http://username.domain/) unique identifier for this contact mainly used for logging in to CiviCRM'),
e501603b
TO
1302 'maxlength' => 255,
1303 'size' => CRM_Utils_Type::HUGE,
c3fc2621 1304 'import' => TRUE,
e501603b
TO
1305 'where' => 'civicrm_contact.user_unique_id',
1306 'headerPattern' => '/^Open\s?ID|u(niq\w*)?\s?ID/i',
1307 'dataPattern' => '/^[\w\/\:\.]+$/',
c3fc2621 1308 'export' => TRUE,
e501603b 1309 'rule' => 'url',
522a26c9 1310 'table_name' => 'civicrm_contact',
1311 'entity' => 'Contact',
1312 'bao' => 'CRM_Contact_BAO_Contact',
6a7e5e5d 1313 'localizable' => 0,
c3fc2621 1314 'html' => [
e501603b 1315 'type' => 'Text',
c3fc2621
CW
1316 ],
1317 ],
1318 'current_employer_id' => [
e501603b
TO
1319 'name' => 'employer_id',
1320 'type' => CRM_Utils_Type::T_INT,
c3fc2621 1321 'title' => ts('Current Employer'),
215b423e 1322 'description' => ts('OPTIONAL FK to civicrm_contact record.'),
e501603b 1323 'where' => 'civicrm_contact.employer_id',
a36434b9 1324 'export' => TRUE,
522a26c9 1325 'table_name' => 'civicrm_contact',
1326 'entity' => 'Contact',
1327 'bao' => 'CRM_Contact_BAO_Contact',
6a7e5e5d 1328 'localizable' => 0,
e501603b 1329 'FKClassName' => 'CRM_Contact_DAO_Contact',
c3fc2621 1330 'html' => [
e501603b 1331 'type' => 'EntityRef',
c3fc2621
CW
1332 ],
1333 ],
1334 'contact_is_deleted' => [
e501603b
TO
1335 'name' => 'is_deleted',
1336 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621
CW
1337 'title' => ts('Contact is in Trash'),
1338 'required' => TRUE,
e501603b 1339 'where' => 'civicrm_contact.is_deleted',
a36434b9 1340 'export' => TRUE,
45a83e42 1341 'default' => '0',
522a26c9 1342 'table_name' => 'civicrm_contact',
1343 'entity' => 'Contact',
1344 'bao' => 'CRM_Contact_BAO_Contact',
6a7e5e5d 1345 'localizable' => 0,
c3fc2621 1346 'html' => [
e501603b 1347 'type' => 'CheckBox',
c3fc2621
CW
1348 ],
1349 ],
1350 'created_date' => [
e501603b
TO
1351 'name' => 'created_date',
1352 'type' => CRM_Utils_Type::T_TIMESTAMP,
c3fc2621 1353 'title' => ts('Created Date'),
215b423e 1354 'description' => ts('When was the contact was created.'),
c3fc2621 1355 'required' => FALSE,
e501603b 1356 'where' => 'civicrm_contact.created_date',
a36434b9 1357 'export' => TRUE,
e501603b 1358 'default' => 'NULL',
522a26c9 1359 'table_name' => 'civicrm_contact',
1360 'entity' => 'Contact',
1361 'bao' => 'CRM_Contact_BAO_Contact',
6a7e5e5d 1362 'localizable' => 0,
c3fc2621
CW
1363 ],
1364 'modified_date' => [
e501603b
TO
1365 'name' => 'modified_date',
1366 'type' => CRM_Utils_Type::T_TIMESTAMP,
c3fc2621 1367 'title' => ts('Modified Date'),
215b423e 1368 'description' => ts('When was the contact (or closely related entity) was created or modified or deleted.'),
c3fc2621 1369 'required' => FALSE,
e501603b 1370 'where' => 'civicrm_contact.modified_date',
a36434b9 1371 'export' => TRUE,
e501603b 1372 'default' => 'CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP',
522a26c9 1373 'table_name' => 'civicrm_contact',
1374 'entity' => 'Contact',
1375 'bao' => 'CRM_Contact_BAO_Contact',
6a7e5e5d 1376 'localizable' => 0,
c3fc2621
CW
1377 ],
1378 ];
346aaaba 1379 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 1380 }
346aaaba 1381 return Civi::$statics[__CLASS__]['fields'];
e501603b 1382 }
c3fc2621 1383
e501603b 1384 /**
bd8e0b14 1385 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
1386 *
1387 * @return array
bd8e0b14 1388 * Array(string $name => string $uniqueName).
e501603b 1389 */
c3fc2621 1390 public static function &fieldKeys() {
bd8e0b14
TO
1391 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
1392 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 1393 }
bd8e0b14 1394 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b 1395 }
c3fc2621 1396
e501603b
TO
1397 /**
1398 * Returns the names of this table
1399 *
1400 * @return string
1401 */
c3fc2621 1402 public static function getTableName() {
e501603b
TO
1403 return self::$_tableName;
1404 }
c3fc2621 1405
e501603b
TO
1406 /**
1407 * Returns if this table needs to be logged
1408 *
c3fc2621 1409 * @return bool
e501603b 1410 */
c3fc2621 1411 public function getLog() {
e501603b
TO
1412 return self::$_log;
1413 }
c3fc2621 1414
e501603b
TO
1415 /**
1416 * Returns the list of fields that can be imported
1417 *
1418 * @param bool $prefix
1419 *
1420 * @return array
1421 */
c3fc2621
CW
1422 public static function &import($prefix = FALSE) {
1423 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'contact', $prefix, []);
60808919 1424 return $r;
e501603b 1425 }
c3fc2621 1426
e501603b
TO
1427 /**
1428 * Returns the list of fields that can be exported
1429 *
1430 * @param bool $prefix
1431 *
1432 * @return array
1433 */
c3fc2621
CW
1434 public static function &export($prefix = FALSE) {
1435 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'contact', $prefix, []);
60808919 1436 return $r;
e501603b 1437 }
c3fc2621 1438
e7a6b91a
AS
1439 /**
1440 * Returns the list of indices
c3fc2621
CW
1441 *
1442 * @param bool $localize
1443 *
1444 * @return array
e7a6b91a
AS
1445 */
1446 public static function indices($localize = TRUE) {
c3fc2621
CW
1447 $indices = [
1448 'index_contact_type' => [
e7a6b91a 1449 'name' => 'index_contact_type',
c3fc2621 1450 'field' => [
e7a6b91a 1451 0 => 'contact_type',
c3fc2621
CW
1452 ],
1453 'localizable' => FALSE,
e7a6b91a 1454 'sig' => 'civicrm_contact::0::contact_type',
c3fc2621
CW
1455 ],
1456 'index_contact_sub_type' => [
e7a6b91a 1457 'name' => 'index_contact_sub_type',
c3fc2621 1458 'field' => [
e7a6b91a 1459 0 => 'contact_sub_type',
c3fc2621
CW
1460 ],
1461 'localizable' => FALSE,
e7a6b91a 1462 'sig' => 'civicrm_contact::0::contact_sub_type',
c3fc2621
CW
1463 ],
1464 'UI_external_identifier' => [
e7a6b91a 1465 'name' => 'UI_external_identifier',
c3fc2621 1466 'field' => [
e7a6b91a 1467 0 => 'external_identifier',
c3fc2621
CW
1468 ],
1469 'localizable' => FALSE,
1470 'unique' => TRUE,
e7a6b91a 1471 'sig' => 'civicrm_contact::1::external_identifier',
c3fc2621
CW
1472 ],
1473 'index_sort_name' => [
e7a6b91a 1474 'name' => 'index_sort_name',
c3fc2621 1475 'field' => [
e7a6b91a 1476 0 => 'sort_name',
c3fc2621
CW
1477 ],
1478 'localizable' => FALSE,
e7a6b91a 1479 'sig' => 'civicrm_contact::0::sort_name',
c3fc2621
CW
1480 ],
1481 'index_preferred_communication_method' => [
e7a6b91a 1482 'name' => 'index_preferred_communication_method',
c3fc2621 1483 'field' => [
e7a6b91a 1484 0 => 'preferred_communication_method',
c3fc2621
CW
1485 ],
1486 'localizable' => FALSE,
e7a6b91a 1487 'sig' => 'civicrm_contact::0::preferred_communication_method',
c3fc2621
CW
1488 ],
1489 'index_hash' => [
e7a6b91a 1490 'name' => 'index_hash',
c3fc2621 1491 'field' => [
e7a6b91a 1492 0 => 'hash',
c3fc2621
CW
1493 ],
1494 'localizable' => FALSE,
e7a6b91a 1495 'sig' => 'civicrm_contact::0::hash',
c3fc2621
CW
1496 ],
1497 'index_api_key' => [
e7a6b91a 1498 'name' => 'index_api_key',
c3fc2621 1499 'field' => [
e7a6b91a 1500 0 => 'api_key',
c3fc2621
CW
1501 ],
1502 'localizable' => FALSE,
e7a6b91a 1503 'sig' => 'civicrm_contact::0::api_key',
c3fc2621
CW
1504 ],
1505 'index_first_name' => [
e7a6b91a 1506 'name' => 'index_first_name',
c3fc2621 1507 'field' => [
e7a6b91a 1508 0 => 'first_name',
c3fc2621
CW
1509 ],
1510 'localizable' => FALSE,
e7a6b91a 1511 'sig' => 'civicrm_contact::0::first_name',
c3fc2621
CW
1512 ],
1513 'index_last_name' => [
e7a6b91a 1514 'name' => 'index_last_name',
c3fc2621 1515 'field' => [
e7a6b91a 1516 0 => 'last_name',
c3fc2621
CW
1517 ],
1518 'localizable' => FALSE,
e7a6b91a 1519 'sig' => 'civicrm_contact::0::last_name',
c3fc2621
CW
1520 ],
1521 'UI_prefix' => [
e7a6b91a 1522 'name' => 'UI_prefix',
c3fc2621 1523 'field' => [
e7a6b91a 1524 0 => 'prefix_id',
c3fc2621
CW
1525 ],
1526 'localizable' => FALSE,
e7a6b91a 1527 'sig' => 'civicrm_contact::0::prefix_id',
c3fc2621
CW
1528 ],
1529 'UI_suffix' => [
e7a6b91a 1530 'name' => 'UI_suffix',
c3fc2621 1531 'field' => [
e7a6b91a 1532 0 => 'suffix_id',
c3fc2621
CW
1533 ],
1534 'localizable' => FALSE,
e7a6b91a 1535 'sig' => 'civicrm_contact::0::suffix_id',
c3fc2621
CW
1536 ],
1537 'index_communication_style_id' => [
e7a6b91a 1538 'name' => 'index_communication_style_id',
c3fc2621 1539 'field' => [
e7a6b91a 1540 0 => 'communication_style_id',
c3fc2621
CW
1541 ],
1542 'localizable' => FALSE,
e7a6b91a 1543 'sig' => 'civicrm_contact::0::communication_style_id',
c3fc2621
CW
1544 ],
1545 'UI_gender' => [
e7a6b91a 1546 'name' => 'UI_gender',
c3fc2621 1547 'field' => [
e7a6b91a 1548 0 => 'gender_id',
c3fc2621
CW
1549 ],
1550 'localizable' => FALSE,
e7a6b91a 1551 'sig' => 'civicrm_contact::0::gender_id',
c3fc2621
CW
1552 ],
1553 'index_is_deceased' => [
27633545 1554 'name' => 'index_is_deceased',
c3fc2621 1555 'field' => [
27633545 1556 0 => 'is_deceased',
c3fc2621
CW
1557 ],
1558 'localizable' => FALSE,
27633545 1559 'sig' => 'civicrm_contact::0::is_deceased',
c3fc2621
CW
1560 ],
1561 'index_household_name' => [
e7a6b91a 1562 'name' => 'index_household_name',
c3fc2621 1563 'field' => [
e7a6b91a 1564 0 => 'household_name',
c3fc2621
CW
1565 ],
1566 'localizable' => FALSE,
e7a6b91a 1567 'sig' => 'civicrm_contact::0::household_name',
c3fc2621
CW
1568 ],
1569 'index_organization_name' => [
e7a6b91a 1570 'name' => 'index_organization_name',
c3fc2621 1571 'field' => [
e7a6b91a 1572 0 => 'organization_name',
c3fc2621
CW
1573 ],
1574 'localizable' => FALSE,
e7a6b91a 1575 'sig' => 'civicrm_contact::0::organization_name',
c3fc2621
CW
1576 ],
1577 'index_is_deleted_sort_name' => [
e7a6b91a 1578 'name' => 'index_is_deleted_sort_name',
c3fc2621 1579 'field' => [
e7a6b91a
AS
1580 0 => 'is_deleted',
1581 1 => 'sort_name',
1582 2 => 'id',
c3fc2621
CW
1583 ],
1584 'localizable' => FALSE,
e7a6b91a 1585 'sig' => 'civicrm_contact::0::is_deleted::sort_name::id',
c3fc2621
CW
1586 ],
1587 ];
e7a6b91a
AS
1588 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
1589 }
c3fc2621 1590
e501603b 1591}