]> CyberLeo.Net >> Repos - Github/sugarcrm.git/blob - modules/Leads/vardefs.php
Release 6.2.4
[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                 //bug 42902
311                 'email'=> array(
312                         'name' => 'email',
313                         'type' => 'email',
314                         'query_type' => 'default',
315                         'source' => 'non-db',
316                         'operator' => 'subquery',
317                         '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',
318                         'db_field' => array(
319                                 'id',
320                         ),
321                         'vname' =>'LBL_ANY_EMAIL',
322                         'studio' => array('visible'=>false, 'searchview'=>true),
323                 ),
324   'webtolead_email1' =>
325   array (
326     'name' => 'webtolead_email1',
327     'vname' => 'LBL_EMAIL_ADDRESS',
328     'type' => 'email',
329     'len' => '100',
330     'source' => 'non-db',
331         'comment' => 'Main email address of lead',
332     'importable' => 'false',
333     'studio' => 'false',
334   ),
335   'webtolead_email2' =>
336   array (
337     'name' => 'webtolead_email2',
338     'vname' => 'LBL_OTHER_EMAIL_ADDRESS',
339     'type' => 'email',
340     'len' => '100',
341     'source' => 'non-db',
342     'comment' => 'Secondary email address of lead',
343     'importable' => 'false',
344     'studio' => 'false',
345   ),
346   'webtolead_email_opt_out' =>
347   array (
348     'name' => 'webtolead_email_opt_out',
349     'vname' => 'LBL_EMAIL_OPT_OUT',
350     'type' => 'bool',
351     'source' => 'non-db',
352         'comment' => 'Indicator signaling if lead elects to opt out of email campaigns',
353     'importable' => 'false',
354     'massupdate' => false,
355         'studio'=>'false',
356   ),
357 'webtolead_invalid_email' =>
358   array (
359     'name' => 'webtolead_invalid_email',
360     'vname' => 'LBL_INVALID_EMAIL',
361     'type' => 'bool',
362     'source' => 'non-db',
363     'comment' => 'Indicator that email address for lead is invalid',
364     'importable' => 'false',
365     'massupdate' => false,
366         'studio'=>'false',
367   ),
368 'birthdate' =>
369         array (
370                 'name' => 'birthdate',
371                 'vname' => 'LBL_BIRTHDATE',
372                 'massupdate' => false,
373                 'type' => 'date',
374                 'comment' => 'The birthdate of the contact'
375         ),
376   
377   'portal_name' =>
378   array (
379     'name' => 'portal_name',
380     'vname' => 'LBL_PORTAL_NAME',
381     'type' => 'varchar',
382     'len' => '255',
383     'group'=>'portal',
384     'comment' => 'Portal user name when lead created via lead portal',
385         //BEGIN SUGARCRM flav!=ent
386         'studio' => 'false',
387         //END SUGARCRM
388   ),
389   'portal_app' =>
390   array (
391     'name' => 'portal_app',
392     'vname' => 'LBL_PORTAL_APP',
393     'type' => 'varchar',
394     'group'=>'portal',
395     'len' => '255',
396     'comment' => 'Portal application that resulted in created of lead',
397         //BEGIN SUGARCRM flav!=ent
398     'studio' => 'false',
399   ),
400    'website' => 
401   array (
402     'name' => 'website',
403     'vname' => 'LBL_WEBSITE',
404     'type' => 'url',
405     'dbType' => 'varchar',
406     'len' => 255,
407     'comment' => 'URL of website for the company',
408   ),
409
410   'tasks' =>
411   array (
412         'name' => 'tasks',
413     'type' => 'link',
414     'relationship' => 'lead_tasks',
415     'source'=>'non-db',
416                 'vname'=>'LBL_TASKS',
417   ),
418   'notes' =>
419   array (
420         'name' => 'notes',
421     'type' => 'link',
422     'relationship' => 'lead_notes',
423     'source'=>'non-db',
424                 'vname'=>'LBL_NOTES',
425   ),
426   'meetings' =>
427   array (
428         'name' => 'meetings',
429     'type' => 'link',
430     'relationship' => 'meetings_leads',
431     'source'=>'non-db',
432                 'vname'=>'LBL_MEETINGS',
433   ),
434   'calls' =>
435   array (
436         'name' => 'calls',
437     'type' => 'link',
438    'relationship' => 'lead_calls',
439     'source'=>'non-db',
440                 'vname'=>'LBL_CALLS',
441   ),
442   'oldmeetings' =>
443   array (
444         'name' => 'oldmeetings',
445     'type' => 'link',
446     'relationship' => 'lead_meetings',
447     'source'=>'non-db',
448                 'vname'=>'LBL_MEETINGS',
449   ),
450   'oldcalls' =>
451   array (
452         'name' => 'oldcalls',
453     'type' => 'link',
454     'relationship' => 'lead_calls',
455     'source'=>'non-db',
456                 'vname'=>'LBL_CALLS',
457   ),
458   'emails' =>
459   array (
460         'name' => 'emails',
461     'type' => 'link',
462     'relationship' => 'emails_leads_rel',
463     'source'=>'non-db',
464     'unified_search'=>true,
465         'vname'=>'LBL_EMAILS',
466   ),
467         'email_addresses' =>
468         array (
469                 'name' => 'email_addresses',
470         'type' => 'link',
471                 'relationship' => 'leads_email_addresses',
472         'source' => 'non-db',
473                 'vname' => 'LBL_EMAIL_ADDRESSES',
474                 'reportable'=>false,
475             'rel_fields' => array('primary_address' => array('type'=>'bool')),
476         ),
477         'email_addresses_primary' =>
478         array (
479                 'name' => 'email_addresses_primary',
480         'type' => 'link',
481                 'relationship' => 'leads_email_addresses_primary',
482         'source' => 'non-db',
483                 'vname' => 'LBL_EMAIL_ADDRESS_PRIMARY',
484                 'duplicate_merge'=> 'disabled',
485         ),
486         'campaigns' =>
487                 array (
488                         'name' => 'campaigns',
489                 'type' => 'link',
490                 'relationship' => 'lead_campaign_log',
491                 'module'=>'CampaignLog',
492                 'bean_name'=>'CampaignLog',
493                 'source'=>'non-db',
494                         'vname'=>'LBL_CAMPAIGNLOG',
495                 ),
496       'prospect_lists' =>
497       array (
498         'name' => 'prospect_lists',
499         'type' => 'link',
500         'relationship' => 'prospect_list_leads',
501         'module'=>'ProspectLists',
502         'source'=>'non-db',
503         'vname'=>'LBL_PROSPECT_LIST',
504       ),
505
506 )
507                                                       , 'indices' => array (
508        array('name' =>'idx_lead_acct_name_first', 'type'=>'index', 'fields'=>array('account_name','deleted')),
509        array('name' =>'idx_lead_last_first', 'type'=>'index', 'fields'=>array('last_name','first_name','deleted')),
510        array('name' =>'idx_lead_del_stat', 'type'=>'index', 'fields'=>array('last_name','status','deleted','first_name')),
511        array('name' =>'idx_lead_opp_del', 'type'=>'index', 'fields'=>array('opportunity_id','deleted',)),
512        array('name' =>'idx_leads_acct_del', 'type'=>'index', 'fields'=>array('account_id','deleted',)),
513        array('name' => 'idx_del_user', 'type' => 'index', 'fields'=> array('deleted', 'assigned_user_id')),
514         array('name' =>'idx_lead_assigned', 'type'=>'index', 'fields'=>array('assigned_user_id')),
515         array('name' =>'idx_lead_contact', 'type'=>'index', 'fields'=>array('contact_id')),
516         array('name' =>'idx_reports_to', 'type'=>'index', 'fields'=>array('reports_to_id')),
517
518                                              )
519 , 'relationships' => array (
520         'lead_direct_reports' => array('lhs_module'=> 'Leads', 'lhs_table'=> 'leads', 'lhs_key' => 'id',
521                                                           'rhs_module'=> 'Leads', 'rhs_table'=> 'leads', 'rhs_key' => 'reports_to_id',
522                                                           'relationship_type'=>'one-to-many'),
523         'lead_tasks' => array('lhs_module'=> 'Leads', 'lhs_table'=> 'leads', 'lhs_key' => 'id',
524                                                           'rhs_module'=> 'Tasks', 'rhs_table'=> 'tasks', 'rhs_key' => 'parent_id',
525                                                           'relationship_type'=>'one-to-many', 'relationship_role_column'=>'parent_type',
526                                                           'relationship_role_column_value'=>'Leads')
527         ,'lead_notes' => array('lhs_module'=> 'Leads', 'lhs_table'=> 'leads', 'lhs_key' => 'id',
528                                                           'rhs_module'=> 'Notes', 'rhs_table'=> 'notes', 'rhs_key' => 'parent_id',
529                                                           'relationship_type'=>'one-to-many', 'relationship_role_column'=>'parent_type',
530                                                           'relationship_role_column_value'=>'Leads')
531
532         ,'lead_meetings' => array('lhs_module'=> 'Leads', 'lhs_table'=> 'leads', 'lhs_key' => 'id',
533                                                           'rhs_module'=> 'Meetings', 'rhs_table'=> 'meetings', 'rhs_key' => 'parent_id',
534                                                           'relationship_type'=>'one-to-many', 'relationship_role_column'=>'parent_type',
535                                                           'relationship_role_column_value'=>'Leads')
536
537         ,'lead_calls' => array('lhs_module'=> 'Leads', 'lhs_table'=> 'leads', 'lhs_key' => 'id',
538                                                           'rhs_module'=> 'Calls', 'rhs_table'=> 'calls', 'rhs_key' => 'parent_id',
539                                                           'relationship_type'=>'one-to-many', 'relationship_role_column'=>'parent_type',
540                                                           'relationship_role_column_value'=>'Leads')
541
542         ,'lead_emails' => array('lhs_module'=> 'Leads', 'lhs_table'=> 'leads', 'lhs_key' => 'id',
543                                                           'rhs_module'=> 'Emails', 'rhs_table'=> 'emails', 'rhs_key' => 'parent_id',
544                                                           'relationship_type'=>'one-to-many', 'relationship_role_column'=>'parent_type',
545                                                           'relationship_role_column_value'=>'Leads'),
546         'lead_campaign_log' => array(
547                                                                         'lhs_module'            =>      'Leads',
548                                                                         'lhs_table'                     =>      'leads',
549                                                                         'lhs_key'                       =>      'id',
550                                                                         'rhs_module'            =>      'CampaignLog',
551                                                                         'rhs_table'                     =>      'campaign_log',
552                                                                         'rhs_key'                       =>      'target_id',
553                                                                         'relationship_type'     =>'one-to-many'
554                                                                 )
555
556         )
557         //This enables optimistic locking for Saves From EditView
558         ,'optimistic_locking'=>true,
559 );
560
561 VardefManager::createVardef('Leads','Lead', array('default', 'assignable',
562 'person'));
563
564
565 ?>