]> CyberLeo.Net >> Repos - Github/sugarcrm.git/blob - modules/Contacts/vardefs.php
Release 6.1.4
[Github/sugarcrm.git] / modules / Contacts / vardefs.php
1 <?php
2 if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
3 /*********************************************************************************
4  * SugarCRM 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, '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         '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         'leads'=>
255                 array (
256                         'name' => 'leads',
257                         'type' => 'link',
258                         'relationship' => 'contact_leads',
259                         'source' => 'non-db',
260                         'vname' => 'LBL_LEADS',
261                 ),
262         'meetings'=>
263                 array (
264                         'name' => 'meetings',
265                         'type' => 'link',
266                         'relationship' => 'meetings_contacts',
267                         'source' => 'non-db',
268                         'vname' => 'LBL_MEETINGS',
269                 ),
270         'notes'=>
271                 array (
272                         'name' => 'notes',
273                         'type' => 'link',
274                         'relationship' => 'contact_notes',
275                         'source' => 'non-db',
276                         'vname' => 'LBL_NOTES',
277                 ),
278         'project'=>
279                 array (
280                         'name' => 'project',
281                         'type' => 'link',
282                         'relationship' => 'projects_contacts',
283                         'source' => 'non-db',
284                         'vname' => 'LBL_PROJECTS',
285                 ),
286
287         'tasks'=>
288                 array (
289                         'name' => 'tasks',
290                         'type' => 'link',
291                         'relationship' => 'contact_tasks',
292                         'source' => 'non-db',
293                         'vname' => 'LBL_TASKS',
294                 ),
295         'tasks_parent'=>
296                 array (
297                         'name' => 'tasks_parent',
298                         'type' => 'link',
299                         'relationship' => 'contact_tasks_parent',
300                         'source' => 'non-db',
301                         'vname' => 'LBL_TASKS',
302         ),
303                 'user_sync'=>
304                 array (
305                         'name' => 'users',
306                         'type' => 'link',
307                         'relationship' => 'contacts_users',
308                         'source' => 'non-db',
309                         'vname' => 'LBL_USER_SYNC',
310                 ),
311         'created_by_link' =>
312                 array (
313                         'name' => 'created_by_link',
314                         'type' => 'link',
315                         'relationship' => 'contacts_created_by',
316                         'vname' => 'LBL_CREATED_BY_USER',
317                         'link_type' => 'one',
318                         'module' => 'Users',
319                         'bean_name' => 'User',
320                         'source' => 'non-db',
321                 ),
322         'modified_user_link' =>
323                 array (
324                         'name' => 'modified_user_link',
325                         'type' => 'link',
326                         'relationship' => 'contacts_modified_user',
327                         'vname' => 'LBL_MODIFIED_BY_USER',
328                         'link_type' => 'one',
329                         'module' => 'Users',
330                         'bean_name' => 'User',
331                         'source' => 'non-db',
332                 ),
333         'assigned_user_link' =>
334                 array (
335                         'name' => 'assigned_user_link',
336                         'type' => 'link',
337                         'relationship' => 'contacts_assigned_user',
338                         'vname' => 'LBL_ASSIGNED_TO_USER',
339                         'link_type' => 'one',
340                         'module' => 'Users',
341                         'bean_name' => 'User',
342                         'source' => 'non-db',
343             'rname' => 'user_name',
344             'id_name' => 'assigned_user_id',
345             'table' => 'users',
346             'duplicate_merge'=>'enabled'
347                 ),
348        'campaign_id' =>
349           array (
350             'name' => 'campaign_id',
351             'comment' => 'Campaign that generated lead',
352             'vname'=>'LBL_CAMPAIGN_ID',
353             'rname' => 'id',
354             'id_name' => 'campaign_id',
355             'type' => 'id',
356             //'dbType' => 'char',
357             'table' => 'campaigns',
358             'isnull' => 'true',
359             'module' => 'Campaigns',
360 //            'reportable'=>false,
361             'massupdate' => false,
362                 'duplicate_merge'=> 'disabled',
363           ),
364
365                  'campaign_name' =>
366                  array (
367                             'name' => 'campaign_name',
368                                 'rname' => 'name',
369                             'vname' => 'LBL_CAMPAIGN',
370                             'type' => 'relate',
371                                 'link' => 'campaign_contacts',
372                                 'isnull' => 'true',
373                                 'reportable'=>false,
374                             'source'=>'non-db',
375                             'table' => 'campaigns',
376                                 'id_name' => 'campaign_id',
377                             'module'=>'Campaigns',
378                             'duplicate_merge'=>'disabled',
379                             'comment' => 'The first campaign name for Contact (Meta-data only)',
380                  ),
381
382                 'campaigns' =>
383                 array (
384                         'name' => 'campaigns',
385                 'type' => 'link',
386                 'relationship' => 'contact_campaign_log',
387                 'module'=>'CampaignLog',
388                 'bean_name'=>'CampaignLog',
389                 'source'=>'non-db',
390                         'vname'=>'LBL_CAMPAIGNLOG',
391                 ),
392
393                 'campaign_contacts' =>
394     array (
395       'name' => 'campaign_contacts',
396       'type' => 'link',
397       'vname' => 'LBL_CAMPAIGN_CONTACT',
398       'relationship' => 'campaign_contacts',
399       'source' => 'non-db',
400     ),
401         'c_accept_status_fields' =>
402                 array (
403                         'name' => 'c_accept_status_fields',
404                         'rname' => 'id',
405                         'relationship_fields'=>array('id' => 'accept_status_id', 'accept_status' => 'accept_status_name'),
406                         'vname' => 'LBL_LIST_ACCEPT_STATUS',
407                         'type' => 'relate',
408                         'link' => 'calls',
409                         'link_type' => 'relationship_info',
410                         'source' => 'non-db',
411                         'importable' => 'false',
412             'duplicate_merge'=> 'disabled',
413                         'studio' => array('listview' => false),
414                 ),
415         'm_accept_status_fields' =>
416                 array (
417                         'name' => 'm_accept_status_fields',
418                         'rname' => 'id',
419                         'relationship_fields'=>array('id' => 'accept_status_id', 'accept_status' => 'accept_status_name'),
420                         'vname' => 'LBL_LIST_ACCEPT_STATUS',
421                         'type' => 'relate',
422                         'link' => 'meetings',
423                         'link_type' => 'relationship_info',
424                         'source' => 'non-db',
425                         'importable' => 'false',
426                         'hideacl'=>true,
427             'duplicate_merge'=> 'disabled',
428                         'studio' => array('listview' => false),
429                 ),
430         'accept_status_id' =>
431                 array(
432                         'name' => 'accept_status_id',
433                         'type' => 'varchar',
434                         'source' => 'non-db',
435                         'vname' => 'LBL_LIST_ACCEPT_STATUS',
436                         'studio' => array('listview' => false),
437                 ),
438         'accept_status_name' =>
439                 array(
440                         'massupdate' => false,
441                         'name' => 'accept_status_name',
442                         'type' => 'enum',
443             'studio' => 'false',
444                         'source' => 'non-db',
445                         'vname' => 'LBL_LIST_ACCEPT_STATUS',
446                         'options' => 'dom_meeting_accept_status',
447                         'importable' => 'false',
448                 ),
449       'prospect_lists' =>
450       array (
451         'name' => 'prospect_lists',
452         'type' => 'link',
453         'relationship' => 'prospect_list_contacts',
454         'module'=>'ProspectLists',
455         'source'=>'non-db',
456         'vname'=>'LBL_PROSPECT_LIST',
457       ),
458       'sync_contact' =>
459       array (
460         'massupdate' => false,
461         'name' => 'sync_contact',
462         'vname' => 'LBL_SYNC_CONTACT',
463         'type' => 'bool',
464         'source' => 'non-db',
465         'comment' => 'Synch to outlook?  (Meta-Data only)',
466       ),
467 ),
468 'indices' => array (
469         array(
470                 'name' => 'idx_cont_last_first',
471                 'type' => 'index',
472                 'fields' => array('last_name', 'first_name', 'deleted')
473         ),
474         array(
475                 'name' => 'idx_contacts_del_last',
476                 'type' => 'index',
477                 'fields' => array('deleted', 'last_name'),
478         ),
479         array(
480                 'name' => 'idx_cont_del_reports',
481                 'type' => 'index',
482                 'fields'=>array('deleted', 'reports_to_id', 'last_name')
483         ),
484         array(
485                 'name' => 'idx_reports_to_id',
486                 'type' => 'index',
487                 'fields'=> array('reports_to_id'),
488         ),
489         array(
490                 'name' => 'idx_del_id_user',
491                 'type' => 'index',
492                 'fields'=> array('deleted', 'id', 'assigned_user_id'),
493         ),
494         array(
495                 'name' => 'idx_cont_assigned',
496                 'type' => 'index',
497                 'fields' => array('assigned_user_id')
498         ),
499 //      array(
500 //              'name' => 'idx_cont_email1',
501 //              'type' => 'index',
502 //              'fields' => array('email1')
503 //      ),
504 //      array(
505 //              'name' => 'idx_cont_email2',
506 //              'type' => 'index',
507 //              'fields' => array('email2')
508 //      ),
509 ),
510     'relationships' => array(
511         'contact_direct_reports' => array('lhs_module' => 'Contacts',
512             'lhs_table' => 'contacts',
513             'lhs_key' => 'id',
514             'rhs_module' => 'Contacts',
515             'rhs_table' => 'contacts',
516             'rhs_key' => 'reports_to_id',
517             'relationship_type' => 'one-to-many'),
518         'contact_leads' => array('lhs_module' => 'Contacts',
519             'lhs_table' => 'contacts',
520             'lhs_key' => 'id',
521             'rhs_module' => 'Leads',
522             'rhs_table' => 'leads',
523             'rhs_key' => 'contact_id',
524             'relationship_type' => 'one-to-many'),
525         'contact_notes' => array('lhs_module' => 'Contacts',
526             'lhs_table' => 'contacts',
527             'lhs_key' => 'id',
528             'rhs_module' => 'Notes',
529             'rhs_table' => 'notes',
530             'rhs_key' => 'contact_id',
531             'relationship_type' => 'one-to-many'),
532         'contact_tasks' => array('lhs_module' => 'Contacts',
533             'lhs_table' => 'contacts',
534             'lhs_key' => 'id',
535             'rhs_module' => 'Tasks',
536             'rhs_table' => 'tasks',
537             'rhs_key' => 'contact_id',
538             'relationship_type' => 'one-to-many'),
539         'contact_tasks_parent' => array('lhs_module' => 'Contacts',
540             'lhs_table' => 'contacts',
541             'lhs_key' => 'id',
542             'rhs_module' => 'Tasks',
543             'rhs_table' => 'tasks',
544             'rhs_key' => 'parent_id',
545             'relationship_type' => 'one-to-many',
546                         'relationship_role_column'=>'parent_type',
547             'relationship_role_column_value'=>'Contacts'
548                 ),
549         'contacts_assigned_user' => array('lhs_module' => 'Users',
550             'lhs_table' => 'users',
551             'lhs_key' => 'id',
552             'rhs_module' => 'Contacts',
553             'rhs_table' => 'contacts',
554             'rhs_key' => 'assigned_user_id',
555             'relationship_type' => 'one-to-many'),
556         'contacts_modified_user' => array('lhs_module' => 'Users',
557             'lhs_table' => 'users',
558             'lhs_key' => 'id',
559             'rhs_module' => 'Contacts',
560             'rhs_table' => 'contacts',
561             'rhs_key' => 'modified_user_id',
562             'relationship_type' => 'one-to-many'),
563         'contacts_created_by' => array('lhs_module' => 'Users',
564             'lhs_table' => 'users',
565             'lhs_key' => 'id',
566             'rhs_module' => 'Contacts',
567             'rhs_table' => 'contacts',
568             'rhs_key' => 'created_by',
569             'relationship_type' => 'one-to-many'),
570                 'contact_campaign_log' => array(
571                         'lhs_module'            =>      'Contacts',
572                         'lhs_table'                     =>      'contacts',
573                         'lhs_key'                       =>      'id',
574                         'rhs_module'            =>      'CampaignLog',
575                         'rhs_table'                     =>      'campaign_log',
576                         'rhs_key'                       =>      'target_id',
577                         'relationship_type'     =>'one-to-many'
578                 ),
579 ),
580
581 //This enables optimistic locking for Saves From EditView
582 'optimistic_locking'=>true,
583 );
584
585 VardefManager::createVardef('Contacts','Contact', array('default', 'assignable',
586   'person'));
587
588 ?>