Merge pull request #23178 from civicrm/5.49
[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
c1e814c7 9 * (GenCodeChecksum:67196fefde2ec151c97d463869102e21)
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 /**
c1e814c7 87 * @var bool|string
28979d65
CW
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 /**
c1e814c7 94 * @var bool|string
28979d65
CW
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 /**
c1e814c7 101 * @var bool|string
28979d65
CW
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 /**
c1e814c7 108 * @var bool|string
28979d65
CW
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 /**
c1e814c7 115 * @var bool|string
28979d65
CW
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 640 'title' => ts('Do Not Email'),
c1e814c7 641 'required' => TRUE,
c3fc2621 642 'import' => TRUE,
e501603b
TO
643 'where' => 'civicrm_contact.do_not_email',
644 'headerPattern' => '/d(o )?(not )?(email)/i',
645 'dataPattern' => '/^\d{1,}$/',
c3fc2621 646 'export' => TRUE,
45a83e42 647 'default' => '0',
522a26c9 648 'table_name' => 'civicrm_contact',
649 'entity' => 'Contact',
650 'bao' => 'CRM_Contact_BAO_Contact',
6a7e5e5d 651 'localizable' => 0,
c3fc2621 652 'html' => [
e501603b 653 'type' => 'CheckBox',
c23563e3 654 'label' => ts("Do Not Email"),
c3fc2621 655 ],
a9d0587b 656 'add' => '1.1',
c3fc2621
CW
657 ],
658 'do_not_phone' => [
e501603b
TO
659 'name' => 'do_not_phone',
660 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 661 'title' => ts('Do Not Phone'),
c1e814c7 662 'required' => TRUE,
c3fc2621 663 'import' => TRUE,
e501603b
TO
664 'where' => 'civicrm_contact.do_not_phone',
665 'headerPattern' => '/d(o )?(not )?(call|phone)/i',
666 'dataPattern' => '/^\d{1,}$/',
c3fc2621 667 'export' => TRUE,
45a83e42 668 'default' => '0',
522a26c9 669 'table_name' => 'civicrm_contact',
670 'entity' => 'Contact',
671 'bao' => 'CRM_Contact_BAO_Contact',
6a7e5e5d 672 'localizable' => 0,
c3fc2621 673 'html' => [
e501603b 674 'type' => 'CheckBox',
c23563e3 675 'label' => ts("Do Not Phone"),
c3fc2621 676 ],
a9d0587b 677 'add' => '1.1',
c3fc2621
CW
678 ],
679 'do_not_mail' => [
e501603b
TO
680 'name' => 'do_not_mail',
681 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 682 'title' => ts('Do Not Mail'),
c1e814c7 683 'required' => TRUE,
c3fc2621 684 'import' => TRUE,
e501603b
TO
685 'where' => 'civicrm_contact.do_not_mail',
686 'headerPattern' => '/^(d(o\s)?n(ot\s)?mail)|(\w*)?bulk\s?(\w*)$/i',
687 'dataPattern' => '/^\d{1,}$/',
c3fc2621 688 'export' => TRUE,
45a83e42 689 'default' => '0',
522a26c9 690 'table_name' => 'civicrm_contact',
691 'entity' => 'Contact',
692 'bao' => 'CRM_Contact_BAO_Contact',
6a7e5e5d 693 'localizable' => 0,
c3fc2621 694 'html' => [
e501603b 695 'type' => 'CheckBox',
c23563e3 696 'label' => ts("Do Not Mail"),
c3fc2621 697 ],
a9d0587b 698 'add' => '1.1',
c3fc2621
CW
699 ],
700 'do_not_sms' => [
e501603b
TO
701 'name' => 'do_not_sms',
702 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 703 'title' => ts('Do Not Sms'),
c1e814c7 704 'required' => TRUE,
c3fc2621 705 'import' => TRUE,
e501603b
TO
706 'where' => 'civicrm_contact.do_not_sms',
707 'headerPattern' => '/d(o )?(not )?(sms)/i',
708 'dataPattern' => '/^\d{1,}$/',
c3fc2621 709 'export' => TRUE,
45a83e42 710 'default' => '0',
522a26c9 711 'table_name' => 'civicrm_contact',
712 'entity' => 'Contact',
713 'bao' => 'CRM_Contact_BAO_Contact',
6a7e5e5d 714 'localizable' => 0,
c3fc2621 715 'html' => [
e501603b 716 'type' => 'CheckBox',
c23563e3 717 'label' => ts("Do Not Sms"),
c3fc2621 718 ],
a9d0587b 719 'add' => '3.0',
c3fc2621
CW
720 ],
721 'do_not_trade' => [
e501603b
TO
722 'name' => 'do_not_trade',
723 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 724 'title' => ts('Do Not Trade'),
c1e814c7 725 'required' => TRUE,
c3fc2621 726 'import' => TRUE,
e501603b
TO
727 'where' => 'civicrm_contact.do_not_trade',
728 'headerPattern' => '/d(o )?(not )?(trade)/i',
729 'dataPattern' => '/^\d{1,}$/',
c3fc2621 730 'export' => TRUE,
45a83e42 731 'default' => '0',
522a26c9 732 'table_name' => 'civicrm_contact',
733 'entity' => 'Contact',
734 'bao' => 'CRM_Contact_BAO_Contact',
6a7e5e5d 735 'localizable' => 0,
c3fc2621 736 'html' => [
e501603b 737 'type' => 'CheckBox',
c23563e3 738 'label' => ts("Do Not Trade"),
c3fc2621 739 ],
a9d0587b 740 'add' => '1.1',
c3fc2621
CW
741 ],
742 'is_opt_out' => [
e501603b
TO
743 'name' => 'is_opt_out',
744 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 745 'title' => ts('No Bulk Emails (User Opt Out)'),
215b423e 746 'description' => ts('Has the contact opted out from receiving all bulk email from the organization or site domain?'),
c3fc2621
CW
747 'required' => TRUE,
748 'import' => TRUE,
e501603b 749 'where' => 'civicrm_contact.is_opt_out',
c3fc2621 750 'export' => TRUE,
45a83e42 751 'default' => '0',
522a26c9 752 'table_name' => 'civicrm_contact',
753 'entity' => 'Contact',
754 'bao' => 'CRM_Contact_BAO_Contact',
6a7e5e5d 755 'localizable' => 0,
c3fc2621 756 'html' => [
e501603b 757 'type' => 'CheckBox',
c23563e3 758 'label' => ts("Is Opt Out"),
c3fc2621 759 ],
a9d0587b 760 'add' => '1.1',
c3fc2621
CW
761 ],
762 'legal_identifier' => [
e501603b
TO
763 'name' => 'legal_identifier',
764 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 765 'title' => ts('Legal Identifier'),
fb607354 766 'description' => ts('May be used for SSN, EIN/TIN, Household ID (census) or other applicable unique legal/government ID.'),
e501603b
TO
767 'maxlength' => 32,
768 'size' => CRM_Utils_Type::MEDIUM,
c3fc2621 769 'import' => TRUE,
e501603b
TO
770 'where' => 'civicrm_contact.legal_identifier',
771 'headerPattern' => '/legal\s?id/i',
772 'dataPattern' => '/\w+?\d{5,}/',
c3fc2621 773 'export' => TRUE,
522a26c9 774 'table_name' => 'civicrm_contact',
775 'entity' => 'Contact',
776 'bao' => 'CRM_Contact_BAO_Contact',
6a7e5e5d 777 'localizable' => 0,
c3fc2621 778 'html' => [
e501603b 779 'type' => 'Text',
c23563e3 780 'label' => ts("Legal Identifier"),
c3fc2621 781 ],
a9d0587b 782 'add' => '1.1',
c3fc2621
CW
783 ],
784 'external_identifier' => [
e501603b
TO
785 'name' => 'external_identifier',
786 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 787 'title' => ts('External Identifier'),
215b423e 788 'description' => ts('Unique trusted external ID (generally from a legacy app/datasource). Particularly useful for deduping operations.'),
e501603b
TO
789 'maxlength' => 64,
790 'size' => 8,
c3fc2621 791 'import' => TRUE,
e501603b
TO
792 'where' => 'civicrm_contact.external_identifier',
793 'headerPattern' => '/external\s?id/i',
794 'dataPattern' => '/^\d{11,}$/',
c3fc2621 795 'export' => TRUE,
522a26c9 796 'table_name' => 'civicrm_contact',
797 'entity' => 'Contact',
798 'bao' => 'CRM_Contact_BAO_Contact',
6a7e5e5d 799 'localizable' => 0,
c3fc2621 800 'html' => [
e501603b 801 'type' => 'Text',
c23563e3 802 'label' => ts("External Identifier"),
c3fc2621 803 ],
a9d0587b 804 'add' => '1.1',
c3fc2621
CW
805 ],
806 'sort_name' => [
e501603b
TO
807 'name' => 'sort_name',
808 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 809 'title' => ts('Sort Name'),
215b423e 810 'description' => ts('Name used for sorting different contact types'),
e501603b
TO
811 'maxlength' => 128,
812 'size' => 30,
e501603b 813 'where' => 'civicrm_contact.sort_name',
a36434b9 814 'export' => TRUE,
522a26c9 815 'table_name' => 'civicrm_contact',
816 'entity' => 'Contact',
817 'bao' => 'CRM_Contact_BAO_Contact',
6a7e5e5d 818 'localizable' => 0,
c3fc2621 819 'html' => [
e501603b 820 'type' => 'Text',
c3fc2621 821 ],
34745448 822 'readonly' => TRUE,
a9d0587b 823 'add' => '1.1',
c3fc2621
CW
824 ],
825 'display_name' => [
e501603b
TO
826 'name' => 'display_name',
827 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 828 'title' => ts('Display Name'),
215b423e 829 'description' => ts('Formatted name representing preferred format for display/print/other output.'),
e501603b
TO
830 'maxlength' => 128,
831 'size' => 30,
e501603b 832 'where' => 'civicrm_contact.display_name',
a36434b9 833 'export' => TRUE,
522a26c9 834 'table_name' => 'civicrm_contact',
835 'entity' => 'Contact',
836 'bao' => 'CRM_Contact_BAO_Contact',
6a7e5e5d 837 'localizable' => 0,
c3fc2621 838 'html' => [
e501603b 839 'type' => 'Text',
c3fc2621 840 ],
34745448 841 'readonly' => TRUE,
a9d0587b 842 'add' => '1.1',
c3fc2621
CW
843 ],
844 'nick_name' => [
e501603b
TO
845 'name' => 'nick_name',
846 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 847 'title' => ts('Nickname'),
215b423e 848 'description' => ts('Nickname.'),
e501603b
TO
849 'maxlength' => 128,
850 'size' => 30,
c3fc2621 851 'import' => TRUE,
e501603b
TO
852 'where' => 'civicrm_contact.nick_name',
853 'headerPattern' => '/n(ick\s)name|nick$/i',
854 'dataPattern' => '/^\w+$/',
c3fc2621 855 'export' => TRUE,
522a26c9 856 'table_name' => 'civicrm_contact',
857 'entity' => 'Contact',
858 'bao' => 'CRM_Contact_BAO_Contact',
6a7e5e5d 859 'localizable' => 0,
c3fc2621 860 'html' => [
e501603b 861 'type' => 'Text',
c3fc2621 862 ],
a9d0587b 863 'add' => '1.1',
c3fc2621
CW
864 ],
865 'legal_name' => [
e501603b
TO
866 'name' => 'legal_name',
867 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 868 'title' => ts('Legal Name'),
215b423e 869 'description' => ts('Legal Name.'),
e501603b
TO
870 'maxlength' => 128,
871 'size' => 30,
c3fc2621 872 'import' => TRUE,
e501603b
TO
873 'where' => 'civicrm_contact.legal_name',
874 'headerPattern' => '/^legal|(l(egal\s)?name)$/i',
c3fc2621 875 'export' => TRUE,
b383d043 876 'contactType' => 'Organization',
522a26c9 877 'table_name' => 'civicrm_contact',
878 'entity' => 'Contact',
879 'bao' => 'CRM_Contact_BAO_Contact',
6a7e5e5d 880 'localizable' => 0,
c3fc2621 881 'html' => [
e501603b 882 'type' => 'Text',
c23563e3 883 'label' => ts("Legal Name"),
c3fc2621 884 ],
a9d0587b 885 'add' => '1.1',
c3fc2621
CW
886 ],
887 'image_URL' => [
e501603b
TO
888 'name' => 'image_URL',
889 'type' => CRM_Utils_Type::T_TEXT,
c3fc2621 890 'title' => ts('Image Url'),
215b423e 891 'description' => ts('optional URL for preferred image (photo, logo, etc.) to display for this contact.'),
c3fc2621 892 'import' => TRUE,
e501603b 893 'where' => 'civicrm_contact.image_URL',
c3fc2621 894 'export' => TRUE,
522a26c9 895 'table_name' => 'civicrm_contact',
896 'entity' => 'Contact',
897 'bao' => 'CRM_Contact_BAO_Contact',
6a7e5e5d 898 'localizable' => 0,
c3fc2621 899 'html' => [
e501603b 900 'type' => 'File',
c23563e3 901 'label' => ts("Image URL"),
c3fc2621 902 ],
a9d0587b 903 'add' => '1.1',
c3fc2621
CW
904 ],
905 'preferred_communication_method' => [
e501603b
TO
906 'name' => 'preferred_communication_method',
907 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 908 'title' => ts('Preferred Communication Method'),
215b423e 909 'description' => ts('What is the preferred mode of communication.'),
e501603b
TO
910 'maxlength' => 255,
911 'size' => CRM_Utils_Type::HUGE,
c3fc2621 912 'import' => TRUE,
e501603b
TO
913 'where' => 'civicrm_contact.preferred_communication_method',
914 'headerPattern' => '/^p(ref\w*\s)?c(omm\w*)|( meth\w*)$/i',
915 'dataPattern' => '/^\w+$/',
c3fc2621 916 'export' => TRUE,
522a26c9 917 'table_name' => 'civicrm_contact',
918 'entity' => 'Contact',
919 'bao' => 'CRM_Contact_BAO_Contact',
6a7e5e5d 920 'localizable' => 0,
2a5c9b4d 921 'serialize' => self::SERIALIZE_SEPARATOR_BOOKEND,
c3fc2621 922 'html' => [
e501603b 923 'type' => 'Select',
c3fc2621
CW
924 ],
925 'pseudoconstant' => [
e501603b
TO
926 'optionGroupName' => 'preferred_communication_method',
927 'optionEditPath' => 'civicrm/admin/options/preferred_communication_method',
e6ca0a57 928 ],
a9d0587b 929 'add' => '1.1',
c3fc2621
CW
930 ],
931 'preferred_language' => [
e501603b
TO
932 'name' => 'preferred_language',
933 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 934 'title' => ts('Preferred Language'),
215b423e 935 'description' => ts('Which language is preferred for communication. FK to languages in civicrm_option_value.'),
e501603b
TO
936 'maxlength' => 5,
937 'size' => CRM_Utils_Type::SIX,
c3fc2621 938 'import' => TRUE,
e501603b
TO
939 'where' => 'civicrm_contact.preferred_language',
940 'headerPattern' => '/^lang/i',
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' => 'languages',
951 'keyColumn' => 'name',
952 'optionEditPath' => 'civicrm/admin/options/languages',
e6ca0a57 953 ],
a9d0587b 954 'add' => '3.2',
c3fc2621
CW
955 ],
956 'preferred_mail_format' => [
e501603b
TO
957 'name' => 'preferred_mail_format',
958 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 959 'title' => ts('Preferred Mail Format'),
215b423e 960 'description' => ts('What is the preferred mode of sending an email.'),
e501603b
TO
961 'maxlength' => 8,
962 'size' => CRM_Utils_Type::EIGHT,
c3fc2621 963 'import' => TRUE,
e501603b
TO
964 'where' => 'civicrm_contact.preferred_mail_format',
965 'headerPattern' => '/^p(ref\w*\s)?m(ail\s)?f(orm\w*)$/i',
c3fc2621 966 'export' => TRUE,
e501603b 967 'default' => 'Both',
522a26c9 968 'table_name' => 'civicrm_contact',
969 'entity' => 'Contact',
970 'bao' => 'CRM_Contact_BAO_Contact',
6a7e5e5d 971 'localizable' => 0,
c3fc2621 972 'html' => [
e501603b 973 'type' => 'Select',
c23563e3 974 'label' => ts("Preferred Mail Format"),
c3fc2621
CW
975 ],
976 'pseudoconstant' => [
e501603b 977 'callback' => 'CRM_Core_SelectValues::pmf',
e6ca0a57 978 ],
a9d0587b 979 'add' => '1.1',
c3fc2621
CW
980 ],
981 'hash' => [
e501603b
TO
982 'name' => 'hash',
983 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 984 'title' => ts('Contact Hash'),
215b423e 985 'description' => ts('Key for validating requests related to this contact.'),
e501603b
TO
986 'maxlength' => 32,
987 'size' => CRM_Utils_Type::MEDIUM,
e501603b 988 'where' => 'civicrm_contact.hash',
a36434b9 989 'export' => TRUE,
522a26c9 990 'table_name' => 'civicrm_contact',
991 'entity' => 'Contact',
992 'bao' => 'CRM_Contact_BAO_Contact',
6a7e5e5d 993 'localizable' => 0,
34745448 994 'readonly' => TRUE,
a9d0587b 995 'add' => '1.1',
c3fc2621
CW
996 ],
997 'api_key' => [
e501603b
TO
998 'name' => 'api_key',
999 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 1000 'title' => ts('Api Key'),
215b423e 1001 'description' => ts('API Key for validating requests related to this contact.'),
e501603b
TO
1002 'maxlength' => 32,
1003 'size' => CRM_Utils_Type::MEDIUM,
a36434b9 1004 'where' => 'civicrm_contact.api_key',
1713a0ec
CW
1005 'permission' => [
1006 [
1007 'administer CiviCRM',
1008 'edit api keys',
1009 ],
1010 ],
522a26c9 1011 'table_name' => 'civicrm_contact',
1012 'entity' => 'Contact',
1013 'bao' => 'CRM_Contact_BAO_Contact',
6a7e5e5d 1014 'localizable' => 0,
c23563e3
SL
1015 'html' => [
1016 'label' => ts("API KEY"),
1017 ],
58b0bf5a 1018 'readonly' => TRUE,
a9d0587b 1019 'add' => '2.2',
c3fc2621
CW
1020 ],
1021 'contact_source' => [
e501603b
TO
1022 'name' => 'source',
1023 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 1024 'title' => ts('Contact Source'),
215b423e 1025 'description' => ts('where contact come from, e.g. import, donate module insert...'),
e501603b
TO
1026 'maxlength' => 255,
1027 'size' => 30,
c3fc2621 1028 'import' => TRUE,
e501603b
TO
1029 'where' => 'civicrm_contact.source',
1030 'headerPattern' => '/(C(ontact\s)?Source)$/i',
c3fc2621 1031 'export' => TRUE,
522a26c9 1032 'table_name' => 'civicrm_contact',
1033 'entity' => 'Contact',
1034 'bao' => 'CRM_Contact_BAO_Contact',
6a7e5e5d 1035 'localizable' => 0,
c3fc2621 1036 'html' => [
e501603b 1037 'type' => 'Text',
c3fc2621 1038 ],
a9d0587b 1039 'add' => '1.1',
c3fc2621
CW
1040 ],
1041 'first_name' => [
e501603b
TO
1042 'name' => 'first_name',
1043 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 1044 'title' => ts('First Name'),
215b423e 1045 'description' => ts('First Name.'),
e501603b
TO
1046 'maxlength' => 64,
1047 'size' => 30,
c3fc2621 1048 'import' => TRUE,
e501603b
TO
1049 'where' => 'civicrm_contact.first_name',
1050 'headerPattern' => '/^first|(f(irst\s)?name)$/i',
1051 'dataPattern' => '/^\w+$/',
c3fc2621 1052 'export' => TRUE,
f5c0f096 1053 'contactType' => 'Individual',
522a26c9 1054 'table_name' => 'civicrm_contact',
1055 'entity' => 'Contact',
1056 'bao' => 'CRM_Contact_BAO_Contact',
6a7e5e5d 1057 'localizable' => 0,
c3fc2621 1058 'html' => [
e501603b 1059 'type' => 'Text',
c23563e3 1060 'label' => ts("First Name"),
c3fc2621 1061 ],
a9d0587b 1062 'add' => '1.1',
c3fc2621
CW
1063 ],
1064 'middle_name' => [
e501603b
TO
1065 'name' => 'middle_name',
1066 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 1067 'title' => ts('Middle Name'),
215b423e 1068 'description' => ts('Middle Name.'),
e501603b
TO
1069 'maxlength' => 64,
1070 'size' => 30,
c3fc2621 1071 'import' => TRUE,
e501603b
TO
1072 'where' => 'civicrm_contact.middle_name',
1073 'headerPattern' => '/^middle|(m(iddle\s)?name)$/i',
1074 'dataPattern' => '/^\w+$/',
c3fc2621 1075 'export' => TRUE,
f5c0f096 1076 'contactType' => 'Individual',
522a26c9 1077 'table_name' => 'civicrm_contact',
1078 'entity' => 'Contact',
1079 'bao' => 'CRM_Contact_BAO_Contact',
6a7e5e5d 1080 'localizable' => 0,
c3fc2621 1081 'html' => [
e501603b 1082 'type' => 'Text',
c23563e3 1083 'label' => ts("Middle Name"),
c3fc2621 1084 ],
a9d0587b 1085 'add' => '1.1',
c3fc2621
CW
1086 ],
1087 'last_name' => [
e501603b
TO
1088 'name' => 'last_name',
1089 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 1090 'title' => ts('Last Name'),
215b423e 1091 'description' => ts('Last Name.'),
e501603b
TO
1092 'maxlength' => 64,
1093 'size' => 30,
c3fc2621 1094 'import' => TRUE,
e501603b
TO
1095 'where' => 'civicrm_contact.last_name',
1096 'headerPattern' => '/^last|(l(ast\s)?name)$/i',
1097 'dataPattern' => '/^\w+(\s\w+)?+$/',
c3fc2621 1098 'export' => TRUE,
f5c0f096 1099 'contactType' => 'Individual',
522a26c9 1100 'table_name' => 'civicrm_contact',
1101 'entity' => 'Contact',
1102 'bao' => 'CRM_Contact_BAO_Contact',
6a7e5e5d 1103 'localizable' => 0,
c3fc2621 1104 'html' => [
e501603b 1105 'type' => 'Text',
c23563e3 1106 'label' => ts("Last Name"),
c3fc2621 1107 ],
a9d0587b 1108 'add' => '1.1',
c3fc2621
CW
1109 ],
1110 'prefix_id' => [
e501603b
TO
1111 'name' => 'prefix_id',
1112 'type' => CRM_Utils_Type::T_INT,
c3fc2621 1113 'title' => ts('Individual Prefix'),
215b423e 1114 'description' => ts('Prefix or Title for name (Ms, Mr...). FK to prefix ID'),
c3fc2621 1115 'import' => TRUE,
e501603b
TO
1116 'where' => 'civicrm_contact.prefix_id',
1117 'headerPattern' => '/^(prefix|title)/i',
1118 'dataPattern' => '/^(mr|ms|mrs|sir|dr)\.?$/i',
c3fc2621 1119 'export' => TRUE,
f5c0f096 1120 'contactType' => 'Individual',
522a26c9 1121 'table_name' => 'civicrm_contact',
1122 'entity' => 'Contact',
1123 'bao' => 'CRM_Contact_BAO_Contact',
6a7e5e5d 1124 'localizable' => 0,
c3fc2621 1125 'html' => [
e501603b 1126 'type' => 'Select',
c3fc2621
CW
1127 ],
1128 'pseudoconstant' => [
e501603b
TO
1129 'optionGroupName' => 'individual_prefix',
1130 'optionEditPath' => 'civicrm/admin/options/individual_prefix',
e6ca0a57 1131 ],
a9d0587b 1132 'add' => '1.2',
c3fc2621
CW
1133 ],
1134 'suffix_id' => [
e501603b
TO
1135 'name' => 'suffix_id',
1136 'type' => CRM_Utils_Type::T_INT,
c3fc2621 1137 'title' => ts('Individual Suffix'),
215b423e 1138 'description' => ts('Suffix for name (Jr, Sr...). FK to suffix ID'),
c3fc2621 1139 'import' => TRUE,
e501603b
TO
1140 'where' => 'civicrm_contact.suffix_id',
1141 'headerPattern' => '/^suffix$/i',
1142 'dataPattern' => '/^(sr|jr)\.?|i{2,}$/',
c3fc2621 1143 'export' => TRUE,
f5c0f096 1144 'contactType' => 'Individual',
522a26c9 1145 'table_name' => 'civicrm_contact',
1146 'entity' => 'Contact',
1147 'bao' => 'CRM_Contact_BAO_Contact',
6a7e5e5d 1148 'localizable' => 0,
c3fc2621 1149 'html' => [
e501603b 1150 'type' => 'Select',
c3fc2621
CW
1151 ],
1152 'pseudoconstant' => [
e501603b
TO
1153 'optionGroupName' => 'individual_suffix',
1154 'optionEditPath' => 'civicrm/admin/options/individual_suffix',
e6ca0a57 1155 ],
a9d0587b 1156 'add' => '1.2',
c3fc2621
CW
1157 ],
1158 'formal_title' => [
e501603b
TO
1159 'name' => 'formal_title',
1160 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 1161 'title' => ts('Formal Title'),
215b423e 1162 'description' => ts('Formal (academic or similar) title in front of name. (Prof., Dr. etc.)'),
e501603b
TO
1163 'maxlength' => 64,
1164 'size' => CRM_Utils_Type::BIG,
c3fc2621 1165 'import' => TRUE,
e501603b
TO
1166 'where' => 'civicrm_contact.formal_title',
1167 'headerPattern' => '/^title/i',
c3fc2621 1168 'export' => TRUE,
f5c0f096 1169 'contactType' => 'Individual',
522a26c9 1170 'table_name' => 'civicrm_contact',
1171 'entity' => 'Contact',
1172 'bao' => 'CRM_Contact_BAO_Contact',
6a7e5e5d 1173 'localizable' => 0,
c3fc2621 1174 'html' => [
e501603b 1175 'type' => 'Text',
c23563e3 1176 'label' => ts("Formal Title"),
c3fc2621 1177 ],
a9d0587b 1178 'add' => '4.5',
c3fc2621
CW
1179 ],
1180 'communication_style_id' => [
e501603b
TO
1181 'name' => 'communication_style_id',
1182 'type' => CRM_Utils_Type::T_INT,
c3fc2621 1183 'title' => ts('Communication Style'),
215b423e 1184 'description' => ts('Communication style (e.g. formal vs. familiar) to use with this contact. FK to communication styles in civicrm_option_value.'),
1a18ea39 1185 'import' => TRUE,
e501603b 1186 'where' => 'civicrm_contact.communication_style_id',
1a18ea39 1187 'headerPattern' => '/style/i',
a36434b9 1188 'export' => TRUE,
522a26c9 1189 'table_name' => 'civicrm_contact',
1190 'entity' => 'Contact',
1191 'bao' => 'CRM_Contact_BAO_Contact',
6a7e5e5d 1192 'localizable' => 0,
c3fc2621 1193 'html' => [
e501603b 1194 'type' => 'Select',
c3fc2621
CW
1195 ],
1196 'pseudoconstant' => [
e501603b
TO
1197 'optionGroupName' => 'communication_style',
1198 'optionEditPath' => 'civicrm/admin/options/communication_style',
e6ca0a57 1199 ],
a9d0587b 1200 'add' => '4.4',
c3fc2621
CW
1201 ],
1202 'email_greeting_id' => [
e501603b
TO
1203 'name' => 'email_greeting_id',
1204 'type' => CRM_Utils_Type::T_INT,
c3fc2621 1205 'title' => ts('Email Greeting ID'),
215b423e 1206 'description' => ts('FK to civicrm_option_value.id, that has to be valid registered Email Greeting.'),
54e389ac 1207 'where' => 'civicrm_contact.email_greeting_id',
a36434b9 1208 'export' => TRUE,
522a26c9 1209 'table_name' => 'civicrm_contact',
1210 'entity' => 'Contact',
1211 'bao' => 'CRM_Contact_BAO_Contact',
6a7e5e5d 1212 'localizable' => 0,
3542118f
CW
1213 'html' => [
1214 'type' => 'Select',
1215 ],
c3fc2621 1216 'pseudoconstant' => [
f4a9693e
SL
1217 'optionGroupName' => 'email_greeting',
1218 'optionEditPath' => 'civicrm/admin/options/email_greeting',
e6ca0a57 1219 ],
a9d0587b 1220 'add' => '3.0',
c3fc2621
CW
1221 ],
1222 'email_greeting_custom' => [
e501603b
TO
1223 'name' => 'email_greeting_custom',
1224 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 1225 'title' => ts('Email Greeting Custom'),
215b423e 1226 'description' => ts('Custom Email Greeting.'),
e501603b
TO
1227 'maxlength' => 128,
1228 'size' => CRM_Utils_Type::HUGE,
c3fc2621 1229 'import' => TRUE,
e501603b 1230 'where' => 'civicrm_contact.email_greeting_custom',
c3fc2621 1231 'export' => FALSE,
522a26c9 1232 'table_name' => 'civicrm_contact',
1233 'entity' => 'Contact',
1234 'bao' => 'CRM_Contact_BAO_Contact',
6a7e5e5d 1235 'localizable' => 0,
c3fc2621 1236 'html' => [
e501603b 1237 'type' => 'Text',
c23563e3 1238 'label' => ts("Email Greeting Custom"),
c3fc2621 1239 ],
a9d0587b 1240 'add' => '3.0',
c3fc2621
CW
1241 ],
1242 'email_greeting_display' => [
e501603b
TO
1243 'name' => 'email_greeting_display',
1244 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 1245 'title' => ts('Email Greeting'),
215b423e 1246 'description' => ts('Cache Email Greeting.'),
e501603b
TO
1247 'maxlength' => 255,
1248 'size' => CRM_Utils_Type::HUGE,
a36434b9 1249 'where' => 'civicrm_contact.email_greeting_display',
522a26c9 1250 'table_name' => 'civicrm_contact',
1251 'entity' => 'Contact',
1252 'bao' => 'CRM_Contact_BAO_Contact',
6a7e5e5d 1253 'localizable' => 0,
a0e733f3 1254 'readonly' => TRUE,
a9d0587b 1255 'add' => '3.0',
c3fc2621
CW
1256 ],
1257 'postal_greeting_id' => [
e501603b
TO
1258 'name' => 'postal_greeting_id',
1259 'type' => CRM_Utils_Type::T_INT,
c3fc2621 1260 'title' => ts('Postal Greeting ID'),
215b423e 1261 'description' => ts('FK to civicrm_option_value.id, that has to be valid registered Postal Greeting.'),
54e389ac 1262 'where' => 'civicrm_contact.postal_greeting_id',
a36434b9 1263 'export' => TRUE,
522a26c9 1264 'table_name' => 'civicrm_contact',
1265 'entity' => 'Contact',
1266 'bao' => 'CRM_Contact_BAO_Contact',
6a7e5e5d 1267 'localizable' => 0,
c3fc2621 1268 'html' => [
3542118f 1269 'type' => 'Select',
c3fc2621
CW
1270 ],
1271 'pseudoconstant' => [
f4a9693e
SL
1272 'optionGroupName' => 'postal_greeting',
1273 'optionEditPath' => 'civicrm/admin/options/postal_greeting',
e6ca0a57 1274 ],
a9d0587b 1275 'add' => '3.0',
c3fc2621
CW
1276 ],
1277 'postal_greeting_custom' => [
e501603b
TO
1278 'name' => 'postal_greeting_custom',
1279 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 1280 'title' => ts('Postal Greeting Custom'),
215b423e 1281 'description' => ts('Custom Postal greeting.'),
e501603b
TO
1282 'maxlength' => 128,
1283 'size' => CRM_Utils_Type::HUGE,
c3fc2621 1284 'import' => TRUE,
e501603b 1285 'where' => 'civicrm_contact.postal_greeting_custom',
c3fc2621 1286 'export' => FALSE,
522a26c9 1287 'table_name' => 'civicrm_contact',
1288 'entity' => 'Contact',
1289 'bao' => 'CRM_Contact_BAO_Contact',
6a7e5e5d 1290 'localizable' => 0,
c3fc2621 1291 'html' => [
e501603b 1292 'type' => 'Text',
c23563e3 1293 'label' => ts("Postal Greeting Custom"),
c3fc2621 1294 ],
a9d0587b 1295 'add' => '3.0',
c3fc2621
CW
1296 ],
1297 'postal_greeting_display' => [
e501603b
TO
1298 'name' => 'postal_greeting_display',
1299 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 1300 'title' => ts('Postal Greeting'),
215b423e 1301 'description' => ts('Cache Postal greeting.'),
e501603b
TO
1302 'maxlength' => 255,
1303 'size' => CRM_Utils_Type::HUGE,
a36434b9 1304 'where' => 'civicrm_contact.postal_greeting_display',
522a26c9 1305 'table_name' => 'civicrm_contact',
1306 'entity' => 'Contact',
1307 'bao' => 'CRM_Contact_BAO_Contact',
6a7e5e5d 1308 'localizable' => 0,
a0e733f3 1309 'readonly' => TRUE,
a9d0587b 1310 'add' => '3.0',
c3fc2621
CW
1311 ],
1312 'addressee_id' => [
e501603b
TO
1313 'name' => 'addressee_id',
1314 'type' => CRM_Utils_Type::T_INT,
c3fc2621 1315 'title' => ts('Addressee ID'),
215b423e 1316 'description' => ts('FK to civicrm_option_value.id, that has to be valid registered Addressee.'),
54e389ac 1317 'where' => 'civicrm_contact.addressee_id',
a36434b9 1318 'export' => TRUE,
522a26c9 1319 'table_name' => 'civicrm_contact',
1320 'entity' => 'Contact',
1321 'bao' => 'CRM_Contact_BAO_Contact',
6a7e5e5d 1322 'localizable' => 0,
3542118f
CW
1323 'html' => [
1324 'type' => 'Select',
1325 ],
c3fc2621 1326 'pseudoconstant' => [
a28e9198 1327 'optionGroupName' => 'addressee',
1328 'optionEditPath' => 'civicrm/admin/options/addressee',
e6ca0a57 1329 ],
a9d0587b 1330 'add' => '3.0',
c3fc2621
CW
1331 ],
1332 'addressee_custom' => [
e501603b
TO
1333 'name' => 'addressee_custom',
1334 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 1335 'title' => ts('Addressee Custom'),
215b423e 1336 'description' => ts('Custom Addressee.'),
e501603b
TO
1337 'maxlength' => 128,
1338 'size' => CRM_Utils_Type::HUGE,
c3fc2621 1339 'import' => TRUE,
e501603b 1340 'where' => 'civicrm_contact.addressee_custom',
c3fc2621 1341 'export' => FALSE,
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',
c23563e3 1348 'label' => ts("Addressee Custom"),
c3fc2621 1349 ],
a9d0587b 1350 'add' => '3.0',
c3fc2621
CW
1351 ],
1352 'addressee_display' => [
e501603b
TO
1353 'name' => 'addressee_display',
1354 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 1355 'title' => ts('Addressee'),
215b423e 1356 'description' => ts('Cache Addressee.'),
e501603b
TO
1357 'maxlength' => 255,
1358 'size' => CRM_Utils_Type::HUGE,
a36434b9 1359 'where' => 'civicrm_contact.addressee_display',
522a26c9 1360 'table_name' => 'civicrm_contact',
1361 'entity' => 'Contact',
1362 'bao' => 'CRM_Contact_BAO_Contact',
6a7e5e5d 1363 'localizable' => 0,
a0e733f3 1364 'readonly' => TRUE,
a9d0587b 1365 'add' => '3.0',
c3fc2621
CW
1366 ],
1367 'job_title' => [
e501603b
TO
1368 'name' => 'job_title',
1369 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 1370 'title' => ts('Job Title'),
215b423e 1371 'description' => ts('Job Title'),
e501603b
TO
1372 'maxlength' => 255,
1373 'size' => 30,
c3fc2621 1374 'import' => TRUE,
e501603b
TO
1375 'where' => 'civicrm_contact.job_title',
1376 'headerPattern' => '/^job|(j(ob\s)?title)$/i',
1377 'dataPattern' => '//',
c3fc2621 1378 'export' => TRUE,
f5c0f096 1379 'contactType' => 'Individual',
522a26c9 1380 'table_name' => 'civicrm_contact',
1381 'entity' => 'Contact',
1382 'bao' => 'CRM_Contact_BAO_Contact',
6a7e5e5d 1383 'localizable' => 0,
c3fc2621 1384 'html' => [
e501603b 1385 'type' => 'Text',
c23563e3 1386 'label' => ts("Job Title"),
c3fc2621 1387 ],
a9d0587b 1388 'add' => '1.1',
c3fc2621
CW
1389 ],
1390 'gender_id' => [
e501603b
TO
1391 'name' => 'gender_id',
1392 'type' => CRM_Utils_Type::T_INT,
9ac33d0f 1393 'title' => ts('Gender ID'),
215b423e 1394 'description' => ts('FK to gender ID'),
c3fc2621 1395 'import' => TRUE,
e501603b
TO
1396 'where' => 'civicrm_contact.gender_id',
1397 'headerPattern' => '/^gender$/i',
c3fc2621 1398 'export' => TRUE,
f5c0f096 1399 'contactType' => 'Individual',
522a26c9 1400 'table_name' => 'civicrm_contact',
1401 'entity' => 'Contact',
1402 'bao' => 'CRM_Contact_BAO_Contact',
6a7e5e5d 1403 'localizable' => 0,
c3fc2621 1404 'html' => [
e501603b 1405 'type' => 'Select',
9ac33d0f 1406 'label' => ts("Gender"),
c3fc2621
CW
1407 ],
1408 'pseudoconstant' => [
e501603b
TO
1409 'optionGroupName' => 'gender',
1410 'optionEditPath' => 'civicrm/admin/options/gender',
e6ca0a57 1411 ],
a9d0587b 1412 'add' => '1.2',
c3fc2621
CW
1413 ],
1414 'birth_date' => [
e501603b
TO
1415 'name' => 'birth_date',
1416 'type' => CRM_Utils_Type::T_DATE,
c3fc2621 1417 'title' => ts('Birth Date'),
215b423e 1418 'description' => ts('Date of birth'),
c3fc2621 1419 'import' => TRUE,
e501603b
TO
1420 'where' => 'civicrm_contact.birth_date',
1421 'headerPattern' => '/^birth|(b(irth\s)?date)|D(\W*)O(\W*)B(\W*)$/i',
1422 'dataPattern' => '/\d{4}-?\d{2}-?\d{2}/',
c3fc2621 1423 'export' => TRUE,
f5c0f096 1424 'contactType' => 'Individual',
522a26c9 1425 'table_name' => 'civicrm_contact',
1426 'entity' => 'Contact',
1427 'bao' => 'CRM_Contact_BAO_Contact',
6a7e5e5d 1428 'localizable' => 0,
c3fc2621 1429 'html' => [
e501603b 1430 'type' => 'Select Date',
24317d89 1431 'formatType' => 'birth',
c23563e3 1432 'label' => ts("Birth Date"),
c3fc2621 1433 ],
a9d0587b 1434 'add' => '1.1',
c3fc2621
CW
1435 ],
1436 'is_deceased' => [
e501603b
TO
1437 'name' => 'is_deceased',
1438 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 1439 'title' => ts('Deceased'),
2cd5d411 1440 'required' => TRUE,
c3fc2621 1441 'import' => TRUE,
e501603b
TO
1442 'where' => 'civicrm_contact.is_deceased',
1443 'headerPattern' => '/i(s\s)?d(eceased)$/i',
c3fc2621 1444 'export' => TRUE,
f5c0f096 1445 'contactType' => 'Individual',
45a83e42 1446 'default' => '0',
522a26c9 1447 'table_name' => 'civicrm_contact',
1448 'entity' => 'Contact',
1449 'bao' => 'CRM_Contact_BAO_Contact',
6a7e5e5d 1450 'localizable' => 0,
c3fc2621 1451 'html' => [
e501603b 1452 'type' => 'CheckBox',
c23563e3 1453 'label' => ts("Is Deceased"),
c3fc2621 1454 ],
a9d0587b 1455 'add' => '1.1',
c3fc2621
CW
1456 ],
1457 'deceased_date' => [
e501603b
TO
1458 'name' => 'deceased_date',
1459 'type' => CRM_Utils_Type::T_DATE,
c3fc2621 1460 'title' => ts('Deceased Date'),
215b423e 1461 'description' => ts('Date of deceased'),
c3fc2621 1462 'import' => TRUE,
e501603b
TO
1463 'where' => 'civicrm_contact.deceased_date',
1464 'headerPattern' => '/^deceased|(d(eceased\s)?date)$/i',
c3fc2621 1465 'export' => TRUE,
f5c0f096 1466 'contactType' => 'Individual',
522a26c9 1467 'table_name' => 'civicrm_contact',
1468 'entity' => 'Contact',
1469 'bao' => 'CRM_Contact_BAO_Contact',
6a7e5e5d 1470 'localizable' => 0,
c3fc2621 1471 'html' => [
e501603b 1472 'type' => 'Select Date',
24317d89 1473 'formatType' => 'birth',
c23563e3 1474 'label' => ts("Deceased Date"),
c3fc2621 1475 ],
a9d0587b 1476 'add' => '1.5',
c3fc2621
CW
1477 ],
1478 'household_name' => [
e501603b
TO
1479 'name' => 'household_name',
1480 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 1481 'title' => ts('Household Name'),
215b423e 1482 'description' => ts('Household Name.'),
e501603b
TO
1483 'maxlength' => 128,
1484 'size' => 30,
c3fc2621 1485 'import' => TRUE,
e501603b
TO
1486 'where' => 'civicrm_contact.household_name',
1487 'headerPattern' => '/^household|(h(ousehold\s)?name)$/i',
1488 'dataPattern' => '/^\w+$/',
c3fc2621 1489 'export' => TRUE,
f5c0f096 1490 'contactType' => 'Household',
522a26c9 1491 'table_name' => 'civicrm_contact',
1492 'entity' => 'Contact',
1493 'bao' => 'CRM_Contact_BAO_Contact',
6a7e5e5d 1494 'localizable' => 0,
c3fc2621 1495 'html' => [
e501603b 1496 'type' => 'Text',
c23563e3 1497 'label' => ts("Household Name"),
c3fc2621 1498 ],
a9d0587b 1499 'add' => '1.1',
c3fc2621
CW
1500 ],
1501 'primary_contact_id' => [
e501603b
TO
1502 'name' => 'primary_contact_id',
1503 'type' => CRM_Utils_Type::T_INT,
c3fc2621 1504 'title' => ts('Household Primary Contact ID'),
215b423e 1505 'description' => ts('Optional FK to Primary Contact for this household.'),
a36434b9 1506 'where' => 'civicrm_contact.primary_contact_id',
f5c0f096 1507 'contactType' => 'Household',
522a26c9 1508 'table_name' => 'civicrm_contact',
1509 'entity' => 'Contact',
1510 'bao' => 'CRM_Contact_BAO_Contact',
6a7e5e5d 1511 'localizable' => 0,
e501603b 1512 'FKClassName' => 'CRM_Contact_DAO_Contact',
2cbbebe8
A
1513 'html' => [
1514 'label' => ts("Household Primary Contact"),
1515 ],
a0e733f3 1516 'readonly' => TRUE,
a9d0587b 1517 'add' => '1.1',
c3fc2621
CW
1518 ],
1519 'organization_name' => [
e501603b
TO
1520 'name' => 'organization_name',
1521 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 1522 'title' => ts('Organization Name'),
215b423e 1523 'description' => ts('Organization Name.'),
e501603b
TO
1524 'maxlength' => 128,
1525 'size' => 30,
c3fc2621 1526 'import' => TRUE,
e501603b
TO
1527 'where' => 'civicrm_contact.organization_name',
1528 'headerPattern' => '/^organization|(o(rganization\s)?name)$/i',
1529 'dataPattern' => '/^\w+$/',
c3fc2621 1530 'export' => TRUE,
f5c0f096 1531 'contactType' => 'Organization',
522a26c9 1532 'table_name' => 'civicrm_contact',
1533 'entity' => 'Contact',
1534 'bao' => 'CRM_Contact_BAO_Contact',
6a7e5e5d 1535 'localizable' => 0,
c3fc2621 1536 'html' => [
e501603b 1537 'type' => 'Text',
c23563e3 1538 'label' => ts("Organization Name"),
c3fc2621 1539 ],
a9d0587b 1540 'add' => '1.1',
c3fc2621
CW
1541 ],
1542 'sic_code' => [
e501603b
TO
1543 'name' => 'sic_code',
1544 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 1545 'title' => ts('Sic Code'),
215b423e 1546 'description' => ts('Standard Industry Classification Code.'),
e501603b
TO
1547 'maxlength' => 8,
1548 'size' => CRM_Utils_Type::EIGHT,
c3fc2621 1549 'import' => TRUE,
e501603b
TO
1550 'where' => 'civicrm_contact.sic_code',
1551 'headerPattern' => '/^sic|(s(ic\s)?code)$/i',
c3fc2621 1552 'export' => TRUE,
f5c0f096 1553 'contactType' => 'Organization',
522a26c9 1554 'table_name' => 'civicrm_contact',
1555 'entity' => 'Contact',
1556 'bao' => 'CRM_Contact_BAO_Contact',
6a7e5e5d 1557 'localizable' => 0,
c3fc2621 1558 'html' => [
e501603b 1559 'type' => 'Text',
c23563e3 1560 'label' => ts("SIC Code"),
c3fc2621 1561 ],
a9d0587b 1562 'add' => '1.1',
c3fc2621
CW
1563 ],
1564 'user_unique_id' => [
e501603b
TO
1565 'name' => 'user_unique_id',
1566 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 1567 'title' => ts('Unique ID (OpenID)'),
215b423e 1568 'description' => ts('the OpenID (or OpenID-style http://username.domain/) unique identifier for this contact mainly used for logging in to CiviCRM'),
e501603b
TO
1569 'maxlength' => 255,
1570 'size' => CRM_Utils_Type::HUGE,
c3fc2621 1571 'import' => TRUE,
e501603b
TO
1572 'where' => 'civicrm_contact.user_unique_id',
1573 'headerPattern' => '/^Open\s?ID|u(niq\w*)?\s?ID/i',
1574 'dataPattern' => '/^[\w\/\:\.]+$/',
c3fc2621 1575 'export' => TRUE,
e501603b 1576 'rule' => 'url',
522a26c9 1577 'table_name' => 'civicrm_contact',
1578 'entity' => 'Contact',
1579 'bao' => 'CRM_Contact_BAO_Contact',
6a7e5e5d 1580 'localizable' => 0,
c3fc2621 1581 'html' => [
e501603b 1582 'type' => 'Text',
c3fc2621 1583 ],
a9d0587b 1584 'add' => '2.0',
c3fc2621
CW
1585 ],
1586 'current_employer_id' => [
e501603b
TO
1587 'name' => 'employer_id',
1588 'type' => CRM_Utils_Type::T_INT,
a1d226d6 1589 'title' => ts('Current Employer ID'),
215b423e 1590 'description' => ts('OPTIONAL FK to civicrm_contact record.'),
e501603b 1591 'where' => 'civicrm_contact.employer_id',
a36434b9 1592 'export' => TRUE,
f5c0f096 1593 'contactType' => 'Individual',
522a26c9 1594 'table_name' => 'civicrm_contact',
1595 'entity' => 'Contact',
1596 'bao' => 'CRM_Contact_BAO_Contact',
6a7e5e5d 1597 'localizable' => 0,
e501603b 1598 'FKClassName' => 'CRM_Contact_DAO_Contact',
c3fc2621 1599 'html' => [
e501603b 1600 'type' => 'EntityRef',
a1d226d6 1601 'label' => ts("Current Employer"),
c3fc2621 1602 ],
a9d0587b 1603 'add' => '2.1',
c3fc2621
CW
1604 ],
1605 'contact_is_deleted' => [
e501603b
TO
1606 'name' => 'is_deleted',
1607 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621
CW
1608 'title' => ts('Contact is in Trash'),
1609 'required' => TRUE,
e501603b 1610 'where' => 'civicrm_contact.is_deleted',
a36434b9 1611 'export' => TRUE,
45a83e42 1612 'default' => '0',
522a26c9 1613 'table_name' => 'civicrm_contact',
1614 'entity' => 'Contact',
1615 'bao' => 'CRM_Contact_BAO_Contact',
6a7e5e5d 1616 'localizable' => 0,
c3fc2621 1617 'html' => [
e501603b 1618 'type' => 'CheckBox',
c3fc2621 1619 ],
a9d0587b 1620 'add' => '3.2',
c3fc2621
CW
1621 ],
1622 'created_date' => [
e501603b
TO
1623 'name' => 'created_date',
1624 'type' => CRM_Utils_Type::T_TIMESTAMP,
c3fc2621 1625 'title' => ts('Created Date'),
215b423e 1626 'description' => ts('When was the contact was created.'),
c3fc2621 1627 'required' => FALSE,
e501603b 1628 'where' => 'civicrm_contact.created_date',
a36434b9 1629 'export' => TRUE,
5fb0de1f 1630 'default' => NULL,
522a26c9 1631 'table_name' => 'civicrm_contact',
1632 'entity' => 'Contact',
1633 'bao' => 'CRM_Contact_BAO_Contact',
6a7e5e5d 1634 'localizable' => 0,
c23563e3
SL
1635 'html' => [
1636 'label' => ts("Created Date"),
1637 ],
a9d0587b 1638 'add' => '4.3',
c3fc2621
CW
1639 ],
1640 'modified_date' => [
e501603b
TO
1641 'name' => 'modified_date',
1642 'type' => CRM_Utils_Type::T_TIMESTAMP,
c3fc2621 1643 'title' => ts('Modified Date'),
215b423e 1644 'description' => ts('When was the contact (or closely related entity) was created or modified or deleted.'),
c3fc2621 1645 'required' => FALSE,
e501603b 1646 'where' => 'civicrm_contact.modified_date',
a36434b9 1647 'export' => TRUE,
e501603b 1648 'default' => 'CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP',
522a26c9 1649 'table_name' => 'civicrm_contact',
1650 'entity' => 'Contact',
1651 'bao' => 'CRM_Contact_BAO_Contact',
6a7e5e5d 1652 'localizable' => 0,
c23563e3
SL
1653 'html' => [
1654 'label' => ts("Modified Date"),
1655 ],
34745448 1656 'readonly' => TRUE,
a9d0587b 1657 'add' => '4.3',
c3fc2621
CW
1658 ],
1659 ];
346aaaba 1660 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 1661 }
346aaaba 1662 return Civi::$statics[__CLASS__]['fields'];
e501603b 1663 }
c3fc2621 1664
e501603b 1665 /**
bd8e0b14 1666 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
1667 *
1668 * @return array
bd8e0b14 1669 * Array(string $name => string $uniqueName).
e501603b 1670 */
c3fc2621 1671 public static function &fieldKeys() {
bd8e0b14
TO
1672 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
1673 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 1674 }
bd8e0b14 1675 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b 1676 }
c3fc2621 1677
e501603b
TO
1678 /**
1679 * Returns the names of this table
1680 *
1681 * @return string
1682 */
c3fc2621 1683 public static function getTableName() {
e501603b
TO
1684 return self::$_tableName;
1685 }
c3fc2621 1686
e501603b
TO
1687 /**
1688 * Returns if this table needs to be logged
1689 *
c3fc2621 1690 * @return bool
e501603b 1691 */
c3fc2621 1692 public function getLog() {
e501603b
TO
1693 return self::$_log;
1694 }
c3fc2621 1695
e501603b
TO
1696 /**
1697 * Returns the list of fields that can be imported
1698 *
1699 * @param bool $prefix
1700 *
1701 * @return array
1702 */
c3fc2621
CW
1703 public static function &import($prefix = FALSE) {
1704 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'contact', $prefix, []);
60808919 1705 return $r;
e501603b 1706 }
c3fc2621 1707
e501603b
TO
1708 /**
1709 * Returns the list of fields that can be exported
1710 *
1711 * @param bool $prefix
1712 *
1713 * @return array
1714 */
c3fc2621
CW
1715 public static function &export($prefix = FALSE) {
1716 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'contact', $prefix, []);
60808919 1717 return $r;
e501603b 1718 }
c3fc2621 1719
e7a6b91a
AS
1720 /**
1721 * Returns the list of indices
c3fc2621
CW
1722 *
1723 * @param bool $localize
1724 *
1725 * @return array
e7a6b91a
AS
1726 */
1727 public static function indices($localize = TRUE) {
c3fc2621
CW
1728 $indices = [
1729 'index_contact_type' => [
e7a6b91a 1730 'name' => 'index_contact_type',
c3fc2621 1731 'field' => [
e7a6b91a 1732 0 => 'contact_type',
c3fc2621
CW
1733 ],
1734 'localizable' => FALSE,
e7a6b91a 1735 'sig' => 'civicrm_contact::0::contact_type',
c3fc2621
CW
1736 ],
1737 'index_contact_sub_type' => [
e7a6b91a 1738 'name' => 'index_contact_sub_type',
c3fc2621 1739 'field' => [
e7a6b91a 1740 0 => 'contact_sub_type',
c3fc2621
CW
1741 ],
1742 'localizable' => FALSE,
e7a6b91a 1743 'sig' => 'civicrm_contact::0::contact_sub_type',
c3fc2621
CW
1744 ],
1745 'UI_external_identifier' => [
e7a6b91a 1746 'name' => 'UI_external_identifier',
c3fc2621 1747 'field' => [
e7a6b91a 1748 0 => 'external_identifier',
c3fc2621
CW
1749 ],
1750 'localizable' => FALSE,
1751 'unique' => TRUE,
e7a6b91a 1752 'sig' => 'civicrm_contact::1::external_identifier',
c3fc2621
CW
1753 ],
1754 'index_sort_name' => [
e7a6b91a 1755 'name' => 'index_sort_name',
c3fc2621 1756 'field' => [
e7a6b91a 1757 0 => 'sort_name',
c3fc2621
CW
1758 ],
1759 'localizable' => FALSE,
e7a6b91a 1760 'sig' => 'civicrm_contact::0::sort_name',
c3fc2621
CW
1761 ],
1762 'index_preferred_communication_method' => [
e7a6b91a 1763 'name' => 'index_preferred_communication_method',
c3fc2621 1764 'field' => [
e7a6b91a 1765 0 => 'preferred_communication_method',
c3fc2621
CW
1766 ],
1767 'localizable' => FALSE,
e7a6b91a 1768 'sig' => 'civicrm_contact::0::preferred_communication_method',
c3fc2621
CW
1769 ],
1770 'index_hash' => [
e7a6b91a 1771 'name' => 'index_hash',
c3fc2621 1772 'field' => [
e7a6b91a 1773 0 => 'hash',
c3fc2621
CW
1774 ],
1775 'localizable' => FALSE,
e7a6b91a 1776 'sig' => 'civicrm_contact::0::hash',
c3fc2621
CW
1777 ],
1778 'index_api_key' => [
e7a6b91a 1779 'name' => 'index_api_key',
c3fc2621 1780 'field' => [
e7a6b91a 1781 0 => 'api_key',
c3fc2621
CW
1782 ],
1783 'localizable' => FALSE,
e7a6b91a 1784 'sig' => 'civicrm_contact::0::api_key',
c3fc2621
CW
1785 ],
1786 'index_first_name' => [
e7a6b91a 1787 'name' => 'index_first_name',
c3fc2621 1788 'field' => [
e7a6b91a 1789 0 => 'first_name',
c3fc2621
CW
1790 ],
1791 'localizable' => FALSE,
e7a6b91a 1792 'sig' => 'civicrm_contact::0::first_name',
c3fc2621
CW
1793 ],
1794 'index_last_name' => [
e7a6b91a 1795 'name' => 'index_last_name',
c3fc2621 1796 'field' => [
e7a6b91a 1797 0 => 'last_name',
c3fc2621
CW
1798 ],
1799 'localizable' => FALSE,
e7a6b91a 1800 'sig' => 'civicrm_contact::0::last_name',
c3fc2621
CW
1801 ],
1802 'UI_prefix' => [
e7a6b91a 1803 'name' => 'UI_prefix',
c3fc2621 1804 'field' => [
e7a6b91a 1805 0 => 'prefix_id',
c3fc2621
CW
1806 ],
1807 'localizable' => FALSE,
e7a6b91a 1808 'sig' => 'civicrm_contact::0::prefix_id',
c3fc2621
CW
1809 ],
1810 'UI_suffix' => [
e7a6b91a 1811 'name' => 'UI_suffix',
c3fc2621 1812 'field' => [
e7a6b91a 1813 0 => 'suffix_id',
c3fc2621
CW
1814 ],
1815 'localizable' => FALSE,
e7a6b91a 1816 'sig' => 'civicrm_contact::0::suffix_id',
c3fc2621
CW
1817 ],
1818 'index_communication_style_id' => [
e7a6b91a 1819 'name' => 'index_communication_style_id',
c3fc2621 1820 'field' => [
e7a6b91a 1821 0 => 'communication_style_id',
c3fc2621
CW
1822 ],
1823 'localizable' => FALSE,
e7a6b91a 1824 'sig' => 'civicrm_contact::0::communication_style_id',
c3fc2621
CW
1825 ],
1826 'UI_gender' => [
e7a6b91a 1827 'name' => 'UI_gender',
c3fc2621 1828 'field' => [
e7a6b91a 1829 0 => 'gender_id',
c3fc2621
CW
1830 ],
1831 'localizable' => FALSE,
e7a6b91a 1832 'sig' => 'civicrm_contact::0::gender_id',
c3fc2621
CW
1833 ],
1834 'index_is_deceased' => [
27633545 1835 'name' => 'index_is_deceased',
c3fc2621 1836 'field' => [
27633545 1837 0 => 'is_deceased',
c3fc2621
CW
1838 ],
1839 'localizable' => FALSE,
27633545 1840 'sig' => 'civicrm_contact::0::is_deceased',
c3fc2621
CW
1841 ],
1842 'index_household_name' => [
e7a6b91a 1843 'name' => 'index_household_name',
c3fc2621 1844 'field' => [
e7a6b91a 1845 0 => 'household_name',
c3fc2621
CW
1846 ],
1847 'localizable' => FALSE,
e7a6b91a 1848 'sig' => 'civicrm_contact::0::household_name',
c3fc2621
CW
1849 ],
1850 'index_organization_name' => [
e7a6b91a 1851 'name' => 'index_organization_name',
c3fc2621 1852 'field' => [
e7a6b91a 1853 0 => 'organization_name',
c3fc2621
CW
1854 ],
1855 'localizable' => FALSE,
e7a6b91a 1856 'sig' => 'civicrm_contact::0::organization_name',
c3fc2621
CW
1857 ],
1858 'index_is_deleted_sort_name' => [
e7a6b91a 1859 'name' => 'index_is_deleted_sort_name',
c3fc2621 1860 'field' => [
e7a6b91a
AS
1861 0 => 'is_deleted',
1862 1 => 'sort_name',
1863 2 => 'id',
c3fc2621
CW
1864 ],
1865 'localizable' => FALSE,
e7a6b91a 1866 'sig' => 'civicrm_contact::0::is_deleted::sort_name::id',
c3fc2621 1867 ],
11e5567f 1868 'index_created_date' => [
1869 'name' => 'index_created_date',
1870 'field' => [
1871 0 => 'created_date',
1872 ],
1873 'localizable' => FALSE,
1874 'sig' => 'civicrm_contact::0::created_date',
1875 ],
1876 'index_modified_date' => [
1877 'name' => 'index_modified_date',
1878 'field' => [
1879 0 => 'modified_date',
1880 ],
1881 'localizable' => FALSE,
1882 'sig' => 'civicrm_contact::0::modified_date',
1883 ],
c3fc2621 1884 ];
e7a6b91a
AS
1885 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
1886 }
c3fc2621 1887
e501603b 1888}