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