2 if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
3 /*********************************************************************************
4 * SugarCRM is a customer relationship management program developed by
5 * SugarCRM, Inc. Copyright (C) 2004-2011 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,'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 'comment' => 'Name of the opportunity',
51 'merge_filter' => 'selected',
52 'importable' => 'required',
57 'name' => 'opportunity_type',
58 'vname' => 'LBL_TYPE',
60 'options'=> 'opportunity_type_dom',
63 'comment' => 'Type of opportunity (ex: Existing, New)',
64 'merge_filter' => 'enabled',
68 'name' => 'account_name',
70 'id_name' => 'account_id',
71 'vname' => 'LBL_ACCOUNT_NAME',
73 'table' => 'accounts',
74 'join_name'=>'accounts',
76 'module' => 'Accounts',
77 'dbType' => 'varchar',
81 'unified_search' => true,
83 'importable' => 'required',
88 'name' => 'account_id',
89 'vname' => 'LBL_ACCOUNT_ID',
96 'name' => 'campaign_id',
97 'comment' => 'Campaign that generated lead',
98 'vname'=>'LBL_CAMPAIGN_ID',
102 'table' => 'campaigns',
104 'module' => 'Campaigns',
105 //'dbType' => 'char',
107 'massupdate' => false,
108 'duplicate_merge'=> 'disabled',
112 'name'=>'campaign_name',
114 'id_name'=>'campaign_id',
115 'vname'=>'LBL_CAMPAIGN',
117 'link' => 'campaign_opportunities',
119 'table' => 'campaigns',
120 'module'=>'Campaigns',
121 'source' => 'non-db',
123 'campaign_opportunities' =>
125 'name' => 'campaign_opportunities',
127 'vname' => 'LBL_CAMPAIGN_OPPORTUNITY',
128 'relationship' => 'campaign_opportunities',
129 'source' => 'non-db',
133 'name' => 'lead_source',
134 'vname' => 'LBL_LEAD_SOURCE',
136 'options' => 'lead_source_dom',
138 'comment' => 'Source of the opportunity',
139 'merge_filter' => 'enabled',
144 'vname' => 'LBL_AMOUNT',
145 //'function'=>array('vname'=>'getCurrencyType'),
146 'type' => 'currency',
147 // 'disable_num_format' => true,
148 'dbType' => 'double',
149 'comment' => 'Unconverted amount of the opportunity',
150 'importable' => 'required',
151 'duplicate_merge'=>'1',
156 'name' => 'amount_usdollar',
157 'vname' => 'LBL_AMOUNT_USDOLLAR',
158 'type' => 'currency',
160 'dbType' => 'double',
161 'disable_num_format' => true,
162 'duplicate_merge'=>'0',
164 'comment' => 'Formatted amount of the opportunity'
168 'name' => 'currency_id',
170 'group'=>'currency_id',
171 'vname' => 'LBL_CURRENCY',
172 'function'=>array('name'=>'getCurrencyDropDown', 'returns'=>'html'),
174 'comment' => 'Currency used for display purposes'
178 'name'=>'currency_name',
180 'id_name'=>'currency_id',
181 'vname'=>'LBL_CURRENCY_NAME',
184 'table' => 'currencies',
185 'module'=>'Currencies',
186 'source' => 'non-db',
187 'function'=>array('name'=>'getCurrencyNameDropDown', 'returns'=>'html'),
189 'duplicate_merge' => 'disabled',
193 'name'=>'currency_symbol',
195 'id_name'=>'currency_id',
196 'vname'=>'LBL_CURRENCY_SYMBOL',
199 'table' => 'currencies',
200 'module'=>'Currencies',
201 'source' => 'non-db',
202 'function'=>array('name'=>'getCurrencySymbolDropDown', 'returns'=>'html'),
204 'duplicate_merge' => 'disabled',
208 'name' => 'date_closed',
209 'vname' => 'LBL_DATE_CLOSED',
212 'comment' => 'Expected or actual date the oppportunity will close',
213 'importable' => 'required',
218 'name' => 'next_step',
219 'vname' => 'LBL_NEXT_STEP',
222 'comment' => 'The next step in the sales process',
223 'merge_filter' => 'enabled',
227 'name' => 'sales_stage',
228 'vname' => 'LBL_SALES_STAGE',
230 'options' => 'sales_stage_dom',
233 'comment' => 'Indication of progression towards closure',
234 'merge_filter' => 'enabled',
235 'importable' => 'required',
240 'name' => 'probability',
241 'vname' => 'LBL_PROBABILITY',
243 'dbType' => 'double',
245 'comment' => 'The probability of closure',
246 'validation' => array('type' => 'range', 'min' => 0, 'max' => 100),
247 'merge_filter' => 'enabled',
251 'name' => 'accounts',
253 'relationship' => 'accounts_opportunities',
256 'module'=>'Accounts',
257 'bean_name'=>'Account',
258 'vname'=>'LBL_ACCOUNTS',
262 'name' => 'contacts',
264 'relationship' => 'opportunities_contacts',
266 'module'=>'Contacts',
267 'bean_name'=>'Contact',
268 'rel_fields'=>array('contact_role'=>array('type'=>'enum', 'options'=>'opportunity_relationship_type_dom')),
269 'vname'=>'LBL_CONTACTS',
275 'relationship' => 'opportunity_tasks',
277 'vname'=>'LBL_TASKS',
283 'relationship' => 'opportunity_notes',
285 'vname'=>'LBL_NOTES',
289 'name' => 'meetings',
291 'relationship' => 'opportunity_meetings',
293 'vname'=>'LBL_MEETINGS',
299 'relationship' => 'opportunity_calls',
301 'vname'=>'LBL_CALLS',
307 'relationship' => 'emails_opportunities_rel',/* reldef in emails */
309 'vname'=>'LBL_EMAILS',
316 'relationship' => 'projects_opportunities',
318 'vname'=>'LBL_PROJECTS',
324 'relationship' => 'opportunity_leads',
326 'vname'=>'LBL_LEADS',
331 'name' => 'campaigns',
333 'relationship' => 'opportunities_campaign',
334 'module'=>'CampaignLog',
335 'bean_name'=>'CampaignLog',
337 'vname'=>'LBL_CAMPAIGNS',
342 'name' => 'campaign_link',
344 'relationship' => 'opportunities_campaign',
345 'vname' => 'LBL_CAMPAIGNS',
346 'link_type' => 'one',
347 'module'=>'Campaigns',
348 'bean_name'=>'Campaign',
353 'name' => 'currencies',
355 'relationship' => 'opportunity_currencies',
357 'vname'=>'LBL_CURRENCIES',
362 'name' => 'idx_opp_name',
364 'fields' => array('name'),
367 'name' => 'idx_opp_assigned',
369 'fields' => array('assigned_user_id'),
373 'relationships' => array (
374 'opportunity_calls' => array('lhs_module'=> 'Opportunities', 'lhs_table'=> 'opportunities', 'lhs_key' => 'id',
375 'rhs_module'=> 'Calls', 'rhs_table'=> 'calls', 'rhs_key' => 'parent_id',
376 'relationship_type'=>'one-to-many', 'relationship_role_column'=>'parent_type',
377 'relationship_role_column_value'=>'Opportunities')
378 ,'opportunity_meetings' => array('lhs_module'=> 'Opportunities', 'lhs_table'=> 'opportunities', 'lhs_key' => 'id',
379 'rhs_module'=> 'Meetings', 'rhs_table'=> 'meetings', 'rhs_key' => 'parent_id',
380 'relationship_type'=>'one-to-many', 'relationship_role_column'=>'parent_type',
381 'relationship_role_column_value'=>'Opportunities')
382 ,'opportunity_tasks' => array('lhs_module'=> 'Opportunities', 'lhs_table'=> 'opportunities', 'lhs_key' => 'id',
383 'rhs_module'=> 'Tasks', 'rhs_table'=> 'tasks', 'rhs_key' => 'parent_id',
384 'relationship_type'=>'one-to-many', 'relationship_role_column'=>'parent_type',
385 'relationship_role_column_value'=>'Opportunities')
386 ,'opportunity_notes' => array('lhs_module'=> 'Opportunities', 'lhs_table'=> 'opportunities', 'lhs_key' => 'id',
387 'rhs_module'=> 'Notes', 'rhs_table'=> 'notes', 'rhs_key' => 'parent_id',
388 'relationship_type'=>'one-to-many', 'relationship_role_column'=>'parent_type',
389 'relationship_role_column_value'=>'Opportunities')
390 ,'opportunity_emails' => array('lhs_module'=> 'Opportunities', 'lhs_table'=> 'opportunities', 'lhs_key' => 'id',
391 'rhs_module'=> 'Emails', 'rhs_table'=> 'emails', 'rhs_key' => 'parent_id',
392 'relationship_type'=>'one-to-many', 'relationship_role_column'=>'parent_type',
393 'relationship_role_column_value'=>'Opportunities')
394 ,'opportunity_leads' => array('lhs_module'=> 'Opportunities', 'lhs_table'=> 'opportunities', 'lhs_key' => 'id',
395 'rhs_module'=> 'Leads', 'rhs_table'=> 'leads', 'rhs_key' => 'opportunity_id',
396 'relationship_type'=>'one-to-many')
397 ,'opportunity_currencies' => array('lhs_module'=> 'Opportunities', 'lhs_table'=> 'opportunities', 'lhs_key' => 'currency_id',
398 'rhs_module'=> 'Currencies', 'rhs_table'=> 'currencies', 'rhs_key' => 'id',
399 'relationship_type'=>'one-to-many')
400 ,'opportunities_assigned_user' =>
401 array('lhs_module'=> 'Users', 'lhs_table'=> 'users', 'lhs_key' => 'id',
402 'rhs_module'=> 'Opportunities', 'rhs_table'=> 'opportunities', 'rhs_key' => 'assigned_user_id',
403 'relationship_type'=>'one-to-many')
405 ,'opportunities_modified_user' =>
406 array('lhs_module'=> 'Users', 'lhs_table'=> 'users', 'lhs_key' => 'id',
407 'rhs_module'=> 'Opportunities', 'rhs_table'=> 'opportunities', 'rhs_key' => 'modified_user_id',
408 'relationship_type'=>'one-to-many')
410 ,'opportunities_created_by' =>
411 array('lhs_module'=> 'Users', 'lhs_table'=> 'users', 'lhs_key' => 'id',
412 'rhs_module'=> 'Opportunities', 'rhs_table'=> 'opportunities', 'rhs_key' => 'created_by',
413 'relationship_type'=>'one-to-many'),
414 'opportunities_campaign' =>
415 array('lhs_module'=> 'campaigns', 'lhs_table'=> 'campaigns', 'lhs_key' => 'id',
416 'rhs_module'=> 'Opportunities', 'rhs_table'=> 'opportunities', 'rhs_key' => 'campaign_id',
417 'relationship_type'=>'one-to-many'),
419 //This enables optimistic locking for Saves From EditView
420 ,'optimistic_locking'=>true,
422 VardefManager::createVardef('Opportunities','Opportunity', array('default', 'assignable',