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