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',
313 'relationship' => 'contact_tasks',
314 'source' => 'non-db',
315 'vname' => 'LBL_TASKS',
319 'name' => 'tasks_parent',
321 'relationship' => 'contact_tasks_parent',
322 'source' => 'non-db',
323 'vname' => 'LBL_TASKS',
329 'relationship' => 'contacts_users',
330 'source' => 'non-db',
331 'vname' => 'LBL_USER_SYNC',
335 'name' => 'created_by_link',
337 'relationship' => 'contacts_created_by',
338 'vname' => 'LBL_CREATED_BY_USER',
339 'link_type' => 'one',
341 'bean_name' => 'User',
342 'source' => 'non-db',
344 'modified_user_link' =>
346 'name' => 'modified_user_link',
348 'relationship' => 'contacts_modified_user',
349 'vname' => 'LBL_MODIFIED_BY_USER',
350 'link_type' => 'one',
352 'bean_name' => 'User',
353 'source' => 'non-db',
355 'assigned_user_link' =>
357 'name' => 'assigned_user_link',
359 'relationship' => 'contacts_assigned_user',
360 'vname' => 'LBL_ASSIGNED_TO_USER',
361 'link_type' => 'one',
363 'bean_name' => 'User',
364 'source' => 'non-db',
365 'rname' => 'user_name',
366 'id_name' => 'assigned_user_id',
368 'duplicate_merge'=>'enabled'
372 'name' => 'campaign_id',
373 'comment' => 'Campaign that generated lead',
374 'vname'=>'LBL_CAMPAIGN_ID',
376 'id_name' => 'campaign_id',
378 //'dbType' => 'char',
379 'table' => 'campaigns',
381 'module' => 'Campaigns',
382 // 'reportable'=>false,
383 'massupdate' => false,
384 'duplicate_merge'=> 'disabled',
389 'name' => 'campaign_name',
391 'vname' => 'LBL_CAMPAIGN',
393 'link' => 'campaign_contacts',
397 'table' => 'campaigns',
398 'id_name' => 'campaign_id',
399 'module'=>'Campaigns',
400 'duplicate_merge'=>'disabled',
401 'comment' => 'The first campaign name for Contact (Meta-data only)',
406 'name' => 'campaigns',
408 'relationship' => 'contact_campaign_log',
409 'module'=>'CampaignLog',
410 'bean_name'=>'CampaignLog',
412 'vname'=>'LBL_CAMPAIGNLOG',
415 'campaign_contacts' =>
417 'name' => 'campaign_contacts',
419 'vname' => 'LBL_CAMPAIGN_CONTACT',
420 'relationship' => 'campaign_contacts',
421 'source' => 'non-db',
423 'c_accept_status_fields' =>
425 'name' => 'c_accept_status_fields',
427 'relationship_fields'=>array('id' => 'accept_status_id', 'accept_status' => 'accept_status_name'),
428 'vname' => 'LBL_LIST_ACCEPT_STATUS',
431 'link_type' => 'relationship_info',
432 'source' => 'non-db',
433 'importable' => 'false',
434 'duplicate_merge'=> 'disabled',
435 'studio' => array('listview' => false),
437 'm_accept_status_fields' =>
439 'name' => 'm_accept_status_fields',
441 'relationship_fields'=>array('id' => 'accept_status_id', 'accept_status' => 'accept_status_name'),
442 'vname' => 'LBL_LIST_ACCEPT_STATUS',
444 'link' => 'meetings',
445 'link_type' => 'relationship_info',
446 'source' => 'non-db',
447 'importable' => 'false',
449 'duplicate_merge'=> 'disabled',
450 'studio' => array('listview' => false),
452 'accept_status_id' =>
454 'name' => 'accept_status_id',
456 'source' => 'non-db',
457 'vname' => 'LBL_LIST_ACCEPT_STATUS',
458 'studio' => array('listview' => false),
460 'accept_status_name' =>
462 'massupdate' => false,
463 'name' => 'accept_status_name',
466 'source' => 'non-db',
467 'vname' => 'LBL_LIST_ACCEPT_STATUS',
468 'options' => 'dom_meeting_accept_status',
469 'importable' => 'false',
473 'name' => 'prospect_lists',
475 'relationship' => 'prospect_list_contacts',
476 'module'=>'ProspectLists',
478 'vname'=>'LBL_PROSPECT_LIST',
482 'massupdate' => false,
483 'name' => 'sync_contact',
484 'vname' => 'LBL_SYNC_CONTACT',
486 'source' => 'non-db',
487 'comment' => 'Synch to outlook? (Meta-Data only)',
493 'name' => 'idx_cont_last_first',
495 'fields' => array('last_name', 'first_name', 'deleted')
498 'name' => 'idx_contacts_del_last',
500 'fields' => array('deleted', 'last_name'),
503 'name' => 'idx_cont_del_reports',
505 'fields'=>array('deleted', 'reports_to_id', 'last_name')
508 'name' => 'idx_reports_to_id',
510 'fields'=> array('reports_to_id'),
513 'name' => 'idx_del_id_user',
515 'fields'=> array('deleted', 'id', 'assigned_user_id'),
518 'name' => 'idx_cont_assigned',
520 'fields' => array('assigned_user_id')
523 // 'name' => 'idx_cont_email1',
524 // 'type' => 'index',
525 // 'fields' => array('email1')
528 // 'name' => 'idx_cont_email2',
529 // 'type' => 'index',
530 // 'fields' => array('email2')
533 'relationships' => array(
534 'contact_direct_reports' => array('lhs_module' => 'Contacts',
535 'lhs_table' => 'contacts',
537 'rhs_module' => 'Contacts',
538 'rhs_table' => 'contacts',
539 'rhs_key' => 'reports_to_id',
540 'relationship_type' => 'one-to-many'),
541 'contact_leads' => array('lhs_module' => 'Contacts',
542 'lhs_table' => 'contacts',
544 'rhs_module' => 'Leads',
545 'rhs_table' => 'leads',
546 'rhs_key' => 'contact_id',
547 'relationship_type' => 'one-to-many'),
548 'contact_notes' => array('lhs_module' => 'Contacts',
549 'lhs_table' => 'contacts',
551 'rhs_module' => 'Notes',
552 'rhs_table' => 'notes',
553 'rhs_key' => 'contact_id',
554 'relationship_type' => 'one-to-many'),
555 'contact_tasks' => array('lhs_module' => 'Contacts',
556 'lhs_table' => 'contacts',
558 'rhs_module' => 'Tasks',
559 'rhs_table' => 'tasks',
560 'rhs_key' => 'contact_id',
561 'relationship_type' => 'one-to-many'),
562 'contact_tasks_parent' => array('lhs_module' => 'Contacts',
563 'lhs_table' => 'contacts',
565 'rhs_module' => 'Tasks',
566 'rhs_table' => 'tasks',
567 'rhs_key' => 'parent_id',
568 'relationship_type' => 'one-to-many',
569 'relationship_role_column'=>'parent_type',
570 'relationship_role_column_value'=>'Contacts'
572 'contacts_assigned_user' => array('lhs_module' => 'Users',
573 'lhs_table' => 'users',
575 'rhs_module' => 'Contacts',
576 'rhs_table' => 'contacts',
577 'rhs_key' => 'assigned_user_id',
578 'relationship_type' => 'one-to-many'),
579 'contacts_modified_user' => array('lhs_module' => 'Users',
580 'lhs_table' => 'users',
582 'rhs_module' => 'Contacts',
583 'rhs_table' => 'contacts',
584 'rhs_key' => 'modified_user_id',
585 'relationship_type' => 'one-to-many'),
586 'contacts_created_by' => array('lhs_module' => 'Users',
587 'lhs_table' => 'users',
589 'rhs_module' => 'Contacts',
590 'rhs_table' => 'contacts',
591 'rhs_key' => 'created_by',
592 'relationship_type' => 'one-to-many'),
593 'contact_campaign_log' => array(
594 'lhs_module' => 'Contacts',
595 'lhs_table' => 'contacts',
597 'rhs_module' => 'CampaignLog',
598 'rhs_table' => 'campaign_log',
599 'rhs_key' => 'target_id',
600 'relationship_type' =>'one-to-many'
604 //This enables optimistic locking for Saves From EditView
605 'optimistic_locking'=>true,
608 VardefManager::createVardef('Contacts','Contact', array('default', 'assignable',