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