]> CyberLeo.Net >> Repos - Github/sugarcrm.git/blob - modules/Accounts/vardefs.php
Release 6.5.16
[Github/sugarcrm.git] / modules / Accounts / 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['Account'] = array('table' => 'accounts', 'audited'=>true, 'unified_search' => true, 'full_text_search' => true, 'unified_search_default_enabled' => true, 'duplicate_merge'=>true,
39   'comment' => 'Accounts are organizations or entities that are the target of selling, support, and marketing activities, or have already purchased products or services',
40   'fields' => array (
41
42    'parent_id' =>
43   array (
44     'name' => 'parent_id',
45     'vname' => 'LBL_PARENT_ACCOUNT_ID',
46     'type' => 'id',
47     'required'=>false,
48     'reportable'=>false,
49     'audited'=>true,
50     'comment' => 'Account ID of the parent of this account',
51   ),
52
53   'sic_code' =>
54   array (
55     'name' => 'sic_code',
56     'vname' => 'LBL_SIC_CODE',
57     'type' => 'varchar',
58     'len' => 10,
59     'comment' => 'SIC code of the account',
60   ),
61
62
63   'parent_name' =>
64   array (
65     'name' => 'parent_name',
66     'rname' => 'name',
67     'id_name' => 'parent_id',
68     'vname' => 'LBL_MEMBER_OF',
69     'type' => 'relate',
70     'isnull' => 'true',
71     'module' => 'Accounts',
72     'table' => 'accounts',
73     'massupdate' => false,
74     'source'=>'non-db',
75     'len' => 36,
76     'link'=>'member_of',
77     'unified_search' => true,
78     'importable' => 'true',
79   ),
80
81
82   'members' =>
83   array (
84     'name' => 'members',
85     'type' => 'link',
86     'relationship' => 'member_accounts',
87     'module'=>'Accounts',
88     'bean_name'=>'Account',
89     'source'=>'non-db',
90     'vname'=>'LBL_MEMBERS',
91   ),
92   'member_of' =>
93   array (
94     'name' => 'member_of',
95     'type' => 'link',
96     'relationship' => 'member_accounts',
97     'module'=>'Accounts',
98     'bean_name'=>'Account',
99     'link_type'=>'one',
100     'source'=>'non-db',
101     'vname'=>'LBL_MEMBER_OF',
102     'side'=>'right',
103   ),
104   'email_opt_out' =>
105                 array(
106                         'name'          => 'email_opt_out',
107                         'vname'     => 'LBL_EMAIL_OPT_OUT',
108                         'source'        => 'non-db',
109                         'type'          => 'bool',
110                     'massupdate' => false,
111                         'studio'=>'false',
112                 ),
113   'invalid_email' =>
114                 array(
115                         'name'          => 'invalid_email',
116                         'vname'     => 'LBL_INVALID_EMAIL',
117                         'source'        => 'non-db',
118                         'type'          => 'bool',
119                     'massupdate' => false,
120                         'studio'=>'false',
121                 ),
122   'cases' =>
123   array (
124     'name' => 'cases',
125     'type' => 'link',
126     'relationship' => 'account_cases',
127     'module'=>'Cases',
128     'bean_name'=>'aCase',
129     'source'=>'non-db',
130         'vname'=>'LBL_CASES',
131   ),
132   //bug 42902
133   'email'=> array(
134                         'name' => 'email',
135                         'type' => 'email',
136                         'query_type' => 'default',
137                         'source' => 'non-db',
138                         'operator' => 'subquery',
139                         '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',
140                         'db_field' => array(
141                                 'id',
142                         ),
143                         'vname' =>'LBL_ANY_EMAIL',
144                         'studio' => array('visible'=>false, 'searchview'=>true),
145             'importable' => false,
146                 ),      
147   'tasks' =>
148   array (
149     'name' => 'tasks',
150     'type' => 'link',
151     'relationship' => 'account_tasks',
152     'module'=>'Tasks',
153     'bean_name'=>'Task',
154     'source'=>'non-db',
155         'vname'=>'LBL_TASKS',
156   ),
157   'notes' =>
158   array (
159     'name' => 'notes',
160     'type' => 'link',
161     'relationship' => 'account_notes',
162     'module'=>'Notes',
163     'bean_name'=>'Note',
164     'source'=>'non-db',
165         'vname'=>'LBL_NOTES',
166   ),
167   'meetings' =>
168   array (
169     'name' => 'meetings',
170     'type' => 'link',
171     'relationship' => 'account_meetings',
172     'module'=>'Meetings',
173     'bean_name'=>'Meeting',
174     'source'=>'non-db',
175         'vname'=>'LBL_MEETINGS',
176   ),
177   'calls' =>
178   array (
179     'name' => 'calls',
180     'type' => 'link',
181     'relationship' => 'account_calls',
182     'module'=>'Calls',
183     'bean_name'=>'Call',
184     'source'=>'non-db',
185         'vname'=>'LBL_CALLS',
186   ),
187
188   'emails' =>
189   array (
190     'name' => 'emails',
191     'type' => 'link',
192     'relationship' => 'emails_accounts_rel', /* reldef in emails */
193     'module'=>'Emails',
194     'bean_name'=>'Email',
195     'source'=>'non-db',
196     'vname'=>'LBL_EMAILS',
197     'studio' => array("formula" => false),
198   ),
199   'documents'=>
200   array (
201       'name' => 'documents',
202       'type' => 'link',
203       'relationship' => 'documents_accounts',
204       'source' => 'non-db',
205       'vname' => 'LBL_DOCUMENTS_SUBPANEL_TITLE',
206   ),
207   'bugs' =>
208   array (
209     'name' => 'bugs',
210     'type' => 'link',
211     'relationship' => 'accounts_bugs',
212     'module'=>'Bugs',
213     'bean_name'=>'Bug',
214     'source'=>'non-db',
215         'vname'=>'LBL_BUGS',
216   ),
217   'contacts' =>
218   array (
219     'name' => 'contacts',
220     'type' => 'link',
221     'relationship' => 'accounts_contacts',
222     'module'=>'Contacts',
223     'bean_name'=>'Contact',
224     'source'=>'non-db',
225         'vname'=>'LBL_CONTACTS',
226   ),
227         'email_addresses' =>
228         array (
229                 'name' => 'email_addresses',
230         'type' => 'link',
231                 'relationship' => 'accounts_email_addresses',
232         'source' => 'non-db',
233                 'vname' => 'LBL_EMAIL_ADDRESSES',
234             'reportable'=>false,
235             'unified_search' => true,
236             'rel_fields' => array('primary_address' => array('type'=>'bool')),
237         'studio' => array("formula" => false),
238         ),
239         'email_addresses_primary' =>
240         array (
241                 'name' => 'email_addresses_primary',
242         'type' => 'link',
243                 'relationship' => 'accounts_email_addresses_primary',
244         'source' => 'non-db',
245                 'vname' => 'LBL_EMAIL_ADDRESS_PRIMARY',
246                 'duplicate_merge'=> 'disabled',
247         'studio' => array("formula" => false),
248         ),
249   'opportunities' =>
250   array (
251     'name' => 'opportunities',
252     'type' => 'link',
253     'relationship' => 'accounts_opportunities',
254     'module'=>'Opportunities',
255     'bean_name'=>'Opportunity',
256     'source'=>'non-db',
257         'vname'=>'LBL_OPPORTUNITY',
258   ),
259
260
261   'project' =>
262   array (
263     'name' => 'project',
264     'type' => 'link',
265     'relationship' => 'projects_accounts',
266     'module'=>'Project',
267     'bean_name'=>'Project',
268     'source'=>'non-db',
269         'vname'=>'LBL_PROJECTS',
270   ),
271   'leads' =>
272   array (
273     'name' => 'leads',
274     'type' => 'link',
275     'relationship' => 'account_leads',
276     'module'=>'Leads',
277     'bean_name'=>'Lead',
278     'source'=>'non-db',
279         'vname'=>'LBL_LEADS',
280   ),
281   'campaigns' =>
282         array (
283                 'name' => 'campaigns',
284         'type' => 'link',
285         'relationship' => 'account_campaign_log',
286         'module'=>'CampaignLog',
287         'bean_name'=>'CampaignLog',
288         'source'=>'non-db',
289                 'vname'=>'LBL_CAMPAIGNLOG',
290         'studio' => array("formula" => false),
291   ),  
292   'campaign_accounts' =>
293     array (
294       'name' => 'campaign_accounts',
295       'type' => 'link',
296       'vname' => 'LBL_CAMPAIGNS',
297       'relationship' => 'campaign_accounts',
298       'source' => 'non-db',
299   ),  
300   
301   'created_by_link' =>
302   array (
303     'name' => 'created_by_link',
304     'type' => 'link',
305     'relationship' => 'accounts_created_by',
306     'vname' => 'LBL_CREATED_BY_USER',
307     'link_type' => 'one',
308     'module'=>'Users',
309     'bean_name'=>'User',
310     'source'=>'non-db',
311   ),
312   'modified_user_link' =>
313   array (
314     'name' => 'modified_user_link',
315     'type' => 'link',
316     'relationship' => 'accounts_modified_user',
317     'vname' => 'LBL_MODIFIED_BY_USER',
318     'link_type' => 'one',
319     'module'=>'Users',
320     'bean_name'=>'User',
321     'source'=>'non-db',
322   ),
323   'assigned_user_link' =>
324   array (
325     'name' => 'assigned_user_link',
326     'type' => 'link',
327     'relationship' => 'accounts_assigned_user',
328     'vname' => 'LBL_ASSIGNED_TO_USER',
329     'link_type' => 'one',
330     'module'=>'Users',
331     'bean_name'=>'User',
332     'source'=>'non-db',
333     'duplicate_merge'=>'enabled',
334     'rname' => 'user_name',
335     'id_name' => 'assigned_user_id',
336     'table' => 'users',
337   ),
338
339
340  'campaign_id' =>
341   array (
342     'name' => 'campaign_id',
343     'comment' => 'Campaign that generated Account',
344     'vname'=>'LBL_CAMPAIGN_ID',
345     'rname' => 'id',
346     'id_name' => 'campaign_id',
347     'type' => 'id',
348     'table' => 'campaigns',
349     'isnull' => 'true',
350     'module' => 'Campaigns',
351     'reportable'=>false,
352     'massupdate' => false,
353         'duplicate_merge'=> 'disabled',
354   ),
355
356  'campaign_name' =>
357  array (
358         'name'=>'campaign_name',
359         'rname'=>'name',
360         'vname' => 'LBL_CAMPAIGN',
361         'type' => 'relate',
362         'reportable'=>false,
363         'source'=>'non-db',
364         'table' => 'campaigns',
365         'id_name' => 'campaign_id',
366         'link' => 'campaign_accounts', 
367         'module'=>'Campaigns',
368         'duplicate_merge'=>'disabled',
369         'comment' => 'The first campaign name for Account (Meta-data only)',
370  ),
371  
372       'prospect_lists' =>
373       array (
374         'name' => 'prospect_lists',
375         'type' => 'link',
376         'relationship' => 'prospect_list_accounts',
377         'module'=>'ProspectLists',
378         'source'=>'non-db',
379         'vname'=>'LBL_PROSPECT_LIST',
380       ), 
381 )
382 , 'indices' => array (
383         array('name' =>'idx_accnt_id_del', 'type' =>'index', 'fields'=>array('id', 'deleted')),
384         array('name' =>'idx_accnt_name_del', 'type' => 'index', 'fields'=>array('name', 'deleted')),//bug #5530
385        array('name' =>'idx_accnt_assigned_del', 'type' =>'index', 'fields'=>array( 'deleted', 'assigned_user_id')),
386         array('name' =>'idx_accnt_parent_id', 'type' =>'index', 'fields'=>array( 'parent_id')),
387   )
388
389 , 'relationships' => array (
390     'member_accounts' => array('lhs_module'=> 'Accounts', 'lhs_table'=> 'accounts', 'lhs_key' => 'id',
391                               'rhs_module'=> 'Accounts', 'rhs_table'=> 'accounts', 'rhs_key' => 'parent_id',
392                               'relationship_type'=>'one-to-many')
393
394     ,'account_cases' => array('lhs_module'=> 'Accounts', 'lhs_table'=> 'accounts', 'lhs_key' => 'id',
395                               'rhs_module'=> 'Cases', 'rhs_table'=> 'cases', 'rhs_key' => 'account_id',
396                               'relationship_type'=>'one-to-many')
397
398     ,'account_tasks' => array('lhs_module'=> 'Accounts', 'lhs_table'=> 'accounts', 'lhs_key' => 'id',
399                               'rhs_module'=> 'Tasks', 'rhs_table'=> 'tasks', 'rhs_key' => 'parent_id',
400                               'relationship_type'=>'one-to-many', 'relationship_role_column'=>'parent_type',
401                               'relationship_role_column_value'=>'Accounts')
402
403     ,'account_notes' => array('lhs_module'=> 'Accounts', 'lhs_table'=> 'accounts', 'lhs_key' => 'id',
404                               'rhs_module'=> 'Notes', 'rhs_table'=> 'notes', 'rhs_key' => 'parent_id',
405                               'relationship_type'=>'one-to-many', 'relationship_role_column'=>'parent_type',
406                               'relationship_role_column_value'=>'Accounts')
407
408     ,'account_meetings' => array('lhs_module'=> 'Accounts', 'lhs_table'=> 'accounts', 'lhs_key' => 'id',
409                               'rhs_module'=> 'Meetings', 'rhs_table'=> 'meetings', 'rhs_key' => 'parent_id',
410                               'relationship_type'=>'one-to-many', 'relationship_role_column'=>'parent_type',
411                               'relationship_role_column_value'=>'Accounts')
412
413     ,'account_calls' => array('lhs_module'=> 'Accounts', 'lhs_table'=> 'accounts', 'lhs_key' => 'id',
414                               'rhs_module'=> 'Calls', 'rhs_table'=> 'calls', 'rhs_key' => 'parent_id',
415                               'relationship_type'=>'one-to-many', 'relationship_role_column'=>'parent_type',
416                               'relationship_role_column_value'=>'Accounts')
417
418 /*,'accounts_emails' => array(
419     'rhs_module'        => 'Emails',
420     'rhs_table'         => 'emails',
421     'rhs_key'           => 'id',
422     'lhs_module'        => 'Accounts',
423     'lhs_table'         => 'accounts',
424     'lhs_key'           => 'id',
425     'relationship_type' => 'many-to-many',
426     'join_table'        => 'emails_accounts',
427     'join_key_rhs'      => 'email_id',
428     'join_key_lhs'      => 'account_id'
429 )
430 */
431     ,'account_emails' => array('lhs_module'=> 'Accounts', 'lhs_table'=> 'accounts', 'lhs_key' => 'id',
432                               'rhs_module'=> 'Emails', 'rhs_table'=> 'emails', 'rhs_key' => 'parent_id',
433                               'relationship_type'=>'one-to-many', 'relationship_role_column'=>'parent_type',
434                               'relationship_role_column_value'=>'Accounts')
435
436     ,'account_leads' => array('lhs_module'=> 'Accounts', 'lhs_table'=> 'accounts', 'lhs_key' => 'id',
437                               'rhs_module'=> 'Leads', 'rhs_table'=> 'leads', 'rhs_key' => 'account_id',
438                               'relationship_type'=>'one-to-many')
439     ,
440
441   'accounts_assigned_user' =>
442   array('lhs_module'=> 'Users', 'lhs_table'=> 'users', 'lhs_key' => 'id',
443   'rhs_module'=> 'Accounts', 'rhs_table'=> 'accounts', 'rhs_key' => 'assigned_user_id',
444   'relationship_type'=>'one-to-many'),
445
446   'accounts_modified_user' =>
447   array('lhs_module'=> 'Users', 'lhs_table'=> 'users', 'lhs_key' => 'id',
448   'rhs_module'=> 'Accounts', 'rhs_table'=> 'accounts', 'rhs_key' => 'modified_user_id',
449   'relationship_type'=>'one-to-many'),
450
451   'accounts_created_by' =>
452   array('lhs_module'=> 'Users', 'lhs_table'=> 'users', 'lhs_key' => 'id',
453   'rhs_module'=> 'Accounts', 'rhs_table'=> 'accounts', 'rhs_key' => 'created_by',
454   'relationship_type'=>'one-to-many'),
455   
456   'account_campaign_log' => array('lhs_module' => 'Accounts', 'lhs_table'=> 'accounts', 'lhs_key'=> 'id',
457   'rhs_module'=> 'CampaignLog','rhs_table'=>'campaign_log', 'rhs_key'=> 'target_id',
458   'relationship_type'   =>'one-to-many',
459   'relationship_role_column' => 'target_type', 'relationship_role_column_value'=>'Accounts'),
460   
461   ),
462   //This enables optimistic locking for Saves From EditView
463   'optimistic_locking'=>true,
464 );
465
466 VardefManager::createVardef('Accounts','Account', array('default', 'assignable',
467 'company',
468 ));
469
470 //jc - adding for refactor for import to not use the required_fields array
471 //defined in the field_arrays.php file
472 $dictionary['Account']['fields']['name']['importable'] = 'required';
473
474 ?>