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.
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 // 'link'=>'reports_to_link',
122 'table' => 'contacts',
124 'module' => 'Contacts',
125 'dbType' => 'varchar',
129 'massupdate' => false,
133 'name' => 'reports_to_link',
135 'relationship' => 'lead_direct_reports',
139 'vname'=>'LBL_REPORTS_TO',
141 /*'acc_name_from_accounts' =>
143 'name' => 'acc_name_from_accounts',
145 'id_name' => 'account_id',
146 'vname' => 'LBL_ACCOUNT_NAME_1',
148 'link' => 'accounts',
149 'table' => 'accounts',
150 'join_name'=>'accounts',
152 'module' => 'Accounts',
153 'dbType' => 'varchar',
155 'source' => 'non-db',
156 'unified_search' => false,
157 'massupdate' => false,
163 'name' => 'account_name',
164 'vname' => 'LBL_ACCOUNT_NAME',
167 'unified_search' => true,
168 'comment' => 'Account name for lead',
174 'name' => 'accounts',
176 'relationship' => 'account_leads',
177 'link_type' => 'one',
178 'source' => 'non-db',
179 'vname' => 'LBL_ACCOUNT',
180 'duplicate_merge'=> 'disabled',
183 'account_description' =>
185 'name' => 'account_description',
186 'vname' => 'LBL_ACCOUNT_DESCRIPTION',
188 'group'=>'account_name',
189 'unified_search' => true,
190 'comment' => 'Description of lead account'
194 'name' => 'contact_id',
197 'vname'=>'LBL_CONTACT_ID',
198 'comment' => 'If converted, Contact ID resulting from the conversion'
202 'name' => 'account_id',
205 'vname'=>'LBL_ACCOUNT_ID',
206 'comment' => 'If converted, Account ID resulting from the conversion'
210 'name' => 'opportunity_id',
213 'vname'=>'LBL_OPPORTUNITY_ID',
214 'comment' => 'If converted, Opportunity ID resulting from the conversion'
216 'opportunity_name' =>
218 'name' => 'opportunity_name',
219 'vname' => 'LBL_OPPORTUNITY_NAME',
222 'comment' => 'Opportunity name associated with lead'
224 'opportunity_amount' =>
226 'name' => 'opportunity_amount',
227 'vname' => 'LBL_OPPORTUNITY_AMOUNT',
229 'group'=>'opportunity_name',
231 'comment' => 'Amount of the opportunity'
235 'name' => 'campaign_id',
238 'vname'=>'LBL_CAMPAIGN_ID',
239 'comment' => 'Campaign that generated lead'
244 'name' => 'campaign_name',
246 'id_name' => 'campaign_id',
247 'vname' => 'LBL_CAMPAIGN',
249 'link' => 'campaign_leads',
250 'table' => 'campaigns',
252 'module' => 'Campaigns',
253 'source' => 'non-db',
257 'name' => 'campaign_leads',
259 'vname' => 'LBL_CAMPAIGN_LEAD',
260 'relationship' => 'campaign_leads',
261 'source' => 'non-db',
263 'c_accept_status_fields' =>
265 'name' => 'c_accept_status_fields',
267 'relationship_fields'=>array('id' => 'accept_status_id', 'accept_status' => 'accept_status_name'),
268 'vname' => 'LBL_LIST_ACCEPT_STATUS',
271 'link_type' => 'relationship_info',
272 'source' => 'non-db',
273 'importable' => 'false',
274 'duplicate_merge'=> 'disabled',
275 'studio' => array('listview' => false),
277 'm_accept_status_fields' =>
279 'name' => 'm_accept_status_fields',
281 'relationship_fields'=>array('id' => 'accept_status_id', 'accept_status' => 'accept_status_name'),
282 'vname' => 'LBL_LIST_ACCEPT_STATUS',
284 'link' => 'meetings',
285 'link_type' => 'relationship_info',
286 'source' => 'non-db',
287 'importable' => 'false',
289 'duplicate_merge'=> 'disabled',
290 'studio' => array('listview' => false),
292 'accept_status_id' =>
294 'name' => 'accept_status_id',
296 'source' => 'non-db',
297 'vname' => 'LBL_LIST_ACCEPT_STATUS',
298 'studio' => array('listview' => false),
300 'accept_status_name' =>
302 'massupdate' => false,
303 'name' => 'accept_status_name',
305 'source' => 'non-db',
306 'vname' => 'LBL_LIST_ACCEPT_STATUS',
307 'options' => 'dom_meeting_accept_status',
308 'importable' => 'false',
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',
321 'vname' =>'LBL_ANY_EMAIL',
322 'studio' => array('visible'=>false, 'searchview'=>true),
324 'webtolead_email1' =>
326 'name' => 'webtolead_email1',
327 'vname' => 'LBL_EMAIL_ADDRESS',
330 'source' => 'non-db',
331 'comment' => 'Main email address of lead',
332 'importable' => 'false',
335 'webtolead_email2' =>
337 'name' => 'webtolead_email2',
338 'vname' => 'LBL_OTHER_EMAIL_ADDRESS',
341 'source' => 'non-db',
342 'comment' => 'Secondary email address of lead',
343 'importable' => 'false',
346 'webtolead_email_opt_out' =>
348 'name' => 'webtolead_email_opt_out',
349 'vname' => 'LBL_EMAIL_OPT_OUT',
351 'source' => 'non-db',
352 'comment' => 'Indicator signaling if lead elects to opt out of email campaigns',
353 'importable' => 'false',
354 'massupdate' => false,
357 'webtolead_invalid_email' =>
359 'name' => 'webtolead_invalid_email',
360 'vname' => 'LBL_INVALID_EMAIL',
362 'source' => 'non-db',
363 'comment' => 'Indicator that email address for lead is invalid',
364 'importable' => 'false',
365 'massupdate' => false,
370 'name' => 'birthdate',
371 'vname' => 'LBL_BIRTHDATE',
372 'massupdate' => false,
374 'comment' => 'The birthdate of the contact'
379 'name' => 'portal_name',
380 'vname' => 'LBL_PORTAL_NAME',
384 'comment' => 'Portal user name when lead created via lead portal',
385 //BEGIN SUGARCRM flav!=ent
391 'name' => 'portal_app',
392 'vname' => 'LBL_PORTAL_APP',
396 'comment' => 'Portal application that resulted in created of lead',
397 //BEGIN SUGARCRM flav!=ent
403 'vname' => 'LBL_WEBSITE',
405 'dbType' => 'varchar',
407 'comment' => 'URL of website for the company',
414 'relationship' => 'lead_tasks',
416 'vname'=>'LBL_TASKS',
422 'relationship' => 'lead_notes',
424 'vname'=>'LBL_NOTES',
428 'name' => 'meetings',
430 'relationship' => 'meetings_leads',
432 'vname'=>'LBL_MEETINGS',
438 'relationship' => 'lead_calls',
440 'vname'=>'LBL_CALLS',
444 'name' => 'oldmeetings',
446 'relationship' => 'lead_meetings',
448 'vname'=>'LBL_MEETINGS',
452 'name' => 'oldcalls',
454 'relationship' => 'lead_calls',
456 'vname'=>'LBL_CALLS',
462 'relationship' => 'emails_leads_rel',
464 'unified_search'=>true,
465 'vname'=>'LBL_EMAILS',
469 'name' => 'email_addresses',
471 'relationship' => 'leads_email_addresses',
472 'source' => 'non-db',
473 'vname' => 'LBL_EMAIL_ADDRESSES',
475 'rel_fields' => array('primary_address' => array('type'=>'bool')),
477 'email_addresses_primary' =>
479 'name' => 'email_addresses_primary',
481 'relationship' => 'leads_email_addresses_primary',
482 'source' => 'non-db',
483 'vname' => 'LBL_EMAIL_ADDRESS_PRIMARY',
484 'duplicate_merge'=> 'disabled',
488 'name' => 'campaigns',
490 'relationship' => 'lead_campaign_log',
491 'module'=>'CampaignLog',
492 'bean_name'=>'CampaignLog',
494 'vname'=>'LBL_CAMPAIGNLOG',
498 'name' => 'prospect_lists',
500 'relationship' => 'prospect_list_leads',
501 'module'=>'ProspectLists',
503 'vname'=>'LBL_PROSPECT_LIST',
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')),
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')
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')
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')
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',
550 'rhs_module' => 'CampaignLog',
551 'rhs_table' => 'campaign_log',
552 'rhs_key' => 'target_id',
553 'relationship_type' =>'one-to-many'
557 //This enables optimistic locking for Saves From EditView
558 ,'optimistic_locking'=>true,
561 VardefManager::createVardef('Leads','Lead', array('default', 'assignable',