2 if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
3 /*********************************************************************************
4 * SugarCRM Community Edition is a customer relationship management program developed by
5 * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc.
7 * This program is free software; you can redistribute it and/or modify it under
8 * the terms of the GNU Affero General Public License version 3 as published by the
9 * Free Software Foundation with the addition of the following permission added
10 * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
11 * IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
12 * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
14 * This program is distributed in the hope that it will be useful, but WITHOUT
15 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16 * FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
19 * You should have received a copy of the GNU Affero General Public License along with
20 * this program; if not, see http://www.gnu.org/licenses or write to the Free
21 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
24 * You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
25 * SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
27 * The interactive user interfaces in modified source and object code versions
28 * of this program must display Appropriate Legal Notices, as required under
29 * Section 5 of the GNU Affero General Public License version 3.
31 * In accordance with Section 7(b) of the GNU Affero General Public License version 3,
32 * these Appropriate Legal Notices must retain the display of the "Powered by
33 * SugarCRM" logo. If the display of the logo is not reasonably feasible for
34 * technical reasons, the Appropriate Legal Notices must display the words
35 * "Powered by SugarCRM".
36 ********************************************************************************/
38 $dictionary['Contact'] = array('table' => 'contacts', 'audited'=>true,
40 'unified_search' => true, 'unified_search_default_enabled' => true, 'duplicate_merge'=>true, 'fields' =>
45 'name' => 'email_and_name1',
46 'rname' => 'email_and_name1',
47 'vname' => 'LBL_NAME',
51 'importable' => 'false',
55 'name' => 'lead_source',
56 'vname' => 'LBL_LEAD_SOURCE',
58 'options' => 'lead_source_dom',
60 'comment' => 'How did the contact come about',
65 'name' => 'account_name',
67 'id_name' => 'account_id',
68 'vname' => 'LBL_ACCOUNT_NAME',
69 'join_name'=>'accounts',
72 'table' => 'accounts',
74 'module' => 'Accounts',
75 'dbType' => 'varchar',
78 'unified_search' => true,
82 'name' => 'account_id',
84 'id_name' => 'account_id',
85 'vname' => 'LBL_ACCOUNT_ID',
87 'table' => 'accounts',
89 'module' => 'Accounts',
93 'massupdate' => false,
94 'duplicate_merge'=> 'disabled',
98 'opportunity_role_fields' =>
100 'name' => 'opportunity_role_fields',
102 'relationship_fields'=>array('id' => 'opportunity_role_id', 'contact_role' => 'opportunity_role'),
103 'vname' => 'LBL_ACCOUNT_NAME',
105 'link' => 'opportunities',
106 'link_type' => 'relationship_info',
107 'join_link_name' => 'opportunities_contacts',
108 'source' => 'non-db',
109 'importable' => 'false',
110 'duplicate_merge'=> 'disabled',
111 'studio' => array('listview' => false),
113 'opportunity_role_id' =>
115 'name' => 'opportunity_role_id',
117 'source' => 'non-db',
118 'vname' => 'LBL_OPPORTUNITY_ROLE_ID',
119 'studio' => array('listview' => false),
125 'query_type' => 'default',
126 'source' => 'non-db',
127 'operator' => 'subquery',
128 'subquery' => 'SELECT eabr.bean_id FROM email_addr_bean_rel eabr JOIN email_addresses ea ON (ea.id = eabr.email_address_id) WHERE eabr.deleted=0 AND ea.email_address LIKE',
132 'vname' =>'LBL_ANY_EMAIL',
133 'studio' => array('visible'=>false, 'searchview'=>true),
135 'opportunity_role' =>
137 'name' => 'opportunity_role',
139 'source' => 'non-db',
140 'vname' => 'LBL_OPPORTUNITY_ROLE',
141 'options' => 'opportunity_relationship_type_dom',
145 'name' => 'reports_to_id',
146 'vname' => 'LBL_REPORTS_TO_ID',
150 'comment' => 'The contact this contact reports to'
154 'name' => 'report_to_name',
155 'rname' => 'last_name',
156 'id_name' => 'reports_to_id',
157 'vname' => 'LBL_REPORTS_TO',
159 'link' => 'reports_to_link',
160 'table' => 'contacts',
162 'module' => 'Contacts',
163 'dbType' => 'varchar',
166 'source' => 'non-db',
170 'name' => 'birthdate',
171 'vname' => 'LBL_BIRTHDATE',
172 'massupdate' => false,
174 'comment' => 'The birthdate of the contact'
178 'name' => 'accounts',
180 'relationship' => 'accounts_contacts',
181 'link_type' => 'one',
182 'source' => 'non-db',
183 'vname' => 'LBL_ACCOUNT',
184 'duplicate_merge'=> 'disabled',
188 'name' => 'reports_to_link',
190 'relationship' => 'contact_direct_reports',
191 'link_type' => 'one',
193 'source' => 'non-db',
194 'vname' => 'LBL_REPORTS_TO',
198 'name' => 'opportunities',
200 'relationship' => 'opportunities_contacts',
201 'source' => 'non-db',
202 'module' => 'Opportunities',
203 'bean_name' => 'Opportunity',
204 'vname' => 'LBL_OPPORTUNITIES',
208 'name' => 'email_addresses',
210 'relationship' => 'contacts_email_addresses',
211 'module' => 'EmailAddress',
212 'bean_name'=>'EmailAddress',
213 'source' => 'non-db',
214 'vname' => 'LBL_EMAIL_ADDRESSES',
216 'rel_fields' => array('primary_address' => array('type'=>'bool')),
217 'unified_search'=>true,
219 'email_addresses_primary' =>
221 'name' => 'email_addresses_primary',
223 'relationship' => 'contacts_email_addresses_primary',
224 'source' => 'non-db',
225 'vname' => 'LBL_EMAIL_ADDRESS_PRIMARY',
226 'duplicate_merge'=> 'disabled',
232 'relationship' => 'contacts_bugs',
233 'source' => 'non-db',
234 'vname' => 'LBL_BUGS',
240 'relationship' => 'calls_contacts',
241 'source' => 'non-db',
242 'vname' => 'LBL_CALLS',
248 'relationship' => 'contacts_cases',
249 'source' => 'non-db',
250 'vname' => 'LBL_CASES',
254 'name' => 'direct_reports',
256 'relationship' => 'contact_direct_reports',
257 'source' => 'non-db',
258 'vname' => 'LBL_DIRECT_REPORTS',
264 'relationship' => 'emails_contacts_rel',
265 'source' => 'non-db',
266 'vname' => 'LBL_EMAILS',
270 'name' => 'documents',
272 'relationship' => 'documents_contacts',
273 'source' => 'non-db',
274 'vname' => 'LBL_DOCUMENTS_SUBPANEL_TITLE',
280 'relationship' => 'contact_leads',
281 'source' => 'non-db',
282 'vname' => 'LBL_LEADS',
286 'name' => 'meetings',
288 'relationship' => 'meetings_contacts',
289 'source' => 'non-db',
290 'vname' => 'LBL_MEETINGS',
296 'relationship' => 'contact_notes',
297 'source' => 'non-db',
298 'vname' => 'LBL_NOTES',
304 'relationship' => 'projects_contacts',
305 'source' => 'non-db',
306 'vname' => 'LBL_PROJECTS',
308 'project_resource' => array(
309 'name' => 'project_resource',
311 'relationship' => 'projects_contacts_resources',
312 'source' => 'non-db',
313 'vname' => 'LBL_PROJECTS_RESOURCES',
322 'relationship' => 'contact_tasks',
323 'source' => 'non-db',
324 'vname' => 'LBL_TASKS',
326 'tasks_parent' => array(
327 'name' => 'tasks_parent',
329 'relationship' => 'contact_tasks_parent',
330 'source' => 'non-db',
331 'vname' => 'LBL_TASKS',
332 'reportable' => false
336 'name' => 'user_sync',
338 'relationship' => 'contacts_users',
339 'source' => 'non-db',
340 'vname' => 'LBL_USER_SYNC',
344 'name' => 'created_by_link',
346 'relationship' => 'contacts_created_by',
347 'vname' => 'LBL_CREATED_BY_USER',
348 'link_type' => 'one',
350 'bean_name' => 'User',
351 'source' => 'non-db',
353 'modified_user_link' =>
355 'name' => 'modified_user_link',
357 'relationship' => 'contacts_modified_user',
358 'vname' => 'LBL_MODIFIED_BY_USER',
359 'link_type' => 'one',
361 'bean_name' => 'User',
362 'source' => 'non-db',
364 'assigned_user_link' =>
366 'name' => 'assigned_user_link',
368 'relationship' => 'contacts_assigned_user',
369 'vname' => 'LBL_ASSIGNED_TO_USER',
370 'link_type' => 'one',
372 'bean_name' => 'User',
373 'source' => 'non-db',
374 'rname' => 'user_name',
375 'id_name' => 'assigned_user_id',
377 'duplicate_merge'=>'enabled'
381 'name' => 'campaign_id',
382 'comment' => 'Campaign that generated lead',
383 'vname'=>'LBL_CAMPAIGN_ID',
385 'id_name' => 'campaign_id',
387 //'dbType' => 'char',
388 'table' => 'campaigns',
390 'module' => 'Campaigns',
391 // 'reportable'=>false,
392 'massupdate' => false,
393 'duplicate_merge'=> 'disabled',
398 'name' => 'campaign_name',
400 'vname' => 'LBL_CAMPAIGN',
402 'link' => 'campaign_contacts',
406 'table' => 'campaigns',
407 'id_name' => 'campaign_id',
408 'module'=>'Campaigns',
409 'duplicate_merge'=>'disabled',
410 'comment' => 'The first campaign name for Contact (Meta-data only)',
415 'name' => 'campaigns',
417 'relationship' => 'contact_campaign_log',
418 'module'=>'CampaignLog',
419 'bean_name'=>'CampaignLog',
421 'vname'=>'LBL_CAMPAIGNLOG',
424 'campaign_contacts' =>
426 'name' => 'campaign_contacts',
428 'vname' => 'LBL_CAMPAIGN_CONTACT',
429 'relationship' => 'campaign_contacts',
430 'source' => 'non-db',
432 'c_accept_status_fields' =>
434 'name' => 'c_accept_status_fields',
436 'relationship_fields'=>array('id' => 'accept_status_id', 'accept_status' => 'accept_status_name'),
437 'vname' => 'LBL_LIST_ACCEPT_STATUS',
440 'link_type' => 'relationship_info',
441 'source' => 'non-db',
442 'importable' => 'false',
443 'duplicate_merge'=> 'disabled',
444 'studio' => array('listview' => false),
446 'm_accept_status_fields' =>
448 'name' => 'm_accept_status_fields',
450 'relationship_fields'=>array('id' => 'accept_status_id', 'accept_status' => 'accept_status_name'),
451 'vname' => 'LBL_LIST_ACCEPT_STATUS',
453 'link' => 'meetings',
454 'link_type' => 'relationship_info',
455 'source' => 'non-db',
456 'importable' => 'false',
458 'duplicate_merge'=> 'disabled',
459 'studio' => array('listview' => false),
461 'accept_status_id' =>
463 'name' => 'accept_status_id',
465 'source' => 'non-db',
466 'vname' => 'LBL_LIST_ACCEPT_STATUS',
467 'studio' => array('listview' => false),
469 'accept_status_name' =>
471 'massupdate' => false,
472 'name' => 'accept_status_name',
475 'source' => 'non-db',
476 'vname' => 'LBL_LIST_ACCEPT_STATUS',
477 'options' => 'dom_meeting_accept_status',
478 'importable' => 'false',
482 'name' => 'prospect_lists',
484 'relationship' => 'prospect_list_contacts',
485 'module'=>'ProspectLists',
487 'vname'=>'LBL_PROSPECT_LIST',
491 'massupdate' => false,
492 'name' => 'sync_contact',
493 'vname' => 'LBL_SYNC_CONTACT',
495 'source' => 'non-db',
496 'comment' => 'Synch to outlook? (Meta-Data only)',
502 'name' => 'idx_cont_last_first',
504 'fields' => array('last_name', 'first_name', 'deleted')
507 'name' => 'idx_contacts_del_last',
509 'fields' => array('deleted', 'last_name'),
512 'name' => 'idx_cont_del_reports',
514 'fields'=>array('deleted', 'reports_to_id', 'last_name')
517 'name' => 'idx_reports_to_id',
519 'fields'=> array('reports_to_id'),
522 'name' => 'idx_del_id_user',
524 'fields'=> array('deleted', 'id', 'assigned_user_id'),
527 'name' => 'idx_cont_assigned',
529 'fields' => array('assigned_user_id')
532 // 'name' => 'idx_cont_email1',
533 // 'type' => 'index',
534 // 'fields' => array('email1')
537 // 'name' => 'idx_cont_email2',
538 // 'type' => 'index',
539 // 'fields' => array('email2')
542 'relationships' => array(
543 'contact_direct_reports' => array('lhs_module' => 'Contacts',
544 'lhs_table' => 'contacts',
546 'rhs_module' => 'Contacts',
547 'rhs_table' => 'contacts',
548 'rhs_key' => 'reports_to_id',
549 'relationship_type' => 'one-to-many'),
550 'contact_leads' => array('lhs_module' => 'Contacts',
551 'lhs_table' => 'contacts',
553 'rhs_module' => 'Leads',
554 'rhs_table' => 'leads',
555 'rhs_key' => 'contact_id',
556 'relationship_type' => 'one-to-many'),
557 'contact_notes' => array('lhs_module' => 'Contacts',
558 'lhs_table' => 'contacts',
560 'rhs_module' => 'Notes',
561 'rhs_table' => 'notes',
562 'rhs_key' => 'contact_id',
563 'relationship_type' => 'one-to-many'),
564 'contact_tasks' => array('lhs_module' => 'Contacts',
565 'lhs_table' => 'contacts',
567 'rhs_module' => 'Tasks',
568 'rhs_table' => 'tasks',
569 'rhs_key' => 'contact_id',
570 'relationship_type' => 'one-to-many'),
571 'contact_tasks_parent' => array('lhs_module' => 'Contacts',
572 'lhs_table' => 'contacts',
574 'rhs_module' => 'Tasks',
575 'rhs_table' => 'tasks',
576 'rhs_key' => 'parent_id',
577 'relationship_type' => 'one-to-many',
578 'relationship_role_column'=>'parent_type',
579 'relationship_role_column_value'=>'Contacts'
581 'contacts_assigned_user' => array('lhs_module' => 'Users',
582 'lhs_table' => 'users',
584 'rhs_module' => 'Contacts',
585 'rhs_table' => 'contacts',
586 'rhs_key' => 'assigned_user_id',
587 'relationship_type' => 'one-to-many'),
588 'contacts_modified_user' => array('lhs_module' => 'Users',
589 'lhs_table' => 'users',
591 'rhs_module' => 'Contacts',
592 'rhs_table' => 'contacts',
593 'rhs_key' => 'modified_user_id',
594 'relationship_type' => 'one-to-many'),
595 'contacts_created_by' => array('lhs_module' => 'Users',
596 'lhs_table' => 'users',
598 'rhs_module' => 'Contacts',
599 'rhs_table' => 'contacts',
600 'rhs_key' => 'created_by',
601 'relationship_type' => 'one-to-many'),
602 'contact_campaign_log' => array(
603 'lhs_module' => 'Contacts',
604 'lhs_table' => 'contacts',
606 'rhs_module' => 'CampaignLog',
607 'rhs_table' => 'campaign_log',
608 'rhs_key' => 'target_id',
609 'relationship_type' =>'one-to-many'
613 //This enables optimistic locking for Saves From EditView
614 'optimistic_locking'=>true,
617 VardefManager::createVardef('Contacts','Contact', array('default', 'assignable',