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