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',
310 'webtolead_email1' =>
312 'name' => 'webtolead_email1',
313 'vname' => 'LBL_EMAIL_ADDRESS',
316 'source' => 'non-db',
317 'comment' => 'Main email address of lead',
318 'importable' => 'false',
321 'webtolead_email2' =>
323 'name' => 'webtolead_email2',
324 'vname' => 'LBL_OTHER_EMAIL_ADDRESS',
327 'source' => 'non-db',
328 'comment' => 'Secondary email address of lead',
329 'importable' => 'false',
332 'webtolead_email_opt_out' =>
334 'name' => 'webtolead_email_opt_out',
335 'vname' => 'LBL_EMAIL_OPT_OUT',
337 'source' => 'non-db',
338 'comment' => 'Indicator signaling if lead elects to opt out of email campaigns',
339 'importable' => 'false',
340 'massupdate' => false,
343 'webtolead_invalid_email' =>
345 'name' => 'webtolead_invalid_email',
346 'vname' => 'LBL_INVALID_EMAIL',
348 'source' => 'non-db',
349 'comment' => 'Indicator that email address for lead is invalid',
350 'importable' => 'false',
351 'massupdate' => false,
356 'name' => 'birthdate',
357 'vname' => 'LBL_BIRTHDATE',
358 'massupdate' => false,
360 'comment' => 'The birthdate of the contact'
365 'name' => 'portal_name',
366 'vname' => 'LBL_PORTAL_NAME',
370 'comment' => 'Portal user name when lead created via lead portal',
371 //BEGIN SUGARCRM flav!=ent
377 'name' => 'portal_app',
378 'vname' => 'LBL_PORTAL_APP',
382 'comment' => 'Portal application that resulted in created of lead',
383 //BEGIN SUGARCRM flav!=ent
389 'vname' => 'LBL_WEBSITE',
391 'dbType' => 'varchar',
393 'comment' => 'URL of website for the company',
400 'relationship' => 'lead_tasks',
402 'vname'=>'LBL_TASKS',
408 'relationship' => 'lead_notes',
410 'vname'=>'LBL_NOTES',
414 'name' => 'meetings',
416 'relationship' => 'meetings_leads',
418 'vname'=>'LBL_MEETINGS',
424 'relationship' => 'calls_leads',
426 'vname'=>'LBL_CALLS',
430 'name' => 'oldmeetings',
432 'relationship' => 'lead_meetings',
434 'vname'=>'LBL_MEETINGS',
438 'name' => 'oldcalls',
440 'relationship' => 'lead_calls',
442 'vname'=>'LBL_CALLS',
448 'relationship' => 'emails_leads_rel',
450 'unified_search'=>true,
451 'vname'=>'LBL_EMAILS',
455 'name' => 'email_addresses',
457 'relationship' => 'leads_email_addresses',
458 'source' => 'non-db',
459 'vname' => 'LBL_EMAIL_ADDRESSES',
461 'rel_fields' => array('primary_address' => array('type'=>'bool')),
463 'email_addresses_primary' =>
465 'name' => 'email_addresses_primary',
467 'relationship' => 'leads_email_addresses_primary',
468 'source' => 'non-db',
469 'vname' => 'LBL_EMAIL_ADDRESS_PRIMARY',
470 'duplicate_merge'=> 'disabled',
474 'name' => 'campaigns',
476 'relationship' => 'lead_campaign_log',
477 'module'=>'CampaignLog',
478 'bean_name'=>'CampaignLog',
480 'vname'=>'LBL_CAMPAIGNLOG',
484 'name' => 'prospect_lists',
486 'relationship' => 'prospect_list_leads',
487 'module'=>'ProspectLists',
489 'vname'=>'LBL_PROSPECT_LIST',
493 , 'indices' => array (
494 array('name' =>'idx_lead_acct_name_first', 'type'=>'index', 'fields'=>array('account_name','deleted')),
495 array('name' =>'idx_lead_last_first', 'type'=>'index', 'fields'=>array('last_name','first_name','deleted')),
496 array('name' =>'idx_lead_del_stat', 'type'=>'index', 'fields'=>array('last_name','status','deleted','first_name')),
497 array('name' =>'idx_lead_opp_del', 'type'=>'index', 'fields'=>array('opportunity_id','deleted',)),
498 array('name' =>'idx_leads_acct_del', 'type'=>'index', 'fields'=>array('account_id','deleted',)),
499 array('name' => 'idx_del_user', 'type' => 'index', 'fields'=> array('deleted', 'assigned_user_id')),
500 array('name' =>'idx_lead_assigned', 'type'=>'index', 'fields'=>array('assigned_user_id')),
501 array('name' =>'idx_lead_contact', 'type'=>'index', 'fields'=>array('contact_id')),
502 array('name' =>'idx_reports_to', 'type'=>'index', 'fields'=>array('reports_to_id')),
505 , 'relationships' => array (
506 'lead_direct_reports' => array('lhs_module'=> 'Leads', 'lhs_table'=> 'leads', 'lhs_key' => 'id',
507 'rhs_module'=> 'Leads', 'rhs_table'=> 'leads', 'rhs_key' => 'reports_to_id',
508 'relationship_type'=>'one-to-many'),
509 'lead_tasks' => array('lhs_module'=> 'Leads', 'lhs_table'=> 'leads', 'lhs_key' => 'id',
510 'rhs_module'=> 'Tasks', 'rhs_table'=> 'tasks', 'rhs_key' => 'parent_id',
511 'relationship_type'=>'one-to-many', 'relationship_role_column'=>'parent_type',
512 'relationship_role_column_value'=>'Leads')
513 ,'lead_notes' => array('lhs_module'=> 'Leads', 'lhs_table'=> 'leads', 'lhs_key' => 'id',
514 'rhs_module'=> 'Notes', 'rhs_table'=> 'notes', 'rhs_key' => 'parent_id',
515 'relationship_type'=>'one-to-many', 'relationship_role_column'=>'parent_type',
516 'relationship_role_column_value'=>'Leads')
518 ,'lead_meetings' => array('lhs_module'=> 'Leads', 'lhs_table'=> 'leads', 'lhs_key' => 'id',
519 'rhs_module'=> 'Meetings', 'rhs_table'=> 'meetings', 'rhs_key' => 'parent_id',
520 'relationship_type'=>'one-to-many', 'relationship_role_column'=>'parent_type',
521 'relationship_role_column_value'=>'Leads')
523 ,'lead_calls' => array('lhs_module'=> 'Leads', 'lhs_table'=> 'leads', 'lhs_key' => 'id',
524 'rhs_module'=> 'Calls', 'rhs_table'=> 'calls', 'rhs_key' => 'parent_id',
525 'relationship_type'=>'one-to-many', 'relationship_role_column'=>'parent_type',
526 'relationship_role_column_value'=>'Leads')
528 ,'lead_emails' => array('lhs_module'=> 'Leads', 'lhs_table'=> 'leads', 'lhs_key' => 'id',
529 'rhs_module'=> 'Emails', 'rhs_table'=> 'emails', 'rhs_key' => 'parent_id',
530 'relationship_type'=>'one-to-many', 'relationship_role_column'=>'parent_type',
531 'relationship_role_column_value'=>'Leads'),
532 'lead_campaign_log' => array(
533 'lhs_module' => 'Leads',
534 'lhs_table' => 'leads',
536 'rhs_module' => 'CampaignLog',
537 'rhs_table' => 'campaign_log',
538 'rhs_key' => 'target_id',
539 'relationship_type' =>'one-to-many'
543 //This enables optimistic locking for Saves From EditView
544 ,'optimistic_locking'=>true,
547 VardefManager::createVardef('Leads','Lead', array('default', 'assignable',