]> CyberLeo.Net >> Repos - Github/sugarcrm.git/blob - modules/Opportunities/vardefs.php
Merge pull request #100 from collinlee/master
[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, '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     'studio' => array('wirelesseditview'=>false, 'wirelessdetailview'=>false, 'editview'=>false, 'detailview'=>false, 'quickcreate'=>false,),
168   ),
169   'currency_id' =>
170   array (
171     'name' => 'currency_id',
172     'type' => 'id',
173     'group'=>'currency_id',
174     'vname' => 'LBL_CURRENCY',
175         'function'=>array('name'=>'getCurrencyDropDown', 'returns'=>'html'),
176     'reportable'=>false,
177     'comment' => 'Currency used for display purposes'
178   ),
179   'currency_name'=>
180            array(
181                 'name'=>'currency_name',
182                 'rname'=>'name',
183                 'id_name'=>'currency_id',
184                 'vname'=>'LBL_CURRENCY_NAME',
185                 'type'=>'relate',
186                 'isnull'=>'true',
187                 'table' => 'currencies',
188                 'module'=>'Currencies',
189                 'source' => 'non-db',
190         'function'=>array('name'=>'getCurrencyNameDropDown', 'returns'=>'html'),
191         'studio' => 'false',
192             'duplicate_merge' => 'disabled',
193         ),
194    'currency_symbol'=>
195            array(
196                 'name'=>'currency_symbol',
197                 'rname'=>'symbol',
198                 'id_name'=>'currency_id',
199                 'vname'=>'LBL_CURRENCY_SYMBOL',
200                 'type'=>'relate',
201                 'isnull'=>'true',
202                 'table' => 'currencies',
203                 'module'=>'Currencies',
204                 'source' => 'non-db',
205         'function'=>array('name'=>'getCurrencySymbolDropDown', 'returns'=>'html'),
206         'studio' => 'false',
207             'duplicate_merge' => 'disabled',
208         ),
209   'date_closed' =>
210   array (
211     'name' => 'date_closed',
212     'vname' => 'LBL_DATE_CLOSED',
213     'type' => 'date',
214     'audited'=>true,
215     'comment' => 'Expected or actual date the oppportunity will close',
216         'importable' => 'required',
217     'required' => true,
218     'enable_range_search' => true,
219     'options' => 'date_range_search_dom',
220   ),
221   'next_step' =>
222   array (
223     'name' => 'next_step',
224     'vname' => 'LBL_NEXT_STEP',
225     'type' => 'varchar',
226     'len' => '100',
227     'comment' => 'The next step in the sales process',
228     'merge_filter' => 'enabled',
229   ),
230   'sales_stage' =>
231   array (
232     'name' => 'sales_stage',
233     'vname' => 'LBL_SALES_STAGE',
234     'type' => 'enum',
235     'options' => 'sales_stage_dom',
236     'len' => '255',
237     'audited'=>true,
238     'comment' => 'Indication of progression towards closure',
239     'merge_filter' => 'enabled',
240     'importable' => 'required',
241     'required' => true,
242   ),
243   'probability' =>
244   array (
245     'name' => 'probability',
246     'vname' => 'LBL_PROBABILITY',
247     'type' => 'int',
248     'dbType' => 'double',
249     'audited'=>true,
250     'comment' => 'The probability of closure',
251     'validation' => array('type' => 'range', 'min' => 0, 'max' => 100),
252     'merge_filter' => 'enabled',
253   ),
254   'accounts' =>
255   array (
256         'name' => 'accounts',
257     'type' => 'link',
258     'relationship' => 'accounts_opportunities',
259     'source'=>'non-db',
260     'link_type'=>'one',
261     'module'=>'Accounts',
262     'bean_name'=>'Account',
263                 'vname'=>'LBL_ACCOUNTS',
264   ),
265   'contacts' =>
266   array (
267         'name' => 'contacts',
268     'type' => 'link',
269     'relationship' => 'opportunities_contacts',
270     'source'=>'non-db',
271     'module'=>'Contacts',
272     'bean_name'=>'Contact',
273     'rel_fields'=>array('contact_role'=>array('type'=>'enum', 'options'=>'opportunity_relationship_type_dom')),
274         'vname'=>'LBL_CONTACTS',
275   ),
276   'tasks' =>
277   array (
278         'name' => 'tasks',
279     'type' => 'link',
280     'relationship' => 'opportunity_tasks',
281     'source'=>'non-db',
282                 'vname'=>'LBL_TASKS',
283   ),
284   'notes' =>
285   array (
286         'name' => 'notes',
287     'type' => 'link',
288     'relationship' => 'opportunity_notes',
289     'source'=>'non-db',
290                 'vname'=>'LBL_NOTES',
291   ),
292   'meetings' =>
293   array (
294         'name' => 'meetings',
295     'type' => 'link',
296     'relationship' => 'opportunity_meetings',
297     'source'=>'non-db',
298                 'vname'=>'LBL_MEETINGS',
299   ),
300   'calls' =>
301   array (
302         'name' => 'calls',
303     'type' => 'link',
304     'relationship' => 'opportunity_calls',
305     'source'=>'non-db',
306                 'vname'=>'LBL_CALLS',
307   ),
308   'emails' =>
309   array (
310         'name' => 'emails',
311     'type' => 'link',
312     'relationship' => 'emails_opportunities_rel',/* reldef in emails */
313     'source'=>'non-db',
314                 'vname'=>'LBL_EMAILS',
315   ),
316   'documents'=>
317   array (
318       'name' => 'documents',
319       'type' => 'link',
320       'relationship' => 'documents_opportunities',
321       'source' => 'non-db',
322       'vname' => 'LBL_DOCUMENTS_SUBPANEL_TITLE',
323   ),
324
325   'project' =>
326   array (
327         'name' => 'project',
328     'type' => 'link',
329     'relationship' => 'projects_opportunities',
330     'source'=>'non-db',
331                 'vname'=>'LBL_PROJECTS',
332   ),
333   'leads' =>
334   array (
335         'name' => 'leads',
336     'type' => 'link',
337     'relationship' => 'opportunity_leads',
338     'source'=>'non-db',
339                 'vname'=>'LBL_LEADS',
340   ),
341
342     'campaigns' => 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         'reportable' => false
351     ),
352
353     'campaign_link' => 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         'reportable' => false
363     ),
364   'currencies' =>
365   array (
366     'name' => 'currencies',
367     'type' => 'link',
368     'relationship' => 'opportunity_currencies',
369     'source'=>'non-db',
370     'vname'=>'LBL_CURRENCIES',
371   ),
372 ),
373                 'indices' => array (
374                         array(
375                                 'name' => 'idx_opp_name',
376                                 'type' => 'index',
377                                 'fields' => array('name'),
378                         ),
379                         array(
380                                 'name' => 'idx_opp_assigned',
381                                 'type' => 'index',
382                                 'fields' => array('assigned_user_id'),
383                         ),
384                         array(
385                                 'name' => 'idx_opp_id_deleted',
386                                 'type' => 'index',
387                                 'fields' => array('id','deleted'),
388                         ),
389                 ),
390
391  'relationships' => array (
392         'opportunity_calls' => array('lhs_module'=> 'Opportunities', 'lhs_table'=> 'opportunities', 'lhs_key' => 'id',
393                                                           'rhs_module'=> 'Calls', 'rhs_table'=> 'calls', 'rhs_key' => 'parent_id',
394                                                           'relationship_type'=>'one-to-many', 'relationship_role_column'=>'parent_type',
395                                                           'relationship_role_column_value'=>'Opportunities')
396         ,'opportunity_meetings' => array('lhs_module'=> 'Opportunities', 'lhs_table'=> 'opportunities', 'lhs_key' => 'id',
397                                                           'rhs_module'=> 'Meetings', 'rhs_table'=> 'meetings', 'rhs_key' => 'parent_id',
398                                                           'relationship_type'=>'one-to-many', 'relationship_role_column'=>'parent_type',
399                                                           'relationship_role_column_value'=>'Opportunities')
400         ,'opportunity_tasks' => array('lhs_module'=> 'Opportunities', 'lhs_table'=> 'opportunities', 'lhs_key' => 'id',
401                                                           'rhs_module'=> 'Tasks', 'rhs_table'=> 'tasks', 'rhs_key' => 'parent_id',
402                                                           'relationship_type'=>'one-to-many', 'relationship_role_column'=>'parent_type',
403                                                           'relationship_role_column_value'=>'Opportunities')
404         ,'opportunity_notes' => array('lhs_module'=> 'Opportunities', 'lhs_table'=> 'opportunities', 'lhs_key' => 'id',
405                                                           'rhs_module'=> 'Notes', 'rhs_table'=> 'notes', 'rhs_key' => 'parent_id',
406                                                           'relationship_type'=>'one-to-many', 'relationship_role_column'=>'parent_type',
407                                                           'relationship_role_column_value'=>'Opportunities')
408         ,'opportunity_emails' => array('lhs_module'=> 'Opportunities', 'lhs_table'=> 'opportunities', 'lhs_key' => 'id',
409                                                           'rhs_module'=> 'Emails', 'rhs_table'=> 'emails', 'rhs_key' => 'parent_id',
410                                                           'relationship_type'=>'one-to-many', 'relationship_role_column'=>'parent_type',
411                                                           'relationship_role_column_value'=>'Opportunities')
412         ,'opportunity_leads' => array('lhs_module'=> 'Opportunities', 'lhs_table'=> 'opportunities', 'lhs_key' => 'id',
413                                                           'rhs_module'=> 'Leads', 'rhs_table'=> 'leads', 'rhs_key' => 'opportunity_id',
414                                                           'relationship_type'=>'one-to-many')
415     ,'opportunity_currencies' => array('lhs_module'=> 'Opportunities', 'lhs_table'=> 'opportunities', 'lhs_key' => 'currency_id',
416                               'rhs_module'=> 'Currencies', 'rhs_table'=> 'currencies', 'rhs_key' => 'id',
417                               'relationship_type'=>'one-to-many')
418   ,'opportunities_assigned_user' =>
419    array('lhs_module'=> 'Users', 'lhs_table'=> 'users', 'lhs_key' => 'id',
420    'rhs_module'=> 'Opportunities', 'rhs_table'=> 'opportunities', 'rhs_key' => 'assigned_user_id',
421    'relationship_type'=>'one-to-many')
422
423    ,'opportunities_modified_user' =>
424    array('lhs_module'=> 'Users', 'lhs_table'=> 'users', 'lhs_key' => 'id',
425    'rhs_module'=> 'Opportunities', 'rhs_table'=> 'opportunities', 'rhs_key' => 'modified_user_id',
426    'relationship_type'=>'one-to-many')
427
428    ,'opportunities_created_by' =>
429    array('lhs_module'=> 'Users', 'lhs_table'=> 'users', 'lhs_key' => 'id',
430    'rhs_module'=> 'Opportunities', 'rhs_table'=> 'opportunities', 'rhs_key' => 'created_by',
431    'relationship_type'=>'one-to-many'),
432 'opportunities_campaign' =>
433    array('lhs_module'=> 'Campaigns', 'lhs_table'=> 'campaigns', 'lhs_key' => 'id',
434    'rhs_module'=> 'Opportunities', 'rhs_table'=> 'opportunities', 'rhs_key' => 'campaign_id',
435    'relationship_type'=>'one-to-many'),
436 )
437 //This enables optimistic locking for Saves From EditView
438         ,'optimistic_locking'=>true,
439 );
440 VardefManager::createVardef('Opportunities','Opportunity', array('default', 'assignable',
441 ));
442 ?>