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