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