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-2013 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 ********************************************************************************/
39 $dictionary['Opportunity'] = array('table' => 'opportunities','audited'=>true, 'unified_search' => true, 'full_text_search' => true, 'unified_search_default_enabled' => true, 'duplicate_merge'=>true,
40 'comment' => 'An opportunity is the target of selling activities',
45 'vname' => 'LBL_OPPORTUNITY_NAME',
47 'dbType' => 'varchar',
49 'unified_search' => true,
50 'full_text_search' => array('boost' => 3),
51 'comment' => 'Name of the opportunity',
52 'merge_filter' => 'selected',
53 'importable' => 'required',
58 'name' => 'opportunity_type',
59 'vname' => 'LBL_TYPE',
61 'options'=> 'opportunity_type_dom',
64 'comment' => 'Type of opportunity (ex: Existing, New)',
65 'merge_filter' => 'enabled',
69 'name' => 'account_name',
71 'id_name' => 'account_id',
72 'vname' => 'LBL_ACCOUNT_NAME',
74 'table' => 'accounts',
75 'join_name'=>'accounts',
77 'module' => 'Accounts',
78 'dbType' => 'varchar',
82 'unified_search' => true,
84 'importable' => 'required',
89 'name' => 'account_id',
90 'vname' => 'LBL_ACCOUNT_ID',
97 'name' => 'campaign_id',
98 'comment' => 'Campaign that generated lead',
99 'vname'=>'LBL_CAMPAIGN_ID',
103 'table' => 'campaigns',
105 'module' => 'Campaigns',
106 //'dbType' => 'char',
108 'massupdate' => false,
109 'duplicate_merge'=> 'disabled',
113 'name'=>'campaign_name',
115 'id_name'=>'campaign_id',
116 'vname'=>'LBL_CAMPAIGN',
118 'link' => 'campaign_opportunities',
120 'table' => 'campaigns',
121 'module'=>'Campaigns',
122 'source' => 'non-db',
123 'additionalFields' => array('id' => 'campaign_id')
125 'campaign_opportunities' =>
127 'name' => 'campaign_opportunities',
129 'vname' => 'LBL_CAMPAIGN_OPPORTUNITY',
130 'relationship' => 'campaign_opportunities',
131 'source' => 'non-db',
135 'name' => 'lead_source',
136 'vname' => 'LBL_LEAD_SOURCE',
138 'options' => 'lead_source_dom',
140 'comment' => 'Source of the opportunity',
141 'merge_filter' => 'enabled',
146 'vname' => 'LBL_AMOUNT',
147 //'function'=>array('vname'=>'getCurrencyType'),
148 'type' => 'currency',
149 // 'disable_num_format' => true,
150 'dbType' => 'double',
151 'comment' => 'Unconverted amount of the opportunity',
152 'importable' => 'required',
153 'duplicate_merge'=>'1',
155 'options' => 'numeric_range_search_dom',
156 'enable_range_search' => true,
160 'name' => 'amount_usdollar',
161 'vname' => 'LBL_AMOUNT_USDOLLAR',
162 'type' => 'currency',
164 'dbType' => 'double',
165 'disable_num_format' => true,
166 'duplicate_merge'=>'0',
168 'comment' => 'Formatted amount of the opportunity',
172 'quickcreate'=>false,
177 'name' => 'currency_id',
179 'group'=>'currency_id',
180 'vname' => 'LBL_CURRENCY',
181 'function'=>array('name'=>'getCurrencyDropDown', 'returns'=>'html'),
183 'comment' => 'Currency used for display purposes'
187 'name'=>'currency_name',
189 'id_name'=>'currency_id',
190 'vname'=>'LBL_CURRENCY_NAME',
193 'table' => 'currencies',
194 'module'=>'Currencies',
195 'source' => 'non-db',
196 'function'=>array('name'=>'getCurrencyNameDropDown', 'returns'=>'html'),
198 'duplicate_merge' => 'disabled',
202 'name'=>'currency_symbol',
204 'id_name'=>'currency_id',
205 'vname'=>'LBL_CURRENCY_SYMBOL',
208 'table' => 'currencies',
209 'module'=>'Currencies',
210 'source' => 'non-db',
211 'function'=>array('name'=>'getCurrencySymbolDropDown', 'returns'=>'html'),
213 'duplicate_merge' => 'disabled',
217 'name' => 'date_closed',
218 'vname' => 'LBL_DATE_CLOSED',
221 'comment' => 'Expected or actual date the oppportunity will close',
222 'importable' => 'required',
224 'enable_range_search' => true,
225 'options' => 'date_range_search_dom',
229 'name' => 'next_step',
230 'vname' => 'LBL_NEXT_STEP',
233 'comment' => 'The next step in the sales process',
234 'merge_filter' => 'enabled',
238 'name' => 'sales_stage',
239 'vname' => 'LBL_SALES_STAGE',
241 'options' => 'sales_stage_dom',
244 'comment' => 'Indication of progression towards closure',
245 'merge_filter' => 'enabled',
246 'importable' => 'required',
251 'name' => 'probability',
252 'vname' => 'LBL_PROBABILITY',
254 'dbType' => 'double',
256 'comment' => 'The probability of closure',
257 'validation' => array('type' => 'range', 'min' => 0, 'max' => 100),
258 'merge_filter' => 'enabled',
262 'name' => 'accounts',
264 'relationship' => 'accounts_opportunities',
267 'module'=>'Accounts',
268 'bean_name'=>'Account',
269 'vname'=>'LBL_ACCOUNTS',
273 'name' => 'contacts',
275 'relationship' => 'opportunities_contacts',
277 'module'=>'Contacts',
278 'bean_name'=>'Contact',
279 'rel_fields'=>array('contact_role'=>array('type'=>'enum', 'options'=>'opportunity_relationship_type_dom')),
280 'vname'=>'LBL_CONTACTS',
281 'hide_history_contacts_emails' => true,
287 'relationship' => 'opportunity_tasks',
289 'vname'=>'LBL_TASKS',
295 'relationship' => 'opportunity_notes',
297 'vname'=>'LBL_NOTES',
301 'name' => 'meetings',
303 'relationship' => 'opportunity_meetings',
305 'vname'=>'LBL_MEETINGS',
311 'relationship' => 'opportunity_calls',
313 'vname'=>'LBL_CALLS',
319 'relationship' => 'emails_opportunities_rel',/* reldef in emails */
321 'vname'=>'LBL_EMAILS',
325 'name' => 'documents',
327 'relationship' => 'documents_opportunities',
328 'source' => 'non-db',
329 'vname' => 'LBL_DOCUMENTS_SUBPANEL_TITLE',
336 'relationship' => 'projects_opportunities',
338 'vname'=>'LBL_PROJECTS',
344 'relationship' => 'opportunity_leads',
346 'vname'=>'LBL_LEADS',
349 'campaigns' => array(
350 'name' => 'campaigns',
352 'relationship' => 'opportunities_campaign',
353 'module' => 'CampaignLog',
354 'bean_name' => 'CampaignLog',
355 'source' => 'non-db',
356 'vname' => 'LBL_CAMPAIGNS',
357 'reportable' => false
360 'campaign_link' => array(
361 'name' => 'campaign_link',
363 'relationship' => 'opportunities_campaign',
364 'vname' => 'LBL_CAMPAIGNS',
365 'link_type' => 'one',
366 'module' => 'Campaigns',
367 'bean_name' => 'Campaign',
368 'source' => 'non-db',
369 'reportable' => false
373 'name' => 'currencies',
375 'relationship' => 'opportunity_currencies',
377 'vname'=>'LBL_CURRENCIES',
382 'name' => 'idx_opp_name',
384 'fields' => array('name'),
387 'name' => 'idx_opp_assigned',
389 'fields' => array('assigned_user_id'),
392 'name' => 'idx_opp_id_deleted',
394 'fields' => array('id','deleted'),
398 'relationships' => array (
399 'opportunity_calls' => array('lhs_module'=> 'Opportunities', 'lhs_table'=> 'opportunities', 'lhs_key' => 'id',
400 'rhs_module'=> 'Calls', 'rhs_table'=> 'calls', 'rhs_key' => 'parent_id',
401 'relationship_type'=>'one-to-many', 'relationship_role_column'=>'parent_type',
402 'relationship_role_column_value'=>'Opportunities')
403 ,'opportunity_meetings' => array('lhs_module'=> 'Opportunities', 'lhs_table'=> 'opportunities', 'lhs_key' => 'id',
404 'rhs_module'=> 'Meetings', 'rhs_table'=> 'meetings', 'rhs_key' => 'parent_id',
405 'relationship_type'=>'one-to-many', 'relationship_role_column'=>'parent_type',
406 'relationship_role_column_value'=>'Opportunities')
407 ,'opportunity_tasks' => array('lhs_module'=> 'Opportunities', 'lhs_table'=> 'opportunities', 'lhs_key' => 'id',
408 'rhs_module'=> 'Tasks', 'rhs_table'=> 'tasks', 'rhs_key' => 'parent_id',
409 'relationship_type'=>'one-to-many', 'relationship_role_column'=>'parent_type',
410 'relationship_role_column_value'=>'Opportunities')
411 ,'opportunity_notes' => array('lhs_module'=> 'Opportunities', 'lhs_table'=> 'opportunities', 'lhs_key' => 'id',
412 'rhs_module'=> 'Notes', 'rhs_table'=> 'notes', 'rhs_key' => 'parent_id',
413 'relationship_type'=>'one-to-many', 'relationship_role_column'=>'parent_type',
414 'relationship_role_column_value'=>'Opportunities')
415 ,'opportunity_emails' => array('lhs_module'=> 'Opportunities', 'lhs_table'=> 'opportunities', 'lhs_key' => 'id',
416 'rhs_module'=> 'Emails', 'rhs_table'=> 'emails', 'rhs_key' => 'parent_id',
417 'relationship_type'=>'one-to-many', 'relationship_role_column'=>'parent_type',
418 'relationship_role_column_value'=>'Opportunities')
419 ,'opportunity_leads' => array('lhs_module'=> 'Opportunities', 'lhs_table'=> 'opportunities', 'lhs_key' => 'id',
420 'rhs_module'=> 'Leads', 'rhs_table'=> 'leads', 'rhs_key' => 'opportunity_id',
421 'relationship_type'=>'one-to-many')
422 ,'opportunity_currencies' => array('lhs_module'=> 'Opportunities', 'lhs_table'=> 'opportunities', 'lhs_key' => 'currency_id',
423 'rhs_module'=> 'Currencies', 'rhs_table'=> 'currencies', 'rhs_key' => 'id',
424 'relationship_type'=>'one-to-many')
425 ,'opportunities_assigned_user' =>
426 array('lhs_module'=> 'Users', 'lhs_table'=> 'users', 'lhs_key' => 'id',
427 'rhs_module'=> 'Opportunities', 'rhs_table'=> 'opportunities', 'rhs_key' => 'assigned_user_id',
428 'relationship_type'=>'one-to-many')
430 ,'opportunities_modified_user' =>
431 array('lhs_module'=> 'Users', 'lhs_table'=> 'users', 'lhs_key' => 'id',
432 'rhs_module'=> 'Opportunities', 'rhs_table'=> 'opportunities', 'rhs_key' => 'modified_user_id',
433 'relationship_type'=>'one-to-many')
435 ,'opportunities_created_by' =>
436 array('lhs_module'=> 'Users', 'lhs_table'=> 'users', 'lhs_key' => 'id',
437 'rhs_module'=> 'Opportunities', 'rhs_table'=> 'opportunities', 'rhs_key' => 'created_by',
438 'relationship_type'=>'one-to-many'),
439 'opportunities_campaign' =>
440 array('lhs_module'=> 'Campaigns', 'lhs_table'=> 'campaigns', 'lhs_key' => 'id',
441 'rhs_module'=> 'Opportunities', 'rhs_table'=> 'opportunities', 'rhs_key' => 'campaign_id',
442 'relationship_type'=>'one-to-many'),
444 //This enables optimistic locking for Saves From EditView
445 ,'optimistic_locking'=>true,
447 VardefManager::createVardef('Opportunities','Opportunity', array('default', 'assignable',