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