]> CyberLeo.Net >> Repos - Github/sugarcrm.git/blob - modules/Contacts/vardefs.php
Release 6.5.16
[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-2013 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         'opportunity_role' =>
122                 array(
123                         'name' => 'opportunity_role',
124                         'type' => 'enum',
125                         'source' => 'non-db',
126                         'vname' => 'LBL_OPPORTUNITY_ROLE',
127                         'options' => 'opportunity_relationship_type_dom',
128                 ),
129         'reports_to_id'=>
130                 array(
131                         'name' => 'reports_to_id',
132                         'vname' => 'LBL_REPORTS_TO_ID',
133                         'type' => 'id',
134                         'required'=>false,
135                         'reportable'=>false,
136                         'comment' => 'The contact this contact reports to'
137                 ),
138         'report_to_name' =>
139                 array (
140                         'name' => 'report_to_name',
141                         'rname' => 'last_name',
142                         'id_name' => 'reports_to_id',
143                         'vname' => 'LBL_REPORTS_TO',
144                         'type' => 'relate',
145                         'link' => 'reports_to_link',
146                         'table' => 'contacts',
147                         'isnull' => 'true',
148                         'module' => 'Contacts',
149                         'dbType' => 'varchar',
150                         'len' => 'id',
151                         'reportable'=>false,
152                         'source' => 'non-db',
153                 ),
154         'birthdate' =>
155                 array (
156                         'name' => 'birthdate',
157                         'vname' => 'LBL_BIRTHDATE',
158                         'massupdate' => false,
159                         'type' => 'date',
160                         'comment' => 'The birthdate of the contact'
161                 ),
162         'accounts' =>
163                 array (
164                         'name' => 'accounts',
165                         'type' => 'link',
166                         'relationship' => 'accounts_contacts',
167                         'link_type' => 'one',
168                         'source' => 'non-db',
169                         'vname' => 'LBL_ACCOUNT',
170             'duplicate_merge'=> 'disabled',
171                 ),
172         'reports_to_link' =>
173                 array (
174                         'name' => 'reports_to_link',
175                         'type' => 'link',
176                         'relationship' => 'contact_direct_reports',
177                         'link_type' => 'one',
178                         'side' => 'right',
179                         'source' => 'non-db',
180                         'vname' => 'LBL_REPORTS_TO',
181                 ),
182         'opportunities' =>
183                 array (
184                         'name' => 'opportunities',
185                         'type' => 'link',
186                         'relationship' => 'opportunities_contacts',
187                         'source' => 'non-db',
188                         'module' => 'Opportunities',
189                         'bean_name' => 'Opportunity',
190                         'vname' => 'LBL_OPPORTUNITIES',
191                 ),
192         'email_addresses' =>
193         array (
194                 'name' => 'email_addresses',
195         'type' => 'link',
196                 'relationship' => 'contacts_email_addresses',
197                 'module' => 'EmailAddress',
198             'bean_name'=>'EmailAddress',
199         'source' => 'non-db',
200                 'vname' => 'LBL_EMAIL_ADDRESSES',
201                 'reportable'=>false,
202             'rel_fields' => array('primary_address' => array('type'=>'bool')),
203                 'unified_search'=>true,
204         ),
205         'email_addresses_primary' =>
206         array (
207                 'name' => 'email_addresses_primary',
208         'type' => 'link',
209                 'relationship' => 'contacts_email_addresses_primary',
210         'source' => 'non-db',
211                 'vname' => 'LBL_EMAIL_ADDRESS_PRIMARY',
212                 'duplicate_merge'=> 'disabled',
213         ),
214         'bugs' =>
215                 array (
216                         'name' => 'bugs',
217                         'type' => 'link',
218                         'relationship' => 'contacts_bugs',
219                         'source' => 'non-db',
220                         'vname' => 'LBL_BUGS',
221                 ),
222         'calls' =>
223                 array (
224                         'name' => 'calls',
225                         'type' => 'link',
226                         'relationship' => 'calls_contacts',
227                         'source' => 'non-db',
228                         'vname' => 'LBL_CALLS',
229                 ),
230         'cases' =>
231                 array (
232                         'name' => 'cases',
233                         'type' => 'link',
234                         'relationship' => 'contacts_cases',
235                         'source' => 'non-db',
236                         'vname' => 'LBL_CASES',
237                 ),
238         'direct_reports'=>
239                 array (
240                         'name' => 'direct_reports',
241                         'type' => 'link',
242                         'relationship' => 'contact_direct_reports',
243                         'source' => 'non-db',
244                         'vname' => 'LBL_DIRECT_REPORTS',
245                 ),
246         'emails'=>
247                 array (
248                         'name' => 'emails',
249                         'type' => 'link',
250                         'relationship' => 'emails_contacts_rel',
251                         'source' => 'non-db',
252                         'vname' => 'LBL_EMAILS',
253                 ),
254         'documents'=>
255                 array (
256                         'name' => 'documents',
257                         'type' => 'link',
258                         'relationship' => 'documents_contacts',
259                         'source' => 'non-db',
260                         'vname' => 'LBL_DOCUMENTS_SUBPANEL_TITLE',
261                 ),
262         'leads'=>
263                 array (
264                         'name' => 'leads',
265                         'type' => 'link',
266                         'relationship' => 'contact_leads',
267                         'source' => 'non-db',
268                         'vname' => 'LBL_LEADS',
269                 ),
270         'meetings'=>
271                 array (
272                         'name' => 'meetings',
273                         'type' => 'link',
274                         'relationship' => 'meetings_contacts',
275                         'source' => 'non-db',
276                         'vname' => 'LBL_MEETINGS',
277                 ),
278         'notes'=>
279                 array (
280                         'name' => 'notes',
281                         'type' => 'link',
282                         'relationship' => 'contact_notes',
283                         'source' => 'non-db',
284                         'vname' => 'LBL_NOTES',
285                 ),
286         'project'=>
287                 array (
288                         'name' => 'project',
289                         'type' => 'link',
290                         'relationship' => 'projects_contacts',
291                         'source' => 'non-db',
292                         'vname' => 'LBL_PROJECTS',
293                 ),
294     'project_resource' => array(
295         'name' => 'project_resource',
296         'type' => 'link',
297         'relationship' => 'projects_contacts_resources',
298         'source' => 'non-db',
299         'vname' => 'LBL_PROJECTS_RESOURCES',
300     ),
301
302
303
304         'tasks'=>
305                 array (
306                         'name' => 'tasks',
307                         'type' => 'link',
308                         'relationship' => 'contact_tasks',
309                         'source' => 'non-db',
310                         'vname' => 'LBL_TASKS',
311                 ),
312         'tasks_parent' => array(
313         'name' => 'tasks_parent',
314         'type' => 'link',
315         'relationship' => 'contact_tasks_parent',
316         'source' => 'non-db',
317         'vname' => 'LBL_TASKS',
318         'reportable' => false
319     ),
320     'notes_parent' => array(
321            'name' => 'notes_parent',
322            'type' => 'link',
323            'relationship' => 'contact_notes_parent',
324            'source' => 'non-db',
325            'vname' => 'LBL_TASKS',
326            'reportable' => false
327        ),
328                 'user_sync'=>
329                 array (
330                         'name' => 'user_sync',
331                         'type' => 'link',
332                         'relationship' => 'contacts_users',
333                         'source' => 'non-db',
334                         'vname' => 'LBL_USER_SYNC',
335                 ),
336         'created_by_link' =>
337                 array (
338                         'name' => 'created_by_link',
339                         'type' => 'link',
340                         'relationship' => 'contacts_created_by',
341                         'vname' => 'LBL_CREATED_BY_USER',
342                         'link_type' => 'one',
343                         'module' => 'Users',
344                         'bean_name' => 'User',
345                         'source' => 'non-db',
346                 ),
347         'modified_user_link' =>
348                 array (
349                         'name' => 'modified_user_link',
350                         'type' => 'link',
351                         'relationship' => 'contacts_modified_user',
352                         'vname' => 'LBL_MODIFIED_BY_USER',
353                         'link_type' => 'one',
354                         'module' => 'Users',
355                         'bean_name' => 'User',
356                         'source' => 'non-db',
357                 ),
358         'assigned_user_link' =>
359                 array (
360                         'name' => 'assigned_user_link',
361                         'type' => 'link',
362                         'relationship' => 'contacts_assigned_user',
363                         'vname' => 'LBL_ASSIGNED_TO_USER',
364                         'link_type' => 'one',
365                         'module' => 'Users',
366                         'bean_name' => 'User',
367                         'source' => 'non-db',
368             'rname' => 'user_name',
369             'id_name' => 'assigned_user_id',
370             'table' => 'users',
371             'duplicate_merge'=>'enabled'
372                 ),
373        'campaign_id' =>
374           array (
375             'name' => 'campaign_id',
376             'comment' => 'Campaign that generated lead',
377             'vname'=>'LBL_CAMPAIGN_ID',
378             'rname' => 'id',
379             'id_name' => 'campaign_id',
380             'type' => 'id',
381             //'dbType' => 'char',
382             'table' => 'campaigns',
383             'isnull' => 'true',
384             'module' => 'Campaigns',
385 //            'reportable'=>false,
386             'massupdate' => false,
387                 'duplicate_merge'=> 'disabled',
388           ),
389
390                  'campaign_name' =>
391                  array (
392                             'name' => 'campaign_name',
393                                 'rname' => 'name',
394                             'vname' => 'LBL_CAMPAIGN',
395                             'type' => 'relate',
396                                 'link' => 'campaign_contacts',
397                                 'isnull' => 'true',
398                                 'reportable'=>false,
399                             'source'=>'non-db',
400                             'table' => 'campaigns',
401                                 'id_name' => 'campaign_id',
402                             'module'=>'Campaigns',
403                             'duplicate_merge'=>'disabled',
404                             'comment' => 'The first campaign name for Contact (Meta-data only)',
405                  ),
406
407                 'campaigns' =>
408                 array (
409                         'name' => 'campaigns',
410                 'type' => 'link',
411                 'relationship' => 'contact_campaign_log',
412                 'module'=>'CampaignLog',
413                 'bean_name'=>'CampaignLog',
414                 'source'=>'non-db',
415                         'vname'=>'LBL_CAMPAIGNLOG',
416                 ),
417
418                 'campaign_contacts' =>
419     array (
420       'name' => 'campaign_contacts',
421       'type' => 'link',
422       'vname' => 'LBL_CAMPAIGN_CONTACT',
423       'relationship' => 'campaign_contacts',
424       'source' => 'non-db',
425     ),
426         'c_accept_status_fields' =>
427                 array (
428                         'name' => 'c_accept_status_fields',
429                         'rname' => 'id',
430                         'relationship_fields'=>array('id' => 'accept_status_id', 'accept_status' => 'accept_status_name'),
431                         'vname' => 'LBL_LIST_ACCEPT_STATUS',
432                         'type' => 'relate',
433                         'link' => 'calls',
434                         'link_type' => 'relationship_info',
435                         'source' => 'non-db',
436                         'importable' => 'false',
437             'duplicate_merge'=> 'disabled',
438                         'studio' => false,
439                 ),
440         'm_accept_status_fields' =>
441                 array (
442                         'name' => 'm_accept_status_fields',
443                         'rname' => 'id',
444                         'relationship_fields'=>array('id' => 'accept_status_id', 'accept_status' => 'accept_status_name'),
445                         'vname' => 'LBL_LIST_ACCEPT_STATUS',
446                         'type' => 'relate',
447                         'link' => 'meetings',
448                         'link_type' => 'relationship_info',
449                         'source' => 'non-db',
450                         'importable' => 'false',
451                         'hideacl'=>true,
452             'duplicate_merge'=> 'disabled',
453                         'studio' => false,
454                 ),
455         'accept_status_id' =>
456                 array(
457                         'name' => 'accept_status_id',
458                         'type' => 'varchar',
459                         'source' => 'non-db',
460                         'vname' => 'LBL_LIST_ACCEPT_STATUS',
461                         'studio' => array('listview' => false),
462                 ),
463         'accept_status_name' =>
464                 array(
465                         'massupdate' => false,
466                         'name' => 'accept_status_name',
467                         'type' => 'enum',
468             'studio' => 'false',
469                         'source' => 'non-db',
470                         'vname' => 'LBL_LIST_ACCEPT_STATUS',
471                         'options' => 'dom_meeting_accept_status',
472                         'importable' => 'false',
473                 ),
474       'prospect_lists' =>
475       array (
476         'name' => 'prospect_lists',
477         'type' => 'link',
478         'relationship' => 'prospect_list_contacts',
479         'module'=>'ProspectLists',
480         'source'=>'non-db',
481         'vname'=>'LBL_PROSPECT_LIST',
482       ),
483       'sync_contact' =>
484       array (
485         'massupdate' => false,
486         'name' => 'sync_contact',
487         'vname' => 'LBL_SYNC_CONTACT',
488         'type' => 'bool',
489         'source' => 'non-db',
490         'comment' => 'Synch to outlook?  (Meta-Data only)',
491         'studio' => 'true',
492       ),
493 ),
494 'indices' => array (
495         array(
496                 'name' => 'idx_cont_last_first',
497                 'type' => 'index',
498                 'fields' => array('last_name', 'first_name', 'deleted')
499         ),
500         array(
501                 'name' => 'idx_contacts_del_last',
502                 'type' => 'index',
503                 'fields' => array('deleted', 'last_name'),
504         ),
505         array(
506                 'name' => 'idx_cont_del_reports',
507                 'type' => 'index',
508                 'fields'=>array('deleted', 'reports_to_id', 'last_name')
509         ),
510         array(
511                 'name' => 'idx_reports_to_id',
512                 'type' => 'index',
513                 'fields'=> array('reports_to_id'),
514         ),
515         array(
516                 'name' => 'idx_del_id_user',
517                 'type' => 'index',
518                 'fields'=> array('deleted', 'id', 'assigned_user_id'),
519         ),
520         array(
521                 'name' => 'idx_cont_assigned',
522                 'type' => 'index',
523                 'fields' => array('assigned_user_id')
524         ),
525 //      array(
526 //              'name' => 'idx_cont_email1',
527 //              'type' => 'index',
528 //              'fields' => array('email1')
529 //      ),
530 //      array(
531 //              'name' => 'idx_cont_email2',
532 //              'type' => 'index',
533 //              'fields' => array('email2')
534 //      ),
535 ),
536     'relationships' => array(
537         'contact_direct_reports' => array('lhs_module' => 'Contacts',
538             'lhs_table' => 'contacts',
539             'lhs_key' => 'id',
540             'rhs_module' => 'Contacts',
541             'rhs_table' => 'contacts',
542             'rhs_key' => 'reports_to_id',
543             'relationship_type' => 'one-to-many'),
544         'contact_leads' => array('lhs_module' => 'Contacts',
545             'lhs_table' => 'contacts',
546             'lhs_key' => 'id',
547             'rhs_module' => 'Leads',
548             'rhs_table' => 'leads',
549             'rhs_key' => 'contact_id',
550             'relationship_type' => 'one-to-many'),
551         'contact_notes' => array('lhs_module' => 'Contacts',
552             'lhs_table' => 'contacts',
553             'lhs_key' => 'id',
554             'rhs_module' => 'Notes',
555             'rhs_table' => 'notes',
556             'rhs_key' => 'contact_id',
557             'relationship_type' => 'one-to-many'),
558         'contact_tasks' => array('lhs_module' => 'Contacts',
559             'lhs_table' => 'contacts',
560             'lhs_key' => 'id',
561             'rhs_module' => 'Tasks',
562             'rhs_table' => 'tasks',
563             'rhs_key' => 'contact_id',
564             'relationship_type' => 'one-to-many'),
565         'contact_tasks_parent' => array('lhs_module' => 'Contacts',
566             'lhs_table' => 'contacts',
567             'lhs_key' => 'id',
568             'rhs_module' => 'Tasks',
569             'rhs_table' => 'tasks',
570             'rhs_key' => 'parent_id',
571             'relationship_type' => 'one-to-many',
572                         'relationship_role_column'=>'parent_type',
573             'relationship_role_column_value'=>'Contacts'
574                 ),
575         'contact_notes_parent' => array('lhs_module' => 'Contacts',
576             'lhs_table' => 'contacts',
577             'lhs_key' => 'id',
578             'rhs_module' => 'Notes',
579             'rhs_table' => 'notes',
580             'rhs_key' => 'parent_id',
581             'relationship_type' => 'one-to-many',
582                         'relationship_role_column'=>'parent_type',
583             'relationship_role_column_value'=>'Contacts'
584                 ),
585         'contacts_assigned_user' => array('lhs_module' => 'Users',
586             'lhs_table' => 'users',
587             'lhs_key' => 'id',
588             'rhs_module' => 'Contacts',
589             'rhs_table' => 'contacts',
590             'rhs_key' => 'assigned_user_id',
591             'relationship_type' => 'one-to-many'),
592         'contacts_modified_user' => array('lhs_module' => 'Users',
593             'lhs_table' => 'users',
594             'lhs_key' => 'id',
595             'rhs_module' => 'Contacts',
596             'rhs_table' => 'contacts',
597             'rhs_key' => 'modified_user_id',
598             'relationship_type' => 'one-to-many'),
599         'contacts_created_by' => array('lhs_module' => 'Users',
600             'lhs_table' => 'users',
601             'lhs_key' => 'id',
602             'rhs_module' => 'Contacts',
603             'rhs_table' => 'contacts',
604             'rhs_key' => 'created_by',
605             'relationship_type' => 'one-to-many'),
606                 'contact_campaign_log' => array(
607                         'lhs_module'            =>      'Contacts',
608                         'lhs_table'                     =>      'contacts',
609                         'lhs_key'                       =>      'id',
610                         'rhs_module'            =>      'CampaignLog',
611                         'rhs_table'                     =>      'campaign_log',
612                         'rhs_key'                       =>      'target_id',
613                         'relationship_type'     =>'one-to-many',
614                         'relationship_role_column' => 'target_type',
615                         'relationship_role_column_value' => 'Contacts'
616                 ),
617 ),
618
619 //This enables optimistic locking for Saves From EditView
620 'optimistic_locking'=>true,
621 );
622
623 VardefManager::createVardef('Contacts','Contact', array('default', 'assignable',
624   'person'));
625
626 ?>