]> CyberLeo.Net >> Repos - Github/sugarcrm.git/blob - modules/Leads/vardefs.php
Release 6.2.0
[Github/sugarcrm.git] / modules / Leads / 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 $dictionary['Lead'] = array('table' => 'leads','audited'=>true, 'unified_search' => true, 'unified_search_default_enabled' => true, 'duplicate_merge'=>true,
39                 'comment' => 'Leads are persons of interest early in a sales cycle', 'fields' => array (
40
41
42   'converted' =>
43   array (
44     'name' => 'converted',
45     'vname' => 'LBL_CONVERTED',
46     'type' => 'bool',
47     'default' => '0',
48     'comment' => 'Has Lead been converted to a Contact (and other Sugar objects)'
49   ),
50   'refered_by' =>
51   array (
52     'name' => 'refered_by',
53     'vname' => 'LBL_REFERED_BY',
54     'type' => 'varchar',
55     'len' => '100',
56     'comment' => 'Identifies who refered the lead',
57     'merge_filter' => 'enabled',
58   ),
59   'lead_source' =>
60   array (
61     'name' => 'lead_source',
62     'vname' => 'LBL_LEAD_SOURCE',
63     'type' => 'enum',
64     'options'=> 'lead_source_dom',
65     'len' => '100',
66         'audited'=>true,
67         'comment' => 'Lead source (ex: Web, print)',
68     'merge_filter' => 'enabled',
69   ),
70   'lead_source_description' =>
71   array (
72     'name' => 'lead_source_description',
73     'vname' => 'LBL_LEAD_SOURCE_DESCRIPTION',
74     'type' => 'text',
75     'group'=>'lead_source',
76     'comment' => 'Description of the lead source'
77   ),
78   'status' =>
79   array (
80     'name' => 'status',
81     'vname' => 'LBL_STATUS',
82     'type' => 'enum',
83     'len' => '100',
84     'options' => 'lead_status_dom',
85         'audited'=>true,
86         'comment' => 'Status of the lead',
87     'merge_filter' => 'enabled',
88   ),
89   'status_description' =>
90   array (
91     'name' => 'status_description',
92     'vname' => 'LBL_STATUS_DESCRIPTION',
93     'type' => 'text',
94     'group'=>'status',
95     'comment' => 'Description of the status of the lead'
96   ),
97   'department' =>
98   array (
99     'name' => 'department',
100     'vname' => 'LBL_DEPARTMENT',
101     'type' => 'varchar',
102     'len' => '100',
103     'comment' => 'Department the lead belongs to',
104     'merge_filter' => 'enabled',
105   ),
106   'reports_to_id' =>
107   array (
108     'name' => 'reports_to_id',
109     'vname' => 'LBL_REPORTS_TO_ID',
110     'type' => 'id',
111     'reportable'=>false,
112     'comment' => 'ID of Contact the Lead reports to'
113   ),
114     'report_to_name' =>
115   array (
116     'name' => 'report_to_name',
117     'rname' => 'name',
118     'id_name' => 'reports_to_id',
119     'vname' => 'LBL_REPORTS_TO',
120     'type' => 'relate',
121    // 'link'=>'reports_to_link',
122     'table' => 'contacts',
123     'isnull' => 'true',
124     'module' => 'Contacts',
125     'dbType' => 'varchar',
126     'len' => 'id',
127         'source'=>'non-db',
128     'reportable'=>false,
129     'massupdate' => false,
130   ),
131     'reports_to_link' =>
132   array (
133         'name' => 'reports_to_link',
134     'type' => 'link',
135     'relationship' => 'lead_direct_reports',
136                 'link_type'=>'one',
137                 'side'=>'right',
138     'source'=>'non-db',
139                 'vname'=>'LBL_REPORTS_TO',
140   ),
141   /*'acc_name_from_accounts' =>
142   array (
143         'name' => 'acc_name_from_accounts',
144         'rname' => 'name',
145         'id_name' => 'account_id',
146         'vname' => 'LBL_ACCOUNT_NAME_1',
147         'type' => 'relate',
148         'link' => 'accounts',
149         'table' => 'accounts',
150         'join_name'=>'accounts',
151         'isnull' => 'true',
152         'module' => 'Accounts',
153         'dbType' => 'varchar',
154         'len' => '255',
155         'source' => 'non-db',
156         'unified_search' => false,
157         'massupdate' => false,
158         'studio' => 'false',
159   ),
160   */
161   'account_name' =>
162   array (
163         'name' => 'account_name',
164         'vname' => 'LBL_ACCOUNT_NAME',
165         'type' => 'varchar',
166         'len' => '255',
167         'unified_search' => true,
168         'comment' => 'Account name for lead',
169   ),
170
171
172   'accounts' =>
173   array (
174         'name' => 'accounts',
175         'type' => 'link',
176         'relationship' => 'account_leads',
177         'link_type' => 'one',
178         'source' => 'non-db',
179         'vname' => 'LBL_ACCOUNT',
180     'duplicate_merge'=> 'disabled',
181   ),
182   
183   'account_description' =>
184   array (
185     'name' => 'account_description',
186     'vname' => 'LBL_ACCOUNT_DESCRIPTION',
187     'type' => 'text',
188     'group'=>'account_name',
189     'unified_search' => true,
190     'comment' => 'Description of lead account'
191   ),
192   'contact_id' =>
193   array (
194     'name' => 'contact_id',
195     'type' => 'id',
196     'reportable'=>false,
197     'vname'=>'LBL_CONTACT_ID',
198         'comment' => 'If converted, Contact ID resulting from the conversion'
199   ),
200   'account_id' =>
201   array (
202     'name' => 'account_id',
203     'type' => 'id',
204     'reportable'=>false,
205     'vname'=>'LBL_ACCOUNT_ID',
206         'comment' => 'If converted, Account ID resulting from the conversion'
207   ),
208   'opportunity_id' =>
209   array (
210     'name' => 'opportunity_id',
211     'type' => 'id',
212     'reportable'=>false,
213     'vname'=>'LBL_OPPORTUNITY_ID',
214         'comment' => 'If converted, Opportunity ID resulting from the conversion'
215   ),
216   'opportunity_name' =>
217   array (
218     'name' => 'opportunity_name',
219     'vname' => 'LBL_OPPORTUNITY_NAME',
220     'type' => 'varchar',
221     'len' => '255',
222     'comment' => 'Opportunity name associated with lead'
223   ),
224   'opportunity_amount' =>
225   array (
226     'name' => 'opportunity_amount',
227     'vname' => 'LBL_OPPORTUNITY_AMOUNT',
228     'type' => 'varchar',
229     'group'=>'opportunity_name',
230     'len' => '50',
231     'comment' => 'Amount of the opportunity'
232   ),
233   'campaign_id' =>
234   array (
235     'name' => 'campaign_id',
236     'type' => 'id',
237     'reportable'=>false,
238     'vname'=>'LBL_CAMPAIGN_ID',
239         'comment' => 'Campaign that generated lead'
240   ),
241
242    'campaign_name' =>
243     array (
244       'name' => 'campaign_name',
245       'rname' => 'name',
246       'id_name' => 'campaign_id',
247       'vname' => 'LBL_CAMPAIGN',
248       'type' => 'relate',
249       'link' => 'campaign_leads',
250       'table' => 'campaigns',
251       'isnull' => 'true',
252       'module' => 'Campaigns',
253       'source' => 'non-db',
254     ),
255     'campaign_leads' =>
256     array (
257       'name' => 'campaign_leads',
258       'type' => 'link',
259       'vname' => 'LBL_CAMPAIGN_LEAD',
260       'relationship' => 'campaign_leads',
261       'source' => 'non-db',
262     ),
263     'c_accept_status_fields' =>
264                 array (
265                         'name' => 'c_accept_status_fields',
266                         'rname' => 'id',
267                         'relationship_fields'=>array('id' => 'accept_status_id', 'accept_status' => 'accept_status_name'),
268                         'vname' => 'LBL_LIST_ACCEPT_STATUS',
269                         'type' => 'relate',
270                         'link' => 'calls',
271                         'link_type' => 'relationship_info',
272                         'source' => 'non-db',
273                         'importable' => 'false',
274             'duplicate_merge'=> 'disabled',
275                         'studio' => array('listview' => false),
276                 ),
277         'm_accept_status_fields' =>
278                 array (
279                         'name' => 'm_accept_status_fields',
280                         'rname' => 'id',
281                         'relationship_fields'=>array('id' => 'accept_status_id', 'accept_status' => 'accept_status_name'),
282                         'vname' => 'LBL_LIST_ACCEPT_STATUS',
283                         'type' => 'relate',
284                         'link' => 'meetings',
285                         'link_type' => 'relationship_info',
286                         'source' => 'non-db',
287                         'importable' => 'false',
288                         'hideacl'=>true,
289             'duplicate_merge'=> 'disabled',
290                         'studio' => array('listview' => false),
291                 ),
292         'accept_status_id' =>
293                 array(
294                         'name' => 'accept_status_id',
295                         'type' => 'varchar',
296                         'source' => 'non-db',
297                         'vname' => 'LBL_LIST_ACCEPT_STATUS',
298                         'studio' => array('listview' => false),
299                 ),
300         'accept_status_name' =>
301                 array(
302                         'massupdate' => false,
303                         'name' => 'accept_status_name',
304                         'type' => 'enum',
305                         'source' => 'non-db',
306                         'vname' => 'LBL_LIST_ACCEPT_STATUS',
307                         'options' => 'dom_meeting_accept_status',
308                         'importable' => 'false',
309                 ),
310   'webtolead_email1' =>
311   array (
312     'name' => 'webtolead_email1',
313     'vname' => 'LBL_EMAIL_ADDRESS',
314     'type' => 'email',
315     'len' => '100',
316     'source' => 'non-db',
317         'comment' => 'Main email address of lead',
318     'importable' => 'false',
319     'studio' => 'false',
320   ),
321   'webtolead_email2' =>
322   array (
323     'name' => 'webtolead_email2',
324     'vname' => 'LBL_OTHER_EMAIL_ADDRESS',
325     'type' => 'email',
326     'len' => '100',
327     'source' => 'non-db',
328     'comment' => 'Secondary email address of lead',
329     'importable' => 'false',
330     'studio' => 'false',
331   ),
332   'webtolead_email_opt_out' =>
333   array (
334     'name' => 'webtolead_email_opt_out',
335     'vname' => 'LBL_EMAIL_OPT_OUT',
336     'type' => 'bool',
337     'source' => 'non-db',
338         'comment' => 'Indicator signaling if lead elects to opt out of email campaigns',
339     'importable' => 'false',
340     'massupdate' => false,
341         'studio'=>'false',
342   ),
343 'webtolead_invalid_email' =>
344   array (
345     'name' => 'webtolead_invalid_email',
346     'vname' => 'LBL_INVALID_EMAIL',
347     'type' => 'bool',
348     'source' => 'non-db',
349     'comment' => 'Indicator that email address for lead is invalid',
350     'importable' => 'false',
351     'massupdate' => false,
352         'studio'=>'false',
353   ),
354 'birthdate' =>
355         array (
356                 'name' => 'birthdate',
357                 'vname' => 'LBL_BIRTHDATE',
358                 'massupdate' => false,
359                 'type' => 'date',
360                 'comment' => 'The birthdate of the contact'
361         ),
362   
363   'portal_name' =>
364   array (
365     'name' => 'portal_name',
366     'vname' => 'LBL_PORTAL_NAME',
367     'type' => 'varchar',
368     'len' => '255',
369     'group'=>'portal',
370     'comment' => 'Portal user name when lead created via lead portal',
371         //BEGIN SUGARCRM flav!=ent
372         'studio' => 'false',
373         //END SUGARCRM
374   ),
375   'portal_app' =>
376   array (
377     'name' => 'portal_app',
378     'vname' => 'LBL_PORTAL_APP',
379     'type' => 'varchar',
380     'group'=>'portal',
381     'len' => '255',
382     'comment' => 'Portal application that resulted in created of lead',
383         //BEGIN SUGARCRM flav!=ent
384     'studio' => 'false',
385   ),
386    'website' => 
387   array (
388     'name' => 'website',
389     'vname' => 'LBL_WEBSITE',
390     'type' => 'url',
391     'dbType' => 'varchar',
392     'len' => 255,
393     'comment' => 'URL of website for the company',
394   ),
395
396   'tasks' =>
397   array (
398         'name' => 'tasks',
399     'type' => 'link',
400     'relationship' => 'lead_tasks',
401     'source'=>'non-db',
402                 'vname'=>'LBL_TASKS',
403   ),
404   'notes' =>
405   array (
406         'name' => 'notes',
407     'type' => 'link',
408     'relationship' => 'lead_notes',
409     'source'=>'non-db',
410                 'vname'=>'LBL_NOTES',
411   ),
412   'meetings' =>
413   array (
414         'name' => 'meetings',
415     'type' => 'link',
416     'relationship' => 'meetings_leads',
417     'source'=>'non-db',
418                 'vname'=>'LBL_MEETINGS',
419   ),
420   'calls' =>
421   array (
422         'name' => 'calls',
423     'type' => 'link',
424     'relationship' => 'calls_leads',
425     'source'=>'non-db',
426                 'vname'=>'LBL_CALLS',
427   ),
428   'oldmeetings' =>
429   array (
430         'name' => 'oldmeetings',
431     'type' => 'link',
432     'relationship' => 'lead_meetings',
433     'source'=>'non-db',
434                 'vname'=>'LBL_MEETINGS',
435   ),
436   'oldcalls' =>
437   array (
438         'name' => 'oldcalls',
439     'type' => 'link',
440     'relationship' => 'lead_calls',
441     'source'=>'non-db',
442                 'vname'=>'LBL_CALLS',
443   ),
444   'emails' =>
445   array (
446         'name' => 'emails',
447     'type' => 'link',
448     'relationship' => 'emails_leads_rel',
449     'source'=>'non-db',
450     'unified_search'=>true,
451         'vname'=>'LBL_EMAILS',
452   ),
453         'email_addresses' =>
454         array (
455                 'name' => 'email_addresses',
456         'type' => 'link',
457                 'relationship' => 'leads_email_addresses',
458         'source' => 'non-db',
459                 'vname' => 'LBL_EMAIL_ADDRESSES',
460                 'reportable'=>false,
461             'rel_fields' => array('primary_address' => array('type'=>'bool')),
462         ),
463         'email_addresses_primary' =>
464         array (
465                 'name' => 'email_addresses_primary',
466         'type' => 'link',
467                 'relationship' => 'leads_email_addresses_primary',
468         'source' => 'non-db',
469                 'vname' => 'LBL_EMAIL_ADDRESS_PRIMARY',
470                 'duplicate_merge'=> 'disabled',
471         ),
472         'campaigns' =>
473                 array (
474                         'name' => 'campaigns',
475                 'type' => 'link',
476                 'relationship' => 'lead_campaign_log',
477                 'module'=>'CampaignLog',
478                 'bean_name'=>'CampaignLog',
479                 'source'=>'non-db',
480                         'vname'=>'LBL_CAMPAIGNLOG',
481                 ),
482       'prospect_lists' =>
483       array (
484         'name' => 'prospect_lists',
485         'type' => 'link',
486         'relationship' => 'prospect_list_leads',
487         'module'=>'ProspectLists',
488         'source'=>'non-db',
489         'vname'=>'LBL_PROSPECT_LIST',
490       ),
491
492 )
493                                                       , 'indices' => array (
494        array('name' =>'idx_lead_acct_name_first', 'type'=>'index', 'fields'=>array('account_name','deleted')),
495        array('name' =>'idx_lead_last_first', 'type'=>'index', 'fields'=>array('last_name','first_name','deleted')),
496        array('name' =>'idx_lead_del_stat', 'type'=>'index', 'fields'=>array('last_name','status','deleted','first_name')),
497        array('name' =>'idx_lead_opp_del', 'type'=>'index', 'fields'=>array('opportunity_id','deleted',)),
498        array('name' =>'idx_leads_acct_del', 'type'=>'index', 'fields'=>array('account_id','deleted',)),
499        array('name' => 'idx_del_user', 'type' => 'index', 'fields'=> array('deleted', 'assigned_user_id')),
500         array('name' =>'idx_lead_assigned', 'type'=>'index', 'fields'=>array('assigned_user_id')),
501         array('name' =>'idx_lead_contact', 'type'=>'index', 'fields'=>array('contact_id')),
502         array('name' =>'idx_reports_to', 'type'=>'index', 'fields'=>array('reports_to_id')),
503
504                                              )
505 , 'relationships' => array (
506         'lead_direct_reports' => array('lhs_module'=> 'Leads', 'lhs_table'=> 'leads', 'lhs_key' => 'id',
507                                                           'rhs_module'=> 'Leads', 'rhs_table'=> 'leads', 'rhs_key' => 'reports_to_id',
508                                                           'relationship_type'=>'one-to-many'),
509         'lead_tasks' => array('lhs_module'=> 'Leads', 'lhs_table'=> 'leads', 'lhs_key' => 'id',
510                                                           'rhs_module'=> 'Tasks', 'rhs_table'=> 'tasks', 'rhs_key' => 'parent_id',
511                                                           'relationship_type'=>'one-to-many', 'relationship_role_column'=>'parent_type',
512                                                           'relationship_role_column_value'=>'Leads')
513         ,'lead_notes' => array('lhs_module'=> 'Leads', 'lhs_table'=> 'leads', 'lhs_key' => 'id',
514                                                           'rhs_module'=> 'Notes', 'rhs_table'=> 'notes', 'rhs_key' => 'parent_id',
515                                                           'relationship_type'=>'one-to-many', 'relationship_role_column'=>'parent_type',
516                                                           'relationship_role_column_value'=>'Leads')
517
518         ,'lead_meetings' => array('lhs_module'=> 'Leads', 'lhs_table'=> 'leads', 'lhs_key' => 'id',
519                                                           'rhs_module'=> 'Meetings', 'rhs_table'=> 'meetings', 'rhs_key' => 'parent_id',
520                                                           'relationship_type'=>'one-to-many', 'relationship_role_column'=>'parent_type',
521                                                           'relationship_role_column_value'=>'Leads')
522
523         ,'lead_calls' => array('lhs_module'=> 'Leads', 'lhs_table'=> 'leads', 'lhs_key' => 'id',
524                                                           'rhs_module'=> 'Calls', 'rhs_table'=> 'calls', 'rhs_key' => 'parent_id',
525                                                           'relationship_type'=>'one-to-many', 'relationship_role_column'=>'parent_type',
526                                                           'relationship_role_column_value'=>'Leads')
527
528         ,'lead_emails' => array('lhs_module'=> 'Leads', 'lhs_table'=> 'leads', 'lhs_key' => 'id',
529                                                           'rhs_module'=> 'Emails', 'rhs_table'=> 'emails', 'rhs_key' => 'parent_id',
530                                                           'relationship_type'=>'one-to-many', 'relationship_role_column'=>'parent_type',
531                                                           'relationship_role_column_value'=>'Leads'),
532         'lead_campaign_log' => array(
533                                                                         'lhs_module'            =>      'Leads',
534                                                                         'lhs_table'                     =>      'leads',
535                                                                         'lhs_key'                       =>      'id',
536                                                                         'rhs_module'            =>      'CampaignLog',
537                                                                         'rhs_table'                     =>      'campaign_log',
538                                                                         'rhs_key'                       =>      'target_id',
539                                                                         'relationship_type'     =>'one-to-many'
540                                                                 )
541
542         )
543         //This enables optimistic locking for Saves From EditView
544         ,'optimistic_locking'=>true,
545 );
546
547 VardefManager::createVardef('Leads','Lead', array('default', 'assignable',
548 'person'));
549
550
551 ?>