]> CyberLeo.Net >> Repos - Github/sugarcrm.git/blob - modules/Contacts/vardefs.php
Release 6.5.0
[Github/sugarcrm.git] / modules / Contacts / vardefs.php
1 <?php
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-2012 SugarCRM Inc.
6  * 
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.
13  * 
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
17  * details.
18  * 
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
22  * 02110-1301 USA.
23  * 
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.
26  * 
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.
30  * 
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  ********************************************************************************/
37
38 $dictionary['Contact'] = array('table' => 'contacts', 'audited'=>true,
39
40 'unified_search' => true, 'full_text_search' => true, 'unified_search_default_enabled' => true, 'duplicate_merge'=>true, 'fields' =>
41 array (
42
43         'email_and_name1' =>
44                 array (
45                         'name' => 'email_and_name1',
46                         'rname' => 'email_and_name1',
47                         'vname' => 'LBL_NAME',
48                         'type' => 'varchar',
49                         'source' => 'non-db',
50                         'len' => '510',
51                         'importable' => 'false',
52                 ),
53         'lead_source' =>
54                 array (
55                         'name' => 'lead_source',
56                         'vname' => 'LBL_LEAD_SOURCE',
57                         'type' => 'enum',
58                         'options' => 'lead_source_dom',
59                         'len' => '255',
60                         'comment' => 'How did the contact come about',
61                 ),
62
63         'account_name' =>
64                 array (
65                         'name' => 'account_name',
66                         'rname' => 'name',
67                         'id_name' => 'account_id',
68                         'vname' => 'LBL_ACCOUNT_NAME',
69                         'join_name'=>'accounts',
70                         'type' => 'relate',
71                         'link' => 'accounts',
72                         'table' => 'accounts',
73                         'isnull' => 'true',
74                         'module' => 'Accounts',
75                         'dbType' => 'varchar',
76                         'len' => '255',
77                         'source' => 'non-db',
78                         'unified_search' => true,
79                 ),
80         'account_id' =>
81                 array (
82                         'name' => 'account_id',
83                         'rname' => 'id',
84                         'id_name' => 'account_id',
85                         'vname' => 'LBL_ACCOUNT_ID',
86                         'type' => 'relate',
87                         'table' => 'accounts',
88                         'isnull' => 'true',
89                         'module' => 'Accounts',
90                         'dbType' => 'id',
91                         'reportable'=>false,
92                         'source' => 'non-db',
93                         'massupdate' => false,
94             'duplicate_merge'=> 'disabled',
95             'hideacl'=>true,
96
97                 ),
98         'opportunity_role_fields' =>
99                 array (
100                         'name' => 'opportunity_role_fields',
101                         'rname' => 'id',
102                         'relationship_fields'=>array('id' => 'opportunity_role_id', 'contact_role' => 'opportunity_role'),
103                         'vname' => 'LBL_ACCOUNT_NAME',
104                         'type' => 'relate',
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' => false,
112                 ),
113         'opportunity_role_id' =>
114                 array(
115                         'name' => 'opportunity_role_id',
116                         'type' => 'varchar',
117                         'source' => 'non-db',
118                         'vname' => 'LBL_OPPORTUNITY_ROLE_ID',
119                         'studio' => array('listview' => false),
120                 ),
121                 //bug 42902
122                 'email'=> array(
123                         'name' => 'email',
124                         'type' => 'email',
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',
129                         'db_field' => array(
130                                 'id',
131                         ),
132                         'vname' =>'LBL_ANY_EMAIL',
133                         'studio' => array('visible'=>false, 'searchview'=>true),
134                 ),      
135         'opportunity_role' =>
136                 array(
137                         'name' => 'opportunity_role',
138                         'type' => 'enum',
139                         'source' => 'non-db',
140                         'vname' => 'LBL_OPPORTUNITY_ROLE',
141                         'options' => 'opportunity_relationship_type_dom',
142                 ),
143         'reports_to_id'=>
144                 array(
145                         'name' => 'reports_to_id',
146                         'vname' => 'LBL_REPORTS_TO_ID',
147                         'type' => 'id',
148                         'required'=>false,
149                         'reportable'=>false,
150                         'comment' => 'The contact this contact reports to'
151                 ),
152         'report_to_name' =>
153                 array (
154                         'name' => 'report_to_name',
155                         'rname' => 'last_name',
156                         'id_name' => 'reports_to_id',
157                         'vname' => 'LBL_REPORTS_TO',
158                         'type' => 'relate',
159                         'link' => 'reports_to_link',
160                         'table' => 'contacts',
161                         'isnull' => 'true',
162                         'module' => 'Contacts',
163                         'dbType' => 'varchar',
164                         'len' => 'id',
165                         'reportable'=>false,
166                         'source' => 'non-db',
167                 ),
168         'birthdate' =>
169                 array (
170                         'name' => 'birthdate',
171                         'vname' => 'LBL_BIRTHDATE',
172                         'massupdate' => false,
173                         'type' => 'date',
174                         'comment' => 'The birthdate of the contact'
175                 ),
176         'accounts' =>
177                 array (
178                         'name' => 'accounts',
179                         'type' => 'link',
180                         'relationship' => 'accounts_contacts',
181                         'link_type' => 'one',
182                         'source' => 'non-db',
183                         'vname' => 'LBL_ACCOUNT',
184             'duplicate_merge'=> 'disabled',
185                 ),
186         'reports_to_link' =>
187                 array (
188                         'name' => 'reports_to_link',
189                         'type' => 'link',
190                         'relationship' => 'contact_direct_reports',
191                         'link_type' => 'one',
192                         'side' => 'right',
193                         'source' => 'non-db',
194                         'vname' => 'LBL_REPORTS_TO',
195                 ),
196         'opportunities' =>
197                 array (
198                         'name' => 'opportunities',
199                         'type' => 'link',
200                         'relationship' => 'opportunities_contacts',
201                         'source' => 'non-db',
202                         'module' => 'Opportunities',
203                         'bean_name' => 'Opportunity',
204                         'vname' => 'LBL_OPPORTUNITIES',
205                 ),
206         'email_addresses' =>
207         array (
208                 'name' => 'email_addresses',
209         'type' => 'link',
210                 'relationship' => 'contacts_email_addresses',
211                 'module' => 'EmailAddress',
212             'bean_name'=>'EmailAddress',
213         'source' => 'non-db',
214                 'vname' => 'LBL_EMAIL_ADDRESSES',
215                 'reportable'=>false,
216             'rel_fields' => array('primary_address' => array('type'=>'bool')),
217                 'unified_search'=>true,
218         ),
219         'email_addresses_primary' =>
220         array (
221                 'name' => 'email_addresses_primary',
222         'type' => 'link',
223                 'relationship' => 'contacts_email_addresses_primary',
224         'source' => 'non-db',
225                 'vname' => 'LBL_EMAIL_ADDRESS_PRIMARY',
226                 'duplicate_merge'=> 'disabled',
227         ),
228         'bugs' =>
229                 array (
230                         'name' => 'bugs',
231                         'type' => 'link',
232                         'relationship' => 'contacts_bugs',
233                         'source' => 'non-db',
234                         'vname' => 'LBL_BUGS',
235                 ),
236         'calls' =>
237                 array (
238                         'name' => 'calls',
239                         'type' => 'link',
240                         'relationship' => 'calls_contacts',
241                         'source' => 'non-db',
242                         'vname' => 'LBL_CALLS',
243                 ),
244         'cases' =>
245                 array (
246                         'name' => 'cases',
247                         'type' => 'link',
248                         'relationship' => 'contacts_cases',
249                         'source' => 'non-db',
250                         'vname' => 'LBL_CASES',
251                 ),
252         'direct_reports'=>
253                 array (
254                         'name' => 'direct_reports',
255                         'type' => 'link',
256                         'relationship' => 'contact_direct_reports',
257                         'source' => 'non-db',
258                         'vname' => 'LBL_DIRECT_REPORTS',
259                 ),
260         'emails'=>
261                 array (
262                         'name' => 'emails',
263                         'type' => 'link',
264                         'relationship' => 'emails_contacts_rel',
265                         'source' => 'non-db',
266                         'vname' => 'LBL_EMAILS',
267                 ),
268         'documents'=>
269                 array (
270                         'name' => 'documents',
271                         'type' => 'link',
272                         'relationship' => 'documents_contacts',
273                         'source' => 'non-db',
274                         'vname' => 'LBL_DOCUMENTS_SUBPANEL_TITLE',
275                 ),
276         'leads'=>
277                 array (
278                         'name' => 'leads',
279                         'type' => 'link',
280                         'relationship' => 'contact_leads',
281                         'source' => 'non-db',
282                         'vname' => 'LBL_LEADS',
283                 ),
284         'meetings'=>
285                 array (
286                         'name' => 'meetings',
287                         'type' => 'link',
288                         'relationship' => 'meetings_contacts',
289                         'source' => 'non-db',
290                         'vname' => 'LBL_MEETINGS',
291                 ),
292         'notes'=>
293                 array (
294                         'name' => 'notes',
295                         'type' => 'link',
296                         'relationship' => 'contact_notes',
297                         'source' => 'non-db',
298                         'vname' => 'LBL_NOTES',
299                 ),
300         'project'=>
301                 array (
302                         'name' => 'project',
303                         'type' => 'link',
304                         'relationship' => 'projects_contacts',
305                         'source' => 'non-db',
306                         'vname' => 'LBL_PROJECTS',
307                 ),
308     'project_resource' => array(
309         'name' => 'project_resource',
310         'type' => 'link',
311         'relationship' => 'projects_contacts_resources',
312         'source' => 'non-db',
313         'vname' => 'LBL_PROJECTS_RESOURCES',
314     ),
315
316
317
318         'tasks'=>
319                 array (
320                         'name' => 'tasks',
321                         'type' => 'link',
322                         'relationship' => 'contact_tasks',
323                         'source' => 'non-db',
324                         'vname' => 'LBL_TASKS',
325                 ),
326         'tasks_parent' => array(
327         'name' => 'tasks_parent',
328         'type' => 'link',
329         'relationship' => 'contact_tasks_parent',
330         'source' => 'non-db',
331         'vname' => 'LBL_TASKS',
332         'reportable' => false
333     ),
334                 'user_sync'=>
335                 array (
336                         'name' => 'user_sync',
337                         'type' => 'link',
338                         'relationship' => 'contacts_users',
339                         'source' => 'non-db',
340                         'vname' => 'LBL_USER_SYNC',
341                 ),
342         'created_by_link' =>
343                 array (
344                         'name' => 'created_by_link',
345                         'type' => 'link',
346                         'relationship' => 'contacts_created_by',
347                         'vname' => 'LBL_CREATED_BY_USER',
348                         'link_type' => 'one',
349                         'module' => 'Users',
350                         'bean_name' => 'User',
351                         'source' => 'non-db',
352                 ),
353         'modified_user_link' =>
354                 array (
355                         'name' => 'modified_user_link',
356                         'type' => 'link',
357                         'relationship' => 'contacts_modified_user',
358                         'vname' => 'LBL_MODIFIED_BY_USER',
359                         'link_type' => 'one',
360                         'module' => 'Users',
361                         'bean_name' => 'User',
362                         'source' => 'non-db',
363                 ),
364         'assigned_user_link' =>
365                 array (
366                         'name' => 'assigned_user_link',
367                         'type' => 'link',
368                         'relationship' => 'contacts_assigned_user',
369                         'vname' => 'LBL_ASSIGNED_TO_USER',
370                         'link_type' => 'one',
371                         'module' => 'Users',
372                         'bean_name' => 'User',
373                         'source' => 'non-db',
374             'rname' => 'user_name',
375             'id_name' => 'assigned_user_id',
376             'table' => 'users',
377             'duplicate_merge'=>'enabled'
378                 ),
379        'campaign_id' =>
380           array (
381             'name' => 'campaign_id',
382             'comment' => 'Campaign that generated lead',
383             'vname'=>'LBL_CAMPAIGN_ID',
384             'rname' => 'id',
385             'id_name' => 'campaign_id',
386             'type' => 'id',
387             //'dbType' => 'char',
388             'table' => 'campaigns',
389             'isnull' => 'true',
390             'module' => 'Campaigns',
391 //            'reportable'=>false,
392             'massupdate' => false,
393                 'duplicate_merge'=> 'disabled',
394           ),
395
396                  'campaign_name' =>
397                  array (
398                             'name' => 'campaign_name',
399                                 'rname' => 'name',
400                             'vname' => 'LBL_CAMPAIGN',
401                             'type' => 'relate',
402                                 'link' => 'campaign_contacts',
403                                 'isnull' => 'true',
404                                 'reportable'=>false,
405                             'source'=>'non-db',
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)',
411                  ),
412
413                 'campaigns' =>
414                 array (
415                         'name' => 'campaigns',
416                 'type' => 'link',
417                 'relationship' => 'contact_campaign_log',
418                 'module'=>'CampaignLog',
419                 'bean_name'=>'CampaignLog',
420                 'source'=>'non-db',
421                         'vname'=>'LBL_CAMPAIGNLOG',
422                 ),
423
424                 'campaign_contacts' =>
425     array (
426       'name' => 'campaign_contacts',
427       'type' => 'link',
428       'vname' => 'LBL_CAMPAIGN_CONTACT',
429       'relationship' => 'campaign_contacts',
430       'source' => 'non-db',
431     ),
432         'c_accept_status_fields' =>
433                 array (
434                         'name' => 'c_accept_status_fields',
435                         'rname' => 'id',
436                         'relationship_fields'=>array('id' => 'accept_status_id', 'accept_status' => 'accept_status_name'),
437                         'vname' => 'LBL_LIST_ACCEPT_STATUS',
438                         'type' => 'relate',
439                         'link' => 'calls',
440                         'link_type' => 'relationship_info',
441                         'source' => 'non-db',
442                         'importable' => 'false',
443             'duplicate_merge'=> 'disabled',
444                         'studio' => false,
445                 ),
446         'm_accept_status_fields' =>
447                 array (
448                         'name' => 'm_accept_status_fields',
449                         'rname' => 'id',
450                         'relationship_fields'=>array('id' => 'accept_status_id', 'accept_status' => 'accept_status_name'),
451                         'vname' => 'LBL_LIST_ACCEPT_STATUS',
452                         'type' => 'relate',
453                         'link' => 'meetings',
454                         'link_type' => 'relationship_info',
455                         'source' => 'non-db',
456                         'importable' => 'false',
457                         'hideacl'=>true,
458             'duplicate_merge'=> 'disabled',
459                         'studio' => false,
460                 ),
461         'accept_status_id' =>
462                 array(
463                         'name' => 'accept_status_id',
464                         'type' => 'varchar',
465                         'source' => 'non-db',
466                         'vname' => 'LBL_LIST_ACCEPT_STATUS',
467                         'studio' => array('listview' => false),
468                 ),
469         'accept_status_name' =>
470                 array(
471                         'massupdate' => false,
472                         'name' => 'accept_status_name',
473                         'type' => 'enum',
474             'studio' => 'false',
475                         'source' => 'non-db',
476                         'vname' => 'LBL_LIST_ACCEPT_STATUS',
477                         'options' => 'dom_meeting_accept_status',
478                         'importable' => 'false',
479                 ),
480       'prospect_lists' =>
481       array (
482         'name' => 'prospect_lists',
483         'type' => 'link',
484         'relationship' => 'prospect_list_contacts',
485         'module'=>'ProspectLists',
486         'source'=>'non-db',
487         'vname'=>'LBL_PROSPECT_LIST',
488       ),
489       'sync_contact' =>
490       array (
491         'massupdate' => false,
492         'name' => 'sync_contact',
493         'vname' => 'LBL_SYNC_CONTACT',
494         'type' => 'bool',
495         'source' => 'non-db',
496         'comment' => 'Synch to outlook?  (Meta-Data only)',
497         'studio' => 'true',
498       ),
499 ),
500 'indices' => array (
501         array(
502                 'name' => 'idx_cont_last_first',
503                 'type' => 'index',
504                 'fields' => array('last_name', 'first_name', 'deleted')
505         ),
506         array(
507                 'name' => 'idx_contacts_del_last',
508                 'type' => 'index',
509                 'fields' => array('deleted', 'last_name'),
510         ),
511         array(
512                 'name' => 'idx_cont_del_reports',
513                 'type' => 'index',
514                 'fields'=>array('deleted', 'reports_to_id', 'last_name')
515         ),
516         array(
517                 'name' => 'idx_reports_to_id',
518                 'type' => 'index',
519                 'fields'=> array('reports_to_id'),
520         ),
521         array(
522                 'name' => 'idx_del_id_user',
523                 'type' => 'index',
524                 'fields'=> array('deleted', 'id', 'assigned_user_id'),
525         ),
526         array(
527                 'name' => 'idx_cont_assigned',
528                 'type' => 'index',
529                 'fields' => array('assigned_user_id')
530         ),
531 //      array(
532 //              'name' => 'idx_cont_email1',
533 //              'type' => 'index',
534 //              'fields' => array('email1')
535 //      ),
536 //      array(
537 //              'name' => 'idx_cont_email2',
538 //              'type' => 'index',
539 //              'fields' => array('email2')
540 //      ),
541 ),
542     'relationships' => array(
543         'contact_direct_reports' => array('lhs_module' => 'Contacts',
544             'lhs_table' => 'contacts',
545             'lhs_key' => 'id',
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',
552             'lhs_key' => 'id',
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',
559             'lhs_key' => 'id',
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',
566             'lhs_key' => 'id',
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',
573             'lhs_key' => 'id',
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'
580                 ),
581         'contacts_assigned_user' => array('lhs_module' => 'Users',
582             'lhs_table' => 'users',
583             'lhs_key' => 'id',
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',
590             'lhs_key' => 'id',
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',
597             'lhs_key' => 'id',
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',
605                         'lhs_key'                       =>      'id',
606                         'rhs_module'            =>      'CampaignLog',
607                         'rhs_table'                     =>      'campaign_log',
608                         'rhs_key'                       =>      'target_id',
609                         'relationship_type'     =>'one-to-many'
610                 ),
611 ),
612
613 //This enables optimistic locking for Saves From EditView
614 'optimistic_locking'=>true,
615 );
616
617 VardefManager::createVardef('Contacts','Contact', array('default', 'assignable',
618   'person'));
619
620 ?>