<?php
if (! defined ( 'sugarEntry' ) || ! sugarEntry)
	die ( 'Not A Valid Entry Point' );
/**
 * *******************************************************************************
 * SugarCRM is a customer relationship management program developed by
 * SugarCRM, Inc.
 * Copyright (C) 2004 - 2009 SugarCRM Inc.
 *
 * This program is free software; you can redistribute it and/or modify it under
 * the terms of the GNU General Public License version 3 as published by the
 * Free Software Foundation with the addition of the following permission added
 * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
 * IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
 * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
 * details.
 *
 * You should have received a copy of the GNU General Public License along with
 * this program; if not, see http://www.gnu.org/licenses or write to the Free
 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 * 02110-1301 USA.
 *
 * You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
 * SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
 *
 * The interactive user interfaces in modified source and object code versions
 * of this program must display Appropriate Legal Notices, as required under
 * Section 5 of the GNU General Public License version 3.
 *
 * In accordance with Section 7(b) of the GNU General Public License version 3,
 * these Appropriate Legal Notices must retain the display of the "Powered by
 * SugarCRM" logo. If the display of the logo is not reasonably feasible for
 * technical reasons, the Appropriate Legal Notices must display the words
 * "Powered by SugarCRM".
 * ******************************************************************************
 */
$dictionary ['Task'] = array (
		'table' => 'tasks',
		'fields' => array (
				'name' => array (
						'name' => 'name',
						'vname' => 'LBL_SUBJECT',
						'dbType' => 'varchar',
						'type' => 'name',
						'len' => '50',
						'importable' => 'required',
						'required' => true 
				),
				'google_calendar_task' => array (
						'name' => 'google_calendar_task',
						'type' => 'varchar',
						'len' => '255' 
				),
				'status' => array (
						'name' => 'status',
						'vname' => 'LBL_STATUS',
						'type' => 'enum',
						'options' => 'activity_status_dom',
						'len' => 45   
				),
				'date_due_flag' => array (
						'name' => 'date_due_flag',
						'vname' => 'LBL_DATE_DUE_FLAG',
						'type' => 'bool',
						'default' => 1,
						'group' => 'date_due' 
				),
		        
		        

		    
		        
				'date_due' => array (
						'name' => 'date_due',
						'vname' => 'LBL_DUE_DATE',
						'type' => 'datetime',
						'group' => 'date_due' 
				),
				'time_due' => array (
						'name' => 'time_due',
						'vname' => 'LBL_DUE_TIME',
						'type' => 'datetime',
						// 'db_concat_fields'=> array(0=>'date_due'),
						'source' => 'non-db',
						'importable' => 'false',
						'massupdate' => false 
				),
				
				'date_due_field' => array (
						'name' => 'date_due_field',
						'group' => 'date_due',
						'vname' => 'LBL_DUE_DATE_AND_TIME',
						'type' => 'datetimecombo',
						'date' => 'date_due',
						'time' => 'time_due',
						'date_readonly' => 'date_due_readonly',
						'time_readonly' => 'time_due_readonly',
						'noneCheckbox' => true,
						'noneCheckboxJavascript' => 'onClick="set_date_due_values(this.form);"',
						'checkboxId' => 'date_due_flag',
						'checked' => 'date_due_checked',
						'meridian' => 'date_due_meridian',
						'showFormats' => true,
						'source' => 'non-db',
						'comment' => 'Used for meta-data framework',
						'importable' => 'false' 
				),
				
				'date_start_flag' => array (
						'name' => 'date_start_flag',
						'vname' => 'LBL_DATE_START_FLAG',
						'type' => 'bool',
						'group' => 'date_start',
						'default' => 1 
				),
				'date_start' => array (
						'name' => 'date_start',
						'vname' => 'LBL_START_DATE',
						'type' => 'datetime',
						'group' => 'date_start',
				        'required'=>true, 
				),
				
				'date_start_field' => array (
						'group' => 'date_start',
						'name' => 'date_start_field',
						'vname' => 'LBL_DUE_DATE_AND_TIME',
						'type' => 'datetimecombo',
						'date' => 'date_start',
						'time' => 'time_start',
						'date_readonly' => 'date_start_readonly',
						'time_readonly' => 'time_start_readonly',
						'noneCheckbox' => true,
						'noneCheckboxJavascript' => 'onClick="set_date_start_values(this.form);"',
						'checkboxId' => 'date_start_flag',
						'checked' => 'date_start_checked',
						'meridian' => 'date_start_meridian',
						'showFormats' => true,
						'source' => 'non-db',
						'comment' => 'Used for meta-data framework' 
				),
		        'telephones' => array (
		                'name' => 'telephones',
		                'vname' => 'LBL_SUBJECT',
		                'dbType' => 'text',
		                'type' => 'text',

		                'required' => false
		        ),
		        'emails' => array (
		                'name' => 'emails',
		                'vname' => 'LBL_SUBJECT',
		                'dbType' => 'text',
		                'type' => 'text',
		        
		                'required' => false
		        ),
				 	'parent_name' => array (
						'name' => 'parent_name',
						'id_name' => 'parent_id',
						'vname' => 'LBL_PARENT_NAME',
						'type' => 'relate',
						'group' => 'parent_name',
						'dbtype' => 'varchar',
						'len' => '255',
						'module' => 'Accounts',
						'massupdate' => false,
						'required' => false
				),
				'parent_id' => array (
						'name' => 'parent_id',
						'type' => 'id',
						'module' => 'Accounts',
						'vname' => 'LBL_PARENT_ID',
						'group' => 'parent_name',
						'massupdate' => false,
						'reportable' => false,
						'required' => false
				),
		        'contact_id' => array (
		                'name' => 'contact_id',
		                'rname' => 'name',
		                'id_name' => 'contact_id',
		                'vname' => 'LBL_CONTACT_ID',
		                'group' => 'contact_name',
		                'type' => 'relate',
		                'table' => 'contacts',
		                'reportable' => true,
		                'Importable' => false,
		                'isnull' => 'false',
		                'dbType' => 'id',
		                'audited' => false,
		                'duplicate_merge' => 'disabled',
		                'massupdate' => false
		        ),
		        'contact_name' => array (
		                'name' => 'contact_name',
		                'vname' => 'LBL_CONTACT_NAME',
		                'type' => 'relate',
		                'reportable' => false,
		                'source' => 'non-db',
		                'table' => 'contacts',
		                'id_name' => 'contact_id',
		                'module' => 'Contacts',
		                'duplicate_merge' => 'disabled',
		                'massupdate' => false,
		                'other_data' => array (
		                        'from_relation' => array (
		                                'module' => 'Accounts',
		                                'rel_name' => 'contacts',
		                                'rel_bean_name' => 'Contact',
		                                'field_id_name' => 'parent_id',
		                                'field_name' => 'parent_name',
		                                'field_id_value' => ''
		                        )
		                ),
		                'initial_filter_fields' => array (
		                        'account_name' => 'parent_name'
		                )
		        ),
		        'date_reminder_flag' => array (
		                'name' => 'date_reminder_flag',
		                'vname' => 'LBL_DATE_REMINDER',
		                'type' => 'bool',
		                'group' => 'date_reminder',
		                'default' => 1
		        ),
		        'date_reminder' => array (
		                'name' => 'date_reminder',
		                'vname' => 'LBL_DATE_REMINDER',
		                'type' => 'datetime',
		                'group' => 'date_reminder'
		        ),
		        
		        'date_reminder_field' => array (
		                'group' => 'date_reminder',
		                'name' => 'date_reminder_field',
		                'vname' => 'LBL_DUE_DATE_AND_TIME',
		                'type' => 'datetimecombo',
		                'date' => 'date_reminder',
		                'time' => 'time_start',
		                'date_readonly' => 'date_reminder_readonly',
		                'time_readonly' => 'time_start_readonly',
		                'noneCheckbox' => true,
		                'noneCheckboxJavascript' => 'onClick="set_date_reminder_values(this.form);"',
		                'checkboxId' => 'date_reminder_flag',
		                'checked' => 'date_reminder_checked',
		                'meridian' => 'date_reminder_meridian',
		                'showFormats' => true,
		                'source' => 'non-db',
		                'comment' => 'Used for meta-data framework'
		        ),

		        'reminder_type' => array (
		                'name' => 'reminder_type',
		                'vname' => 'LBL_REMINDER_TYPE',
		                'type' => 'enum',
		                'default'=>'0',
		                #'options' => 'reminder_type_dom',
		                'len' => 25
		        ),
		        'remider_interval' => array (
		                'name' => 'remider_interval',
		                'vname' => 'LBL_REMINDER_TYPE',
		                'type' => 'enum',
		                'default'=>'0',
		                #'options' => 'reminder_type_dom',
		                'len' => 25
		        ),
		        'remider_interval_type' => array (
		                'name' => 'remider_interval_type',
		                'vname' => 'LBL_REMINDER_TYPE',
		                'type' => 'enum',
		                'default'=>'0',
		                #'options' => 'reminder_type_dom',
		                'len' => 25
		        ),
				'contact_id' => array (
						'name' => 'contact_id',
						'type' => 'id',
						'group' => 'contact_name',
						'reportable' => false,
						'vname' => 'LBL_CONTACT_ID' 
				),
		        'record_id' => array (
		                'name' => 'record_id',
		                'type' => 'varchar',
		                'reportable' => false,
		                'vname' => 'LBL_CONTACT_ID'
		        ),
		        'record_type' => array (
		                'name' => 'record_type',
		                'type' => 'varchar',
		                'reportable' => false,
		                'vname' => 'LBL_CONTACT_ID'
		        ),
				'contact_name' => array (
						'name' => 'contact_name',
						'rname' => 'last_name',
						'db_concat_fields' => array (
								0 => 'first_name',
								1 => 'last_name' 
						),
						'source' => 'non-db',
						'len' => '510',
						'group' => 'contact_name',
						'vname' => 'LBL_CONTACT_NAME',
						'reportable' => false,
						'id_name' => 'contact_id',
						'join_name' => 'contacts',
						'type' => 'relate',
						'module' => 'Contacts',
						'link' => 'contacts',
						'table' => 'contacts' 
				),
				
				'assigned_user_id2' => array (
						'name' => 'assigned_user_id2',
						'type' => 'id',
						'group' => 'assigned_user_id2',
						'reportable' => false,
						'vname' => 'LBL_ASSIGNED_USER_ID' 
				),
				
				'assigned_user_name2' => array (
						'name' => 'assigned_user_name2',
						'rname' => 'full_name',
						'db_concat_fields' => array (
								0 => 'first_name',
								1 => 'last_name' 
						),
						'source' => 'non-db',
						'len' => '510',
						'group' => 'assigned_user_name2',
						'vname' => 'LBL_CONTACT_NAME',
						'reportable' => false,
						'id_name' => 'assigned_user_id2',
						'join_name' => 'users',
						'type' => 'relate',
						'module' => 'Users',
						'link' => 'users',
						'table' => 'users' 
				),
				
				'contact_phone' => array (
						'name' => 'contact_phone',
						'type' => 'phone',
						'source' => 'non-db',
						'vname' => 'LBL_CONTACT_PHONE' 
				),
				
				'contact_email' => array (
						'name' => 'contact_email',
						'type' => 'varchar',
						'vname' => 'LBL_EMAIL_ADDRESS',
						'source' => 'non-db' 
				),
				
				'priority' => array (
						'name' => 'priority',
						'vname' => 'LBL_PRIORITY',
						'type' => 'enum',
						'options' => 'task_priority_dom',
						'len' => 25 
				),
				'contacts' => array (
						'name' => 'contacts',
						'type' => 'link',
						'relationship' => 'contact_tasks',
						'source' => 'non-db',
						'side' => 'right',
						'vname' => 'LBL_CONTACT' 
				),
				'accounts' => array (
						'name' => 'accounts',
						'type' => 'link',
						'relationship' => 'account_tasks',
						'source' => 'non-db',
						'vname' => 'LBL_ACCOUNT' 
				),
				'opportunities' => array (
						'name' => 'opportunities',
						'type' => 'link',
						'relationship' => 'opportunity_tasks',
						'source' => 'non-db',
						'vname' => 'LBL_TASKS' 
				) 
		),
		'relationships' => array (
				
				'tasks_assigned_user' => array (
						'lhs_module' => 'Users',
						'lhs_table' => 'users',
						'lhs_key' => 'id',
						'rhs_module' => 'Tasks',
						'rhs_table' => 'tasks',
						'rhs_key' => 'assigned_user_id',
						'relationship_type' => 'one-to-many' 
				),
				
				'tasks_assigned_user2' => array (
						'lhs_module' => 'Users',
						'lhs_table' => 'users',
						'lhs_key' => 'id',
						'rhs_module' => 'Tasks',
						'rhs_table' => 'tasks',
						'rhs_key' => 'assigned_user_id',
						'relationship_type' => 'one-to-many' 
				),
				
				'tasks_modified_user' => array (
						'lhs_module' => 'Users',
						'lhs_table' => 'users',
						'lhs_key' => 'id',
						'rhs_module' => 'Tasks',
						'rhs_table' => 'tasks',
						'rhs_key' => 'modified_user_id',
						'relationship_type' => 'one-to-many' 
				),
				
				'tasks_created_by' => array (
						'lhs_module' => 'Users',
						'lhs_table' => 'users',
						'lhs_key' => 'id',
						'rhs_module' => 'Tasks',
						'rhs_table' => 'tasks',
						'rhs_key' => 'created_by',
						'relationship_type' => 'one-to-many' 
				) 
		)
		,
		'indices' => array (
				array (
						'name' => 'idx_tsk_name',
						'type' => 'index',
						'fields' => array (
								'name' 
						) 
				),
				array (
						'name' => 'idx_task_con_del',
						'type' => 'index',
						'fields' => array (
								'contact_id',
								'deleted' 
						) 
				),
				array (
						'name' => 'idx_task_par_del',
						'type' => 'index',
						'fields' => array (
								'parent_id',
								'parent_type',
								'deleted' 
						) 
				),
				array (
						'name' => 'idx_task_assigned',
						'type' => 'index',
						'fields' => array (
								'assigned_user_id' 
						) 
				),
				array (
						'name' => 'idx_task_assigned',
						'type' => 'index',
						'fields' => array (
								'assigned_user_id2' 
						) 
				) 
		)
		,
		
		// This enables optimistic locking for Saves From EditView
		'optimistic_locking' => true 
);
VardefManager::createVardef ( 'Tasks', 'Task', array (
		'default',
		'assignable' 
)
 );
?>
