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