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