Merge pull request #10340 from Stoob/master
[civicrm-core.git] / CRM / Contact / DAO / Contact.php
CommitLineData
e501603b
TO
1<?php
2/*
3+--------------------------------------------------------------------+
4| CiviCRM version 4.7 |
5+--------------------------------------------------------------------+
0f03f337 6| Copyright CiviCRM LLC (c) 2004-2017 |
e501603b
TO
7+--------------------------------------------------------------------+
8| This file is a part of CiviCRM. |
9| |
10| CiviCRM is free software; you can copy, modify, and distribute it |
11| under the terms of the GNU Affero General Public License |
12| Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
13| |
14| CiviCRM is distributed in the hope that it will be useful, but |
15| WITHOUT ANY WARRANTY; without even the implied warranty of |
16| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
17| See the GNU Affero General Public License for more details. |
18| |
19| You should have received a copy of the GNU Affero General Public |
20| License and the CiviCRM Licensing Exception along |
21| with this program; if not, contact CiviCRM LLC |
22| at info[AT]civicrm[DOT]org. If you have questions about the |
23| GNU Affero General Public License or the licensing of CiviCRM, |
24| see the CiviCRM license FAQ at http://civicrm.org/licensing |
25+--------------------------------------------------------------------+
26*/
27/**
28 * @package CRM
0f03f337 29 * @copyright CiviCRM LLC (c) 2004-2017
e501603b
TO
30 *
31 * Generated from xml/schema/CRM/Contact/Contact.xml
32 * DO NOT EDIT. Generated by CRM_Core_CodeGen
27633545 33 * (GenCodeChecksum:6b04aae8fb2f9ebedb5aa9c792b81e30)
e501603b
TO
34 */
35require_once 'CRM/Core/DAO.php';
36require_once 'CRM/Utils/Type.php';
f41f0342 37/**
38 * CRM_Contact_DAO_Contact constructor.
39 */
e501603b
TO
40class CRM_Contact_DAO_Contact extends CRM_Core_DAO {
41 /**
f41f0342 42 * Static instance to hold the table name.
e501603b
TO
43 *
44 * @var string
45 */
46 static $_tableName = 'civicrm_contact';
e501603b 47 /**
f41f0342 48 * Should CiviCRM log any modifications to this table in the civicrm_log table.
e501603b
TO
49 *
50 * @var boolean
51 */
52 static $_log = true;
53 /**
54 * Unique Contact ID
55 *
56 * @var int unsigned
57 */
58 public $id;
59 /**
60 * Type of Contact.
61 *
62 * @var string
63 */
64 public $contact_type;
65 /**
66 * May be used to over-ride contact view and edit templates.
67 *
68 * @var string
69 */
70 public $contact_sub_type;
71 /**
72 *
73 * @var boolean
74 */
75 public $do_not_email;
76 /**
77 *
78 * @var boolean
79 */
80 public $do_not_phone;
81 /**
82 *
83 * @var boolean
84 */
85 public $do_not_mail;
86 /**
87 *
88 * @var boolean
89 */
90 public $do_not_sms;
91 /**
92 *
93 * @var boolean
94 */
95 public $do_not_trade;
96 /**
97 * Has the contact opted out from receiving all bulk email from the organization or site domain?
98 *
99 * @var boolean
100 */
101 public $is_opt_out;
102 /**
103 * May be used for SSN, EIN/TIN, Household ID (census) or other applicable unique legal/government ID.
104 *
105 * @var string
106 */
107 public $legal_identifier;
108 /**
109 * Unique trusted external ID (generally from a legacy app/datasource). Particularly useful for deduping operations.
110 *
111 * @var string
112 */
113 public $external_identifier;
114 /**
115 * Name used for sorting different contact types
116 *
117 * @var string
118 */
119 public $sort_name;
120 /**
121 * Formatted name representing preferred format for display/print/other output.
122 *
123 * @var string
124 */
125 public $display_name;
126 /**
127 * Nickname.
128 *
129 * @var string
130 */
131 public $nick_name;
132 /**
133 * Legal Name.
134 *
135 * @var string
136 */
137 public $legal_name;
138 /**
139 * optional URL for preferred image (photo, logo, etc.) to display for this contact.
140 *
141 * @var text
142 */
143 public $image_URL;
144 /**
145 * What is the preferred mode of communication.
146 *
147 * @var string
148 */
149 public $preferred_communication_method;
150 /**
151 * Which language is preferred for communication. FK to languages in civicrm_option_value.
152 *
153 * @var string
154 */
155 public $preferred_language;
156 /**
157 * What is the preferred mode of sending an email.
158 *
159 * @var string
160 */
161 public $preferred_mail_format;
162 /**
163 * Key for validating requests related to this contact.
164 *
165 * @var string
166 */
167 public $hash;
168 /**
169 * API Key for validating requests related to this contact.
170 *
171 * @var string
172 */
173 public $api_key;
174 /**
175 * where contact come from, e.g. import, donate module insert...
176 *
177 * @var string
178 */
179 public $source;
180 /**
181 * First Name.
182 *
183 * @var string
184 */
185 public $first_name;
186 /**
187 * Middle Name.
188 *
189 * @var string
190 */
191 public $middle_name;
192 /**
193 * Last Name.
194 *
195 * @var string
196 */
197 public $last_name;
198 /**
199 * Prefix or Title for name (Ms, Mr...). FK to prefix ID
200 *
201 * @var int unsigned
202 */
203 public $prefix_id;
204 /**
205 * Suffix for name (Jr, Sr...). FK to suffix ID
206 *
207 * @var int unsigned
208 */
209 public $suffix_id;
210 /**
211 * Formal (academic or similar) title in front of name. (Prof., Dr. etc.)
212 *
213 * @var string
214 */
215 public $formal_title;
216 /**
217 * Communication style (e.g. formal vs. familiar) to use with this contact. FK to communication styles in civicrm_option_value.
218 *
219 * @var int unsigned
220 */
221 public $communication_style_id;
222 /**
223 * FK to civicrm_option_value.id, that has to be valid registered Email Greeting.
224 *
225 * @var int unsigned
226 */
227 public $email_greeting_id;
228 /**
229 * Custom Email Greeting.
230 *
231 * @var string
232 */
233 public $email_greeting_custom;
234 /**
235 * Cache Email Greeting.
236 *
237 * @var string
238 */
239 public $email_greeting_display;
240 /**
241 * FK to civicrm_option_value.id, that has to be valid registered Postal Greeting.
242 *
243 * @var int unsigned
244 */
245 public $postal_greeting_id;
246 /**
247 * Custom Postal greeting.
248 *
249 * @var string
250 */
251 public $postal_greeting_custom;
252 /**
253 * Cache Postal greeting.
254 *
255 * @var string
256 */
257 public $postal_greeting_display;
258 /**
259 * FK to civicrm_option_value.id, that has to be valid registered Addressee.
260 *
261 * @var int unsigned
262 */
263 public $addressee_id;
264 /**
265 * Custom Addressee.
266 *
267 * @var string
268 */
269 public $addressee_custom;
270 /**
271 * Cache Addressee.
272 *
273 * @var string
274 */
275 public $addressee_display;
276 /**
277 * Job Title
278 *
279 * @var string
280 */
281 public $job_title;
282 /**
283 * FK to gender ID
284 *
285 * @var int unsigned
286 */
287 public $gender_id;
288 /**
289 * Date of birth
290 *
291 * @var date
292 */
293 public $birth_date;
294 /**
295 *
296 * @var boolean
297 */
298 public $is_deceased;
299 /**
300 * Date of deceased
301 *
302 * @var date
303 */
304 public $deceased_date;
305 /**
306 * Household Name.
307 *
308 * @var string
309 */
310 public $household_name;
311 /**
312 * Optional FK to Primary Contact for this household.
313 *
314 * @var int unsigned
315 */
316 public $primary_contact_id;
317 /**
318 * Organization Name.
319 *
320 * @var string
321 */
322 public $organization_name;
323 /**
324 * Standard Industry Classification Code.
325 *
326 * @var string
327 */
328 public $sic_code;
329 /**
330 * the OpenID (or OpenID-style http://username.domain/) unique identifier for this contact mainly used for logging in to CiviCRM
331 *
332 * @var string
333 */
334 public $user_unique_id;
335 /**
336 * OPTIONAL FK to civicrm_contact record.
337 *
338 * @var int unsigned
339 */
340 public $employer_id;
341 /**
342 *
343 * @var boolean
344 */
345 public $is_deleted;
346 /**
347 * When was the contact was created.
348 *
349 * @var timestamp
350 */
351 public $created_date;
352 /**
353 * When was the contact (or closely related entity) was created or modified or deleted.
354 *
355 * @var timestamp
356 */
357 public $modified_date;
358 /**
f41f0342 359 * Class constructor.
e501603b
TO
360 */
361 function __construct() {
362 $this->__table = 'civicrm_contact';
363 parent::__construct();
364 }
365 /**
f41f0342 366 * Returns foreign keys and entity references.
e501603b
TO
367 *
368 * @return array
369 * [CRM_Core_Reference_Interface]
370 */
371 static function getReferenceColumns() {
346aaaba
TO
372 if (!isset(Civi::$statics[__CLASS__]['links'])) {
373 Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__);
374 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'primary_contact_id', 'civicrm_contact', 'id');
375 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'employer_id', 'civicrm_contact', 'id');
376 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
e501603b 377 }
346aaaba 378 return Civi::$statics[__CLASS__]['links'];
e501603b
TO
379 }
380 /**
381 * Returns all the column names of this table
382 *
383 * @return array
384 */
385 static function &fields() {
346aaaba
TO
386 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
387 Civi::$statics[__CLASS__]['fields'] = array(
e501603b
TO
388 'id' => array(
389 'name' => 'id',
390 'type' => CRM_Utils_Type::T_INT,
391 'title' => ts('Contact ID') ,
392 'description' => 'Unique Contact ID',
393 'required' => true,
394 'import' => true,
395 'where' => 'civicrm_contact.id',
396 'headerPattern' => '/internal|contact?|id$/i',
397 'dataPattern' => '',
398 'export' => true,
522a26c9 399 'table_name' => 'civicrm_contact',
400 'entity' => 'Contact',
401 'bao' => 'CRM_Contact_BAO_Contact',
6a7e5e5d 402 'localizable' => 0,
e501603b
TO
403 ) ,
404 'contact_type' => array(
405 'name' => 'contact_type',
406 'type' => CRM_Utils_Type::T_STRING,
407 'title' => ts('Contact Type') ,
408 'description' => 'Type of Contact.',
409 'maxlength' => 64,
410 'size' => CRM_Utils_Type::BIG,
411 'export' => true,
412 'where' => 'civicrm_contact.contact_type',
413 'headerPattern' => '',
414 'dataPattern' => '',
522a26c9 415 'table_name' => 'civicrm_contact',
416 'entity' => 'Contact',
417 'bao' => 'CRM_Contact_BAO_Contact',
6a7e5e5d 418 'localizable' => 0,
e501603b
TO
419 'html' => array(
420 'type' => 'Select',
421 ) ,
422 'pseudoconstant' => array(
423 'table' => 'civicrm_contact_type',
424 'keyColumn' => 'name',
425 'labelColumn' => 'label',
426 'condition' => 'parent_id IS NULL',
427 )
428 ) ,
429 'contact_sub_type' => array(
430 'name' => 'contact_sub_type',
431 'type' => CRM_Utils_Type::T_STRING,
432 'title' => ts('Contact Subtype') ,
433 'description' => 'May be used to over-ride contact view and edit templates.',
434 'maxlength' => 255,
435 'size' => CRM_Utils_Type::HUGE,
436 'import' => true,
437 'where' => 'civicrm_contact.contact_sub_type',
438 'headerPattern' => '/C(ontact )?(subtype|sub-type|sub type)/i',
439 'dataPattern' => '',
440 'export' => true,
522a26c9 441 'table_name' => 'civicrm_contact',
442 'entity' => 'Contact',
443 'bao' => 'CRM_Contact_BAO_Contact',
6a7e5e5d 444 'localizable' => 0,
e501603b
TO
445 'html' => array(
446 'type' => 'Select',
447 ) ,
448 'pseudoconstant' => array(
449 'table' => 'civicrm_contact_type',
450 'keyColumn' => 'name',
451 'labelColumn' => 'label',
452 'condition' => 'parent_id IS NOT NULL',
453 )
454 ) ,
455 'do_not_email' => array(
456 'name' => 'do_not_email',
457 'type' => CRM_Utils_Type::T_BOOLEAN,
458 'title' => ts('Do Not Email') ,
459 'import' => true,
460 'where' => 'civicrm_contact.do_not_email',
461 'headerPattern' => '/d(o )?(not )?(email)/i',
462 'dataPattern' => '/^\d{1,}$/',
463 'export' => true,
522a26c9 464 'table_name' => 'civicrm_contact',
465 'entity' => 'Contact',
466 'bao' => 'CRM_Contact_BAO_Contact',
6a7e5e5d 467 'localizable' => 0,
e501603b
TO
468 'html' => array(
469 'type' => 'CheckBox',
470 ) ,
471 ) ,
472 'do_not_phone' => array(
473 'name' => 'do_not_phone',
474 'type' => CRM_Utils_Type::T_BOOLEAN,
475 'title' => ts('Do Not Phone') ,
476 'import' => true,
477 'where' => 'civicrm_contact.do_not_phone',
478 'headerPattern' => '/d(o )?(not )?(call|phone)/i',
479 'dataPattern' => '/^\d{1,}$/',
480 'export' => true,
522a26c9 481 'table_name' => 'civicrm_contact',
482 'entity' => 'Contact',
483 'bao' => 'CRM_Contact_BAO_Contact',
6a7e5e5d 484 'localizable' => 0,
e501603b
TO
485 'html' => array(
486 'type' => 'CheckBox',
487 ) ,
488 ) ,
489 'do_not_mail' => array(
490 'name' => 'do_not_mail',
491 'type' => CRM_Utils_Type::T_BOOLEAN,
492 'title' => ts('Do Not Mail') ,
493 'import' => true,
494 'where' => 'civicrm_contact.do_not_mail',
495 'headerPattern' => '/^(d(o\s)?n(ot\s)?mail)|(\w*)?bulk\s?(\w*)$/i',
496 'dataPattern' => '/^\d{1,}$/',
497 'export' => true,
522a26c9 498 'table_name' => 'civicrm_contact',
499 'entity' => 'Contact',
500 'bao' => 'CRM_Contact_BAO_Contact',
6a7e5e5d 501 'localizable' => 0,
e501603b
TO
502 'html' => array(
503 'type' => 'CheckBox',
504 ) ,
505 ) ,
506 'do_not_sms' => array(
507 'name' => 'do_not_sms',
508 'type' => CRM_Utils_Type::T_BOOLEAN,
509 'title' => ts('Do Not Sms') ,
510 'import' => true,
511 'where' => 'civicrm_contact.do_not_sms',
512 'headerPattern' => '/d(o )?(not )?(sms)/i',
513 'dataPattern' => '/^\d{1,}$/',
514 'export' => true,
522a26c9 515 'table_name' => 'civicrm_contact',
516 'entity' => 'Contact',
517 'bao' => 'CRM_Contact_BAO_Contact',
6a7e5e5d 518 'localizable' => 0,
e501603b
TO
519 'html' => array(
520 'type' => 'CheckBox',
521 ) ,
522 ) ,
523 'do_not_trade' => array(
524 'name' => 'do_not_trade',
525 'type' => CRM_Utils_Type::T_BOOLEAN,
526 'title' => ts('Do Not Trade') ,
527 'import' => true,
528 'where' => 'civicrm_contact.do_not_trade',
529 'headerPattern' => '/d(o )?(not )?(trade)/i',
530 'dataPattern' => '/^\d{1,}$/',
531 'export' => true,
522a26c9 532 'table_name' => 'civicrm_contact',
533 'entity' => 'Contact',
534 'bao' => 'CRM_Contact_BAO_Contact',
6a7e5e5d 535 'localizable' => 0,
e501603b
TO
536 'html' => array(
537 'type' => 'CheckBox',
538 ) ,
539 ) ,
540 'is_opt_out' => array(
541 'name' => 'is_opt_out',
542 'type' => CRM_Utils_Type::T_BOOLEAN,
543 'title' => ts('No Bulk Emails (User Opt Out)') ,
544 'description' => 'Has the contact opted out from receiving all bulk email from the organization or site domain?',
545 'required' => true,
546 'import' => true,
547 'where' => 'civicrm_contact.is_opt_out',
548 'headerPattern' => '',
549 'dataPattern' => '',
550 'export' => true,
522a26c9 551 'table_name' => 'civicrm_contact',
552 'entity' => 'Contact',
553 'bao' => 'CRM_Contact_BAO_Contact',
6a7e5e5d 554 'localizable' => 0,
e501603b
TO
555 'html' => array(
556 'type' => 'CheckBox',
557 ) ,
558 ) ,
559 'legal_identifier' => array(
560 'name' => 'legal_identifier',
561 'type' => CRM_Utils_Type::T_STRING,
562 'title' => ts('Legal Identifier') ,
563 'description' => 'May be used for SSN, EIN/TIN, Household ID (census) or other applicable unique legal/government ID.
564 ',
565 'maxlength' => 32,
566 'size' => CRM_Utils_Type::MEDIUM,
567 'import' => true,
568 'where' => 'civicrm_contact.legal_identifier',
569 'headerPattern' => '/legal\s?id/i',
570 'dataPattern' => '/\w+?\d{5,}/',
571 'export' => true,
522a26c9 572 'table_name' => 'civicrm_contact',
573 'entity' => 'Contact',
574 'bao' => 'CRM_Contact_BAO_Contact',
6a7e5e5d 575 'localizable' => 0,
e501603b
TO
576 'html' => array(
577 'type' => 'Text',
578 ) ,
579 ) ,
580 'external_identifier' => array(
581 'name' => 'external_identifier',
582 'type' => CRM_Utils_Type::T_STRING,
583 'title' => ts('External Identifier') ,
584 'description' => 'Unique trusted external ID (generally from a legacy app/datasource). Particularly useful for deduping operations.',
585 'maxlength' => 64,
586 'size' => 8,
587 'import' => true,
588 'where' => 'civicrm_contact.external_identifier',
589 'headerPattern' => '/external\s?id/i',
590 'dataPattern' => '/^\d{11,}$/',
591 'export' => true,
522a26c9 592 'table_name' => 'civicrm_contact',
593 'entity' => 'Contact',
594 'bao' => 'CRM_Contact_BAO_Contact',
6a7e5e5d 595 'localizable' => 0,
e501603b
TO
596 'html' => array(
597 'type' => 'Text',
598 ) ,
599 ) ,
600 'sort_name' => array(
601 'name' => 'sort_name',
602 'type' => CRM_Utils_Type::T_STRING,
603 'title' => ts('Sort Name') ,
604 'description' => 'Name used for sorting different contact types',
605 'maxlength' => 128,
606 'size' => 30,
607 'export' => true,
608 'where' => 'civicrm_contact.sort_name',
609 'headerPattern' => '',
610 'dataPattern' => '',
522a26c9 611 'table_name' => 'civicrm_contact',
612 'entity' => 'Contact',
613 'bao' => 'CRM_Contact_BAO_Contact',
6a7e5e5d 614 'localizable' => 0,
e501603b
TO
615 'html' => array(
616 'type' => 'Text',
617 ) ,
618 ) ,
619 'display_name' => array(
620 'name' => 'display_name',
621 'type' => CRM_Utils_Type::T_STRING,
622 'title' => ts('Display Name') ,
623 'description' => 'Formatted name representing preferred format for display/print/other output.',
624 'maxlength' => 128,
625 'size' => 30,
626 'export' => true,
627 'where' => 'civicrm_contact.display_name',
628 'headerPattern' => '',
629 'dataPattern' => '',
522a26c9 630 'table_name' => 'civicrm_contact',
631 'entity' => 'Contact',
632 'bao' => 'CRM_Contact_BAO_Contact',
6a7e5e5d 633 'localizable' => 0,
e501603b
TO
634 'html' => array(
635 'type' => 'Text',
636 ) ,
637 ) ,
638 'nick_name' => array(
639 'name' => 'nick_name',
640 'type' => CRM_Utils_Type::T_STRING,
641 'title' => ts('Nickname') ,
642 'description' => 'Nickname.',
643 'maxlength' => 128,
644 'size' => 30,
645 'import' => true,
646 'where' => 'civicrm_contact.nick_name',
647 'headerPattern' => '/n(ick\s)name|nick$/i',
648 'dataPattern' => '/^\w+$/',
649 'export' => true,
522a26c9 650 'table_name' => 'civicrm_contact',
651 'entity' => 'Contact',
652 'bao' => 'CRM_Contact_BAO_Contact',
6a7e5e5d 653 'localizable' => 0,
e501603b
TO
654 'html' => array(
655 'type' => 'Text',
656 ) ,
657 ) ,
658 'legal_name' => array(
659 'name' => 'legal_name',
660 'type' => CRM_Utils_Type::T_STRING,
661 'title' => ts('Legal Name') ,
662 'description' => 'Legal Name.',
663 'maxlength' => 128,
664 'size' => 30,
665 'import' => true,
666 'where' => 'civicrm_contact.legal_name',
667 'headerPattern' => '/^legal|(l(egal\s)?name)$/i',
668 'dataPattern' => '',
669 'export' => true,
522a26c9 670 'table_name' => 'civicrm_contact',
671 'entity' => 'Contact',
672 'bao' => 'CRM_Contact_BAO_Contact',
6a7e5e5d 673 'localizable' => 0,
e501603b
TO
674 'html' => array(
675 'type' => 'Text',
676 ) ,
677 ) ,
678 'image_URL' => array(
679 'name' => 'image_URL',
680 'type' => CRM_Utils_Type::T_TEXT,
681 'title' => ts('Image Url') ,
682 'description' => 'optional URL for preferred image (photo, logo, etc.) to display for this contact.',
683 'import' => true,
684 'where' => 'civicrm_contact.image_URL',
685 'headerPattern' => '',
686 'dataPattern' => '',
687 'export' => true,
522a26c9 688 'table_name' => 'civicrm_contact',
689 'entity' => 'Contact',
690 'bao' => 'CRM_Contact_BAO_Contact',
6a7e5e5d 691 'localizable' => 0,
e501603b
TO
692 'html' => array(
693 'type' => 'File',
694 ) ,
695 ) ,
696 'preferred_communication_method' => array(
697 'name' => 'preferred_communication_method',
698 'type' => CRM_Utils_Type::T_STRING,
699 'title' => ts('Preferred Communication Method') ,
700 'description' => 'What is the preferred mode of communication.',
701 'maxlength' => 255,
702 'size' => CRM_Utils_Type::HUGE,
703 'import' => true,
704 'where' => 'civicrm_contact.preferred_communication_method',
705 'headerPattern' => '/^p(ref\w*\s)?c(omm\w*)|( meth\w*)$/i',
706 'dataPattern' => '/^\w+$/',
707 'export' => true,
522a26c9 708 'table_name' => 'civicrm_contact',
709 'entity' => 'Contact',
710 'bao' => 'CRM_Contact_BAO_Contact',
6a7e5e5d 711 'localizable' => 0,
e501603b
TO
712 'html' => array(
713 'type' => 'Select',
714 ) ,
715 'pseudoconstant' => array(
716 'optionGroupName' => 'preferred_communication_method',
717 'optionEditPath' => 'civicrm/admin/options/preferred_communication_method',
718 )
719 ) ,
720 'preferred_language' => array(
721 'name' => 'preferred_language',
722 'type' => CRM_Utils_Type::T_STRING,
723 'title' => ts('Preferred Language') ,
724 'description' => 'Which language is preferred for communication. FK to languages in civicrm_option_value.',
725 'maxlength' => 5,
726 'size' => CRM_Utils_Type::SIX,
727 'import' => true,
728 'where' => 'civicrm_contact.preferred_language',
729 'headerPattern' => '/^lang/i',
730 'dataPattern' => '',
731 'export' => true,
522a26c9 732 'table_name' => 'civicrm_contact',
733 'entity' => 'Contact',
734 'bao' => 'CRM_Contact_BAO_Contact',
6a7e5e5d 735 'localizable' => 0,
e501603b
TO
736 'html' => array(
737 'type' => 'Select',
738 ) ,
739 'pseudoconstant' => array(
740 'optionGroupName' => 'languages',
741 'keyColumn' => 'name',
742 'optionEditPath' => 'civicrm/admin/options/languages',
743 )
744 ) ,
745 'preferred_mail_format' => array(
746 'name' => 'preferred_mail_format',
747 'type' => CRM_Utils_Type::T_STRING,
748 'title' => ts('Preferred Mail Format') ,
749 'description' => 'What is the preferred mode of sending an email.',
750 'maxlength' => 8,
751 'size' => CRM_Utils_Type::EIGHT,
752 'import' => true,
753 'where' => 'civicrm_contact.preferred_mail_format',
754 'headerPattern' => '/^p(ref\w*\s)?m(ail\s)?f(orm\w*)$/i',
755 'dataPattern' => '',
756 'export' => true,
757 'default' => 'Both',
522a26c9 758 'table_name' => 'civicrm_contact',
759 'entity' => 'Contact',
760 'bao' => 'CRM_Contact_BAO_Contact',
6a7e5e5d 761 'localizable' => 0,
e501603b
TO
762 'html' => array(
763 'type' => 'Select',
764 ) ,
765 'pseudoconstant' => array(
766 'callback' => 'CRM_Core_SelectValues::pmf',
767 )
768 ) ,
769 'hash' => array(
770 'name' => 'hash',
771 'type' => CRM_Utils_Type::T_STRING,
772 'title' => ts('Contact Hash') ,
773 'description' => 'Key for validating requests related to this contact.',
774 'maxlength' => 32,
775 'size' => CRM_Utils_Type::MEDIUM,
776 'export' => true,
777 'where' => 'civicrm_contact.hash',
778 'headerPattern' => '',
779 'dataPattern' => '',
522a26c9 780 'table_name' => 'civicrm_contact',
781 'entity' => 'Contact',
782 'bao' => 'CRM_Contact_BAO_Contact',
6a7e5e5d 783 'localizable' => 0,
e501603b
TO
784 ) ,
785 'api_key' => array(
786 'name' => 'api_key',
787 'type' => CRM_Utils_Type::T_STRING,
788 'title' => ts('Api Key') ,
789 'description' => 'API Key for validating requests related to this contact.',
790 'maxlength' => 32,
791 'size' => CRM_Utils_Type::MEDIUM,
522a26c9 792 'table_name' => 'civicrm_contact',
793 'entity' => 'Contact',
794 'bao' => 'CRM_Contact_BAO_Contact',
6a7e5e5d 795 'localizable' => 0,
e501603b
TO
796 ) ,
797 'contact_source' => array(
798 'name' => 'source',
799 'type' => CRM_Utils_Type::T_STRING,
800 'title' => ts('Contact Source') ,
801 'description' => 'where contact come from, e.g. import, donate module insert...',
802 'maxlength' => 255,
803 'size' => 30,
804 'import' => true,
805 'where' => 'civicrm_contact.source',
806 'headerPattern' => '/(C(ontact\s)?Source)$/i',
807 'dataPattern' => '',
808 'export' => true,
522a26c9 809 'table_name' => 'civicrm_contact',
810 'entity' => 'Contact',
811 'bao' => 'CRM_Contact_BAO_Contact',
6a7e5e5d 812 'localizable' => 0,
e501603b
TO
813 'html' => array(
814 'type' => 'Text',
815 ) ,
816 ) ,
817 'first_name' => array(
818 'name' => 'first_name',
819 'type' => CRM_Utils_Type::T_STRING,
820 'title' => ts('First Name') ,
821 'description' => 'First Name.',
822 'maxlength' => 64,
823 'size' => 30,
824 'import' => true,
825 'where' => 'civicrm_contact.first_name',
826 'headerPattern' => '/^first|(f(irst\s)?name)$/i',
827 'dataPattern' => '/^\w+$/',
828 'export' => true,
522a26c9 829 'table_name' => 'civicrm_contact',
830 'entity' => 'Contact',
831 'bao' => 'CRM_Contact_BAO_Contact',
6a7e5e5d 832 'localizable' => 0,
e501603b
TO
833 'html' => array(
834 'type' => 'Text',
835 ) ,
836 ) ,
837 'middle_name' => array(
838 'name' => 'middle_name',
839 'type' => CRM_Utils_Type::T_STRING,
840 'title' => ts('Middle Name') ,
841 'description' => 'Middle Name.',
842 'maxlength' => 64,
843 'size' => 30,
844 'import' => true,
845 'where' => 'civicrm_contact.middle_name',
846 'headerPattern' => '/^middle|(m(iddle\s)?name)$/i',
847 'dataPattern' => '/^\w+$/',
848 'export' => true,
522a26c9 849 'table_name' => 'civicrm_contact',
850 'entity' => 'Contact',
851 'bao' => 'CRM_Contact_BAO_Contact',
6a7e5e5d 852 'localizable' => 0,
e501603b
TO
853 'html' => array(
854 'type' => 'Text',
855 ) ,
856 ) ,
857 'last_name' => array(
858 'name' => 'last_name',
859 'type' => CRM_Utils_Type::T_STRING,
860 'title' => ts('Last Name') ,
861 'description' => 'Last Name.',
862 'maxlength' => 64,
863 'size' => 30,
864 'import' => true,
865 'where' => 'civicrm_contact.last_name',
866 'headerPattern' => '/^last|(l(ast\s)?name)$/i',
867 'dataPattern' => '/^\w+(\s\w+)?+$/',
868 'export' => true,
522a26c9 869 'table_name' => 'civicrm_contact',
870 'entity' => 'Contact',
871 'bao' => 'CRM_Contact_BAO_Contact',
6a7e5e5d 872 'localizable' => 0,
e501603b
TO
873 'html' => array(
874 'type' => 'Text',
875 ) ,
876 ) ,
877 'prefix_id' => array(
878 'name' => 'prefix_id',
879 'type' => CRM_Utils_Type::T_INT,
880 'title' => ts('Individual Prefix') ,
881 'description' => 'Prefix or Title for name (Ms, Mr...). FK to prefix ID',
882 'import' => true,
883 'where' => 'civicrm_contact.prefix_id',
884 'headerPattern' => '/^(prefix|title)/i',
885 'dataPattern' => '/^(mr|ms|mrs|sir|dr)\.?$/i',
886 'export' => true,
522a26c9 887 'table_name' => 'civicrm_contact',
888 'entity' => 'Contact',
889 'bao' => 'CRM_Contact_BAO_Contact',
6a7e5e5d 890 'localizable' => 0,
e501603b
TO
891 'html' => array(
892 'type' => 'Select',
893 ) ,
894 'pseudoconstant' => array(
895 'optionGroupName' => 'individual_prefix',
896 'optionEditPath' => 'civicrm/admin/options/individual_prefix',
897 )
898 ) ,
899 'suffix_id' => array(
900 'name' => 'suffix_id',
901 'type' => CRM_Utils_Type::T_INT,
902 'title' => ts('Individual Suffix') ,
903 'description' => 'Suffix for name (Jr, Sr...). FK to suffix ID',
904 'import' => true,
905 'where' => 'civicrm_contact.suffix_id',
906 'headerPattern' => '/^suffix$/i',
907 'dataPattern' => '/^(sr|jr)\.?|i{2,}$/',
908 'export' => true,
522a26c9 909 'table_name' => 'civicrm_contact',
910 'entity' => 'Contact',
911 'bao' => 'CRM_Contact_BAO_Contact',
6a7e5e5d 912 'localizable' => 0,
e501603b
TO
913 'html' => array(
914 'type' => 'Select',
915 ) ,
916 'pseudoconstant' => array(
917 'optionGroupName' => 'individual_suffix',
918 'optionEditPath' => 'civicrm/admin/options/individual_suffix',
919 )
920 ) ,
921 'formal_title' => array(
922 'name' => 'formal_title',
923 'type' => CRM_Utils_Type::T_STRING,
924 'title' => ts('Formal Title') ,
925 'description' => 'Formal (academic or similar) title in front of name. (Prof., Dr. etc.)',
926 'maxlength' => 64,
927 'size' => CRM_Utils_Type::BIG,
928 'import' => true,
929 'where' => 'civicrm_contact.formal_title',
930 'headerPattern' => '/^title/i',
931 'dataPattern' => '',
932 'export' => true,
522a26c9 933 'table_name' => 'civicrm_contact',
934 'entity' => 'Contact',
935 'bao' => 'CRM_Contact_BAO_Contact',
6a7e5e5d 936 'localizable' => 0,
e501603b
TO
937 'html' => array(
938 'type' => 'Text',
939 ) ,
940 ) ,
941 'communication_style_id' => array(
942 'name' => 'communication_style_id',
943 'type' => CRM_Utils_Type::T_INT,
944 'title' => ts('Communication Style') ,
945 'description' => 'Communication style (e.g. formal vs. familiar) to use with this contact. FK to communication styles in civicrm_option_value.',
946 'export' => true,
947 'where' => 'civicrm_contact.communication_style_id',
948 'headerPattern' => '',
949 'dataPattern' => '',
522a26c9 950 'table_name' => 'civicrm_contact',
951 'entity' => 'Contact',
952 'bao' => 'CRM_Contact_BAO_Contact',
6a7e5e5d 953 'localizable' => 0,
e501603b
TO
954 'html' => array(
955 'type' => 'Select',
956 ) ,
957 'pseudoconstant' => array(
958 'optionGroupName' => 'communication_style',
959 'optionEditPath' => 'civicrm/admin/options/communication_style',
960 )
961 ) ,
962 'email_greeting_id' => array(
963 'name' => 'email_greeting_id',
964 'type' => CRM_Utils_Type::T_INT,
965 'title' => ts('Email Greeting ID') ,
966 'description' => 'FK to civicrm_option_value.id, that has to be valid registered Email Greeting.',
522a26c9 967 'table_name' => 'civicrm_contact',
968 'entity' => 'Contact',
969 'bao' => 'CRM_Contact_BAO_Contact',
6a7e5e5d 970 'localizable' => 0,
e501603b
TO
971 ) ,
972 'email_greeting_custom' => array(
973 'name' => 'email_greeting_custom',
974 'type' => CRM_Utils_Type::T_STRING,
975 'title' => ts('Email Greeting Custom') ,
976 'description' => 'Custom Email Greeting.',
977 'maxlength' => 128,
978 'size' => CRM_Utils_Type::HUGE,
979 'import' => true,
980 'where' => 'civicrm_contact.email_greeting_custom',
981 'headerPattern' => '',
982 'dataPattern' => '',
983 'export' => false,
522a26c9 984 'table_name' => 'civicrm_contact',
985 'entity' => 'Contact',
986 'bao' => 'CRM_Contact_BAO_Contact',
6a7e5e5d 987 'localizable' => 0,
e501603b
TO
988 'html' => array(
989 'type' => 'Text',
990 ) ,
991 ) ,
992 'email_greeting_display' => array(
993 'name' => 'email_greeting_display',
994 'type' => CRM_Utils_Type::T_STRING,
995 'title' => ts('Email Greeting') ,
996 'description' => 'Cache Email Greeting.',
997 'maxlength' => 255,
998 'size' => CRM_Utils_Type::HUGE,
522a26c9 999 'table_name' => 'civicrm_contact',
1000 'entity' => 'Contact',
1001 'bao' => 'CRM_Contact_BAO_Contact',
6a7e5e5d 1002 'localizable' => 0,
e501603b
TO
1003 'html' => array(
1004 'type' => 'Text',
1005 ) ,
1006 ) ,
1007 'postal_greeting_id' => array(
1008 'name' => 'postal_greeting_id',
1009 'type' => CRM_Utils_Type::T_INT,
1010 'title' => ts('Postal Greeting ID') ,
1011 'description' => 'FK to civicrm_option_value.id, that has to be valid registered Postal Greeting.',
522a26c9 1012 'table_name' => 'civicrm_contact',
1013 'entity' => 'Contact',
1014 'bao' => 'CRM_Contact_BAO_Contact',
6a7e5e5d 1015 'localizable' => 0,
e501603b
TO
1016 'html' => array(
1017 'type' => 'Text',
1018 ) ,
1019 ) ,
1020 'postal_greeting_custom' => array(
1021 'name' => 'postal_greeting_custom',
1022 'type' => CRM_Utils_Type::T_STRING,
1023 'title' => ts('Postal Greeting Custom') ,
1024 'description' => 'Custom Postal greeting.',
1025 'maxlength' => 128,
1026 'size' => CRM_Utils_Type::HUGE,
1027 'import' => true,
1028 'where' => 'civicrm_contact.postal_greeting_custom',
1029 'headerPattern' => '',
1030 'dataPattern' => '',
1031 'export' => false,
522a26c9 1032 'table_name' => 'civicrm_contact',
1033 'entity' => 'Contact',
1034 'bao' => 'CRM_Contact_BAO_Contact',
6a7e5e5d 1035 'localizable' => 0,
e501603b
TO
1036 'html' => array(
1037 'type' => 'Text',
1038 ) ,
1039 ) ,
1040 'postal_greeting_display' => array(
1041 'name' => 'postal_greeting_display',
1042 'type' => CRM_Utils_Type::T_STRING,
1043 'title' => ts('Postal Greeting') ,
1044 'description' => 'Cache Postal greeting.',
1045 'maxlength' => 255,
1046 'size' => CRM_Utils_Type::HUGE,
522a26c9 1047 'table_name' => 'civicrm_contact',
1048 'entity' => 'Contact',
1049 'bao' => 'CRM_Contact_BAO_Contact',
6a7e5e5d 1050 'localizable' => 0,
e501603b
TO
1051 'html' => array(
1052 'type' => 'Text',
1053 ) ,
1054 ) ,
1055 'addressee_id' => array(
1056 'name' => 'addressee_id',
1057 'type' => CRM_Utils_Type::T_INT,
1058 'title' => ts('Addressee ID') ,
1059 'description' => 'FK to civicrm_option_value.id, that has to be valid registered Addressee.',
522a26c9 1060 'table_name' => 'civicrm_contact',
1061 'entity' => 'Contact',
1062 'bao' => 'CRM_Contact_BAO_Contact',
6a7e5e5d 1063 'localizable' => 0,
e501603b
TO
1064 ) ,
1065 'addressee_custom' => array(
1066 'name' => 'addressee_custom',
1067 'type' => CRM_Utils_Type::T_STRING,
1068 'title' => ts('Addressee Custom') ,
1069 'description' => 'Custom Addressee.',
1070 'maxlength' => 128,
1071 'size' => CRM_Utils_Type::HUGE,
1072 'import' => true,
1073 'where' => 'civicrm_contact.addressee_custom',
1074 'headerPattern' => '',
1075 'dataPattern' => '',
1076 'export' => false,
522a26c9 1077 'table_name' => 'civicrm_contact',
1078 'entity' => 'Contact',
1079 'bao' => 'CRM_Contact_BAO_Contact',
6a7e5e5d 1080 'localizable' => 0,
e501603b
TO
1081 'html' => array(
1082 'type' => 'Text',
1083 ) ,
1084 ) ,
1085 'addressee_display' => array(
1086 'name' => 'addressee_display',
1087 'type' => CRM_Utils_Type::T_STRING,
1088 'title' => ts('Addressee') ,
1089 'description' => 'Cache Addressee.',
1090 'maxlength' => 255,
1091 'size' => CRM_Utils_Type::HUGE,
522a26c9 1092 'table_name' => 'civicrm_contact',
1093 'entity' => 'Contact',
1094 'bao' => 'CRM_Contact_BAO_Contact',
6a7e5e5d 1095 'localizable' => 0,
e501603b
TO
1096 'html' => array(
1097 'type' => 'Text',
1098 ) ,
1099 ) ,
1100 'job_title' => array(
1101 'name' => 'job_title',
1102 'type' => CRM_Utils_Type::T_STRING,
1103 'title' => ts('Job Title') ,
1104 'description' => 'Job Title',
1105 'maxlength' => 255,
1106 'size' => 30,
1107 'import' => true,
1108 'where' => 'civicrm_contact.job_title',
1109 'headerPattern' => '/^job|(j(ob\s)?title)$/i',
1110 'dataPattern' => '//',
1111 'export' => true,
522a26c9 1112 'table_name' => 'civicrm_contact',
1113 'entity' => 'Contact',
1114 'bao' => 'CRM_Contact_BAO_Contact',
6a7e5e5d 1115 'localizable' => 0,
e501603b
TO
1116 'html' => array(
1117 'type' => 'Text',
1118 ) ,
1119 ) ,
1120 'gender_id' => array(
1121 'name' => 'gender_id',
1122 'type' => CRM_Utils_Type::T_INT,
1123 'title' => ts('Gender') ,
1124 'description' => 'FK to gender ID',
1125 'import' => true,
1126 'where' => 'civicrm_contact.gender_id',
1127 'headerPattern' => '/^gender$/i',
1128 'dataPattern' => '',
1129 'export' => true,
522a26c9 1130 'table_name' => 'civicrm_contact',
1131 'entity' => 'Contact',
1132 'bao' => 'CRM_Contact_BAO_Contact',
6a7e5e5d 1133 'localizable' => 0,
e501603b
TO
1134 'html' => array(
1135 'type' => 'Select',
1136 ) ,
1137 'pseudoconstant' => array(
1138 'optionGroupName' => 'gender',
1139 'optionEditPath' => 'civicrm/admin/options/gender',
1140 )
1141 ) ,
1142 'birth_date' => array(
1143 'name' => 'birth_date',
1144 'type' => CRM_Utils_Type::T_DATE,
1145 'title' => ts('Birth Date') ,
1146 'description' => 'Date of birth',
1147 'import' => true,
1148 'where' => 'civicrm_contact.birth_date',
1149 'headerPattern' => '/^birth|(b(irth\s)?date)|D(\W*)O(\W*)B(\W*)$/i',
1150 'dataPattern' => '/\d{4}-?\d{2}-?\d{2}/',
1151 'export' => true,
522a26c9 1152 'table_name' => 'civicrm_contact',
1153 'entity' => 'Contact',
1154 'bao' => 'CRM_Contact_BAO_Contact',
6a7e5e5d 1155 'localizable' => 0,
e501603b
TO
1156 'html' => array(
1157 'type' => 'Select Date',
24317d89 1158 'formatType' => 'birth',
e501603b
TO
1159 ) ,
1160 ) ,
1161 'is_deceased' => array(
1162 'name' => 'is_deceased',
1163 'type' => CRM_Utils_Type::T_BOOLEAN,
1164 'title' => ts('Deceased') ,
1165 'import' => true,
1166 'where' => 'civicrm_contact.is_deceased',
1167 'headerPattern' => '/i(s\s)?d(eceased)$/i',
1168 'dataPattern' => '',
1169 'export' => true,
522a26c9 1170 'table_name' => 'civicrm_contact',
1171 'entity' => 'Contact',
1172 'bao' => 'CRM_Contact_BAO_Contact',
6a7e5e5d 1173 'localizable' => 0,
e501603b
TO
1174 'html' => array(
1175 'type' => 'CheckBox',
1176 ) ,
1177 ) ,
1178 'deceased_date' => array(
1179 'name' => 'deceased_date',
1180 'type' => CRM_Utils_Type::T_DATE,
1181 'title' => ts('Deceased Date') ,
1182 'description' => 'Date of deceased',
1183 'import' => true,
1184 'where' => 'civicrm_contact.deceased_date',
1185 'headerPattern' => '/^deceased|(d(eceased\s)?date)$/i',
1186 'dataPattern' => '',
1187 'export' => true,
522a26c9 1188 'table_name' => 'civicrm_contact',
1189 'entity' => 'Contact',
1190 'bao' => 'CRM_Contact_BAO_Contact',
6a7e5e5d 1191 'localizable' => 0,
e501603b
TO
1192 'html' => array(
1193 'type' => 'Select Date',
24317d89 1194 'formatType' => 'birth',
e501603b
TO
1195 ) ,
1196 ) ,
1197 'household_name' => array(
1198 'name' => 'household_name',
1199 'type' => CRM_Utils_Type::T_STRING,
1200 'title' => ts('Household Name') ,
1201 'description' => 'Household Name.',
1202 'maxlength' => 128,
1203 'size' => 30,
1204 'import' => true,
1205 'where' => 'civicrm_contact.household_name',
1206 'headerPattern' => '/^household|(h(ousehold\s)?name)$/i',
1207 'dataPattern' => '/^\w+$/',
1208 'export' => true,
522a26c9 1209 'table_name' => 'civicrm_contact',
1210 'entity' => 'Contact',
1211 'bao' => 'CRM_Contact_BAO_Contact',
6a7e5e5d 1212 'localizable' => 0,
e501603b
TO
1213 'html' => array(
1214 'type' => 'Text',
1215 ) ,
1216 ) ,
1217 'primary_contact_id' => array(
1218 'name' => 'primary_contact_id',
1219 'type' => CRM_Utils_Type::T_INT,
1220 'title' => ts('Household Primary Contact ID') ,
1221 'description' => 'Optional FK to Primary Contact for this household.',
522a26c9 1222 'table_name' => 'civicrm_contact',
1223 'entity' => 'Contact',
1224 'bao' => 'CRM_Contact_BAO_Contact',
6a7e5e5d 1225 'localizable' => 0,
e501603b
TO
1226 'FKClassName' => 'CRM_Contact_DAO_Contact',
1227 'html' => array(
1228 'type' => 'Select',
1229 ) ,
1230 ) ,
1231 'organization_name' => array(
1232 'name' => 'organization_name',
1233 'type' => CRM_Utils_Type::T_STRING,
1234 'title' => ts('Organization Name') ,
1235 'description' => 'Organization Name.',
1236 'maxlength' => 128,
1237 'size' => 30,
1238 'import' => true,
1239 'where' => 'civicrm_contact.organization_name',
1240 'headerPattern' => '/^organization|(o(rganization\s)?name)$/i',
1241 'dataPattern' => '/^\w+$/',
1242 'export' => true,
522a26c9 1243 'table_name' => 'civicrm_contact',
1244 'entity' => 'Contact',
1245 'bao' => 'CRM_Contact_BAO_Contact',
6a7e5e5d 1246 'localizable' => 0,
e501603b
TO
1247 'html' => array(
1248 'type' => 'Text',
1249 ) ,
1250 ) ,
1251 'sic_code' => array(
1252 'name' => 'sic_code',
1253 'type' => CRM_Utils_Type::T_STRING,
1254 'title' => ts('Sic Code') ,
1255 'description' => 'Standard Industry Classification Code.',
1256 'maxlength' => 8,
1257 'size' => CRM_Utils_Type::EIGHT,
1258 'import' => true,
1259 'where' => 'civicrm_contact.sic_code',
1260 'headerPattern' => '/^sic|(s(ic\s)?code)$/i',
1261 'dataPattern' => '',
1262 'export' => true,
522a26c9 1263 'table_name' => 'civicrm_contact',
1264 'entity' => 'Contact',
1265 'bao' => 'CRM_Contact_BAO_Contact',
6a7e5e5d 1266 'localizable' => 0,
e501603b
TO
1267 'html' => array(
1268 'type' => 'Text',
1269 ) ,
1270 ) ,
1271 'user_unique_id' => array(
1272 'name' => 'user_unique_id',
1273 'type' => CRM_Utils_Type::T_STRING,
1274 'title' => ts('Unique ID (OpenID)') ,
1275 'description' => 'the OpenID (or OpenID-style http://username.domain/) unique identifier for this contact mainly used for logging in to CiviCRM',
1276 'maxlength' => 255,
1277 'size' => CRM_Utils_Type::HUGE,
1278 'import' => true,
1279 'where' => 'civicrm_contact.user_unique_id',
1280 'headerPattern' => '/^Open\s?ID|u(niq\w*)?\s?ID/i',
1281 'dataPattern' => '/^[\w\/\:\.]+$/',
1282 'export' => true,
1283 'rule' => 'url',
522a26c9 1284 'table_name' => 'civicrm_contact',
1285 'entity' => 'Contact',
1286 'bao' => 'CRM_Contact_BAO_Contact',
6a7e5e5d 1287 'localizable' => 0,
e501603b
TO
1288 'html' => array(
1289 'type' => 'Text',
1290 ) ,
1291 ) ,
1292 'current_employer_id' => array(
1293 'name' => 'employer_id',
1294 'type' => CRM_Utils_Type::T_INT,
1295 'title' => ts('Current Employer') ,
1296 'description' => 'OPTIONAL FK to civicrm_contact record.',
1297 'export' => true,
1298 'where' => 'civicrm_contact.employer_id',
1299 'headerPattern' => '',
1300 'dataPattern' => '',
522a26c9 1301 'table_name' => 'civicrm_contact',
1302 'entity' => 'Contact',
1303 'bao' => 'CRM_Contact_BAO_Contact',
6a7e5e5d 1304 'localizable' => 0,
e501603b
TO
1305 'FKClassName' => 'CRM_Contact_DAO_Contact',
1306 'html' => array(
1307 'type' => 'EntityRef',
1308 ) ,
1309 ) ,
1310 'contact_is_deleted' => array(
1311 'name' => 'is_deleted',
1312 'type' => CRM_Utils_Type::T_BOOLEAN,
1313 'title' => ts('Contact is in Trash') ,
1314 'required' => true,
1315 'export' => true,
1316 'where' => 'civicrm_contact.is_deleted',
1317 'headerPattern' => '',
1318 'dataPattern' => '',
522a26c9 1319 'table_name' => 'civicrm_contact',
1320 'entity' => 'Contact',
1321 'bao' => 'CRM_Contact_BAO_Contact',
6a7e5e5d 1322 'localizable' => 0,
e501603b
TO
1323 'html' => array(
1324 'type' => 'CheckBox',
1325 ) ,
1326 ) ,
1327 'created_date' => array(
1328 'name' => 'created_date',
1329 'type' => CRM_Utils_Type::T_TIMESTAMP,
1330 'title' => ts('Created Date') ,
1331 'description' => 'When was the contact was created.',
1332 'required' => false,
1333 'export' => true,
1334 'where' => 'civicrm_contact.created_date',
1335 'headerPattern' => '',
1336 'dataPattern' => '',
1337 'default' => 'NULL',
522a26c9 1338 'table_name' => 'civicrm_contact',
1339 'entity' => 'Contact',
1340 'bao' => 'CRM_Contact_BAO_Contact',
6a7e5e5d 1341 'localizable' => 0,
e501603b
TO
1342 ) ,
1343 'modified_date' => array(
1344 'name' => 'modified_date',
1345 'type' => CRM_Utils_Type::T_TIMESTAMP,
1346 'title' => ts('Modified Date') ,
1347 'description' => 'When was the contact (or closely related entity) was created or modified or deleted.',
1348 'required' => false,
1349 'export' => true,
1350 'where' => 'civicrm_contact.modified_date',
1351 'headerPattern' => '',
1352 'dataPattern' => '',
1353 'default' => 'CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP',
522a26c9 1354 'table_name' => 'civicrm_contact',
1355 'entity' => 'Contact',
1356 'bao' => 'CRM_Contact_BAO_Contact',
6a7e5e5d 1357 'localizable' => 0,
e501603b
TO
1358 ) ,
1359 );
346aaaba 1360 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 1361 }
346aaaba 1362 return Civi::$statics[__CLASS__]['fields'];
e501603b
TO
1363 }
1364 /**
bd8e0b14 1365 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
1366 *
1367 * @return array
bd8e0b14 1368 * Array(string $name => string $uniqueName).
e501603b
TO
1369 */
1370 static function &fieldKeys() {
bd8e0b14
TO
1371 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
1372 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 1373 }
bd8e0b14 1374 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b
TO
1375 }
1376 /**
1377 * Returns the names of this table
1378 *
1379 * @return string
1380 */
1381 static function getTableName() {
1382 return self::$_tableName;
1383 }
1384 /**
1385 * Returns if this table needs to be logged
1386 *
1387 * @return boolean
1388 */
1389 function getLog() {
1390 return self::$_log;
1391 }
1392 /**
1393 * Returns the list of fields that can be imported
1394 *
1395 * @param bool $prefix
1396 *
1397 * @return array
1398 */
1399 static function &import($prefix = false) {
60808919
TO
1400 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'contact', $prefix, array());
1401 return $r;
e501603b
TO
1402 }
1403 /**
1404 * Returns the list of fields that can be exported
1405 *
1406 * @param bool $prefix
1407 *
1408 * @return array
1409 */
1410 static function &export($prefix = false) {
60808919
TO
1411 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'contact', $prefix, array());
1412 return $r;
e501603b 1413 }
e7a6b91a
AS
1414 /**
1415 * Returns the list of indices
1416 */
1417 public static function indices($localize = TRUE) {
1418 $indices = array(
1419 'index_contact_type' => array(
1420 'name' => 'index_contact_type',
1421 'field' => array(
1422 0 => 'contact_type',
1423 ) ,
1424 'localizable' => false,
1425 'sig' => 'civicrm_contact::0::contact_type',
1426 ) ,
1427 'index_contact_sub_type' => array(
1428 'name' => 'index_contact_sub_type',
1429 'field' => array(
1430 0 => 'contact_sub_type',
1431 ) ,
1432 'localizable' => false,
1433 'sig' => 'civicrm_contact::0::contact_sub_type',
1434 ) ,
1435 'UI_external_identifier' => array(
1436 'name' => 'UI_external_identifier',
1437 'field' => array(
1438 0 => 'external_identifier',
1439 ) ,
1440 'localizable' => false,
1441 'unique' => true,
1442 'sig' => 'civicrm_contact::1::external_identifier',
1443 ) ,
1444 'index_sort_name' => array(
1445 'name' => 'index_sort_name',
1446 'field' => array(
1447 0 => 'sort_name',
1448 ) ,
1449 'localizable' => false,
1450 'sig' => 'civicrm_contact::0::sort_name',
1451 ) ,
1452 'index_preferred_communication_method' => array(
1453 'name' => 'index_preferred_communication_method',
1454 'field' => array(
1455 0 => 'preferred_communication_method',
1456 ) ,
1457 'localizable' => false,
1458 'sig' => 'civicrm_contact::0::preferred_communication_method',
1459 ) ,
1460 'index_hash' => array(
1461 'name' => 'index_hash',
1462 'field' => array(
1463 0 => 'hash',
1464 ) ,
1465 'localizable' => false,
1466 'sig' => 'civicrm_contact::0::hash',
1467 ) ,
1468 'index_api_key' => array(
1469 'name' => 'index_api_key',
1470 'field' => array(
1471 0 => 'api_key',
1472 ) ,
1473 'localizable' => false,
1474 'sig' => 'civicrm_contact::0::api_key',
1475 ) ,
1476 'index_first_name' => array(
1477 'name' => 'index_first_name',
1478 'field' => array(
1479 0 => 'first_name',
1480 ) ,
1481 'localizable' => false,
1482 'sig' => 'civicrm_contact::0::first_name',
1483 ) ,
1484 'index_last_name' => array(
1485 'name' => 'index_last_name',
1486 'field' => array(
1487 0 => 'last_name',
1488 ) ,
1489 'localizable' => false,
1490 'sig' => 'civicrm_contact::0::last_name',
1491 ) ,
1492 'UI_prefix' => array(
1493 'name' => 'UI_prefix',
1494 'field' => array(
1495 0 => 'prefix_id',
1496 ) ,
1497 'localizable' => false,
1498 'sig' => 'civicrm_contact::0::prefix_id',
1499 ) ,
1500 'UI_suffix' => array(
1501 'name' => 'UI_suffix',
1502 'field' => array(
1503 0 => 'suffix_id',
1504 ) ,
1505 'localizable' => false,
1506 'sig' => 'civicrm_contact::0::suffix_id',
1507 ) ,
1508 'index_communication_style_id' => array(
1509 'name' => 'index_communication_style_id',
1510 'field' => array(
1511 0 => 'communication_style_id',
1512 ) ,
1513 'localizable' => false,
1514 'sig' => 'civicrm_contact::0::communication_style_id',
1515 ) ,
1516 'UI_gender' => array(
1517 'name' => 'UI_gender',
1518 'field' => array(
1519 0 => 'gender_id',
1520 ) ,
1521 'localizable' => false,
1522 'sig' => 'civicrm_contact::0::gender_id',
1523 ) ,
27633545
SL
1524 'index_is_deceased' => array(
1525 'name' => 'index_is_deceased',
1526 'field' => array(
1527 0 => 'is_deceased',
1528 ) ,
1529 'localizable' => false,
1530 'sig' => 'civicrm_contact::0::is_deceased',
1531 ) ,
e7a6b91a
AS
1532 'index_household_name' => array(
1533 'name' => 'index_household_name',
1534 'field' => array(
1535 0 => 'household_name',
1536 ) ,
1537 'localizable' => false,
1538 'sig' => 'civicrm_contact::0::household_name',
1539 ) ,
1540 'index_organization_name' => array(
1541 'name' => 'index_organization_name',
1542 'field' => array(
1543 0 => 'organization_name',
1544 ) ,
1545 'localizable' => false,
1546 'sig' => 'civicrm_contact::0::organization_name',
1547 ) ,
1548 'index_is_deleted_sort_name' => array(
1549 'name' => 'index_is_deleted_sort_name',
1550 'field' => array(
1551 0 => 'is_deleted',
1552 1 => 'sort_name',
1553 2 => 'id',
1554 ) ,
1555 'localizable' => false,
1556 'sig' => 'civicrm_contact::0::is_deleted::sort_name::id',
1557 ) ,
1558 );
1559 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
1560 }
e501603b 1561}