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.
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.
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
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
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.
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.
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 ********************************************************************************/
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 (
44 'name' => 'converted',
45 'vname' => 'LBL_CONVERTED',
48 'comment' => 'Has Lead been converted to a Contact (and other Sugar objects)'
52 'name' => 'refered_by',
53 'vname' => 'LBL_REFERED_BY',
56 'comment' => 'Identifies who refered the lead',
57 'merge_filter' => 'enabled',
61 'name' => 'lead_source',
62 'vname' => 'LBL_LEAD_SOURCE',
64 'options'=> 'lead_source_dom',
67 'comment' => 'Lead source (ex: Web, print)',
68 'merge_filter' => 'enabled',
70 'lead_source_description' =>
72 'name' => 'lead_source_description',
73 'vname' => 'LBL_LEAD_SOURCE_DESCRIPTION',
75 'group'=>'lead_source',
76 'comment' => 'Description of the lead source'
81 'vname' => 'LBL_STATUS',
84 'options' => 'lead_status_dom',
86 'comment' => 'Status of the lead',
87 'merge_filter' => 'enabled',
89 'status_description' =>
91 'name' => 'status_description',
92 'vname' => 'LBL_STATUS_DESCRIPTION',
95 'comment' => 'Description of the status of the lead'
99 'name' => 'department',
100 'vname' => 'LBL_DEPARTMENT',
103 'comment' => 'Department the lead belongs to',
104 'merge_filter' => 'enabled',
108 'name' => 'reports_to_id',
109 'vname' => 'LBL_REPORTS_TO_ID',
112 'comment' => 'ID of Contact the Lead reports to'
116 'name' => 'report_to_name',
118 'id_name' => 'reports_to_id',
119 'vname' => 'LBL_REPORTS_TO',
121 'table' => 'contacts',
123 'module' => 'Contacts',
124 'dbType' => 'varchar',
128 'massupdate' => false,
130 'reports_to_link' => array (
131 'name' => 'reports_to_link',
133 'relationship' => 'lead_direct_reports',
137 'vname'=>'LBL_REPORTS_TO',
140 'reportees' => array (
141 'name' => 'reportees',
143 'relationship' => 'lead_direct_reports',
147 'vname'=>'LBL_REPORTS_TO',
151 'name' => 'contacts',
153 'relationship' => 'contact_leads',
154 'module' => "Contacts",
155 'source' => 'non-db',
156 'vname' => 'LBL_CONTACTS',
159 /*'acc_name_from_accounts' =>
161 'name' => 'acc_name_from_accounts',
163 'id_name' => 'account_id',
164 'vname' => 'LBL_ACCOUNT_NAME_1',
166 'link' => 'accounts',
167 'table' => 'accounts',
168 'join_name'=>'accounts',
170 'module' => 'Accounts',
171 'dbType' => 'varchar',
173 'source' => 'non-db',
174 'unified_search' => false,
175 'massupdate' => false,
181 'name' => 'account_name',
182 'vname' => 'LBL_ACCOUNT_NAME',
185 'unified_search' => true,
186 'comment' => 'Account name for lead',
192 'name' => 'accounts',
194 'relationship' => 'account_leads',
195 'link_type' => 'one',
196 'source' => 'non-db',
197 'vname' => 'LBL_ACCOUNT',
198 'duplicate_merge'=> 'disabled',
201 'account_description' =>
203 'name' => 'account_description',
204 'vname' => 'LBL_ACCOUNT_DESCRIPTION',
206 'group'=>'account_name',
207 'unified_search' => true,
208 'comment' => 'Description of lead account'
212 'name' => 'contact_id',
215 'vname'=>'LBL_CONTACT_ID',
216 'comment' => 'If converted, Contact ID resulting from the conversion'
221 'link_type' => 'one',
222 'relationship' => 'contact_leads',
223 'source' => 'non-db',
224 'vname' => 'LBL_LEADS',
225 'reportable' => false,
229 'name' => 'account_id',
232 'vname'=>'LBL_ACCOUNT_ID',
233 'comment' => 'If converted, Account ID resulting from the conversion'
237 'name' => 'opportunity_id',
240 'vname'=>'LBL_OPPORTUNITY_ID',
241 'comment' => 'If converted, Opportunity ID resulting from the conversion'
243 'opportunity' => array (
244 'name' => 'opportunity',
246 'link_type' => 'one',
247 'relationship' => 'opportunity_leads',
249 'vname'=>'LBL_OPPORTUNITIES',
251 'opportunity_name' =>
253 'name' => 'opportunity_name',
254 'vname' => 'LBL_OPPORTUNITY_NAME',
257 'comment' => 'Opportunity name associated with lead'
259 'opportunity_amount' =>
261 'name' => 'opportunity_amount',
262 'vname' => 'LBL_OPPORTUNITY_AMOUNT',
264 'group'=>'opportunity_name',
266 'comment' => 'Amount of the opportunity'
270 'name' => 'campaign_id',
273 'vname'=>'LBL_CAMPAIGN_ID',
274 'comment' => 'Campaign that generated lead'
279 'name' => 'campaign_name',
281 'id_name' => 'campaign_id',
282 'vname' => 'LBL_CAMPAIGN',
284 'link' => 'campaign_leads',
285 'table' => 'campaigns',
287 'module' => 'Campaigns',
288 'source' => 'non-db',
292 'name' => 'campaign_leads',
294 'vname' => 'LBL_CAMPAIGN_LEAD',
295 'relationship' => 'campaign_leads',
296 'source' => 'non-db',
298 'c_accept_status_fields' =>
300 'name' => 'c_accept_status_fields',
302 'relationship_fields'=>array('id' => 'accept_status_id', 'accept_status' => 'accept_status_name'),
303 'vname' => 'LBL_LIST_ACCEPT_STATUS',
306 'link_type' => 'relationship_info',
307 'source' => 'non-db',
308 'importable' => 'false',
309 'duplicate_merge'=> 'disabled',
312 'm_accept_status_fields' =>
314 'name' => 'm_accept_status_fields',
316 'relationship_fields'=>array('id' => 'accept_status_id', 'accept_status' => 'accept_status_name'),
317 'vname' => 'LBL_LIST_ACCEPT_STATUS',
319 'link' => 'meetings',
320 'link_type' => 'relationship_info',
321 'source' => 'non-db',
322 'importable' => 'false',
324 'duplicate_merge'=> 'disabled',
327 'accept_status_id' =>
329 'name' => 'accept_status_id',
331 'source' => 'non-db',
332 'vname' => 'LBL_LIST_ACCEPT_STATUS',
333 'studio' => array('listview' => false),
335 'accept_status_name' =>
337 'massupdate' => false,
338 'name' => 'accept_status_name',
340 'source' => 'non-db',
341 'vname' => 'LBL_LIST_ACCEPT_STATUS',
342 'options' => 'dom_meeting_accept_status',
343 'importable' => 'false',
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',
356 'vname' =>'LBL_ANY_EMAIL',
357 'studio' => array('visible'=>false, 'searchview'=>true),
359 'webtolead_email1' =>
361 'name' => 'webtolead_email1',
362 'vname' => 'LBL_EMAIL_ADDRESS',
365 'source' => 'non-db',
366 'comment' => 'Main email address of lead',
367 'importable' => 'false',
370 'webtolead_email2' =>
372 'name' => 'webtolead_email2',
373 'vname' => 'LBL_OTHER_EMAIL_ADDRESS',
376 'source' => 'non-db',
377 'comment' => 'Secondary email address of lead',
378 'importable' => 'false',
381 'webtolead_email_opt_out' =>
383 'name' => 'webtolead_email_opt_out',
384 'vname' => 'LBL_EMAIL_OPT_OUT',
386 'source' => 'non-db',
387 'comment' => 'Indicator signaling if lead elects to opt out of email campaigns',
388 'importable' => 'false',
389 'massupdate' => false,
392 'webtolead_invalid_email' =>
394 'name' => 'webtolead_invalid_email',
395 'vname' => 'LBL_INVALID_EMAIL',
397 'source' => 'non-db',
398 'comment' => 'Indicator that email address for lead is invalid',
399 'importable' => 'false',
400 'massupdate' => false,
405 'name' => 'birthdate',
406 'vname' => 'LBL_BIRTHDATE',
407 'massupdate' => false,
409 'comment' => 'The birthdate of the contact'
414 'name' => 'portal_name',
415 'vname' => 'LBL_PORTAL_NAME',
419 'comment' => 'Portal user name when lead created via lead portal',
420 //BEGIN SUGARCRM flav!=ent
426 'name' => 'portal_app',
427 'vname' => 'LBL_PORTAL_APP',
431 'comment' => 'Portal application that resulted in created of lead',
432 //BEGIN SUGARCRM flav!=ent
438 'vname' => 'LBL_WEBSITE',
440 'dbType' => 'varchar',
442 'comment' => 'URL of website for the company',
449 'relationship' => 'lead_tasks',
451 'vname'=>'LBL_TASKS',
457 'relationship' => 'lead_notes',
459 'vname'=>'LBL_NOTES',
463 'name' => 'meetings',
465 'relationship' => 'meetings_leads',
467 'vname'=>'LBL_MEETINGS',
473 'relationship' => 'calls_leads',
475 'vname'=>'LBL_CALLS',
479 'name' => 'oldmeetings',
481 'relationship' => 'lead_meetings',
483 'vname'=>'LBL_MEETINGS',
487 'name' => 'oldcalls',
489 'relationship' => 'lead_calls',
491 'vname'=>'LBL_CALLS',
497 'relationship' => 'emails_leads_rel',
499 'unified_search'=>true,
500 'vname'=>'LBL_EMAILS',
504 'name' => 'email_addresses',
506 'relationship' => 'leads_email_addresses',
507 'source' => 'non-db',
508 'vname' => 'LBL_EMAIL_ADDRESSES',
510 'rel_fields' => array('primary_address' => array('type'=>'bool')),
512 'email_addresses_primary' =>
514 'name' => 'email_addresses_primary',
516 'relationship' => 'leads_email_addresses_primary',
517 'source' => 'non-db',
518 'vname' => 'LBL_EMAIL_ADDRESS_PRIMARY',
519 'duplicate_merge'=> 'disabled',
523 'name' => 'campaigns',
525 'relationship' => 'lead_campaign_log',
526 'module'=>'CampaignLog',
527 'bean_name'=>'CampaignLog',
529 'vname'=>'LBL_CAMPAIGNLOG',
533 'name' => 'prospect_lists',
535 'relationship' => 'prospect_list_leads',
536 'module'=>'ProspectLists',
538 'vname'=>'LBL_PROSPECT_LIST',
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',)),
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')
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')
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')
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',
587 'rhs_module' => 'CampaignLog',
588 'rhs_table' => 'campaign_log',
589 'rhs_key' => 'target_id',
590 'relationship_type' =>'one-to-many'
594 //This enables optimistic locking for Saves From EditView
595 ,'optimistic_locking'=>true,
598 VardefManager::createVardef('Leads','Lead', array('default', 'assignable',