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