]> CyberLeo.Net >> Repos - Github/sugarcrm.git/blob - modules/Opportunities/vardefs.php
Release 6.5.0
[Github/sugarcrm.git] / modules / Opportunities / 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-2012 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
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',
41                 'fields' => array (
42   'name' =>
43   array (
44     'name' => 'name',
45     'vname' => 'LBL_OPPORTUNITY_NAME',
46     'type' => 'name',
47     'dbType' => 'varchar',
48     'len' => '50',
49     'unified_search' => true,
50     'full_text_search' => array('boost' => 3),
51     'comment' => 'Name of the opportunity',
52     'merge_filter' => 'selected',
53     'importable' => 'required',
54     'required' => true,
55   ),
56   'opportunity_type' =>
57   array (
58     'name' => 'opportunity_type',
59     'vname' => 'LBL_TYPE',
60     'type' => 'enum',
61     'options'=> 'opportunity_type_dom',
62     'len' => '255',
63     'audited'=>true,
64     'comment' => 'Type of opportunity (ex: Existing, New)',
65     'merge_filter' => 'enabled',
66   ),
67   'account_name' =>
68   array (
69     'name' => 'account_name',
70     'rname' => 'name',
71     'id_name' => 'account_id',
72     'vname' => 'LBL_ACCOUNT_NAME',
73     'type' => 'relate',
74     'table' => 'accounts',
75     'join_name'=>'accounts',
76     'isnull' => 'true',
77     'module' => 'Accounts',
78     'dbType' => 'varchar',
79     'link'=>'accounts',
80     'len' => '255',
81          'source'=>'non-db',
82          'unified_search' => true,
83          'required' => true,
84          'importable' => 'required',
85      'required' => true,
86   ),
87   'account_id' =>
88    array (
89     'name' => 'account_id',
90     'vname' => 'LBL_ACCOUNT_ID',
91     'type' => 'id',
92     'source'=>'non-db',
93     'audited'=>true,
94   ),
95   'campaign_id' =>
96       array (
97         'name' => 'campaign_id',
98         'comment' => 'Campaign that generated lead',
99         'vname'=>'LBL_CAMPAIGN_ID',
100         'rname' => 'id',
101         'type' => 'id',
102         'dbType'=>'id',
103         'table' => 'campaigns',
104         'isnull' => 'true',
105         'module' => 'Campaigns',
106         //'dbType' => 'char',
107         'reportable'=>false,
108         'massupdate' => false,
109         'duplicate_merge'=> 'disabled',
110       ),
111   'campaign_name'=>
112            array(
113                 'name'=>'campaign_name',
114                 'rname'=>'name',
115                 'id_name'=>'campaign_id',
116                 'vname'=>'LBL_CAMPAIGN',
117                 'type'=>'relate',
118                 'link' => 'campaign_opportunities',
119                 'isnull'=>'true',
120                 'table' => 'campaigns',
121                 'module'=>'Campaigns',
122                 'source' => 'non-db',
123         ),
124   'campaign_opportunities' =>
125                 array (
126                 'name' => 'campaign_opportunities',
127                 'type' => 'link',
128                 'vname' => 'LBL_CAMPAIGN_OPPORTUNITY',
129                 'relationship' => 'campaign_opportunities',
130                 'source' => 'non-db',
131     ),
132   'lead_source' =>
133   array (
134     'name' => 'lead_source',
135     'vname' => 'LBL_LEAD_SOURCE',
136     'type' => 'enum',
137     'options' => 'lead_source_dom',
138     'len' => '50',
139     'comment' => 'Source of the opportunity',
140     'merge_filter' => 'enabled',
141   ),
142   'amount' =>
143   array (
144     'name' => 'amount',
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',
153     'required' => true,
154         'options' => 'numeric_range_search_dom',
155     'enable_range_search' => true,
156   ),
157   'amount_usdollar' =>
158   array (
159     'name' => 'amount_usdollar',
160     'vname' => 'LBL_AMOUNT_USDOLLAR',
161     'type' => 'currency',
162     'group'=>'amount',
163     'dbType' => 'double',
164     'disable_num_format' => true,
165     'duplicate_merge'=>'0',
166     'audited'=>true,
167     'comment' => 'Formatted amount of the opportunity',
168     'studio' => array('wirelesseditview'=>false, 'wirelessdetailview'=>false, 'editview'=>false, 'detailview'=>false, 'quickcreate'=>false,),
169   ),
170   'currency_id' =>
171   array (
172     'name' => 'currency_id',
173     'type' => 'id',
174     'group'=>'currency_id',
175     'vname' => 'LBL_CURRENCY',
176         'function'=>array('name'=>'getCurrencyDropDown', 'returns'=>'html'),
177     'reportable'=>false,
178     'comment' => 'Currency used for display purposes'
179   ),
180   'currency_name'=>
181            array(
182                 'name'=>'currency_name',
183                 'rname'=>'name',
184                 'id_name'=>'currency_id',
185                 'vname'=>'LBL_CURRENCY_NAME',
186                 'type'=>'relate',
187                 'isnull'=>'true',
188                 'table' => 'currencies',
189                 'module'=>'Currencies',
190                 'source' => 'non-db',
191         'function'=>array('name'=>'getCurrencyNameDropDown', 'returns'=>'html'),
192         'studio' => 'false',
193             'duplicate_merge' => 'disabled',
194         ),
195    'currency_symbol'=>
196            array(
197                 'name'=>'currency_symbol',
198                 'rname'=>'symbol',
199                 'id_name'=>'currency_id',
200                 'vname'=>'LBL_CURRENCY_SYMBOL',
201                 'type'=>'relate',
202                 'isnull'=>'true',
203                 'table' => 'currencies',
204                 'module'=>'Currencies',
205                 'source' => 'non-db',
206         'function'=>array('name'=>'getCurrencySymbolDropDown', 'returns'=>'html'),
207         'studio' => 'false',
208             'duplicate_merge' => 'disabled',
209         ),
210   'date_closed' =>
211   array (
212     'name' => 'date_closed',
213     'vname' => 'LBL_DATE_CLOSED',
214     'type' => 'date',
215     'audited'=>true,
216     'comment' => 'Expected or actual date the oppportunity will close',
217         'importable' => 'required',
218     'required' => true,
219     'enable_range_search' => true,
220     'options' => 'date_range_search_dom',
221   ),
222   'next_step' =>
223   array (
224     'name' => 'next_step',
225     'vname' => 'LBL_NEXT_STEP',
226     'type' => 'varchar',
227     'len' => '100',
228     'comment' => 'The next step in the sales process',
229     'merge_filter' => 'enabled',
230   ),
231   'sales_stage' =>
232   array (
233     'name' => 'sales_stage',
234     'vname' => 'LBL_SALES_STAGE',
235     'type' => 'enum',
236     'options' => 'sales_stage_dom',
237     'len' => '255',
238     'audited'=>true,
239     'comment' => 'Indication of progression towards closure',
240     'merge_filter' => 'enabled',
241     'importable' => 'required',
242     'required' => true,
243   ),
244   'probability' =>
245   array (
246     'name' => 'probability',
247     'vname' => 'LBL_PROBABILITY',
248     'type' => 'int',
249     'dbType' => 'double',
250     'audited'=>true,
251     'comment' => 'The probability of closure',
252     'validation' => array('type' => 'range', 'min' => 0, 'max' => 100),
253     'merge_filter' => 'enabled',
254   ),
255   'accounts' =>
256   array (
257         'name' => 'accounts',
258     'type' => 'link',
259     'relationship' => 'accounts_opportunities',
260     'source'=>'non-db',
261     'link_type'=>'one',
262     'module'=>'Accounts',
263     'bean_name'=>'Account',
264                 'vname'=>'LBL_ACCOUNTS',
265   ),
266   'contacts' =>
267   array (
268         'name' => 'contacts',
269     'type' => 'link',
270     'relationship' => 'opportunities_contacts',
271     'source'=>'non-db',
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',
276   ),
277   'tasks' =>
278   array (
279         'name' => 'tasks',
280     'type' => 'link',
281     'relationship' => 'opportunity_tasks',
282     'source'=>'non-db',
283                 'vname'=>'LBL_TASKS',
284   ),
285   'notes' =>
286   array (
287         'name' => 'notes',
288     'type' => 'link',
289     'relationship' => 'opportunity_notes',
290     'source'=>'non-db',
291                 'vname'=>'LBL_NOTES',
292   ),
293   'meetings' =>
294   array (
295         'name' => 'meetings',
296     'type' => 'link',
297     'relationship' => 'opportunity_meetings',
298     'source'=>'non-db',
299                 'vname'=>'LBL_MEETINGS',
300   ),
301   'calls' =>
302   array (
303         'name' => 'calls',
304     'type' => 'link',
305     'relationship' => 'opportunity_calls',
306     'source'=>'non-db',
307                 'vname'=>'LBL_CALLS',
308   ),
309   'emails' =>
310   array (
311         'name' => 'emails',
312     'type' => 'link',
313     'relationship' => 'emails_opportunities_rel',/* reldef in emails */
314     'source'=>'non-db',
315                 'vname'=>'LBL_EMAILS',
316   ),
317   'documents'=>
318   array (
319       'name' => 'documents',
320       'type' => 'link',
321       'relationship' => 'documents_opportunities',
322       'source' => 'non-db',
323       'vname' => 'LBL_DOCUMENTS_SUBPANEL_TITLE',
324   ),
325
326   'project' =>
327   array (
328         'name' => 'project',
329     'type' => 'link',
330     'relationship' => 'projects_opportunities',
331     'source'=>'non-db',
332                 'vname'=>'LBL_PROJECTS',
333   ),
334   'leads' =>
335   array (
336         'name' => 'leads',
337     'type' => 'link',
338     'relationship' => 'opportunity_leads',
339     'source'=>'non-db',
340                 'vname'=>'LBL_LEADS',
341   ),
342
343     'campaigns' => array(
344         'name' => 'campaigns',
345         'type' => 'link',
346         'relationship' => 'opportunities_campaign',
347         'module' => 'CampaignLog',
348         'bean_name' => 'CampaignLog',
349         'source' => 'non-db',
350         'vname' => 'LBL_CAMPAIGNS',
351         'reportable' => false
352     ),
353
354     'campaign_link' => array(
355         'name' => 'campaign_link',
356         'type' => '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
364     ),
365   'currencies' =>
366   array (
367     'name' => 'currencies',
368     'type' => 'link',
369     'relationship' => 'opportunity_currencies',
370     'source'=>'non-db',
371     'vname'=>'LBL_CURRENCIES',
372   ),
373 ),
374                 'indices' => array (
375                         array(
376                                 'name' => 'idx_opp_name',
377                                 'type' => 'index',
378                                 'fields' => array('name'),
379                         ),
380                         array(
381                                 'name' => 'idx_opp_assigned',
382                                 'type' => 'index',
383                                 'fields' => array('assigned_user_id'),
384                         ),
385                         array(
386                                 'name' => 'idx_opp_id_deleted',
387                                 'type' => 'index',
388                                 'fields' => array('id','deleted'),
389                         ),
390                 ),
391
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')
423
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')
428
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'),
437 )
438 //This enables optimistic locking for Saves From EditView
439         ,'optimistic_locking'=>true,
440 );
441 VardefManager::createVardef('Opportunities','Opportunity', array('default', 'assignable',
442 ));
443 ?>