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.
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.
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
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
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.
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.
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 ********************************************************************************/
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',
44 'name' => 'parent_id',
45 'vname' => 'LBL_PARENT_ACCOUNT_ID',
50 'comment' => 'Account ID of the parent of this account',
56 'vname' => 'LBL_SIC_CODE',
59 'comment' => 'SIC code of the account',
65 'name' => 'parent_name',
67 'id_name' => 'parent_id',
68 'vname' => 'LBL_MEMBER_OF',
71 'module' => 'Accounts',
72 'table' => 'accounts',
73 'massupdate' => false,
77 'unified_search' => true,
78 'importable' => 'true',
86 'relationship' => 'member_accounts',
88 'bean_name'=>'Account',
90 'vname'=>'LBL_MEMBERS',
94 'name' => 'member_of',
96 'relationship' => 'member_accounts',
98 'bean_name'=>'Account',
101 'vname'=>'LBL_MEMBER_OF',
106 'name' => 'email_opt_out',
107 'vname' => 'LBL_EMAIL_OPT_OUT',
108 'source' => 'non-db',
110 'massupdate' => false,
115 'name' => 'invalid_email',
116 'vname' => 'LBL_INVALID_EMAIL',
117 'source' => 'non-db',
119 'massupdate' => false,
126 'relationship' => 'account_cases',
128 'bean_name'=>'aCase',
130 'vname'=>'LBL_CASES',
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',
143 'vname' =>'LBL_ANY_EMAIL',
144 'studio' => array('visible'=>false, 'searchview'=>true),
150 'relationship' => 'account_tasks',
154 'vname'=>'LBL_TASKS',
160 'relationship' => 'account_notes',
164 'vname'=>'LBL_NOTES',
168 'name' => 'meetings',
170 'relationship' => 'account_meetings',
171 'module'=>'Meetings',
172 'bean_name'=>'Meeting',
174 'vname'=>'LBL_MEETINGS',
180 'relationship' => 'account_calls',
184 'vname'=>'LBL_CALLS',
191 'relationship' => 'emails_accounts_rel', /* reldef in emails */
193 'bean_name'=>'Email',
195 'vname'=>'LBL_EMAILS',
199 'name' => 'documents',
201 'relationship' => 'documents_accounts',
202 'source' => 'non-db',
203 'vname' => 'LBL_DOCUMENTS_SUBPANEL_TITLE',
209 'relationship' => 'accounts_bugs',
217 'name' => 'contacts',
219 'relationship' => 'accounts_contacts',
220 'module'=>'Contacts',
221 'bean_name'=>'Contact',
223 'vname'=>'LBL_CONTACTS',
227 'name' => 'email_addresses',
229 'relationship' => 'accounts_email_addresses',
230 'source' => 'non-db',
231 'vname' => 'LBL_EMAIL_ADDRESSES',
233 'unified_search' => true,
234 'rel_fields' => array('primary_address' => array('type'=>'bool')),
236 'email_addresses_primary' =>
238 'name' => 'email_addresses_primary',
240 'relationship' => 'accounts_email_addresses_primary',
241 'source' => 'non-db',
242 'vname' => 'LBL_EMAIL_ADDRESS_PRIMARY',
243 'duplicate_merge'=> 'disabled',
247 'name' => 'opportunities',
249 'relationship' => 'accounts_opportunities',
250 'module'=>'Opportunities',
251 'bean_name'=>'Opportunity',
253 'vname'=>'LBL_OPPORTUNITY',
261 'relationship' => 'projects_accounts',
263 'bean_name'=>'Project',
265 'vname'=>'LBL_PROJECTS',
271 'relationship' => 'account_leads',
275 'vname'=>'LBL_LEADS',
279 'name' => 'campaigns',
281 'relationship' => 'account_campaign_log',
282 'module'=>'CampaignLog',
283 'bean_name'=>'CampaignLog',
285 'vname'=>'LBL_CAMPAIGNLOG',
287 'campaign_accounts' =>
289 'name' => 'campaign_accounts',
291 'vname' => 'LBL_CAMPAIGNS',
292 'relationship' => 'campaign_accounts',
293 'source' => 'non-db',
298 'name' => 'created_by_link',
300 'relationship' => 'accounts_created_by',
301 'vname' => 'LBL_CREATED_BY_USER',
302 'link_type' => 'one',
307 'modified_user_link' =>
309 'name' => 'modified_user_link',
311 'relationship' => 'accounts_modified_user',
312 'vname' => 'LBL_MODIFIED_BY_USER',
313 'link_type' => 'one',
318 'assigned_user_link' =>
320 'name' => 'assigned_user_link',
322 'relationship' => 'accounts_assigned_user',
323 'vname' => 'LBL_ASSIGNED_TO_USER',
324 'link_type' => 'one',
328 'duplicate_merge'=>'enabled',
329 'rname' => 'user_name',
330 'id_name' => 'assigned_user_id',
335 'name' => 'products',
337 'relationship' => 'products_accounts',
338 'source' => 'non-db',
339 'vname' => 'LBL_PRODUCTS',
344 'name' => 'campaign_id',
345 'comment' => 'Campaign that generated Account',
346 'vname'=>'LBL_CAMPAIGN_ID',
348 'id_name' => 'campaign_id',
350 'table' => 'campaigns',
352 'module' => 'Campaigns',
354 'massupdate' => false,
355 'duplicate_merge'=> 'disabled',
360 'name'=>'campaign_name',
362 'vname' => 'LBL_CAMPAIGN',
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)',
376 'name' => 'prospect_lists',
378 'relationship' => 'prospect_list_accounts',
379 'module'=>'ProspectLists',
381 'vname'=>'LBL_PROSPECT_LIST',
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')),
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')
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')
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')
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')
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')
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')
420 /*,'accounts_emails' => array(
421 'rhs_module' => 'Emails',
422 'rhs_table' => 'emails',
424 'lhs_module' => 'Accounts',
425 'lhs_table' => 'accounts',
427 'relationship_type' => 'many-to-many',
428 'join_table' => 'emails_accounts',
429 'join_key_rhs' => 'email_id',
430 'join_key_lhs' => 'account_id'
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')
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')
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'),
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'),
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'),
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'),
463 //This enables optimistic locking for Saves From EditView
464 'optimistic_locking'=>true,
467 VardefManager::createVardef('Accounts','Account', array('default', 'assignable',
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';