]> CyberLeo.Net >> Repos - Github/sugarcrm.git/blob - modules/Contacts/vardefs.php
Release 6.2.4
[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-2011 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, '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' => array('listview' => 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
309         'tasks'=>
310                 array (
311                         'name' => 'tasks',
312                         'type' => 'link',
313                         'relationship' => 'contact_tasks',
314                         'source' => 'non-db',
315                         'vname' => 'LBL_TASKS',
316                 ),
317         'tasks_parent'=>
318                 array (
319                         'name' => 'tasks_parent',
320                         'type' => 'link',
321                         'relationship' => 'contact_tasks_parent',
322                         'source' => 'non-db',
323                         'vname' => 'LBL_TASKS',
324         ),
325                 'user_sync'=>
326                 array (
327                         'name' => 'users',
328                         'type' => 'link',
329                         'relationship' => 'contacts_users',
330                         'source' => 'non-db',
331                         'vname' => 'LBL_USER_SYNC',
332                 ),
333         'created_by_link' =>
334                 array (
335                         'name' => 'created_by_link',
336                         'type' => 'link',
337                         'relationship' => 'contacts_created_by',
338                         'vname' => 'LBL_CREATED_BY_USER',
339                         'link_type' => 'one',
340                         'module' => 'Users',
341                         'bean_name' => 'User',
342                         'source' => 'non-db',
343                 ),
344         'modified_user_link' =>
345                 array (
346                         'name' => 'modified_user_link',
347                         'type' => 'link',
348                         'relationship' => 'contacts_modified_user',
349                         'vname' => 'LBL_MODIFIED_BY_USER',
350                         'link_type' => 'one',
351                         'module' => 'Users',
352                         'bean_name' => 'User',
353                         'source' => 'non-db',
354                 ),
355         'assigned_user_link' =>
356                 array (
357                         'name' => 'assigned_user_link',
358                         'type' => 'link',
359                         'relationship' => 'contacts_assigned_user',
360                         'vname' => 'LBL_ASSIGNED_TO_USER',
361                         'link_type' => 'one',
362                         'module' => 'Users',
363                         'bean_name' => 'User',
364                         'source' => 'non-db',
365             'rname' => 'user_name',
366             'id_name' => 'assigned_user_id',
367             'table' => 'users',
368             'duplicate_merge'=>'enabled'
369                 ),
370        'campaign_id' =>
371           array (
372             'name' => 'campaign_id',
373             'comment' => 'Campaign that generated lead',
374             'vname'=>'LBL_CAMPAIGN_ID',
375             'rname' => 'id',
376             'id_name' => 'campaign_id',
377             'type' => 'id',
378             //'dbType' => 'char',
379             'table' => 'campaigns',
380             'isnull' => 'true',
381             'module' => 'Campaigns',
382 //            'reportable'=>false,
383             'massupdate' => false,
384                 'duplicate_merge'=> 'disabled',
385           ),
386
387                  'campaign_name' =>
388                  array (
389                             'name' => 'campaign_name',
390                                 'rname' => 'name',
391                             'vname' => 'LBL_CAMPAIGN',
392                             'type' => 'relate',
393                                 'link' => 'campaign_contacts',
394                                 'isnull' => 'true',
395                                 'reportable'=>false,
396                             'source'=>'non-db',
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)',
402                  ),
403
404                 'campaigns' =>
405                 array (
406                         'name' => 'campaigns',
407                 'type' => 'link',
408                 'relationship' => 'contact_campaign_log',
409                 'module'=>'CampaignLog',
410                 'bean_name'=>'CampaignLog',
411                 'source'=>'non-db',
412                         'vname'=>'LBL_CAMPAIGNLOG',
413                 ),
414
415                 'campaign_contacts' =>
416     array (
417       'name' => 'campaign_contacts',
418       'type' => 'link',
419       'vname' => 'LBL_CAMPAIGN_CONTACT',
420       'relationship' => 'campaign_contacts',
421       'source' => 'non-db',
422     ),
423         'c_accept_status_fields' =>
424                 array (
425                         'name' => 'c_accept_status_fields',
426                         'rname' => 'id',
427                         'relationship_fields'=>array('id' => 'accept_status_id', 'accept_status' => 'accept_status_name'),
428                         'vname' => 'LBL_LIST_ACCEPT_STATUS',
429                         'type' => 'relate',
430                         'link' => 'calls',
431                         'link_type' => 'relationship_info',
432                         'source' => 'non-db',
433                         'importable' => 'false',
434             'duplicate_merge'=> 'disabled',
435                         'studio' => array('listview' => false),
436                 ),
437         'm_accept_status_fields' =>
438                 array (
439                         'name' => 'm_accept_status_fields',
440                         'rname' => 'id',
441                         'relationship_fields'=>array('id' => 'accept_status_id', 'accept_status' => 'accept_status_name'),
442                         'vname' => 'LBL_LIST_ACCEPT_STATUS',
443                         'type' => 'relate',
444                         'link' => 'meetings',
445                         'link_type' => 'relationship_info',
446                         'source' => 'non-db',
447                         'importable' => 'false',
448                         'hideacl'=>true,
449             'duplicate_merge'=> 'disabled',
450                         'studio' => array('listview' => false),
451                 ),
452         'accept_status_id' =>
453                 array(
454                         'name' => 'accept_status_id',
455                         'type' => 'varchar',
456                         'source' => 'non-db',
457                         'vname' => 'LBL_LIST_ACCEPT_STATUS',
458                         'studio' => array('listview' => false),
459                 ),
460         'accept_status_name' =>
461                 array(
462                         'massupdate' => false,
463                         'name' => 'accept_status_name',
464                         'type' => 'enum',
465             'studio' => 'false',
466                         'source' => 'non-db',
467                         'vname' => 'LBL_LIST_ACCEPT_STATUS',
468                         'options' => 'dom_meeting_accept_status',
469                         'importable' => 'false',
470                 ),
471       'prospect_lists' =>
472       array (
473         'name' => 'prospect_lists',
474         'type' => 'link',
475         'relationship' => 'prospect_list_contacts',
476         'module'=>'ProspectLists',
477         'source'=>'non-db',
478         'vname'=>'LBL_PROSPECT_LIST',
479       ),
480       'sync_contact' =>
481       array (
482         'massupdate' => false,
483         'name' => 'sync_contact',
484         'vname' => 'LBL_SYNC_CONTACT',
485         'type' => 'bool',
486         'source' => 'non-db',
487         'comment' => 'Synch to outlook?  (Meta-Data only)',
488         'studio' => 'true',
489       ),
490 ),
491 'indices' => array (
492         array(
493                 'name' => 'idx_cont_last_first',
494                 'type' => 'index',
495                 'fields' => array('last_name', 'first_name', 'deleted')
496         ),
497         array(
498                 'name' => 'idx_contacts_del_last',
499                 'type' => 'index',
500                 'fields' => array('deleted', 'last_name'),
501         ),
502         array(
503                 'name' => 'idx_cont_del_reports',
504                 'type' => 'index',
505                 'fields'=>array('deleted', 'reports_to_id', 'last_name')
506         ),
507         array(
508                 'name' => 'idx_reports_to_id',
509                 'type' => 'index',
510                 'fields'=> array('reports_to_id'),
511         ),
512         array(
513                 'name' => 'idx_del_id_user',
514                 'type' => 'index',
515                 'fields'=> array('deleted', 'id', 'assigned_user_id'),
516         ),
517         array(
518                 'name' => 'idx_cont_assigned',
519                 'type' => 'index',
520                 'fields' => array('assigned_user_id')
521         ),
522 //      array(
523 //              'name' => 'idx_cont_email1',
524 //              'type' => 'index',
525 //              'fields' => array('email1')
526 //      ),
527 //      array(
528 //              'name' => 'idx_cont_email2',
529 //              'type' => 'index',
530 //              'fields' => array('email2')
531 //      ),
532 ),
533     'relationships' => array(
534         'contact_direct_reports' => array('lhs_module' => 'Contacts',
535             'lhs_table' => 'contacts',
536             'lhs_key' => 'id',
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',
543             'lhs_key' => 'id',
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',
550             'lhs_key' => 'id',
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',
557             'lhs_key' => 'id',
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',
564             'lhs_key' => 'id',
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'
571                 ),
572         'contacts_assigned_user' => array('lhs_module' => 'Users',
573             'lhs_table' => 'users',
574             'lhs_key' => 'id',
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',
581             'lhs_key' => 'id',
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',
588             'lhs_key' => 'id',
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',
596                         'lhs_key'                       =>      'id',
597                         'rhs_module'            =>      'CampaignLog',
598                         'rhs_table'                     =>      'campaign_log',
599                         'rhs_key'                       =>      'target_id',
600                         'relationship_type'     =>'one-to-many'
601                 ),
602 ),
603
604 //This enables optimistic locking for Saves From EditView
605 'optimistic_locking'=>true,
606 );
607
608 VardefManager::createVardef('Contacts','Contact', array('default', 'assignable',
609   'person'));
610
611 ?>