]> CyberLeo.Net >> Repos - Github/sugarcrm.git/blob - modules/Leads/vardefs.php
Release 6.5.1
[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-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 $dictionary['Lead'] = array('table' => 'leads','audited'=>true, 'unified_search' => true, 'full_text_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     'table' => 'contacts',
122     'isnull' => 'true',
123     'module' => 'Contacts',
124     'dbType' => 'varchar',
125     'len' => 'id',
126         'source'=>'non-db',
127     'reportable'=>false,
128     'massupdate' => false,
129   ),
130     'reports_to_link' => array (
131             'name' => 'reports_to_link',
132         'type' => 'link',
133         'relationship' => 'lead_direct_reports',
134                 'link_type'=>'one',
135                 'side'=>'right',
136         'source'=>'non-db',
137                 'vname'=>'LBL_REPORTS_TO',
138         'reportable'=>false
139   ),
140     'reportees' => array (
141             'name' => 'reportees',
142         'type' => 'link',
143         'relationship' => 'lead_direct_reports',
144                 'link_type'=>'many',
145                 'side'=>'left',
146         'source'=>'non-db',
147                 'vname'=>'LBL_REPORTS_TO',
148         'reportable'=>false
149   ),
150     'contacts'=> array(
151         'name' => 'contacts',
152         'type' => 'link',
153         'relationship' => 'contact_leads',
154         'module' => "Contacts",
155         'source' => 'non-db',
156         'vname' => 'LBL_CONTACTS',
157         'reportable'=>false
158     ),
159   /*'acc_name_from_accounts' =>
160   array (
161         'name' => 'acc_name_from_accounts',
162         'rname' => 'name',
163         'id_name' => 'account_id',
164         'vname' => 'LBL_ACCOUNT_NAME_1',
165         'type' => 'relate',
166         'link' => 'accounts',
167         'table' => 'accounts',
168         'join_name'=>'accounts',
169         'isnull' => 'true',
170         'module' => 'Accounts',
171         'dbType' => 'varchar',
172         'len' => '255',
173         'source' => 'non-db',
174         'unified_search' => false,
175         'massupdate' => false,
176         'studio' => 'false',
177   ),
178   */
179   'account_name' =>
180   array (
181         'name' => 'account_name',
182         'vname' => 'LBL_ACCOUNT_NAME',
183         'type' => 'varchar',
184         'len' => '255',
185         'unified_search' => true,
186         'full_text_search' => 1,
187         'comment' => 'Account name for lead',
188   ),
189
190
191   'accounts' =>
192   array (
193         'name' => 'accounts',
194         'type' => 'link',
195         'relationship' => 'account_leads',
196         'link_type' => 'one',
197         'source' => 'non-db',
198         'vname' => 'LBL_ACCOUNT',
199     'duplicate_merge'=> 'disabled',
200   ),
201   
202   'account_description' =>
203   array (
204     'name' => 'account_description',
205     'vname' => 'LBL_ACCOUNT_DESCRIPTION',
206     'type' => 'text',
207     'group'=>'account_name',
208     'unified_search' => true,
209     'full_text_search' => 1,
210     'comment' => 'Description of lead account'
211   ),
212   'contact_id' =>
213   array (
214     'name' => 'contact_id',
215     'type' => 'id',
216     'reportable'=>false,
217     'vname'=>'LBL_CONTACT_ID',
218         'comment' => 'If converted, Contact ID resulting from the conversion'
219   ),
220     'contact' => array(
221         'name' => 'contact',
222         'type' => 'link',
223         'link_type' => 'one',
224         'relationship' => 'contact_leads',
225         'source' => 'non-db',
226         'vname' => 'LBL_LEADS',
227         'reportable' => false,
228     ),
229   'account_id' =>
230   array (
231     'name' => 'account_id',
232     'type' => 'id',
233     'reportable'=>false,
234     'vname'=>'LBL_ACCOUNT_ID',
235         'comment' => 'If converted, Account ID resulting from the conversion'
236   ),
237   'opportunity_id' =>
238   array (
239     'name' => 'opportunity_id',
240     'type' => 'id',
241     'reportable'=>false,
242     'vname'=>'LBL_OPPORTUNITY_ID',
243         'comment' => 'If converted, Opportunity ID resulting from the conversion'
244   ),
245   'opportunity' => array (
246     'name' => 'opportunity',
247     'type' => 'link',
248     'link_type' => 'one',
249     'relationship' => 'opportunity_leads',
250     'source'=>'non-db',
251     'vname'=>'LBL_OPPORTUNITIES',
252   ),
253   'opportunity_name' =>
254   array (
255     'name' => 'opportunity_name',
256     'vname' => 'LBL_OPPORTUNITY_NAME',
257     'type' => 'varchar',
258     'len' => '255',
259     'comment' => 'Opportunity name associated with lead'
260   ),
261   'opportunity_amount' =>
262   array (
263     'name' => 'opportunity_amount',
264     'vname' => 'LBL_OPPORTUNITY_AMOUNT',
265     'type' => 'varchar',
266     'group'=>'opportunity_name',
267     'len' => '50',
268     'comment' => 'Amount of the opportunity'
269   ),
270   'campaign_id' =>
271   array (
272     'name' => 'campaign_id',
273     'type' => 'id',
274     'reportable'=>false,
275     'vname'=>'LBL_CAMPAIGN_ID',
276         'comment' => 'Campaign that generated lead'
277   ),
278
279    'campaign_name' =>
280     array (
281       'name' => 'campaign_name',
282       'rname' => 'name',
283       'id_name' => 'campaign_id',
284       'vname' => 'LBL_CAMPAIGN',
285       'type' => 'relate',
286       'link' => 'campaign_leads',
287       'table' => 'campaigns',
288       'isnull' => 'true',
289       'module' => 'Campaigns',
290       'source' => 'non-db',
291       'additionalFields' => array('id' => 'campaign_id')
292     ),
293     'campaign_leads' =>
294     array (
295       'name' => 'campaign_leads',
296       'type' => 'link',
297       'vname' => 'LBL_CAMPAIGN_LEAD',
298       'relationship' => 'campaign_leads',
299       'source' => 'non-db',
300     ),
301     'c_accept_status_fields' =>
302                 array (
303                         'name' => 'c_accept_status_fields',
304                         'rname' => 'id',
305                         'relationship_fields'=>array('id' => 'accept_status_id', 'accept_status' => 'accept_status_name'),
306                         'vname' => 'LBL_LIST_ACCEPT_STATUS',
307                         'type' => 'relate',
308                         'link' => 'calls',
309                         'link_type' => 'relationship_info',
310                         'source' => 'non-db',
311                         'importable' => 'false',
312             'duplicate_merge'=> 'disabled',
313                         'studio' => false,
314                 ),
315         'm_accept_status_fields' =>
316                 array (
317                         'name' => 'm_accept_status_fields',
318                         'rname' => 'id',
319                         'relationship_fields'=>array('id' => 'accept_status_id', 'accept_status' => 'accept_status_name'),
320                         'vname' => 'LBL_LIST_ACCEPT_STATUS',
321                         'type' => 'relate',
322                         'link' => 'meetings',
323                         'link_type' => 'relationship_info',
324                         'source' => 'non-db',
325                         'importable' => 'false',
326                         'hideacl'=>true,
327             'duplicate_merge'=> 'disabled',
328                         'studio' => false,
329                 ),
330         'accept_status_id' =>
331                 array(
332                         'name' => 'accept_status_id',
333                         'type' => 'varchar',
334                         'source' => 'non-db',
335                         'vname' => 'LBL_LIST_ACCEPT_STATUS',
336                         'studio' => array('listview' => false),
337                 ),
338         'accept_status_name' =>
339                 array(
340                         'massupdate' => false,
341                         'name' => 'accept_status_name',
342                         'type' => 'enum',
343                         'source' => 'non-db',
344                         'vname' => 'LBL_LIST_ACCEPT_STATUS',
345                         'options' => 'dom_meeting_accept_status',
346                         'importable' => 'false',
347                 ),
348                 //bug 42902
349                 'email'=> array(
350                         'name' => 'email',
351                         'type' => 'email',
352                         'query_type' => 'default',
353                         'source' => 'non-db',
354                         'operator' => 'subquery',
355                         'subquery' => 'SELECT eabr.bean_id FROM email_addr_bean_rel eabr JOIN email_addresses ea ON (ea.id = eabr.email_address_id) WHERE eabr.deleted=0 AND ea.email_address LIKE',
356                         'db_field' => array(
357                                 'id',
358                         ),
359                         'vname' =>'LBL_ANY_EMAIL',
360                         'studio' => array('visible'=>false, 'searchview'=>true),
361                 ),
362   'webtolead_email1' =>
363   array (
364     'name' => 'webtolead_email1',
365     'vname' => 'LBL_EMAIL_ADDRESS',
366     'type' => 'email',
367     'len' => '100',
368     'source' => 'non-db',
369         'comment' => 'Main email address of lead',
370     'importable' => 'false',
371     'studio' => 'false',
372   ),
373   'webtolead_email2' =>
374   array (
375     'name' => 'webtolead_email2',
376     'vname' => 'LBL_OTHER_EMAIL_ADDRESS',
377     'type' => 'email',
378     'len' => '100',
379     'source' => 'non-db',
380     'comment' => 'Secondary email address of lead',
381     'importable' => 'false',
382     'studio' => 'false',
383   ),
384   'webtolead_email_opt_out' =>
385   array (
386     'name' => 'webtolead_email_opt_out',
387     'vname' => 'LBL_EMAIL_OPT_OUT',
388     'type' => 'bool',
389     'source' => 'non-db',
390         'comment' => 'Indicator signaling if lead elects to opt out of email campaigns',
391     'importable' => 'false',
392     'massupdate' => false,
393         'studio'=>'false',
394   ),
395 'webtolead_invalid_email' =>
396   array (
397     'name' => 'webtolead_invalid_email',
398     'vname' => 'LBL_INVALID_EMAIL',
399     'type' => 'bool',
400     'source' => 'non-db',
401     'comment' => 'Indicator that email address for lead is invalid',
402     'importable' => 'false',
403     'massupdate' => false,
404         'studio'=>'false',
405   ),
406 'birthdate' =>
407         array (
408                 'name' => 'birthdate',
409                 'vname' => 'LBL_BIRTHDATE',
410                 'massupdate' => false,
411                 'type' => 'date',
412                 'comment' => 'The birthdate of the contact'
413         ),
414   
415   'portal_name' =>
416   array (
417     'name' => 'portal_name',
418     'vname' => 'LBL_PORTAL_NAME',
419     'type' => 'varchar',
420     'len' => '255',
421     'group'=>'portal',
422     'comment' => 'Portal user name when lead created via lead portal',
423         //BEGIN SUGARCRM flav!=ent
424         'studio' => 'false',
425         //END SUGARCRM
426   ),
427   'portal_app' =>
428   array (
429     'name' => 'portal_app',
430     'vname' => 'LBL_PORTAL_APP',
431     'type' => 'varchar',
432     'group'=>'portal',
433     'len' => '255',
434     'comment' => 'Portal application that resulted in created of lead',
435         //BEGIN SUGARCRM flav!=ent
436     'studio' => 'false',
437   ),
438    'website' => 
439   array (
440     'name' => 'website',
441     'vname' => 'LBL_WEBSITE',
442     'type' => 'url',
443     'dbType' => 'varchar',
444     'len' => 255,
445     'link_target' => '_blank',
446     'comment' => 'URL of website for the company',
447   ),
448
449   'tasks' =>
450   array (
451         'name' => 'tasks',
452     'type' => 'link',
453     'relationship' => 'lead_tasks',
454     'source'=>'non-db',
455                 'vname'=>'LBL_TASKS',
456   ),
457   'notes' =>
458   array (
459         'name' => 'notes',
460     'type' => 'link',
461     'relationship' => 'lead_notes',
462     'source'=>'non-db',
463                 'vname'=>'LBL_NOTES',
464   ),
465   'meetings' =>
466   array (
467         'name' => 'meetings',
468     'type' => 'link',
469     'relationship' => 'meetings_leads',
470     'source'=>'non-db',
471                 'vname'=>'LBL_MEETINGS',
472   ),
473   'calls' =>
474   array (
475         'name' => 'calls',
476     'type' => 'link',
477    'relationship' => 'calls_leads',
478     'source'=>'non-db',
479                 'vname'=>'LBL_CALLS',
480   ),
481   'oldmeetings' =>
482   array (
483         'name' => 'oldmeetings',
484     'type' => 'link',
485     'relationship' => 'lead_meetings',
486     'source'=>'non-db',
487                 'vname'=>'LBL_MEETINGS',
488   ),
489   'oldcalls' =>
490   array (
491         'name' => 'oldcalls',
492     'type' => 'link',
493     'relationship' => 'lead_calls',
494     'source'=>'non-db',
495                 'vname'=>'LBL_CALLS',
496   ),
497   'emails' =>
498   array (
499         'name' => 'emails',
500     'type' => 'link',
501     'relationship' => 'emails_leads_rel',
502     'source'=>'non-db',
503     'unified_search'=>true,
504         'vname'=>'LBL_EMAILS',
505   ),
506         'email_addresses' =>
507         array (
508                 'name' => 'email_addresses',
509         'type' => 'link',
510                 'relationship' => 'leads_email_addresses',
511         'source' => 'non-db',
512                 'vname' => 'LBL_EMAIL_ADDRESSES',
513                 'reportable'=>false,
514             'rel_fields' => array('primary_address' => array('type'=>'bool')),
515         ),
516         'email_addresses_primary' =>
517         array (
518                 'name' => 'email_addresses_primary',
519         'type' => 'link',
520                 'relationship' => 'leads_email_addresses_primary',
521         'source' => 'non-db',
522                 'vname' => 'LBL_EMAIL_ADDRESS_PRIMARY',
523                 'duplicate_merge'=> 'disabled',
524         ),
525         'campaigns' =>
526                 array (
527                         'name' => 'campaigns',
528                 'type' => 'link',
529                 'relationship' => 'lead_campaign_log',
530                 'module'=>'CampaignLog',
531                 'bean_name'=>'CampaignLog',
532                 'source'=>'non-db',
533                         'vname'=>'LBL_CAMPAIGNLOG',
534                 ),
535       'prospect_lists' =>
536       array (
537         'name' => 'prospect_lists',
538         'type' => 'link',
539         'relationship' => 'prospect_list_leads',
540         'module'=>'ProspectLists',
541         'source'=>'non-db',
542         'vname'=>'LBL_PROSPECT_LIST',
543       ),
544
545 )
546                                                       , 'indices' => array (
547        array('name' =>'idx_lead_acct_name_first', 'type'=>'index', 'fields'=>array('account_name','deleted')),
548        array('name' =>'idx_lead_last_first', 'type'=>'index', 'fields'=>array('last_name','first_name','deleted')),
549        array('name' =>'idx_lead_del_stat', 'type'=>'index', 'fields'=>array('last_name','status','deleted','first_name')),
550        array('name' =>'idx_lead_opp_del', 'type'=>'index', 'fields'=>array('opportunity_id','deleted',)),
551        array('name' =>'idx_leads_acct_del', 'type'=>'index', 'fields'=>array('account_id','deleted',)),
552        array('name' => 'idx_del_user', 'type' => 'index', 'fields'=> array('deleted', 'assigned_user_id')),
553         array('name' =>'idx_lead_assigned', 'type'=>'index', 'fields'=>array('assigned_user_id')),
554         array('name' =>'idx_lead_contact', 'type'=>'index', 'fields'=>array('contact_id')),
555         array('name' =>'idx_reports_to', 'type'=>'index', 'fields'=>array('reports_to_id')),
556         array('name' =>'idx_lead_phone_work', 'type'=>'index', 'fields'=>array('phone_work')),
557        array('name' =>'idx_leads_id_del', 'type'=>'index', 'fields'=>array('id','deleted',)),
558
559                                              )
560 , 'relationships' => array (
561         'lead_direct_reports' => array('lhs_module'=> 'Leads', 'lhs_table'=> 'leads', 'lhs_key' => 'id',
562                                                           'rhs_module'=> 'Leads', 'rhs_table'=> 'leads', 'rhs_key' => 'reports_to_id',
563                                                           'relationship_type'=>'one-to-many'),
564         'lead_tasks' => array('lhs_module'=> 'Leads', 'lhs_table'=> 'leads', 'lhs_key' => 'id',
565                                                           'rhs_module'=> 'Tasks', 'rhs_table'=> 'tasks', 'rhs_key' => 'parent_id',
566                                                           'relationship_type'=>'one-to-many', 'relationship_role_column'=>'parent_type',
567                                                           'relationship_role_column_value'=>'Leads')
568         ,'lead_notes' => array('lhs_module'=> 'Leads', 'lhs_table'=> 'leads', 'lhs_key' => 'id',
569                                                           'rhs_module'=> 'Notes', 'rhs_table'=> 'notes', 'rhs_key' => 'parent_id',
570                                                           'relationship_type'=>'one-to-many', 'relationship_role_column'=>'parent_type',
571                                                           'relationship_role_column_value'=>'Leads')
572
573         ,'lead_meetings' => array('lhs_module'=> 'Leads', 'lhs_table'=> 'leads', 'lhs_key' => 'id',
574                                                           'rhs_module'=> 'Meetings', 'rhs_table'=> 'meetings', 'rhs_key' => 'parent_id',
575                                                           'relationship_type'=>'one-to-many', 'relationship_role_column'=>'parent_type',
576                                                           'relationship_role_column_value'=>'Leads')
577
578         ,'lead_calls' => array('lhs_module'=> 'Leads', 'lhs_table'=> 'leads', 'lhs_key' => 'id',
579                                                           'rhs_module'=> 'Calls', 'rhs_table'=> 'calls', 'rhs_key' => 'parent_id',
580                                                           'relationship_type'=>'one-to-many', 'relationship_role_column'=>'parent_type',
581                                                           'relationship_role_column_value'=>'Leads')
582
583         ,'lead_emails' => array('lhs_module'=> 'Leads', 'lhs_table'=> 'leads', 'lhs_key' => 'id',
584                                                           'rhs_module'=> 'Emails', 'rhs_table'=> 'emails', 'rhs_key' => 'parent_id',
585                                                           'relationship_type'=>'one-to-many', 'relationship_role_column'=>'parent_type',
586                                                           'relationship_role_column_value'=>'Leads'),
587         'lead_campaign_log' => array(
588                                                                         'lhs_module'            =>      'Leads',
589                                                                         'lhs_table'                     =>      'leads',
590                                                                         'lhs_key'                       =>      'id',
591                                                                         'rhs_module'            =>      'CampaignLog',
592                                                                         'rhs_table'                     =>      'campaign_log',
593                                                                         'rhs_key'                       =>      'target_id',
594                                                                         'relationship_type'     =>'one-to-many'
595                                                                 )
596
597         )
598         //This enables optimistic locking for Saves From EditView
599         ,'optimistic_locking'=>true,
600 );
601
602 VardefManager::createVardef('Leads','Lead', array('default', 'assignable',
603 'person'));
604
605
606 ?>