2 if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
3 /*********************************************************************************
4 * SugarCRM 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['Note'] = array(
40 'unified_search' => true,
41 'comment' => 'Notes and Attachments'
50 'comment' => 'Unique identifier'
54 'name' => 'date_entered',
55 'vname' => 'LBL_DATE_ENTERED',
57 'comment' => 'Date record created'
61 'name' => 'date_modified',
62 'vname' => 'LBL_DATE_MODIFIED',
64 'comment' => 'Date record last modified'
68 'name' => 'modified_user_id',
69 'rname' => 'user_name',
70 'id_name' => 'modified_user_id',
71 'vname' => 'LBL_MODIFIED',
72 'type' => 'assigned_user_name',
75 'group'=>'modified_by_name',
78 'comment' => 'User who last modified record',
82 'name' => 'modified_by_name',
83 'vname' => 'LBL_MODIFIED_BY',
89 'id_name' => 'modified_user_id',
91 'link'=>'modified_user_link',
92 'duplicate_merge'=>'disabled'
96 'name' => 'created_by',
97 'rname' => 'user_name',
98 'id_name' => 'modified_user_id',
99 'vname' => 'LBL_CREATED_BY',
100 'type' => 'assigned_user_name',
104 'comment' => 'User who created record'
108 'name' => 'created_by_name',
109 'vname' => 'LBL_CREATED_BY',
112 'link' => 'created_by_link',
113 'rname' => 'user_name',
116 'id_name' => 'created_by',
118 'duplicate_merge'=>'disabled',
119 'importable' => 'false',
124 'vname' => 'LBL_NOTE_SUBJECT',
125 'dbType' => 'varchar',
128 'unified_search' => true,
129 'comment' => 'Name of the note',
130 'importable' => 'required',
135 'name' => 'filename',
136 'vname' => 'LBL_FILENAME',
140 'comment' => 'File name associated with the note (attachment)',
141 'importable' => false,
145 'name' => 'file_mime_type',
146 'vname' => 'LBL_FILE_MIME_TYPE',
149 'comment' => 'Attachment MIME type',
150 'importable' => false,
155 'vname' => 'LBL_FILE_URL',
157 'function_require'=>'include/upload_file.php',
158 'function_class'=>'UploadFile',
159 'function_name'=>'get_url',
160 'function_params'=> array('filename', 'id'),
161 'source'=>'function',
163 'comment' => 'Path to file (can be URL)',
164 'importable' => false,
168 'name'=>'parent_type',
169 'vname'=>'LBL_PARENT_TYPE',
170 'type' =>'parent_type',
171 'dbType' => 'varchar',
172 'group'=>'parent_name',
174 'comment' => 'Sugar module the Note is associated with'
179 'vname'=>'LBL_PARENT_ID',
183 'comment' => 'The ID of the Sugar item specified in parent_type'
187 'name'=>'contact_id',
188 'vname'=>'LBL_CONTACT_ID',
192 'comment' => 'Contact ID note is associated with'
196 'name' => 'portal_flag',
197 'vname' => 'LBL_PORTAL_FLAG',
200 'comment' => 'Portal flag indicator determines if note created via portal'
204 'name' => 'embed_flag',
205 'vname' => 'LBL_EMBED_FLAG',
208 'comment' => 'Embed flag indicator determines if note embedded in email'
212 'name' => 'description',
213 'vname' => 'LBL_NOTE_STATUS',
215 'comment' => 'Full text of the note'
220 'vname' => 'LBL_DELETED',
225 'comment' => 'Record deletion indicator'
232 'name'=> 'parent_name',
233 'parent_type'=>'record_type_display' ,
234 'type_name'=>'parent_type',
235 'id_name'=>'parent_id', 'vname'=>'LBL_RELATED_TO',
238 'options'=> 'record_type_display_notes',
243 'name'=>'contact_name',
244 'rname'=>'last_name',
245 'id_name'=>'contact_id',
246 'vname'=>'LBL_CONTACT_NAME',
250 'join_name'=>'contacts',
251 'db_concat_fields'=> array(0=>'first_name', 1=>'last_name'),
253 'module'=>'Contacts',
259 'name'=>'contact_phone',
260 'vname' => 'LBL_PHONE',
262 'vname' => 'LBL_PHONE',
268 'name'=>'contact_email',
270 'vname' => 'LBL_EMAIL_ADDRESS',
276 'name' => 'account_id',
277 'vname' => 'LBL_ACCOUNT_ID',
284 'name' => 'opportunity_id',
285 'vname' => 'LBL_OPPORTUNITY_ID',
292 'name' => 'acase_id',
293 'vname' => 'LBL_CASE_ID',
301 'vname' => 'LBL_LEAD_ID',
309 'name' => 'created_by_link',
311 'relationship' => 'notes_created_by',
312 'vname' => 'LBL_CREATED_BY_USER',
313 'link_type' => 'one',
318 'modified_user_link' =>
320 'name' => 'modified_user_link',
322 'relationship' => 'notes_modified_user',
323 'vname' => 'LBL_MODIFIED_BY_USER',
324 'link_type' => 'one',
334 'relationship' => 'contact_notes',
335 'vname' => 'LBL_LIST_CONTACT_NAME',
342 'relationship' => 'case_notes',
343 'vname' => 'LBL_CASES',
348 'name' => 'accounts',
350 'relationship' => 'account_notes',
352 'vname'=>'LBL_ACCOUNTS',
356 'name' => 'opportunities',
358 'relationship' => 'opportunity_notes',
360 'vname'=>'LBL_OPPORTUNITIES',
366 'relationship' => 'lead_notes',
368 'vname'=>'LBL_LEADS',
374 'relationship' => 'bug_notes',
381 'vname'=> 'LBL_EMAILS',
383 'relationship'=> 'emails_notes_rel',
388 'name' => 'projects',
390 'relationship' => 'projects_notes',
392 'vname'=>'LBL_PROJECTS',
396 'name' => 'project_tasks',
398 'relationship' => 'project_tasks_notes',
400 'vname'=>'LBL_PROJECT_TASKS',
404 'name' => 'meetings',
406 'relationship' => 'meetings_notes',
408 'vname'=>'LBL_MEETINGS',
414 'relationship' => 'calls_notes',
416 'vname'=>'LBL_CALLS',
420 'name' => 'description',
421 'vname' => 'LBL_DESCRIPTION',
423 'comment' => 'Full text of the note',
428 'relationships'=>array(
429 'notes_modified_user' =>
430 array('lhs_module'=> 'Users', 'lhs_table'=> 'users', 'lhs_key' => 'id',
431 'rhs_module'=> 'Notes', 'rhs_table'=> 'notes', 'rhs_key' => 'modified_user_id',
432 'relationship_type'=>'one-to-many')
434 ,'notes_created_by' =>
435 array('lhs_module'=> 'Users', 'lhs_table'=> 'users', 'lhs_key' => 'id',
436 'rhs_module'=> 'Notes', 'rhs_table'=> 'notes', 'rhs_key' => 'created_by',
437 'relationship_type'=>'one-to-many')
441 , 'indices' => array (
442 array('name' =>'notespk', 'type' =>'primary', 'fields'=>array('id')),
443 array('name' =>'idx_note_name', 'type'=>'index', 'fields'=>array('name')),
444 array('name' =>'idx_notes_parent', 'type'=>'index', 'fields'=>array('parent_id', 'parent_type')),
445 array('name' =>'idx_note_contact', 'type'=>'index', 'fields'=>array('contact_id')),
449 //This enables optimistic locking for Saves From EditView
450 ,'optimistic_locking'=>true,
453 VardefManager::createVardef('Notes','Note', array('assignable',