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 ********************************************************************************/
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',
124 'campaign_opportunities' =>
126 'name' => 'campaign_opportunities',
128 'vname' => 'LBL_CAMPAIGN_OPPORTUNITY',
129 'relationship' => 'campaign_opportunities',
130 'source' => 'non-db',
134 'name' => 'lead_source',
135 'vname' => 'LBL_LEAD_SOURCE',
137 'options' => 'lead_source_dom',
139 'comment' => 'Source of the opportunity',
140 'merge_filter' => 'enabled',
145 'vname' => 'LBL_AMOUNT',
146 //'function'=>array('vname'=>'getCurrencyType'),
147 'type' => 'currency',
148 // 'disable_num_format' => true,
149 'dbType' => 'double',
150 'comment' => 'Unconverted amount of the opportunity',
151 'importable' => 'required',
152 'duplicate_merge'=>'1',
154 'options' => 'numeric_range_search_dom',
155 'enable_range_search' => true,
159 'name' => 'amount_usdollar',
160 'vname' => 'LBL_AMOUNT_USDOLLAR',
161 'type' => 'currency',
163 'dbType' => 'double',
164 'disable_num_format' => true,
165 'duplicate_merge'=>'0',
167 'comment' => 'Formatted amount of the opportunity',
168 'studio' => array('wirelesseditview'=>false, 'wirelessdetailview'=>false, 'editview'=>false, 'detailview'=>false, 'quickcreate'=>false,),
172 'name' => 'currency_id',
174 'group'=>'currency_id',
175 'vname' => 'LBL_CURRENCY',
176 'function'=>array('name'=>'getCurrencyDropDown', 'returns'=>'html'),
178 'comment' => 'Currency used for display purposes'
182 'name'=>'currency_name',
184 'id_name'=>'currency_id',
185 'vname'=>'LBL_CURRENCY_NAME',
188 'table' => 'currencies',
189 'module'=>'Currencies',
190 'source' => 'non-db',
191 'function'=>array('name'=>'getCurrencyNameDropDown', 'returns'=>'html'),
193 'duplicate_merge' => 'disabled',
197 'name'=>'currency_symbol',
199 'id_name'=>'currency_id',
200 'vname'=>'LBL_CURRENCY_SYMBOL',
203 'table' => 'currencies',
204 'module'=>'Currencies',
205 'source' => 'non-db',
206 'function'=>array('name'=>'getCurrencySymbolDropDown', 'returns'=>'html'),
208 'duplicate_merge' => 'disabled',
212 'name' => 'date_closed',
213 'vname' => 'LBL_DATE_CLOSED',
216 'comment' => 'Expected or actual date the oppportunity will close',
217 'importable' => 'required',
219 'enable_range_search' => true,
220 'options' => 'date_range_search_dom',
224 'name' => 'next_step',
225 'vname' => 'LBL_NEXT_STEP',
228 'comment' => 'The next step in the sales process',
229 'merge_filter' => 'enabled',
233 'name' => 'sales_stage',
234 'vname' => 'LBL_SALES_STAGE',
236 'options' => 'sales_stage_dom',
239 'comment' => 'Indication of progression towards closure',
240 'merge_filter' => 'enabled',
241 'importable' => 'required',
246 'name' => 'probability',
247 'vname' => 'LBL_PROBABILITY',
249 'dbType' => 'double',
251 'comment' => 'The probability of closure',
252 'validation' => array('type' => 'range', 'min' => 0, 'max' => 100),
253 'merge_filter' => 'enabled',
257 'name' => 'accounts',
259 'relationship' => 'accounts_opportunities',
262 'module'=>'Accounts',
263 'bean_name'=>'Account',
264 'vname'=>'LBL_ACCOUNTS',
268 'name' => 'contacts',
270 'relationship' => 'opportunities_contacts',
272 'module'=>'Contacts',
273 'bean_name'=>'Contact',
274 'rel_fields'=>array('contact_role'=>array('type'=>'enum', 'options'=>'opportunity_relationship_type_dom')),
275 'vname'=>'LBL_CONTACTS',
281 'relationship' => 'opportunity_tasks',
283 'vname'=>'LBL_TASKS',
289 'relationship' => 'opportunity_notes',
291 'vname'=>'LBL_NOTES',
295 'name' => 'meetings',
297 'relationship' => 'opportunity_meetings',
299 'vname'=>'LBL_MEETINGS',
305 'relationship' => 'opportunity_calls',
307 'vname'=>'LBL_CALLS',
313 'relationship' => 'emails_opportunities_rel',/* reldef in emails */
315 'vname'=>'LBL_EMAILS',
319 'name' => 'documents',
321 'relationship' => 'documents_opportunities',
322 'source' => 'non-db',
323 'vname' => 'LBL_DOCUMENTS_SUBPANEL_TITLE',
330 'relationship' => 'projects_opportunities',
332 'vname'=>'LBL_PROJECTS',
338 'relationship' => 'opportunity_leads',
340 'vname'=>'LBL_LEADS',
343 'campaigns' => array(
344 'name' => 'campaigns',
346 'relationship' => 'opportunities_campaign',
347 'module' => 'CampaignLog',
348 'bean_name' => 'CampaignLog',
349 'source' => 'non-db',
350 'vname' => 'LBL_CAMPAIGNS',
351 'reportable' => false
354 'campaign_link' => array(
355 'name' => 'campaign_link',
357 'relationship' => 'opportunities_campaign',
358 'vname' => 'LBL_CAMPAIGNS',
359 'link_type' => 'one',
360 'module' => 'Campaigns',
361 'bean_name' => 'Campaign',
362 'source' => 'non-db',
363 'reportable' => false
367 'name' => 'currencies',
369 'relationship' => 'opportunity_currencies',
371 'vname'=>'LBL_CURRENCIES',
376 'name' => 'idx_opp_name',
378 'fields' => array('name'),
381 'name' => 'idx_opp_assigned',
383 'fields' => array('assigned_user_id'),
386 'name' => 'idx_opp_id_deleted',
388 'fields' => array('id','deleted'),
392 'relationships' => array (
393 'opportunity_calls' => array('lhs_module'=> 'Opportunities', 'lhs_table'=> 'opportunities', 'lhs_key' => 'id',
394 'rhs_module'=> 'Calls', 'rhs_table'=> 'calls', 'rhs_key' => 'parent_id',
395 'relationship_type'=>'one-to-many', 'relationship_role_column'=>'parent_type',
396 'relationship_role_column_value'=>'Opportunities')
397 ,'opportunity_meetings' => array('lhs_module'=> 'Opportunities', 'lhs_table'=> 'opportunities', 'lhs_key' => 'id',
398 'rhs_module'=> 'Meetings', 'rhs_table'=> 'meetings', 'rhs_key' => 'parent_id',
399 'relationship_type'=>'one-to-many', 'relationship_role_column'=>'parent_type',
400 'relationship_role_column_value'=>'Opportunities')
401 ,'opportunity_tasks' => array('lhs_module'=> 'Opportunities', 'lhs_table'=> 'opportunities', 'lhs_key' => 'id',
402 'rhs_module'=> 'Tasks', 'rhs_table'=> 'tasks', 'rhs_key' => 'parent_id',
403 'relationship_type'=>'one-to-many', 'relationship_role_column'=>'parent_type',
404 'relationship_role_column_value'=>'Opportunities')
405 ,'opportunity_notes' => array('lhs_module'=> 'Opportunities', 'lhs_table'=> 'opportunities', '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'=>'Opportunities')
409 ,'opportunity_emails' => array('lhs_module'=> 'Opportunities', 'lhs_table'=> 'opportunities', 'lhs_key' => 'id',
410 'rhs_module'=> 'Emails', 'rhs_table'=> 'emails', 'rhs_key' => 'parent_id',
411 'relationship_type'=>'one-to-many', 'relationship_role_column'=>'parent_type',
412 'relationship_role_column_value'=>'Opportunities')
413 ,'opportunity_leads' => array('lhs_module'=> 'Opportunities', 'lhs_table'=> 'opportunities', 'lhs_key' => 'id',
414 'rhs_module'=> 'Leads', 'rhs_table'=> 'leads', 'rhs_key' => 'opportunity_id',
415 'relationship_type'=>'one-to-many')
416 ,'opportunity_currencies' => array('lhs_module'=> 'Opportunities', 'lhs_table'=> 'opportunities', 'lhs_key' => 'currency_id',
417 'rhs_module'=> 'Currencies', 'rhs_table'=> 'currencies', 'rhs_key' => 'id',
418 'relationship_type'=>'one-to-many')
419 ,'opportunities_assigned_user' =>
420 array('lhs_module'=> 'Users', 'lhs_table'=> 'users', 'lhs_key' => 'id',
421 'rhs_module'=> 'Opportunities', 'rhs_table'=> 'opportunities', 'rhs_key' => 'assigned_user_id',
422 'relationship_type'=>'one-to-many')
424 ,'opportunities_modified_user' =>
425 array('lhs_module'=> 'Users', 'lhs_table'=> 'users', 'lhs_key' => 'id',
426 'rhs_module'=> 'Opportunities', 'rhs_table'=> 'opportunities', 'rhs_key' => 'modified_user_id',
427 'relationship_type'=>'one-to-many')
429 ,'opportunities_created_by' =>
430 array('lhs_module'=> 'Users', 'lhs_table'=> 'users', 'lhs_key' => 'id',
431 'rhs_module'=> 'Opportunities', 'rhs_table'=> 'opportunities', 'rhs_key' => 'created_by',
432 'relationship_type'=>'one-to-many'),
433 'opportunities_campaign' =>
434 array('lhs_module'=> 'Campaigns', 'lhs_table'=> 'campaigns', 'lhs_key' => 'id',
435 'rhs_module'=> 'Opportunities', 'rhs_table'=> 'opportunities', 'rhs_key' => 'campaign_id',
436 'relationship_type'=>'one-to-many'),
438 //This enables optimistic locking for Saves From EditView
439 ,'optimistic_locking'=>true,
441 VardefManager::createVardef('Opportunities','Opportunity', array('default', 'assignable',