]> CyberLeo.Net >> Repos - Github/sugarcrm.git/blob - modules/Notes/vardefs.php
Release 6.5.0
[Github/sugarcrm.git] / modules / Notes / vardefs.php
1 <?php
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.
6  * 
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.
13  * 
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
17  * details.
18  * 
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
22  * 02110-1301 USA.
23  * 
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.
26  * 
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.
30  * 
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  ********************************************************************************/
37
38 $dictionary['Note'] = array(
39
40     'table' => 'notes',
41         'unified_search' => true, 'full_text_search' => true, 'unified_search_default_enabled' => true,
42
43         'comment' => 'Notes and Attachments'
44                                ,'fields' => array (
45   'id' =>
46   array (
47     'name' => 'id',
48     'vname' => 'LBL_ID',
49     'type' => 'id',
50     'required'=>true,
51     'reportable'=>true,
52     'comment' => 'Unique identifier'
53   ),
54    'date_entered' =>
55   array (
56     'name' => 'date_entered',
57     'vname' => 'LBL_DATE_ENTERED',
58     'type' => 'datetime',
59     'comment' => 'Date record created',
60     'enable_range_search' => true,
61     'options' => 'date_range_search_dom',
62   ),
63   'date_modified' =>
64   array (
65     'name' => 'date_modified',
66     'vname' => 'LBL_DATE_MODIFIED',
67     'type' => 'datetime',
68     'comment' => 'Date record last modified',
69     'enable_range_search' => true,
70   ),
71    'modified_user_id' =>
72           array (
73             'name' => 'modified_user_id',
74             'rname' => 'user_name',
75             'id_name' => 'modified_user_id',
76             'vname' => 'LBL_MODIFIED',
77             'type' => 'assigned_user_name',
78             'table' => 'users',
79             'isnull' => 'false',
80              'group'=>'modified_by_name',
81             'dbType' => 'id',
82             'reportable'=>true,
83             'comment' => 'User who last modified record',
84           ),
85           'modified_by_name' =>
86           array (
87             'name' => 'modified_by_name',
88     'vname' => 'LBL_MODIFIED_BY',
89             'type' => 'relate',
90             'reportable'=>false,
91             'source'=>'non-db',
92             'rname'=>'user_name',
93             'table' => 'users',
94             'id_name' => 'modified_user_id',
95             'module'=>'Users',
96             'link'=>'modified_user_link',
97             'duplicate_merge'=>'disabled'
98           ),
99           'created_by' =>
100           array (
101             'name' => 'created_by',
102             'rname' => 'user_name',
103             'id_name' => 'modified_user_id',
104                 'vname' => 'LBL_CREATED_BY',
105             'type' => 'assigned_user_name',
106             'table' => 'users',
107             'isnull' => 'false',
108             'dbType' => 'id',
109     'comment' => 'User who created record'
110           ),
111                 'created_by_name' =>
112           array (
113             'name' => 'created_by_name',
114                 'vname' => 'LBL_CREATED_BY',
115                 'type' => 'relate',
116                 'reportable'=>false,
117             'link' => 'created_by_link',
118             'rname' => 'user_name',
119                 'source'=>'non-db',
120                 'table' => 'users',
121                 'id_name' => 'created_by',
122                 'module'=>'Users',
123                 'duplicate_merge'=>'disabled',
124         'importable' => 'false',
125         ),
126   'name' =>
127   array (
128     'name' => 'name',
129     'vname' => 'LBL_NOTE_SUBJECT',
130     'dbType' => 'varchar',
131     'type' => 'name',
132     'len' => '255',
133         'unified_search' => true,
134         'full_text_search' => array('boost' => 3),
135     'comment' => 'Name of the note',
136     'importable' => 'required',
137     'required' => true,
138   ),
139   'file_mime_type' =>
140   array (
141     'name' => 'file_mime_type',
142     'vname' => 'LBL_FILE_MIME_TYPE',
143     'type' => 'varchar',
144     'len' => '100',
145     'comment' => 'Attachment MIME type',
146     'importable' => false,
147   ),
148   'file_url'=>
149   array(
150         'name'=>'file_url',
151     'vname' => 'LBL_FILE_URL',
152         'type'=>'function',
153         'function_class'=>'UploadFile',
154         'function_name'=>'get_upload_url',
155         'function_params'=> array('$this'),
156         'source'=>'function',
157         'reportable'=>false,
158         'comment' => 'Path to file (can be URL)',
159     'importable' => false,
160         ),
161   'filename' =>
162   array (
163     'name' => 'filename',
164     'vname' => 'LBL_FILENAME',
165     'type' => 'file',
166     'dbType' => 'varchar',
167     'len' => '255',
168     'reportable'=>true,
169     'comment' => 'File name associated with the note (attachment)',
170     'importable' => false,
171   ),
172   'parent_type'=>
173   array(
174         'name'=>'parent_type',
175         'vname'=>'LBL_PARENT_TYPE',
176         'type' =>'parent_type',
177     'dbType' => 'varchar',
178     'group'=>'parent_name',
179     'options'=> 'parent_type_display',
180         'len'=> '255',
181         'comment' => 'Sugar module the Note is associated with'
182   ),
183   'parent_id'=>
184   array(
185         'name'=>'parent_id',
186         'vname'=>'LBL_PARENT_ID',
187         'type'=>'id',
188         'required'=>false,
189         'reportable'=>true,
190         'comment' => 'The ID of the Sugar item specified in parent_type'
191   ),
192   'contact_id'=>
193   array(
194         'name'=>'contact_id',
195         'vname'=>'LBL_CONTACT_ID',
196         'type'=>'id',
197         'required'=>false,
198         'reportable'=>false,
199         'comment' => 'Contact ID note is associated with'
200   ),
201   'portal_flag' =>
202   array (
203     'name' => 'portal_flag',
204     'vname' => 'LBL_PORTAL_FLAG',
205     'type' => 'bool',
206         'required' => true,
207         'comment' => 'Portal flag indicator determines if note created via portal'
208   ),
209   'embed_flag' =>
210   array (
211     'name' => 'embed_flag',
212     'vname' => 'LBL_EMBED_FLAG',
213     'type' => 'bool',
214     'default' => 0,
215         'comment' => 'Embed flag indicator determines if note embedded in email'
216   ),
217   'description' =>
218   array (
219     'name' => 'description',
220     'vname' => 'LBL_NOTE_STATUS',
221     'type' => 'text',
222     'comment' => 'Full text of the note'
223   ),
224   'deleted' =>
225   array (
226     'name' => 'deleted',
227     'vname' => 'LBL_DELETED',
228     'type' => 'bool',
229     'required' => false,
230     'default' => '0',
231     'reportable'=>false,
232     'comment' => 'Record deletion indicator'
233   ),
234
235
236
237  'parent_name'=>
238         array(
239                 'name'=> 'parent_name',
240                 'parent_type'=>'record_type_display' ,
241                 'type_name'=>'parent_type',
242                 'id_name'=>'parent_id', 'vname'=>'LBL_RELATED_TO',
243                 'type'=>'parent',
244                 'source'=>'non-db',
245                 'options'=> 'record_type_display_notes',
246                 ),
247
248  'contact_name'=>
249         array(
250                 'name'=>'contact_name',
251                 'rname'=>'name',
252                 'id_name'=>'contact_id',
253                 'vname'=>'LBL_CONTACT_NAME',
254         'table'=>'contacts',
255                 'type'=>'relate',
256                 'link'=>'contact',
257                 'join_name'=>'contacts',
258         'db_concat_fields'=> array(0=>'first_name', 1=>'last_name'),
259                 'isnull'=>'true',
260                 'module'=>'Contacts',
261                 'source'=>'non-db',
262                 ),
263
264   'contact_phone'=>
265     array(
266         'name'=>'contact_phone',
267         'vname' => 'LBL_PHONE',
268         'type'=>'phone',
269         'vname' => 'LBL_PHONE',
270         'source'=>'non-db'
271     ),
272
273  'contact_email'=>
274     array(
275         'name'=>'contact_email',
276         'type'=>'varchar',
277                 'vname' => 'LBL_EMAIL_ADDRESS',
278                 'source' => 'non-db',
279         'studio' => false
280     ),
281
282   'account_id' =>
283   array (
284     'name' => 'account_id',
285     'vname' => 'LBL_ACCOUNT_ID',
286     'type' => 'id',
287     'reportable'=>false,
288         'source'=>'non-db',
289   ),
290   'opportunity_id' =>
291   array (
292     'name' => 'opportunity_id',
293     'vname' => 'LBL_OPPORTUNITY_ID',
294     'type' => 'id',
295     'reportable'=>false,
296         'source'=>'non-db',
297   ),
298   'acase_id' =>
299   array (
300     'name' => 'acase_id',
301     'vname' => 'LBL_CASE_ID',
302     'type' => 'id',
303     'reportable'=>false,
304         'source'=>'non-db',
305   ),
306   'lead_id' =>
307   array (
308     'name' => 'lead_id',
309     'vname' => 'LBL_LEAD_ID',
310     'type' => 'id',
311     'reportable'=>false,
312         'source'=>'non-db',
313   ),
314
315   'created_by_link' =>
316   array (
317         'name' => 'created_by_link',
318     'type' => 'link',
319     'relationship' => 'notes_created_by',
320     'vname' => 'LBL_CREATED_BY_USER',
321     'link_type' => 'one',
322     'module'=>'Users',
323     'bean_name'=>'User',
324     'source'=>'non-db',
325   ),
326   'modified_user_link' =>
327   array (
328         'name' => 'modified_user_link',
329     'type' => 'link',
330     'relationship' => 'notes_modified_user',
331     'vname' => 'LBL_MODIFIED_BY_USER',
332     'link_type' => 'one',
333     'module'=>'Users',
334     'bean_name'=>'User',
335     'source'=>'non-db',
336   ),
337
338   'contact' =>
339   array (
340     'name' => 'contact',
341     'type' => 'link',
342     'relationship' => 'contact_notes',
343     'vname' => 'LBL_LIST_CONTACT_NAME',
344     'source'=>'non-db',
345   ),
346   'cases' =>
347   array (
348     'name' => 'cases',
349     'type' => 'link',
350     'relationship' => 'case_notes',
351     'vname' => 'LBL_CASES',
352     'source'=>'non-db',
353   ),
354   'accounts' =>
355   array (
356     'name' => 'accounts',
357     'type' => 'link',
358     'relationship' => 'account_notes',
359     'source'=>'non-db',
360     'vname'=>'LBL_ACCOUNTS',
361   ),
362   'opportunities' =>
363   array (
364     'name' => 'opportunities',
365     'type' => 'link',
366     'relationship' => 'opportunity_notes',
367     'source'=>'non-db',
368     'vname'=>'LBL_OPPORTUNITIES',
369   ),
370   'leads' =>
371   array (
372     'name' => 'leads',
373     'type' => 'link',
374     'relationship' => 'lead_notes',
375     'source'=>'non-db',
376     'vname'=>'LBL_LEADS',
377   ),
378   'bugs' =>
379   array (
380     'name' => 'bugs',
381     'type' => 'link',
382     'relationship' => 'bug_notes',
383     'source'=>'non-db',
384     'vname'=>'LBL_BUGS',
385   ),
386   'emails' =>
387   array(
388     'name'=> 'emails',
389     'vname'=> 'LBL_EMAILS',
390     'type'=> 'link',
391     'relationship'=> 'emails_notes_rel',
392     'source'=> 'non-db',
393   ),
394   'projects' =>
395   array (
396     'name' => 'projects',
397     'type' => 'link',
398     'relationship' => 'projects_notes',
399     'source'=>'non-db',
400     'vname'=>'LBL_PROJECTS',
401   ),
402   'project_tasks' =>
403   array (
404     'name' => 'project_tasks',
405     'type' => 'link',
406     'relationship' => 'project_tasks_notes',
407     'source'=>'non-db',
408     'vname'=>'LBL_PROJECT_TASKS',
409   ),
410   'meetings' =>
411   array (
412     'name' => 'meetings',
413     'type' => 'link',
414     'relationship' => 'meetings_notes',
415     'source'=>'non-db',
416     'vname'=>'LBL_MEETINGS',
417   ),
418   'calls' =>
419   array (
420     'name' => 'calls',
421     'type' => 'link',
422     'relationship' => 'calls_notes',
423     'source'=>'non-db',
424     'vname'=>'LBL_CALLS',
425   ),
426   'tasks' =>
427   array (
428     'name' => 'tasks',
429     'type' => 'link',
430     'relationship' => 'tasks_notes',
431     'source'=>'non-db',
432     'vname'=>'LBL_TASKS',
433   ),
434   'description' =>
435       array (
436         'name' => 'description',
437         'vname' => 'LBL_DESCRIPTION',
438         'type' => 'text',
439         'comment' => 'Full text of the note',
440         'rows' => 30,
441         'cols' => 90,
442       ),
443 ),
444 'relationships'=>array(
445 'notes_modified_user' =>
446    array('lhs_module'=> 'Users', 'lhs_table'=> 'users', 'lhs_key' => 'id',
447    'rhs_module'=> 'Notes', 'rhs_table'=> 'notes', 'rhs_key' => 'modified_user_id',
448    'relationship_type'=>'one-to-many')
449
450    ,'notes_created_by' =>
451    array('lhs_module'=> 'Users', 'lhs_table'=> 'users', 'lhs_key' => 'id',
452    'rhs_module'=> 'Notes', 'rhs_table'=> 'notes', 'rhs_key' => 'created_by',
453    'relationship_type'=>'one-to-many')
454
455
456 )
457                                                       , 'indices' => array (
458        array('name' =>'notespk', 'type' =>'primary', 'fields'=>array('id')),
459        array('name' =>'idx_note_name', 'type'=>'index', 'fields'=>array('name')),
460        array('name' =>'idx_notes_parent', 'type'=>'index', 'fields'=>array('parent_id', 'parent_type')),
461        array('name' =>'idx_note_contact', 'type'=>'index', 'fields'=>array('contact_id')),
462        array('name' =>'idx_notes_assigned_del', 'type' =>'index', 'fields'=>array( 'deleted', 'assigned_user_id')),
463                                                       )
464
465
466                                                       //This enables optimistic locking for Saves From EditView
467         ,'optimistic_locking'=>true,
468                             );
469
470 VardefManager::createVardef('Notes','Note', array('assignable',
471 ));
472 ?>