]> CyberLeo.Net >> Repos - Github/sugarcrm.git/blob - modules/Tasks/vardefs.php
Merge pull request #100 from collinlee/master
[Github/sugarcrm.git] / modules / Tasks / 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['Task'] = array('table' => 'tasks',
39         'unified_search' => true,
40                                'fields' => array (
41   'name' =>
42   array (
43     'name' => 'name',
44     'vname' => 'LBL_SUBJECT',
45     'dbType' => 'varchar',
46     'type' => 'name',
47     'len' => '50',
48         'unified_search' => true,
49     'importable' => 'required',
50     'required' => 'true',
51   ),
52   'status' =>
53   array (
54     'name' => 'status',
55     'vname' => 'LBL_STATUS',
56     'type' => 'enum',
57     'options' => 'task_status_dom',
58     'len' => 100,
59     'required' => 'true',
60     'default' => 'Not Started',
61   ),
62   'date_due_flag' =>
63   array (
64     'name' => 'date_due_flag',
65     'vname' => 'LBL_DATE_DUE_FLAG',
66     'type' =>'bool',
67     'default'=>0,
68     'group'=>'date_due',
69         'studio' => false,
70   ),
71   'date_due' =>
72   array (
73     'name' => 'date_due',
74     'vname' => 'LBL_DUE_DATE',
75     'type' => 'datetimecombo',
76     'dbType' => 'datetime',
77     'group'=>'date_due',
78     'studio' => array('required' => true, 'no_duplicate' => true),
79     'enable_range_search' => true,
80     'options' => 'date_range_search_dom',
81     ),
82   'time_due' =>
83   array (
84     'name' => 'time_due',
85     'vname' => 'LBL_DUE_TIME',
86     'type' => 'datetime',
87     //'db_concat_fields'=> array(0=>'date_due'),
88     'source' => 'non-db',
89     'importable' => 'false',
90     'massupdate' => false,
91     ),
92   'date_start_flag' =>
93   array (
94     'name' => 'date_start_flag',
95     'vname' => 'LBL_DATE_START_FLAG',
96     'type' =>'bool',
97     'group'=>'date_start',
98     'default'=>0,
99         'studio' => false,
100   ),
101   'date_start' =>
102   array (
103     'name' => 'date_start',
104     'vname' => 'LBL_START_DATE',
105     'type' => 'datetimecombo',
106     'dbType' => 'datetime',
107     'group'=>'date_start',
108     'validation' => array('type' => 'isbefore', 'compareto' => 'date_due', 'blank' => false),
109     'studio' => array('required' => true, 'no_duplicate' => true),
110     'enable_range_search' => true,
111     'options' => 'date_range_search_dom',
112     ),
113  'parent_type'=>
114   array(
115         'name'=>'parent_type',
116         'vname'=>'LBL_PARENT_NAME',
117     'type' => 'parent_type',
118     'dbType'=>'varchar',
119         'group'=>'parent_name',
120     'options'=> 'parent_type_display',
121         'required'=>false,
122         'len'=>'255',
123     'comment' => 'The Sugar object to which the call is related',
124     'options' => 'parent_type_display',
125 ),
126
127   'parent_name'=>
128   array(
129         'name'=> 'parent_name',
130         'parent_type'=>'record_type_display' ,
131         'type_name'=>'parent_type',
132         'id_name'=>'parent_id',
133     'vname'=>'LBL_LIST_RELATED_TO',
134         'type'=>'parent',
135         'group'=>'parent_name',
136         'source'=>'non-db',
137         'options'=> 'parent_type_display',
138   ),
139
140   'parent_id' =>
141   array (
142     'name' => 'parent_id',
143     'type' => 'id',
144     'group'=>'parent_name',
145     'reportable'=>false,
146     'vname'=>'LBL_PARENT_ID',
147   ),
148   'contact_id' =>
149   array (
150     'name' => 'contact_id',
151     'type' => 'id',
152     'group'=>'contact_name',
153     'reportable'=>false,
154     'vname'=>'LBL_CONTACT_ID',
155   ),
156
157   'contact_name' =>
158   array (
159     'name' => 'contact_name',
160     'rname'=>'last_name',
161     'db_concat_fields'=> array(0=>'first_name', 1=>'last_name'),
162     'source' => 'non-db',
163     'len' => '510',
164     'group'=>'contact_name',
165     'vname' => 'LBL_CONTACT_NAME',
166     'reportable'=>false,
167     'id_name' => 'contact_id',
168     'join_name' => 'contacts',
169     'type' => 'relate',
170     'module' => 'Contacts',
171     'link'=>'contacts',
172     'table'=>'contacts',
173   ),
174
175   'contact_phone'=>
176     array(
177         'name'=>'contact_phone',
178         'type'=>'phone',
179         'source'=>'non-db',
180         'vname'=>'LBL_CONTACT_PHONE',
181         'studio'=>array('listview' => true)
182     ),
183
184  'contact_email'=>
185     array(
186         'name'=>'contact_email',
187         'type'=>'varchar',
188                 'vname' => 'LBL_EMAIL_ADDRESS',
189                 'source' => 'non-db',
190         'studio' => 'hidden'
191     ),
192
193   'priority' =>
194   array (
195     'name' => 'priority',
196     'vname' => 'LBL_PRIORITY',
197     'type' => 'enum',
198     'options' => 'task_priority_dom',
199     'len' => 100,
200     'required' => 'true',
201   ),
202         'contacts'=>    array(
203                 'name' => 'contacts',
204                 'type' => 'link',
205                 'relationship' => 'contact_tasks',
206                 'source'=>'non-db',
207                 'side'=>'right',
208                 'vname'=>'LBL_CONTACT',
209         ),
210   'accounts' =>
211   array (
212         'name' => 'accounts',
213     'type' => 'link',
214     'relationship' => 'account_tasks',
215     'source'=>'non-db',
216                 'vname'=>'LBL_ACCOUNT',
217   ),
218   'opportunities' =>
219   array (
220     'name' => 'opportunities',
221     'type' => 'link',
222     'relationship' => 'opportunity_tasks',
223     'source'=>'non-db',
224     'vname'=>'LBL_OPPORTUNITY',
225   ),
226   'cases' =>
227   array (
228     'name' => 'cases',
229     'type' => 'link',
230     'relationship' => 'case_tasks',
231     'source'=>'non-db',
232     'vname'=>'LBL_CASE',
233   ),
234   'bugs' =>
235   array (
236     'name' => 'bugs',
237     'type' => 'link',
238     'relationship' => 'bug_tasks',
239     'source'=>'non-db',
240     'vname'=>'LBL_BUGS',
241   ),
242   'leads' =>
243   array (
244     'name' => 'leads',
245     'type' => 'link',
246     'relationship' => 'lead_tasks',
247     'source'=>'non-db',
248     'vname'=>'LBL_LEADS',
249   ),
250   'projects' =>
251     array (
252     'name' => 'projects',
253     'type' => 'link',
254     'relationship' => 'projects_tasks',
255     'source'=>'non-db',
256     'vname'=>'LBL_PROJECTS',
257   ),
258   'project_tasks' =>
259     array (
260     'name' => 'project_tasks',
261     'type' => 'link',
262     'relationship' => 'project_tasks_tasks',
263     'source'=>'non-db',
264     'vname'=>'LBL_PROJECT_TASKS',
265   ),
266     'notes' =>
267   array (
268         'name' => 'notes',
269     'type' => 'link',
270     'relationship' => 'tasks_notes',
271     'module'=>'Notes',
272     'bean_name'=>'Note',
273     'source'=>'non-db',
274                 'vname'=>'LBL_NOTES',
275   ),
276   
277         'contact_parent'=>
278                 array (
279                         'name' => 'contact_parent',
280                         'type' => 'link',
281                         'relationship' => 'contact_tasks_parent',
282                         'source' => 'non-db',
283             'reportable' => false
284         ),
285 )
286 ,
287  'relationships' => array (
288                 'tasks_notes' => array(
289                         'lhs_module'            => 'Tasks',
290                         'lhs_table'                     => 'tasks',
291                         'lhs_key'                       => 'id',
292                         'rhs_module'            => 'Notes',
293                         'rhs_table'                     => 'notes',
294                         'rhs_key'                       => 'parent_id',
295                         'relationship_type'     => 'one-to-many',
296                 ),
297
298   'tasks_assigned_user' =>
299    array('lhs_module'=> 'Users', 'lhs_table'=> 'users', 'lhs_key' => 'id',
300    'rhs_module'=> 'Tasks', 'rhs_table'=> 'tasks', 'rhs_key' => 'assigned_user_id',
301    'relationship_type'=>'one-to-many')
302
303    ,'tasks_modified_user' =>
304    array('lhs_module'=> 'Users', 'lhs_table'=> 'users', 'lhs_key' => 'id',
305    'rhs_module'=> 'Tasks', 'rhs_table'=> 'tasks', 'rhs_key' => 'modified_user_id',
306    'relationship_type'=>'one-to-many')
307
308    ,'tasks_created_by' =>
309    array('lhs_module'=> 'Users', 'lhs_table'=> 'users', 'lhs_key' => 'id',
310    'rhs_module'=> 'Tasks', 'rhs_table'=> 'tasks', 'rhs_key' => 'created_by',
311    'relationship_type'=>'one-to-many')
312 )
313                                                       , 'indices' => array (
314        array('name' =>'idx_tsk_name', 'type'=>'index', 'fields'=>array('name')),
315        array('name' =>'idx_task_con_del', 'type'=>'index', 'fields'=>array('contact_id','deleted')),
316        array('name' =>'idx_task_par_del', 'type'=>'index', 'fields'=>array('parent_id','parent_type','deleted')),
317        array('name' =>'idx_task_assigned', 'type'=>'index', 'fields'=>array('assigned_user_id')),
318         array('name' =>'idx_task_status', 'type'=>'index', 'fields'=>array('status')),
319              )
320
321         //This enables optimistic locking for Saves From EditView
322         ,'optimistic_locking'=>true,
323                             );
324 VardefManager::createVardef('Tasks','Task', array('default', 'assignable',
325 ));
326 ?>