<?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-2010 SugarCRM Inc.
 *
 * This program is free software; you can redistribute it and/or modify it under
 * the terms of the GNU Affero 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 Affero General Public License for more
 * details.
 *
 * You should have received a copy of the GNU Affero 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 Affero General Public License version 3.
 *
 * In accordance with Section 7(b) of the GNU Affero 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 ['EcmDesign'] = array (
		'table' => 'ecmdesigns',
		'unified_search' => true,
		'comment' => 'EcmDesigns and Attachments',
		'fields' => array (
				'id' => array (
						'name' => 'id',
						'vname' => 'LBL_ID',
						'type' => 'id',
						'required' => true,
						'reportable' => true,
						'comment' => 'Unique identifier' 
				),
				'date_entered' => array (
						'name' => 'date_entered',
						'vname' => 'LBL_DATE_ENTERED',
						'type' => 'datetime',
						'comment' => 'Date record created' 
				),
				'date_modified' => array (
						'name' => 'date_modified',
						'vname' => 'LBL_DATE_MODIFIED',
						'type' => 'datetime',
						'comment' => 'Date record last modified' 
				),
				'modified_user_id' => array (
						'name' => 'modified_user_id',
						'rname' => 'user_name',
						'id_name' => 'modified_user_id',
						'vname' => 'LBL_MODIFIED',
						'type' => 'assigned_user_name',
						'table' => 'users',
						'isnull' => 'false',
						'dbType' => 'id',
						'reportable' => true,
						'comment' => 'User who last modified record' 
				),
				'modified_by_name' => array (
						'name' => 'modified_by_name',
						'vname' => 'LBL_MODIFIED_BY',
						'type' => 'relate',
						'reportable' => false,
						'source' => 'non-db',
						'table' => 'users',
						'id_name' => 'modified_user_id',
						'module' => 'Users',
						'duplicate_merge' => 'disabled' 
				),
				'created_by' => array (
						'name' => 'created_by',
						'rname' => 'user_name',
						'id_name' => 'modified_user_id',
						'vname' => 'LBL_CREATED_ID',
						'type' => 'assigned_user_name',
						'table' => 'users',
						'isnull' => 'false',
						'dbType' => 'id',
						'comment' => 'User who created record' 
				),
				'created_by_name' => array (
						'name' => 'created_by_name',
						'vname' => 'LBL_CREATED_BY',
						'type' => 'relate',
						'reportable' => false,
						'source' => 'non-db',
						'table' => 'users',
						'id_name' => 'created_by',
						'module' => 'Users',
						'duplicate_merge' => 'disabled' 
				),
				'name' => array (
						'name' => 'name',
						'vname' => 'LBL_ECMDESIGN_SUBJECT',
						'dbType' => 'varchar',
						'type' => 'name',
						'len' => '255',
						'unified_search' => true,
						'comment' => 'Name of the ecmdesign',
						'importable' => 'required',
						'required' => true 
				),
				'filename' => array (
						'name' => 'filename',
						'vname' => 'LBL_FILENAME',
						'type' => 'varchar',
						'len' => '255',
						'reportable' => true,
						'comment' => 'File name associated with the ecmdesign (attachment)',
						'importable' => false 
				),
				'file_mime_type' => array (
						'name' => 'file_mime_type',
						'vname' => 'LBL_FILE_MIME_TYPE',
						'type' => 'varchar',
						'len' => '100',
						'comment' => 'Attachment MIME type',
						'importable' => false 
				),
				'file_url' => array (
						'name' => 'file_url',
						'vname' => 'LBL_FILE_URL',
						'type' => 'function',
						'function_require' => 'include/upload_file.php',
						'function_class' => 'UploadFile',
						'function_name' => 'get_url',
						'function_params' => array (
								'filename',
								'id' 
						),
						'source' => 'function',
						'reportable' => false,
						'comment' => 'Path to file (can be URL)',
						'importable' => false 
				),
				// SECOND FILE
				// add mz
				'filename2' => array (
						'name' => 'filename2',
						'vname' => 'LBL_FILENAME2',
						'type' => 'varchar',
						'len' => '255',
						'reportable' => true,
						'comment' => 'File name associated with the ecmdesign (attachment)',
						'importable' => false 
				),
				'file_mime_type2' => array (
						'name' => 'file_mime_type2',
						'vname' => 'LBL_FILE_MIME_TYPE2',
						'type' => 'varchar',
						'len' => '100',
						'comment' => 'Attachment MIME type',
						'importable' => false 
				),
				'file_url2' => array (
						'name' => 'file_url2',
						'vname' => 'LBL_FILE_URL2',
						'type' => 'function',
						'function_require' => 'include/upload_file.php',
						'function_class' => 'UploadFile',
						'function_name' => 'get_url',
						'function_params' => array (
								'filename',
								'id'
						),
						'source' => 'function',
						'reportable' => false,
						'comment' => 'Path to file (can be URL)',
						'importable' => false 
				),
				// end mz
				'parent_type' => array (
						'name' => 'parent_type',
						'vname' => 'LBL_PARENT_TYPE',
						'type' => 'parent_type',
						'dbType' => 'varchar',
						'group' => 'parent_name',
						'len' => '255',
						'comment' => 'Sugar module the EcmDesign is associated with' 
				),
				'parent_id' => array (
						'name' => 'parent_id',
						'vname' => 'LBL_PARENT_ID',
						'type' => 'id',
						'required' => false,
						'reportable' => true,
						'comment' => 'The ID of the Sugar item specified in parent_type' 
				),
				'contact_id' => array (
						'name' => 'contact_id',
						'vname' => 'LBL_CONTACT_ID',
						'type' => 'id',
						'required' => false,
						'reportable' => false,
						'comment' => 'Contact ID ecmdesign is associated with' 
				),
				'portal_flag' => array (
						'name' => 'portal_flag',
						'vname' => 'LBL_PORTAL_FLAG',
						'type' => 'bool',
						'required' => true,
						'comment' => 'Portal flag indicator determines if ecmdesign created via portal' 
				),
				'embed_flag' => array (
						'name' => 'embed_flag',
						'vname' => 'LBL_EMBED_FLAG',
						'type' => 'bool',
						'default' => 0,
						'comment' => 'Embed flag indicator determines if ecmdesign embedded in email' 
				),
				'description' => array (
						'name' => 'description',
						'vname' => 'LBL_ECMDESIGN_STATUS',
						'type' => 'text',
						'comment' => 'Full text of the ecmdesign' 
				),
				'deleted' => array (
						'name' => 'deleted',
						'vname' => 'LBL_DELETED',
						'type' => 'bool',
						'required' => false,
						'default' => '0',
						'reportable' => false,
						'comment' => 'Record deletion indicator' 
				),
				
				'parent_name' => array (
						'name' => 'parent_name',
						'parent_type' => 'record_type_display',
						'type_name' => 'parent_type',
						'id_name' => 'parent_id',
						'vname' => 'LBL_RELATED_TO',
						'type' => 'parent',
						'source' => 'non-db',
						'options' => 'record_type_display_ecmdesigns' 
				),
				
				'contact_name' => array (
						'name' => 'contact_name',
						'rname' => 'last_name',
						'id_name' => 'contact_id',
						'vname' => 'LBL_CONTACT_NAME',
						'table' => 'contacts',
						'type' => 'relate',
						'link' => 'contact',
						'join_name' => 'contacts',
						'db_concat_fields' => array (
								0 => 'first_name',
								1 => 'last_name' 
						),
						'isnull' => 'true',
						'module' => 'Contacts',
						'source' => 'non-db' 
				),
				
				'contact_phone' => array (
						'name' => 'contact_phone',
						'vname' => 'LBL_PHONE',
						'type' => 'phone',
						'vname' => 'LBL_PHONE',
						'source' => 'non-db' 
				),
				
				'contact_email' => array (
						'name' => 'contact_email',
						'type' => 'varchar',
						'vname' => 'LBL_EMAIL_ADDRESS',
						'source' => 'non-db' 
				),
				
				'account_id' => array (
						'name' => 'account_id',
						'vname' => 'LBL_ACCOUNT_ID',
						'type' => 'id',
						'reportable' => false,
						'source' => 'non-db' 
				),
				'opportunity_id' => array (
						'name' => 'opportunity_id',
						'vname' => 'LBL_OPPORTUNITY_ID',
						'type' => 'id',
						'reportable' => false,
						'source' => 'non-db' 
				),
				'acase_id' => array (
						'name' => 'acase_id',
						'vname' => 'LBL_CASE_ID',
						'type' => 'id',
						'reportable' => false,
						'source' => 'non-db' 
				),
				'lead_id' => array (
						'name' => 'lead_id',
						'vname' => 'LBL_LEAD_ID',
						'type' => 'id',
						'reportable' => false,
						'source' => 'non-db' 
				),
				
				'created_by_link' => array (
						'name' => 'created_by_link',
						'type' => 'link',
						'relationship' => 'ecmdesigns_created_by',
						'vname' => 'LBL_CREATED_BY_USER',
						'link_type' => 'one',
						'module' => 'Users',
						'bean_name' => 'User',
						'source' => 'non-db' 
				),
				'modified_user_link' => array (
						'name' => 'modified_user_link',
						'type' => 'link',
						'relationship' => 'ecmdesigns_modified_user',
						'vname' => 'LBL_MODIFIED_BY_USER',
						'link_type' => 'one',
						'module' => 'Users',
						'bean_name' => 'User',
						'source' => 'non-db' 
				),
				
				'contact' => array (
						'name' => 'contact',
						'type' => 'link',
						'relationship' => 'contact_ecmdesigns',
						'vname' => 'LBL_LIST_CONTACT_NAME',
						'source' => 'non-db' 
				),
				'cases' => array (
						'name' => 'cases',
						'type' => 'link',
						'relationship' => 'case_ecmdesigns',
						'vname' => 'LBL_CASES',
						'source' => 'non-db' 
				),
				'accounts' => array (
						'name' => 'accounts',
						'type' => 'link',
						'relationship' => 'account_ecmdesigns',
						'source' => 'non-db',
						'vname' => 'LBL_ACCOUNTS' 
				),
				'ecmquotes' => array (
						'name' => 'ecmquotes',
						'type' => 'link',
						'relationship' => 'ecmquote_ecmdesigns',
						'source' => 'non-db',
						'vname' => 'LBL_ECMQUOTES' 
				),
				'ecmproducts' => array (
						'name' => 'ecmproducts',
						'type' => 'link',
						'relationship' => 'ecmproduct_ecmdesigns',
						'source' => 'non-db',
						'vname' => 'LBL_ECMQUOTES' 
				),
				'ecmpurchaseorders' => array (
						'name' => 'ecmpurchaseorders',
						'type' => 'link',
						'relationship' => 'ecmpurchaseorder_ecmdesigns',
						'source' => 'non-db',
						'vname' => 'LBL_ECMQUOTES' 
				),
				'opportunities' => array (
						'name' => 'opportunities',
						'type' => 'link',
						'relationship' => 'opportunity_ecmdesigns',
						'source' => 'non-db',
						'vname' => 'LBL_OPPORTUNITIES' 
				),
				'leads' => array (
						'name' => 'leads',
						'type' => 'link',
						'relationship' => 'lead_ecmdesigns',
						'source' => 'non-db',
						'vname' => 'LBL_LEADS' 
				),
				'bugs' => array (
						'name' => 'bugs',
						'type' => 'link',
						'relationship' => 'bug_ecmdesigns',
						'source' => 'non-db',
						'vname' => 'LBL_BUGS' 
				),
				'emails' => array (
						'name' => 'emails',
						'vname' => 'LBL_EMAILS',
						'type' => 'link',
						'relationship' => 'emails_ecmdesigns_rel',
						'source' => 'non-db' 
				),
				'projects' => array (
						'name' => 'projects',
						'type' => 'link',
						'relationship' => 'projects_ecmdesigns',
						'source' => 'non-db',
						'vname' => 'LBL_PROJECTS' 
				),
				'project_tasks' => array (
						'name' => 'project_tasks',
						'type' => 'link',
						'relationship' => 'project_tasks_ecmdesigns',
						'source' => 'non-db',
						'vname' => 'LBL_PROJECT_TASKS' 
				),
				'meetings' => array (
						'name' => 'meetings',
						'type' => 'link',
						'relationship' => 'meetings_ecmdesigns',
						'source' => 'non-db',
						'vname' => 'LBL_MEETINGS' 
				),
				'calls' => array (
						'name' => 'calls',
						'type' => 'link',
						'relationship' => 'calls_ecmdesigns',
						'source' => 'non-db',
						'vname' => 'LBL_CALLS' 
				),
				'description' => array (
						'name' => 'description',
						'vname' => 'LBL_DESCRIPTION',
						'type' => 'text',
						'comment' => 'Full text of the ecmdesign',
						'rows' => 30,
						'cols' => 90 
				) 
		),
		'relationships' => array (
				'ecmdesigns_modified_user' => array (
						'lhs_module' => 'Users',
						'lhs_table' => 'users',
						'lhs_key' => 'id',
						'rhs_module' => 'EcmDesigns',
						'rhs_table' => 'ecmdesigns',
						'rhs_key' => 'modified_user_id',
						'relationship_type' => 'one-to-many' 
				),
				
				'ecmdesigns_created_by' => array (
						'lhs_module' => 'Users',
						'lhs_table' => 'users',
						'lhs_key' => 'id',
						'rhs_module' => 'EcmDesigns',
						'rhs_table' => 'ecmdesigns',
						'rhs_key' => 'created_by',
						'relationship_type' => 'one-to-many' 
				) 
		)
		,
		'indices' => array (
				array (
						'name' => 'ecmdesignspk',
						'type' => 'primary',
						'fields' => array (
								'id' 
						) 
				),
				array (
						'name' => 'idx_ecmdesign_name',
						'type' => 'index',
						'fields' => array (
								'name' 
						) 
				),
				array (
						'name' => 'idx_ecmdesigns_parent',
						'type' => 'index',
						'fields' => array (
								'parent_id',
								'parent_type' 
						) 
				),
				array (
						'name' => 'idx_ecmdesign_contact',
						'type' => 'index',
						'fields' => array (
								'contact_id' 
						) 
				) 
		),
		
		// This enables optimistic locking for Saves From EditView
		'optimistic_locking' => true 
);

VardefManager::createVardef ( 'EcmDesigns', 'EcmDesign', array () );
?>
