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