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