]> CyberLeo.Net >> Repos - Github/sugarcrm.git/blob - modules/Notes/vardefs.php
Release 6.4.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-2011 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, '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     'comment' => 'Name of the note',
135     'importable' => 'required',
136     'required' => true,
137   ),
138   'file_mime_type' =>
139   array (
140     'name' => 'file_mime_type',
141     'vname' => 'LBL_FILE_MIME_TYPE',
142     'type' => 'varchar',
143     'len' => '100',
144     'comment' => 'Attachment MIME type',
145     'importable' => false,
146   ),
147   'file_url'=>
148   array(
149         'name'=>'file_url',
150     'vname' => 'LBL_FILE_URL',
151         'type'=>'function',
152         'function_class'=>'UploadFile',
153         'function_name'=>'get_upload_url',
154         'function_params'=> array('$this'),
155         'source'=>'function',
156         'reportable'=>false,
157         'comment' => 'Path to file (can be URL)',
158     'importable' => false,
159         ),
160   'filename' =>
161   array (
162     'name' => 'filename',
163     'vname' => 'LBL_FILENAME',
164     'type' => 'file',
165     'dbType' => 'varchar',
166     'len' => '255',
167     'reportable'=>true,
168     'comment' => 'File name associated with the note (attachment)',
169     'importable' => false,
170   ),
171   'parent_type'=>
172   array(
173         'name'=>'parent_type',
174         'vname'=>'LBL_PARENT_TYPE',
175         'type' =>'parent_type',
176     'dbType' => 'varchar',
177     'group'=>'parent_name',
178         'len'=> '255',
179         'comment' => 'Sugar module the Note is associated with'
180   ),
181   'parent_id'=>
182   array(
183         'name'=>'parent_id',
184         'vname'=>'LBL_PARENT_ID',
185         'type'=>'id',
186         'required'=>false,
187         'reportable'=>true,
188         'comment' => 'The ID of the Sugar item specified in parent_type'
189   ),
190   'contact_id'=>
191   array(
192         'name'=>'contact_id',
193         'vname'=>'LBL_CONTACT_ID',
194         'type'=>'id',
195         'required'=>false,
196         'reportable'=>false,
197         'comment' => 'Contact ID note is associated with'
198   ),
199   'portal_flag' =>
200   array (
201     'name' => 'portal_flag',
202     'vname' => 'LBL_PORTAL_FLAG',
203     'type' => 'bool',
204         'required' => true,
205         'comment' => 'Portal flag indicator determines if note created via portal'
206   ),
207   'embed_flag' =>
208   array (
209     'name' => 'embed_flag',
210     'vname' => 'LBL_EMBED_FLAG',
211     'type' => 'bool',
212     'default' => 0,
213         'comment' => 'Embed flag indicator determines if note embedded in email'
214   ),
215   'description' =>
216   array (
217     'name' => 'description',
218     'vname' => 'LBL_NOTE_STATUS',
219     'type' => 'text',
220     'comment' => 'Full text of the note'
221   ),
222   'deleted' =>
223   array (
224     'name' => 'deleted',
225     'vname' => 'LBL_DELETED',
226     'type' => 'bool',
227     'required' => false,
228     'default' => '0',
229     'reportable'=>false,
230     'comment' => 'Record deletion indicator'
231   ),
232
233
234
235  'parent_name'=>
236         array(
237                 'name'=> 'parent_name',
238                 'parent_type'=>'record_type_display' ,
239                 'type_name'=>'parent_type',
240                 'id_name'=>'parent_id', 'vname'=>'LBL_RELATED_TO',
241                 'type'=>'parent',
242                 'source'=>'non-db',
243                 'options'=> 'record_type_display_notes',
244                 ),
245
246  'contact_name'=>
247         array(
248                 'name'=>'contact_name',
249                 'rname'=>'name',
250                 'id_name'=>'contact_id',
251                 'vname'=>'LBL_CONTACT_NAME',
252         'table'=>'contacts',
253                 'type'=>'relate',
254                 'link'=>'contact',
255                 'join_name'=>'contacts',
256         'db_concat_fields'=> array(0=>'first_name', 1=>'last_name'),
257                 'isnull'=>'true',
258                 'module'=>'Contacts',
259                 'source'=>'non-db',
260                 ),
261
262   'contact_phone'=>
263     array(
264         'name'=>'contact_phone',
265         'vname' => 'LBL_PHONE',
266         'type'=>'phone',
267         'vname' => 'LBL_PHONE',
268         'source'=>'non-db'
269     ),
270
271  'contact_email'=>
272     array(
273         'name'=>'contact_email',
274         'type'=>'varchar',
275                 'vname' => 'LBL_EMAIL_ADDRESS',
276                 'source' => 'non-db'
277     ),
278
279   'account_id' =>
280   array (
281     'name' => 'account_id',
282     'vname' => 'LBL_ACCOUNT_ID',
283     'type' => 'id',
284     'reportable'=>false,
285         'source'=>'non-db',
286   ),
287   'opportunity_id' =>
288   array (
289     'name' => 'opportunity_id',
290     'vname' => 'LBL_OPPORTUNITY_ID',
291     'type' => 'id',
292     'reportable'=>false,
293         'source'=>'non-db',
294   ),
295   'acase_id' =>
296   array (
297     'name' => 'acase_id',
298     'vname' => 'LBL_CASE_ID',
299     'type' => 'id',
300     'reportable'=>false,
301         'source'=>'non-db',
302   ),
303   'lead_id' =>
304   array (
305     'name' => 'lead_id',
306     'vname' => 'LBL_LEAD_ID',
307     'type' => 'id',
308     'reportable'=>false,
309         'source'=>'non-db',
310   ),
311
312   'created_by_link' =>
313   array (
314         'name' => 'created_by_link',
315     'type' => 'link',
316     'relationship' => 'notes_created_by',
317     'vname' => 'LBL_CREATED_BY_USER',
318     'link_type' => 'one',
319     'module'=>'Users',
320     'bean_name'=>'User',
321     'source'=>'non-db',
322   ),
323   'modified_user_link' =>
324   array (
325         'name' => 'modified_user_link',
326     'type' => 'link',
327     'relationship' => 'notes_modified_user',
328     'vname' => 'LBL_MODIFIED_BY_USER',
329     'link_type' => 'one',
330     'module'=>'Users',
331     'bean_name'=>'User',
332     'source'=>'non-db',
333   ),
334
335   'contact' =>
336   array (
337     'name' => 'contact',
338     'type' => 'link',
339     'relationship' => 'contact_notes',
340     'vname' => 'LBL_LIST_CONTACT_NAME',
341     'source'=>'non-db',
342   ),
343   'cases' =>
344   array (
345     'name' => 'cases',
346     'type' => 'link',
347     'relationship' => 'case_notes',
348     'vname' => 'LBL_CASES',
349     'source'=>'non-db',
350   ),
351   'accounts' =>
352   array (
353     'name' => 'accounts',
354     'type' => 'link',
355     'relationship' => 'account_notes',
356     'source'=>'non-db',
357     'vname'=>'LBL_ACCOUNTS',
358   ),
359   'opportunities' =>
360   array (
361     'name' => 'opportunities',
362     'type' => 'link',
363     'relationship' => 'opportunity_notes',
364     'source'=>'non-db',
365     'vname'=>'LBL_OPPORTUNITIES',
366   ),
367   'leads' =>
368   array (
369     'name' => 'leads',
370     'type' => 'link',
371     'relationship' => 'lead_notes',
372     'source'=>'non-db',
373     'vname'=>'LBL_LEADS',
374   ),
375   'bugs' =>
376   array (
377     'name' => 'bugs',
378     'type' => 'link',
379     'relationship' => 'bug_notes',
380     'source'=>'non-db',
381     'vname'=>'LBL_BUGS',
382   ),
383   'emails' =>
384   array(
385     'name'=> 'emails',
386     'vname'=> 'LBL_EMAILS',
387     'type'=> 'link',
388     'relationship'=> 'emails_notes_rel',
389     'source'=> 'non-db',
390   ),
391   'projects' =>
392   array (
393     'name' => 'projects',
394     'type' => 'link',
395     'relationship' => 'projects_notes',
396     'source'=>'non-db',
397     'vname'=>'LBL_PROJECTS',
398   ),
399   'project_tasks' =>
400   array (
401     'name' => 'project_tasks',
402     'type' => 'link',
403     'relationship' => 'project_tasks_notes',
404     'source'=>'non-db',
405     'vname'=>'LBL_PROJECT_TASKS',
406   ),
407   'meetings' =>
408   array (
409     'name' => 'meetings',
410     'type' => 'link',
411     'relationship' => 'meetings_notes',
412     'source'=>'non-db',
413     'vname'=>'LBL_MEETINGS',
414   ),
415   'calls' =>
416   array (
417     'name' => 'calls',
418     'type' => 'link',
419     'relationship' => 'calls_notes',
420     'source'=>'non-db',
421     'vname'=>'LBL_CALLS',
422   ),
423   'tasks' =>
424   array (
425     'name' => 'tasks',
426     'type' => 'link',
427     'relationship' => 'tasks_notes',
428     'source'=>'non-db',
429     'vname'=>'LBL_TASKS',
430   ),
431   'description' =>
432       array (
433         'name' => 'description',
434         'vname' => 'LBL_DESCRIPTION',
435         'type' => 'text',
436         'comment' => 'Full text of the note',
437         'rows' => 30,
438         'cols' => 90,
439       ),
440 ),
441 'relationships'=>array(
442 'notes_modified_user' =>
443    array('lhs_module'=> 'Users', 'lhs_table'=> 'users', 'lhs_key' => 'id',
444    'rhs_module'=> 'Notes', 'rhs_table'=> 'notes', 'rhs_key' => 'modified_user_id',
445    'relationship_type'=>'one-to-many')
446
447    ,'notes_created_by' =>
448    array('lhs_module'=> 'Users', 'lhs_table'=> 'users', 'lhs_key' => 'id',
449    'rhs_module'=> 'Notes', 'rhs_table'=> 'notes', 'rhs_key' => 'created_by',
450    'relationship_type'=>'one-to-many')
451
452
453 )
454                                                       , 'indices' => array (
455        array('name' =>'notespk', 'type' =>'primary', 'fields'=>array('id')),
456        array('name' =>'idx_note_name', 'type'=>'index', 'fields'=>array('name')),
457        array('name' =>'idx_notes_parent', 'type'=>'index', 'fields'=>array('parent_id', 'parent_type')),
458        array('name' =>'idx_note_contact', 'type'=>'index', 'fields'=>array('contact_id')),
459        array('name' =>'idx_notes_assigned_del', 'type' =>'index', 'fields'=>array( 'deleted', 'assigned_user_id')),
460                                                       )
461
462
463                                                       //This enables optimistic locking for Saves From EditView
464         ,'optimistic_locking'=>true,
465                             );
466
467 VardefManager::createVardef('Notes','Note', array('assignable',
468 ));
469 ?>