]> CyberLeo.Net >> Repos - Github/sugarcrm.git/blob - modules/Accounts/vardefs.php
Release 6.5.0
[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-2012 SugarCRM Inc.
6  * 
7  * This program is free software; you can redistribute it and/or modify it under
8  * the terms of the GNU Affero General Public License version 3 as published by the
9  * Free Software Foundation with the addition of the following permission added
10  * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
11  * IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
12  * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
13  * 
14  * This program is distributed in the hope that it will be useful, but WITHOUT
15  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16  * FOR A PARTICULAR PURPOSE.  See the GNU Affero General Public License for more
17  * details.
18  * 
19  * You should have received a copy of the GNU Affero General Public License along with
20  * this program; if not, see http://www.gnu.org/licenses or write to the Free
21  * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
22  * 02110-1301 USA.
23  * 
24  * You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
25  * SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
26  * 
27  * The interactive user interfaces in modified source and object code versions
28  * of this program must display Appropriate Legal Notices, as required under
29  * Section 5 of the GNU Affero General Public License version 3.
30  * 
31  * In accordance with Section 7(b) of the GNU Affero General Public License version 3,
32  * these Appropriate Legal Notices must retain the display of the "Powered by
33  * SugarCRM" logo. If the display of the logo is not reasonably feasible for
34  * technical reasons, the Appropriate Legal Notices must display the words
35  * "Powered by SugarCRM".
36  ********************************************************************************/
37
38 $dictionary['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                 ),      
146   'tasks' =>
147   array (
148     'name' => 'tasks',
149     'type' => 'link',
150     'relationship' => 'account_tasks',
151     'module'=>'Tasks',
152     'bean_name'=>'Task',
153     'source'=>'non-db',
154         'vname'=>'LBL_TASKS',
155   ),
156   'notes' =>
157   array (
158     'name' => 'notes',
159     'type' => 'link',
160     'relationship' => 'account_notes',
161     'module'=>'Notes',
162     'bean_name'=>'Note',
163     'source'=>'non-db',
164         'vname'=>'LBL_NOTES',
165   ),
166   'meetings' =>
167   array (
168     'name' => 'meetings',
169     'type' => 'link',
170     'relationship' => 'account_meetings',
171     'module'=>'Meetings',
172     'bean_name'=>'Meeting',
173     'source'=>'non-db',
174         'vname'=>'LBL_MEETINGS',
175   ),
176   'calls' =>
177   array (
178     'name' => 'calls',
179     'type' => 'link',
180     'relationship' => 'account_calls',
181     'module'=>'Calls',
182     'bean_name'=>'Call',
183     'source'=>'non-db',
184         'vname'=>'LBL_CALLS',
185   ),
186
187   'emails' =>
188   array (
189     'name' => 'emails',
190     'type' => 'link',
191     'relationship' => 'emails_accounts_rel', /* reldef in emails */
192     'module'=>'Emails',
193     'bean_name'=>'Email',
194     'source'=>'non-db',
195     'vname'=>'LBL_EMAILS',
196     'studio' => array("formula" => false),
197   ),
198   'documents'=>
199   array (
200       'name' => 'documents',
201       'type' => 'link',
202       'relationship' => 'documents_accounts',
203       'source' => 'non-db',
204       'vname' => 'LBL_DOCUMENTS_SUBPANEL_TITLE',
205   ),
206   'bugs' =>
207   array (
208     'name' => 'bugs',
209     'type' => 'link',
210     'relationship' => 'accounts_bugs',
211     'module'=>'Bugs',
212     'bean_name'=>'Bug',
213     'source'=>'non-db',
214         'vname'=>'LBL_BUGS',
215   ),
216   'contacts' =>
217   array (
218     'name' => 'contacts',
219     'type' => 'link',
220     'relationship' => 'accounts_contacts',
221     'module'=>'Contacts',
222     'bean_name'=>'Contact',
223     'source'=>'non-db',
224         'vname'=>'LBL_CONTACTS',
225   ),
226         'email_addresses' =>
227         array (
228                 'name' => 'email_addresses',
229         'type' => 'link',
230                 'relationship' => 'accounts_email_addresses',
231         'source' => 'non-db',
232                 'vname' => 'LBL_EMAIL_ADDRESSES',
233             'reportable'=>false,
234             'unified_search' => true,
235             'rel_fields' => array('primary_address' => array('type'=>'bool')),
236         'studio' => array("formula" => false),
237         ),
238         'email_addresses_primary' =>
239         array (
240                 'name' => 'email_addresses_primary',
241         'type' => 'link',
242                 'relationship' => 'accounts_email_addresses_primary',
243         'source' => 'non-db',
244                 'vname' => 'LBL_EMAIL_ADDRESS_PRIMARY',
245                 'duplicate_merge'=> 'disabled',
246         'studio' => array("formula" => false),
247         ),
248   'opportunities' =>
249   array (
250     'name' => 'opportunities',
251     'type' => 'link',
252     'relationship' => 'accounts_opportunities',
253     'module'=>'Opportunities',
254     'bean_name'=>'Opportunity',
255     'source'=>'non-db',
256         'vname'=>'LBL_OPPORTUNITY',
257   ),
258
259
260   'project' =>
261   array (
262     'name' => 'project',
263     'type' => 'link',
264     'relationship' => 'projects_accounts',
265     'module'=>'Project',
266     'bean_name'=>'Project',
267     'source'=>'non-db',
268         'vname'=>'LBL_PROJECTS',
269   ),
270   'leads' =>
271   array (
272     'name' => 'leads',
273     'type' => 'link',
274     'relationship' => 'account_leads',
275     'module'=>'Leads',
276     'bean_name'=>'Lead',
277     'source'=>'non-db',
278         'vname'=>'LBL_LEADS',
279   ),
280   'campaigns' =>
281         array (
282                 'name' => 'campaigns',
283         'type' => 'link',
284         'relationship' => 'account_campaign_log',
285         'module'=>'CampaignLog',
286         'bean_name'=>'CampaignLog',
287         'source'=>'non-db',
288                 'vname'=>'LBL_CAMPAIGNLOG',
289         'studio' => array("formula" => false),
290   ),  
291   'campaign_accounts' =>
292     array (
293       'name' => 'campaign_accounts',
294       'type' => 'link',
295       'vname' => 'LBL_CAMPAIGNS',
296       'relationship' => 'campaign_accounts',
297       'source' => 'non-db',
298   ),  
299   
300   'created_by_link' =>
301   array (
302     'name' => 'created_by_link',
303     'type' => 'link',
304     'relationship' => 'accounts_created_by',
305     'vname' => 'LBL_CREATED_BY_USER',
306     'link_type' => 'one',
307     'module'=>'Users',
308     'bean_name'=>'User',
309     'source'=>'non-db',
310   ),
311   'modified_user_link' =>
312   array (
313     'name' => 'modified_user_link',
314     'type' => 'link',
315     'relationship' => 'accounts_modified_user',
316     'vname' => 'LBL_MODIFIED_BY_USER',
317     'link_type' => 'one',
318     'module'=>'Users',
319     'bean_name'=>'User',
320     'source'=>'non-db',
321   ),
322   'assigned_user_link' =>
323   array (
324     'name' => 'assigned_user_link',
325     'type' => 'link',
326     'relationship' => 'accounts_assigned_user',
327     'vname' => 'LBL_ASSIGNED_TO_USER',
328     'link_type' => 'one',
329     'module'=>'Users',
330     'bean_name'=>'User',
331     'source'=>'non-db',
332     'duplicate_merge'=>'enabled',
333     'rname' => 'user_name',
334     'id_name' => 'assigned_user_id',
335     'table' => 'users',
336   ),
337
338   'products' => array(
339       'name' => 'products',
340       'type' => 'link',
341       'relationship' => 'products_accounts',
342       'source' => 'non-db',
343       'vname' => 'LBL_PRODUCTS',
344   ),
345
346  'campaign_id' =>
347   array (
348     'name' => 'campaign_id',
349     'comment' => 'Campaign that generated Account',
350     'vname'=>'LBL_CAMPAIGN_ID',
351     'rname' => 'id',
352     'id_name' => 'campaign_id',
353     'type' => 'id',
354     'table' => 'campaigns',
355     'isnull' => 'true',
356     'module' => 'Campaigns',
357     'reportable'=>false,
358     'massupdate' => false,
359         'duplicate_merge'=> 'disabled',
360   ),
361
362  'campaign_name' =>
363  array (
364         'name'=>'campaign_name',
365         'rname'=>'name',
366         'vname' => 'LBL_CAMPAIGN',
367         'type' => 'relate',
368         'reportable'=>false,
369         'source'=>'non-db',
370         'table' => 'campaigns',
371         'id_name' => 'campaign_id',
372         'link' => 'campaign_accounts', 
373         'module'=>'Campaigns',
374         'duplicate_merge'=>'disabled',
375         'comment' => 'The first campaign name for Account (Meta-data only)',
376  ),
377  
378       'prospect_lists' =>
379       array (
380         'name' => 'prospect_lists',
381         'type' => 'link',
382         'relationship' => 'prospect_list_accounts',
383         'module'=>'ProspectLists',
384         'source'=>'non-db',
385         'vname'=>'LBL_PROSPECT_LIST',
386       ), 
387 )
388 , 'indices' => array (
389         array('name' =>'idx_accnt_id_del', 'type' =>'index', 'fields'=>array('id', 'deleted')),
390         array('name' =>'idx_accnt_name_del', 'type' => 'index', 'fields'=>array('name', 'deleted')),//bug #5530
391        array('name' =>'idx_accnt_assigned_del', 'type' =>'index', 'fields'=>array( 'deleted', 'assigned_user_id')),
392         array('name' =>'idx_accnt_parent_id', 'type' =>'index', 'fields'=>array( 'parent_id')),
393   )
394
395 , 'relationships' => array (
396     'member_accounts' => array('lhs_module'=> 'Accounts', 'lhs_table'=> 'accounts', 'lhs_key' => 'id',
397                               'rhs_module'=> 'Accounts', 'rhs_table'=> 'accounts', 'rhs_key' => 'parent_id',
398                               'relationship_type'=>'one-to-many')
399
400     ,'account_cases' => array('lhs_module'=> 'Accounts', 'lhs_table'=> 'accounts', 'lhs_key' => 'id',
401                               'rhs_module'=> 'Cases', 'rhs_table'=> 'cases', 'rhs_key' => 'account_id',
402                               'relationship_type'=>'one-to-many')
403
404     ,'account_tasks' => array('lhs_module'=> 'Accounts', 'lhs_table'=> 'accounts', 'lhs_key' => 'id',
405                               'rhs_module'=> 'Tasks', 'rhs_table'=> 'tasks', 'rhs_key' => 'parent_id',
406                               'relationship_type'=>'one-to-many', 'relationship_role_column'=>'parent_type',
407                               'relationship_role_column_value'=>'Accounts')
408
409     ,'account_notes' => array('lhs_module'=> 'Accounts', 'lhs_table'=> 'accounts', 'lhs_key' => 'id',
410                               'rhs_module'=> 'Notes', 'rhs_table'=> 'notes', 'rhs_key' => 'parent_id',
411                               'relationship_type'=>'one-to-many', 'relationship_role_column'=>'parent_type',
412                               'relationship_role_column_value'=>'Accounts')
413
414     ,'account_meetings' => array('lhs_module'=> 'Accounts', 'lhs_table'=> 'accounts', 'lhs_key' => 'id',
415                               'rhs_module'=> 'Meetings', 'rhs_table'=> 'meetings', 'rhs_key' => 'parent_id',
416                               'relationship_type'=>'one-to-many', 'relationship_role_column'=>'parent_type',
417                               'relationship_role_column_value'=>'Accounts')
418
419     ,'account_calls' => array('lhs_module'=> 'Accounts', 'lhs_table'=> 'accounts', 'lhs_key' => 'id',
420                               'rhs_module'=> 'Calls', 'rhs_table'=> 'calls', 'rhs_key' => 'parent_id',
421                               'relationship_type'=>'one-to-many', 'relationship_role_column'=>'parent_type',
422                               'relationship_role_column_value'=>'Accounts')
423
424 /*,'accounts_emails' => array(
425     'rhs_module'        => 'Emails',
426     'rhs_table'         => 'emails',
427     'rhs_key'           => 'id',
428     'lhs_module'        => 'Accounts',
429     'lhs_table'         => 'accounts',
430     'lhs_key'           => 'id',
431     'relationship_type' => 'many-to-many',
432     'join_table'        => 'emails_accounts',
433     'join_key_rhs'      => 'email_id',
434     'join_key_lhs'      => 'account_id'
435 )
436 */
437     ,'account_emails' => array('lhs_module'=> 'Accounts', 'lhs_table'=> 'accounts', 'lhs_key' => 'id',
438                               'rhs_module'=> 'Emails', 'rhs_table'=> 'emails', 'rhs_key' => 'parent_id',
439                               'relationship_type'=>'one-to-many', 'relationship_role_column'=>'parent_type',
440                               'relationship_role_column_value'=>'Accounts')
441
442     ,'account_leads' => array('lhs_module'=> 'Accounts', 'lhs_table'=> 'accounts', 'lhs_key' => 'id',
443                               'rhs_module'=> 'Leads', 'rhs_table'=> 'leads', 'rhs_key' => 'account_id',
444                               'relationship_type'=>'one-to-many')
445     ,
446
447   'accounts_assigned_user' =>
448   array('lhs_module'=> 'Users', 'lhs_table'=> 'users', 'lhs_key' => 'id',
449   'rhs_module'=> 'Accounts', 'rhs_table'=> 'accounts', 'rhs_key' => 'assigned_user_id',
450   'relationship_type'=>'one-to-many'),
451
452   'accounts_modified_user' =>
453   array('lhs_module'=> 'Users', 'lhs_table'=> 'users', 'lhs_key' => 'id',
454   'rhs_module'=> 'Accounts', 'rhs_table'=> 'accounts', 'rhs_key' => 'modified_user_id',
455   'relationship_type'=>'one-to-many'),
456
457   'accounts_created_by' =>
458   array('lhs_module'=> 'Users', 'lhs_table'=> 'users', 'lhs_key' => 'id',
459   'rhs_module'=> 'Accounts', 'rhs_table'=> 'accounts', 'rhs_key' => 'created_by',
460   'relationship_type'=>'one-to-many'),
461   
462   'account_campaign_log' => array('lhs_module' => 'Accounts', 'lhs_table'=> 'accounts', 'lhs_key'=> 'id',
463   'rhs_module'=> 'CampaignLog','rhs_table'=>'campaign_log', 'rhs_key'=> 'target_id',
464   'relationship_type'   =>'one-to-many'),
465   
466   ),
467   //This enables optimistic locking for Saves From EditView
468   'optimistic_locking'=>true,
469 );
470
471 VardefManager::createVardef('Accounts','Account', array('default', 'assignable',
472 'company',
473 ));
474
475 //jc - adding for refactor for import to not use the required_fields array
476 //defined in the field_arrays.php file
477 $dictionary['Account']['fields']['name']['importable'] = 'required';
478
479 ?>