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