]> CyberLeo.Net >> Repos - Github/sugarcrm.git/blob - modules/Accounts/vardefs.php
Release 6.1.4
[Github/sugarcrm.git] / modules / Accounts / 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['Account'] = array('table' => 'accounts', 'audited'=>true, 'unified_search' => 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     'table' => 'parent_accounts',
71     'isnull' => 'true',
72     'module' => 'Accounts',
73     'massupdate' => false,
74     'source'=>'non-db',
75     'len' => 36,
76     'link'=>'member_of',
77     'unified_search' => true,
78     'importable' => 'false',
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   'tasks' =>
133   array (
134     'name' => 'tasks',
135     'type' => 'link',
136     'relationship' => 'account_tasks',
137     'module'=>'Tasks',
138     'bean_name'=>'Task',
139     'source'=>'non-db',
140         'vname'=>'LBL_TASKS',
141   ),
142   'notes' =>
143   array (
144     'name' => 'notes',
145     'type' => 'link',
146     'relationship' => 'account_notes',
147     'module'=>'Notes',
148     'bean_name'=>'Note',
149     'source'=>'non-db',
150         'vname'=>'LBL_NOTES',
151   ),
152   'meetings' =>
153   array (
154     'name' => 'meetings',
155     'type' => 'link',
156     'relationship' => 'account_meetings',
157     'module'=>'Meetings',
158     'bean_name'=>'Meeting',
159     'source'=>'non-db',
160         'vname'=>'LBL_MEETINGS',
161   ),
162   'calls' =>
163   array (
164     'name' => 'calls',
165     'type' => 'link',
166     'relationship' => 'account_calls',
167     'module'=>'Calls',
168     'bean_name'=>'Call',
169     'source'=>'non-db',
170         'vname'=>'LBL_CALLS',
171   ),
172
173   'emails' =>
174   array (
175     'name' => 'emails',
176     'type' => 'link',
177     'relationship' => 'emails_accounts_rel', /* reldef in emails */
178     'module'=>'Emails',
179     'bean_name'=>'Email',
180     'source'=>'non-db',
181     'vname'=>'LBL_EMAILS',
182   ),
183   'bugs' =>
184   array (
185     'name' => 'bugs',
186     'type' => 'link',
187     'relationship' => 'accounts_bugs',
188     'module'=>'Bugs',
189     'bean_name'=>'Bug',
190     'source'=>'non-db',
191         'vname'=>'LBL_BUGS',
192   ),
193   'contacts' =>
194   array (
195     'name' => 'contacts',
196     'type' => 'link',
197     'relationship' => 'accounts_contacts',
198     'module'=>'Contacts',
199     'bean_name'=>'Contact',
200     'source'=>'non-db',
201         'vname'=>'LBL_CONTACTS',
202   ),
203         'email_addresses' =>
204         array (
205                 'name' => 'email_addresses',
206         'type' => 'link',
207                 'relationship' => 'accounts_email_addresses',
208         'source' => 'non-db',
209                 'vname' => 'LBL_EMAIL_ADDRESSES',
210             'reportable'=>false,
211             'unified_search' => true,
212             'rel_fields' => array('primary_address' => array('type'=>'bool')),
213         ),
214         'email_addresses_primary' =>
215         array (
216                 'name' => 'email_addresses_primary',
217         'type' => 'link',
218                 'relationship' => 'accounts_email_addresses_primary',
219         'source' => 'non-db',
220                 'vname' => 'LBL_EMAIL_ADDRESS_PRIMARY',
221                 'duplicate_merge'=> 'disabled',
222         ),
223   'opportunities' =>
224   array (
225     'name' => 'opportunities',
226     'type' => 'link',
227     'relationship' => 'accounts_opportunities',
228     'module'=>'Opportunities',
229     'bean_name'=>'Opportunity',
230     'source'=>'non-db',
231         'vname'=>'LBL_OPPORTUNITY',
232   ),
233
234
235   'project' =>
236   array (
237     'name' => 'project',
238     'type' => 'link',
239     'relationship' => 'projects_accounts',
240     'module'=>'Project',
241     'bean_name'=>'Project',
242     'source'=>'non-db',
243         'vname'=>'LBL_PROJECTS',
244   ),
245   'leads' =>
246   array (
247     'name' => 'leads',
248     'type' => 'link',
249     'relationship' => 'account_leads',
250     'module'=>'Leads',
251     'bean_name'=>'Lead',
252     'source'=>'non-db',
253         'vname'=>'LBL_LEADS',
254   ),
255   'campaigns' =>
256   array (
257     'name' => 'campaigns',
258     'type' => 'link',
259     'relationship' => 'campaign_accounts',
260     'module'=>'Campaigns',
261     'bean_name'=>'Campaign',
262     'source'=>'non-db',
263     'vname'=>'LBL_CAMPAIGNS',
264   ),
265   'created_by_link' =>
266   array (
267     'name' => 'created_by_link',
268     'type' => 'link',
269     'relationship' => 'accounts_created_by',
270     'vname' => 'LBL_CREATED_BY_USER',
271     'link_type' => 'one',
272     'module'=>'Users',
273     'bean_name'=>'User',
274     'source'=>'non-db',
275   ),
276   'modified_user_link' =>
277   array (
278     'name' => 'modified_user_link',
279     'type' => 'link',
280     'relationship' => 'accounts_modified_user',
281     'vname' => 'LBL_MODIFIED_BY_USER',
282     'link_type' => 'one',
283     'module'=>'Users',
284     'bean_name'=>'User',
285     'source'=>'non-db',
286   ),
287   'assigned_user_link' =>
288   array (
289     'name' => 'assigned_user_link',
290     'type' => 'link',
291     'relationship' => 'accounts_assigned_user',
292     'vname' => 'LBL_ASSIGNED_TO_USER',
293     'link_type' => 'one',
294     'module'=>'Users',
295     'bean_name'=>'User',
296     'source'=>'non-db',
297     'duplicate_merge'=>'enabled',
298     'rname' => 'user_name',
299     'id_name' => 'assigned_user_id',
300     'table' => 'users',
301   ),
302
303   'products' => array(
304       'name' => 'products',
305       'type' => 'link',
306       'relationship' => 'products_accounts',
307       'source' => 'non-db',
308       'vname' => 'LBL_PRODUCTS',
309   ),
310
311  'campaign_id' =>
312   array (
313     'name' => 'campaign_id',
314     'comment' => 'Campaign that generated Account',
315     'vname'=>'LBL_CAMPAIGN_ID',
316     'rname' => 'id',
317     'id_name' => 'campaign_id',
318     'type' => 'id',
319     'table' => 'campaigns',
320     'isnull' => 'true',
321     'module' => 'Campaigns',
322     'reportable'=>false,
323     'massupdate' => false,
324         'duplicate_merge'=> 'disabled',
325   ),
326
327  'campaign_name' =>
328  array (
329         'name'=>'campaign_name',
330         'rname'=>'name',
331         'vname' => 'LBL_CAMPAIGN',
332         'type' => 'relate',
333         'reportable'=>false,
334         'source'=>'non-db',
335         'table' => 'campaigns',
336         'id_name' => 'campaign_id',
337         'link' => 'campaigns', 
338         'module'=>'Campaigns',
339         'duplicate_merge'=>'disabled',
340         'comment' => 'The first campaign name for Account (Meta-data only)',
341  ),
342  
343       'prospect_lists' =>
344       array (
345         'name' => 'prospect_lists',
346         'type' => 'link',
347         'relationship' => 'prospect_list_accounts',
348         'module'=>'ProspectLists',
349         'source'=>'non-db',
350         'vname'=>'LBL_PROSPECT_LIST',
351       ), 
352 )
353 , 'indices' => array (
354         array('name' =>'idx_accnt_id_del', 'type' =>'index', 'fields'=>array('id', 'deleted')),
355         array('name' =>'idx_accnt_name_del', 'type' => 'index', 'fields'=>array('name', 'deleted')),//bug #5530
356        array('name' =>'idx_accnt_assigned_del', 'type' =>'index', 'fields'=>array( 'deleted', 'assigned_user_id')),
357         array('name' =>'idx_accnt_parent_id', 'type' =>'index', 'fields'=>array( 'parent_id')),
358   )
359
360 , 'relationships' => array (
361     'member_accounts' => array('lhs_module'=> 'Accounts', 'lhs_table'=> 'accounts', 'lhs_key' => 'id',
362                               'rhs_module'=> 'Accounts', 'rhs_table'=> 'accounts', 'rhs_key' => 'parent_id',
363                               'relationship_type'=>'one-to-many')
364
365     ,'account_cases' => array('lhs_module'=> 'Accounts', 'lhs_table'=> 'accounts', 'lhs_key' => 'id',
366                               'rhs_module'=> 'Cases', 'rhs_table'=> 'cases', 'rhs_key' => 'account_id',
367                               'relationship_type'=>'one-to-many')
368
369     ,'account_tasks' => array('lhs_module'=> 'Accounts', 'lhs_table'=> 'accounts', 'lhs_key' => 'id',
370                               'rhs_module'=> 'Tasks', 'rhs_table'=> 'tasks', 'rhs_key' => 'parent_id',
371                               'relationship_type'=>'one-to-many', 'relationship_role_column'=>'parent_type',
372                               'relationship_role_column_value'=>'Accounts')
373
374     ,'account_notes' => array('lhs_module'=> 'Accounts', 'lhs_table'=> 'accounts', 'lhs_key' => 'id',
375                               'rhs_module'=> 'Notes', 'rhs_table'=> 'notes', 'rhs_key' => 'parent_id',
376                               'relationship_type'=>'one-to-many', 'relationship_role_column'=>'parent_type',
377                               'relationship_role_column_value'=>'Accounts')
378
379     ,'account_meetings' => array('lhs_module'=> 'Accounts', 'lhs_table'=> 'accounts', 'lhs_key' => 'id',
380                               'rhs_module'=> 'Meetings', 'rhs_table'=> 'meetings', 'rhs_key' => 'parent_id',
381                               'relationship_type'=>'one-to-many', 'relationship_role_column'=>'parent_type',
382                               'relationship_role_column_value'=>'Accounts')
383
384     ,'account_calls' => array('lhs_module'=> 'Accounts', 'lhs_table'=> 'accounts', 'lhs_key' => 'id',
385                               'rhs_module'=> 'Calls', 'rhs_table'=> 'calls', 'rhs_key' => 'parent_id',
386                               'relationship_type'=>'one-to-many', 'relationship_role_column'=>'parent_type',
387                               'relationship_role_column_value'=>'Accounts')
388
389 /*,'accounts_emails' => array(
390     'rhs_module'        => 'Emails',
391     'rhs_table'         => 'emails',
392     'rhs_key'           => 'id',
393     'lhs_module'        => 'Accounts',
394     'lhs_table'         => 'accounts',
395     'lhs_key'           => 'id',
396     'relationship_type' => 'many-to-many',
397     'join_table'        => 'emails_accounts',
398     'join_key_rhs'      => 'email_id',
399     'join_key_lhs'      => 'account_id'
400 )
401 */
402     ,'account_emails' => array('lhs_module'=> 'Accounts', 'lhs_table'=> 'accounts', 'lhs_key' => 'id',
403                               'rhs_module'=> 'Emails', 'rhs_table'=> 'emails', 'rhs_key' => 'parent_id',
404                               'relationship_type'=>'one-to-many', 'relationship_role_column'=>'parent_type',
405                               'relationship_role_column_value'=>'Accounts')
406
407     ,'account_leads' => array('lhs_module'=> 'Accounts', 'lhs_table'=> 'accounts', 'lhs_key' => 'id',
408                               'rhs_module'=> 'Leads', 'rhs_table'=> 'leads', 'rhs_key' => 'account_id',
409                               'relationship_type'=>'one-to-many')
410     ,
411
412   'accounts_assigned_user' =>
413   array('lhs_module'=> 'Users', 'lhs_table'=> 'users', 'lhs_key' => 'id',
414   'rhs_module'=> 'Accounts', 'rhs_table'=> 'accounts', 'rhs_key' => 'assigned_user_id',
415   'relationship_type'=>'one-to-many'),
416
417   'accounts_modified_user' =>
418   array('lhs_module'=> 'Users', 'lhs_table'=> 'users', 'lhs_key' => 'id',
419   'rhs_module'=> 'Accounts', 'rhs_table'=> 'accounts', 'rhs_key' => 'modified_user_id',
420   'relationship_type'=>'one-to-many'),
421
422   'accounts_created_by' =>
423   array('lhs_module'=> 'Users', 'lhs_table'=> 'users', 'lhs_key' => 'id',
424   'rhs_module'=> 'Accounts', 'rhs_table'=> 'accounts', 'rhs_key' => 'created_by',
425   'relationship_type'=>'one-to-many'),
426   )
427     //This enables optimistic locking for Saves From EditView
428     ,'optimistic_locking'=>true,
429 );
430
431 VardefManager::createVardef('Accounts','Account', array('default', 'assignable',
432 'company',
433 ));
434
435 //jc - adding for refactor for import to not use the required_fields array
436 //defined in the field_arrays.php file
437 $dictionary['Account']['fields']['name']['importable'] = 'required';
438
439 ?>