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-2013 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, '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 (
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 'full_text_search' => 1,
187 'comment' => 'Account name for lead',
193 'name' => 'accounts',
195 'relationship' => 'account_leads',
196 'link_type' => 'one',
197 'source' => 'non-db',
198 'vname' => 'LBL_ACCOUNT',
199 'duplicate_merge'=> 'disabled',
202 'account_description' =>
204 'name' => 'account_description',
205 'vname' => 'LBL_ACCOUNT_DESCRIPTION',
207 'group'=>'account_name',
208 'unified_search' => true,
209 'full_text_search' => 1,
210 'comment' => 'Description of lead account'
214 'name' => 'contact_id',
217 'vname'=>'LBL_CONTACT_ID',
218 'comment' => 'If converted, Contact ID resulting from the conversion'
223 'link_type' => 'one',
224 'relationship' => 'contact_leads',
225 'source' => 'non-db',
226 'vname' => 'LBL_LEADS',
227 'reportable' => false,
231 'name' => 'account_id',
234 'vname'=>'LBL_ACCOUNT_ID',
235 'comment' => 'If converted, Account ID resulting from the conversion'
239 'name' => 'opportunity_id',
242 'vname'=>'LBL_OPPORTUNITY_ID',
243 'comment' => 'If converted, Opportunity ID resulting from the conversion'
245 'opportunity' => array (
246 'name' => 'opportunity',
248 'link_type' => 'one',
249 'relationship' => 'opportunity_leads',
251 'vname'=>'LBL_OPPORTUNITIES',
253 'opportunity_name' =>
255 'name' => 'opportunity_name',
256 'vname' => 'LBL_OPPORTUNITY_NAME',
259 'comment' => 'Opportunity name associated with lead'
261 'opportunity_amount' =>
263 'name' => 'opportunity_amount',
264 'vname' => 'LBL_OPPORTUNITY_AMOUNT',
266 'group'=>'opportunity_name',
268 'comment' => 'Amount of the opportunity'
272 'name' => 'campaign_id',
275 'vname'=>'LBL_CAMPAIGN_ID',
276 'comment' => 'Campaign that generated lead'
281 'name' => 'campaign_name',
283 'id_name' => 'campaign_id',
284 'vname' => 'LBL_CAMPAIGN',
286 'link' => 'campaign_leads',
287 'table' => 'campaigns',
289 'module' => 'Campaigns',
290 'source' => 'non-db',
291 'additionalFields' => array('id' => 'campaign_id')
295 'name' => 'campaign_leads',
297 'vname' => 'LBL_CAMPAIGN_LEAD',
298 'relationship' => 'campaign_leads',
299 'source' => 'non-db',
301 'c_accept_status_fields' =>
303 'name' => 'c_accept_status_fields',
305 'relationship_fields'=>array('id' => 'accept_status_id', 'accept_status' => 'accept_status_name'),
306 'vname' => 'LBL_LIST_ACCEPT_STATUS',
309 'link_type' => 'relationship_info',
310 'source' => 'non-db',
311 'importable' => 'false',
312 'duplicate_merge'=> 'disabled',
315 'm_accept_status_fields' =>
317 'name' => 'm_accept_status_fields',
319 'relationship_fields'=>array('id' => 'accept_status_id', 'accept_status' => 'accept_status_name'),
320 'vname' => 'LBL_LIST_ACCEPT_STATUS',
322 'link' => 'meetings',
323 'link_type' => 'relationship_info',
324 'source' => 'non-db',
325 'importable' => 'false',
327 'duplicate_merge'=> 'disabled',
330 'accept_status_id' =>
332 'name' => 'accept_status_id',
334 'source' => 'non-db',
335 'vname' => 'LBL_LIST_ACCEPT_STATUS',
336 'studio' => array('listview' => false),
338 'accept_status_name' =>
340 'massupdate' => false,
341 'name' => 'accept_status_name',
343 'source' => 'non-db',
344 'vname' => 'LBL_LIST_ACCEPT_STATUS',
345 'options' => 'dom_meeting_accept_status',
346 'importable' => 'false',
348 'webtolead_email1' =>
350 'name' => 'webtolead_email1',
351 'vname' => 'LBL_EMAIL_ADDRESS',
354 'source' => 'non-db',
355 'comment' => 'Main email address of lead',
356 'importable' => 'false',
359 'webtolead_email2' =>
361 'name' => 'webtolead_email2',
362 'vname' => 'LBL_OTHER_EMAIL_ADDRESS',
365 'source' => 'non-db',
366 'comment' => 'Secondary email address of lead',
367 'importable' => 'false',
370 'webtolead_email_opt_out' =>
372 'name' => 'webtolead_email_opt_out',
373 'vname' => 'LBL_EMAIL_OPT_OUT',
375 'source' => 'non-db',
376 'comment' => 'Indicator signaling if lead elects to opt out of email campaigns',
377 'importable' => 'false',
378 'massupdate' => false,
381 'webtolead_invalid_email' =>
383 'name' => 'webtolead_invalid_email',
384 'vname' => 'LBL_INVALID_EMAIL',
386 'source' => 'non-db',
387 'comment' => 'Indicator that email address for lead is invalid',
388 'importable' => 'false',
389 'massupdate' => false,
394 'name' => 'birthdate',
395 'vname' => 'LBL_BIRTHDATE',
396 'massupdate' => false,
398 'comment' => 'The birthdate of the contact'
403 'name' => 'portal_name',
404 'vname' => 'LBL_PORTAL_NAME',
408 'comment' => 'Portal user name when lead created via lead portal',
409 //BEGIN SUGARCRM flav!=ent
415 'name' => 'portal_app',
416 'vname' => 'LBL_PORTAL_APP',
420 'comment' => 'Portal application that resulted in created of lead',
421 //BEGIN SUGARCRM flav!=ent
427 'vname' => 'LBL_WEBSITE',
429 'dbType' => 'varchar',
431 'link_target' => '_blank',
432 'comment' => 'URL of website for the company',
439 'relationship' => 'lead_tasks',
441 'vname'=>'LBL_TASKS',
447 'relationship' => 'lead_notes',
449 'vname'=>'LBL_NOTES',
453 'name' => 'meetings',
455 'relationship' => 'meetings_leads',
457 'vname'=>'LBL_MEETINGS',
463 'relationship' => 'calls_leads',
465 'vname'=>'LBL_CALLS',
469 'name' => 'oldmeetings',
471 'relationship' => 'lead_meetings',
473 'vname'=>'LBL_MEETINGS',
477 'name' => 'oldcalls',
479 'relationship' => 'lead_calls',
481 'vname'=>'LBL_CALLS',
487 'relationship' => 'emails_leads_rel',
489 'unified_search'=>true,
490 'vname'=>'LBL_EMAILS',
494 'name' => 'email_addresses',
496 'relationship' => 'leads_email_addresses',
497 'source' => 'non-db',
498 'vname' => 'LBL_EMAIL_ADDRESSES',
500 'rel_fields' => array('primary_address' => array('type'=>'bool')),
502 'email_addresses_primary' =>
504 'name' => 'email_addresses_primary',
506 'relationship' => 'leads_email_addresses_primary',
507 'source' => 'non-db',
508 'vname' => 'LBL_EMAIL_ADDRESS_PRIMARY',
509 'duplicate_merge'=> 'disabled',
513 'name' => 'campaigns',
515 'relationship' => 'lead_campaign_log',
516 'module'=>'CampaignLog',
517 'bean_name'=>'CampaignLog',
519 'vname'=>'LBL_CAMPAIGNLOG',
523 'name' => 'prospect_lists',
525 'relationship' => 'prospect_list_leads',
526 'module'=>'ProspectLists',
528 'vname'=>'LBL_PROSPECT_LIST',
532 , 'indices' => array (
533 array('name' =>'idx_lead_acct_name_first', 'type'=>'index', 'fields'=>array('account_name','deleted')),
534 array('name' =>'idx_lead_last_first', 'type'=>'index', 'fields'=>array('last_name','first_name','deleted')),
535 array('name' =>'idx_lead_del_stat', 'type'=>'index', 'fields'=>array('last_name','status','deleted','first_name')),
536 array('name' =>'idx_lead_opp_del', 'type'=>'index', 'fields'=>array('opportunity_id','deleted',)),
537 array('name' =>'idx_leads_acct_del', 'type'=>'index', 'fields'=>array('account_id','deleted',)),
538 array('name' => 'idx_del_user', 'type' => 'index', 'fields'=> array('deleted', 'assigned_user_id')),
539 array('name' =>'idx_lead_assigned', 'type'=>'index', 'fields'=>array('assigned_user_id')),
540 array('name' =>'idx_lead_contact', 'type'=>'index', 'fields'=>array('contact_id')),
541 array('name' =>'idx_reports_to', 'type'=>'index', 'fields'=>array('reports_to_id')),
542 array('name' =>'idx_lead_phone_work', 'type'=>'index', 'fields'=>array('phone_work')),
543 array('name' =>'idx_leads_id_del', 'type'=>'index', 'fields'=>array('id','deleted',)),
546 , 'relationships' => array (
547 'lead_direct_reports' => array('lhs_module'=> 'Leads', 'lhs_table'=> 'leads', 'lhs_key' => 'id',
548 'rhs_module'=> 'Leads', 'rhs_table'=> 'leads', 'rhs_key' => 'reports_to_id',
549 'relationship_type'=>'one-to-many'),
550 'lead_tasks' => array('lhs_module'=> 'Leads', 'lhs_table'=> 'leads', 'lhs_key' => 'id',
551 'rhs_module'=> 'Tasks', 'rhs_table'=> 'tasks', 'rhs_key' => 'parent_id',
552 'relationship_type'=>'one-to-many', 'relationship_role_column'=>'parent_type',
553 'relationship_role_column_value'=>'Leads')
554 ,'lead_notes' => array('lhs_module'=> 'Leads', 'lhs_table'=> 'leads', 'lhs_key' => 'id',
555 'rhs_module'=> 'Notes', 'rhs_table'=> 'notes', 'rhs_key' => 'parent_id',
556 'relationship_type'=>'one-to-many', 'relationship_role_column'=>'parent_type',
557 'relationship_role_column_value'=>'Leads')
559 ,'lead_meetings' => array('lhs_module'=> 'Leads', 'lhs_table'=> 'leads', 'lhs_key' => 'id',
560 'rhs_module'=> 'Meetings', 'rhs_table'=> 'meetings', 'rhs_key' => 'parent_id',
561 'relationship_type'=>'one-to-many', 'relationship_role_column'=>'parent_type',
562 'relationship_role_column_value'=>'Leads')
564 ,'lead_calls' => array('lhs_module'=> 'Leads', 'lhs_table'=> 'leads', 'lhs_key' => 'id',
565 'rhs_module'=> 'Calls', 'rhs_table'=> 'calls', 'rhs_key' => 'parent_id',
566 'relationship_type'=>'one-to-many', 'relationship_role_column'=>'parent_type',
567 'relationship_role_column_value'=>'Leads')
569 ,'lead_emails' => array('lhs_module'=> 'Leads', 'lhs_table'=> 'leads', 'lhs_key' => 'id',
570 'rhs_module'=> 'Emails', 'rhs_table'=> 'emails', 'rhs_key' => 'parent_id',
571 'relationship_type'=>'one-to-many', 'relationship_role_column'=>'parent_type',
572 'relationship_role_column_value'=>'Leads'),
573 'lead_campaign_log' => array(
574 'lhs_module' => 'Leads',
575 'lhs_table' => 'leads',
577 'rhs_module' => 'CampaignLog',
578 'rhs_table' => 'campaign_log',
579 'rhs_key' => 'target_id',
580 'relationship_type' =>'one-to-many',
581 'relationship_role_column' => 'target_type',
582 'relationship_role_column_value' => 'Leads'
586 //This enables optimistic locking for Saves From EditView
587 ,'optimistic_locking'=>true,
590 VardefManager::createVardef('Leads','Lead', array('default', 'assignable',