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