<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*****************************************************************************
 * The contents of this file are subject to the RECIPROCAL PUBLIC LICENSE
 * Version 1.1 ("License"); You may not use this file except in compliance
 * with the License. You may obtain a copy of the License at
 * http://opensource.org/licenses/rpl.php. Software distributed under the
 * License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND,
 * either express or implied.
 *
 * You may:
 * a) Use and distribute this code exactly as you received without payment or
 *    a royalty or other fee.
 * b) Create extensions for this code, provided that you make the extensions
 *    publicly available and document your modifications clearly.
 * c) Charge for a fee for warranty or support or for accepting liability
 *    obligations for your customers.
 *
 * You may NOT:
 * a) Charge for the use of the original code or extensions, including in
 *    electronic distribution models, such as ASP (Application Service
 *    Provider).
 * b) Charge for the original source code or your extensions other than a
 *    nominal fee to cover distribution costs where such distribution
 *    involves PHYSICAL media.
 * c) Modify or delete any pre-existing copyright notices, change notices,
 *    or License text in the Licensed Software
 * d) Assert any patent claims against the Licensor or Contributors, or
 *    which would in any way restrict the ability of any third party to use the
 *    Licensed Software.
 *
 * You must:
 * a) Document any modifications you make to this code including the nature of
 *    the change, the authors of the change, and the date of the change.
 * b) Make the source code for any extensions you deploy available via an
 *    Electronic Distribution Mechanism such as FTP or HTTP download.
 * c) Notify the licensor of the availability of source code to your extensions
 *    and include instructions on how to acquire the source code and updates.
 * d) Grant Licensor a world-wide, non-exclusive, royalty-free license to use,
 *    reproduce, perform, modify, sublicense, and distribute your extensions.
 *
 * The Original Code is: CommuniCore
 *                       Olavo Farias
 *                       2006-04-7 olavo.farias@gmail.com
 *
 * The Initial Developer of the Original Code is CommuniCore.
 * Portions created by CommuniCore are Copyright (C) 2005 CommuniCore Ltda
 * All Rights Reserved.
 ********************************************************************************/
$dictionary['EcmPriceKopia'] = array(
'table'             => 'ecmpricekopias',    
'audited'           =>  true, 
'comment'           => 'EcmPriceKopias',
'duplicate_merge'   =>  true,
'unified_search'    =>  true,
'fields' => array (
//STANDARD FIELDS SECTION
  'id' =>   array (
    'name'              => 'id',
    'vname'             => 'LBL_ID',
    'type'              => 'id',
    'required'          =>  true,
    'reportable'        =>  false,
    'comment'           => 'Unique identifier'
  ),
 'name' =>   array (
    'name'              => 'name',
    'vname'             => 'LBL_NAME',
    'type'              => 'name',
    'required'          =>  true,
    'dbType'            => 'varchar',
    'len'               =>  255,
    'audited'           =>  true,
    'unified_search'    =>  true,
    'comment'           => 'The short description of the record contents',
    'massupdate'        =>  true,
    'merge_filter'      => 'selected',
  ),
  'date_entered' =>   array (
    'name'              => 'date_entered',
    'vname'             => 'LBL_DATE_ENTERED',
    'type'              => 'datetime',
    'required'          =>  true,
    'comment'           => 'Date record created'
  ),
  'date_modified' =>   array (
    'name'              => 'date_modified',
    'vname'             => 'LBL_DATE_MODIFIED',
    'type'              => 'datetime',
    'required'          =>  true,
    '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'             => 'modified_user_id_users',
    'isnull'            => 'false',
    'dbType'            => 'varchar',
    'len'               =>  36,
    'required'          =>  true,
    'reportable'        =>  true,
    'comment'           => 'User who last modified record'
  ),
'assigned_user_id' => 

    array (

      'name' => 'assigned_user_id',

      'rname' => 'user_name',

      'id_name' => 'assigned_user_id',

      'vname' => 'LBL_ASSIGNED_TO_ID',

      'group' => 'assigned_user_name',

      'type' => 'relate',

      'table' => 'users',

      'reportable' => true,

      'Importable' => false,

      'isnull' => 'false',

      'dbType' => 'id',

      'audited' => true,

      'comment' => 'User ID assigned to record',

      'duplicate_merge' => 'disabled',
	  
	  'massupdate' => false,

    ),

    'assigned_user_name' => 

    array (

      'name' => 'assigned_user_name',

      'vname' => 'LBL_ASSIGNED_TO',

      'type' => 'relate',

      'reportable' => false,

      'source' => 'non-db',

      'table' => 'users',

      'id_name' => 'assigned_user_id',

      'module' => 'Users',

      'duplicate_merge' => 'disabled',
	  
	  'massupdate' => false,

    ),
  'created_by' =>   array (
    'name'              => 'created_by',
    'rname'             => 'user_name',
    'id_name'           => 'created_by',
    'vname'             => 'LBL_CREATED',
    'type'              => 'assigned_user_name',
    'table'             => 'created_by_users',
    'isnull'            => 'false',
    'dbType'            => 'varchar',
    'len'               =>  36,
    'comment'           => 'User that created the record'
  ),
  'created_by_link' =>  array (
    'name'              => 'created_by_link',
    'type'              => 'link',
    'relationship'      => 'ecmpricekopias_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'      => 'ecmpricekopias_modified_user',
    'vname'             => 'LBL_MODIFIED_BY_USER',
    'link_type'         => 'one',
    'module'            => 'Users',
    'bean_name'         => 'User',
    'source'            => 'non-db',
  ),
  'assigned_user_link' =>  array (
    'name'              => 'assigned_user_link',
    'type'              => 'link',
    'relationship'      => 'ecmpricekopias_assigned_user',
    'vname'             => 'LBL_ASSIGNED_TO_USER',
    'link_type'         => 'one',
    'module'            => 'Users',
    'bean_name'         => 'User',
    'source'            => 'non-db',
    'duplicate_merge'   => 'enabled',
    'rname'             => 'user_name',
    'id_name'           => 'assigned_user_id',
    'table'             => 'users',     
  ),
 'deleted' =>   array (
    'name'              => 'deleted',
    'vname'             => 'LBL_CREATED_BY',
    'type'              => 'bool',
    'required'          =>  true,
    'reportable'        =>  false,
    'comment'           => 'Record deletion indicator'
  ),

//NEW FIELDS SECTION
  'active' => array(
   'type'  => 'bool',
   'name'  => 'active',
   'options' => 'ecmpricekopias_active_dom',
   'vname'  => 'LBL_ACTIVE',
   'comment'  => 'Product active',
   'default'  => '1',
  ),
  
  'description' => array(
   'type'  => 'text',
   'name'  => 'description',
   'vname'  => 'LBL_DESCRIPTION',
   'comment'  => 'Description',
   'unified_search' => true,
  ),
  
  
  'exchange_rate_id' => 
  array (
    'name' => 'exchange_rate_id',
    'type' => 'id',
    'group'=>'exchange_rate_id',
    'vname' => 'LBL_EXCHANGE_RATE_NAME',
	'function'=>array('name'=>'getCurrencyDropDown', 'returns'=>'html'),  
    'reportable'=>false,    
    'comment' => 'Currency used for display purposes'
  ),
  'exchange_rate_name' => 
  array (
    'name' => 'exchange_rate_name',
    'vname' => 'LBL_EXCHANGE_RATE_NAME',
    'duplicate_merge' => 'disabled',
	'massupdate' => false,
  ),
  
  'account_id' => 
  array (
    'name' => 'account_id',
    'rname' => 'name',
    'id_name' => 'account_id',
    'vname' => 'LBL_ACCOUNT_ID',
    'group' => 'product_category_name',
    'type' => 'relate',
    'table' => 'accounts',
    'reportable' => true,
    'Importable' => false,
    'isnull' => 'false',
    'dbType' => 'id',
    'audited' => true,
    'duplicate_merge' => 'disabled',
	'massupdate' => false,
  ),
  'account_name' => 
  array (
    'name' => 'account_name',
    'vname' => 'LBL_ACCOUNT_NAME',
    'type' => 'relate',
    'reportable' => false,
    //'source' => 'non-db',
    'table' => 'accounts',
    'id_name' => 'account_id',
    'module' => 'Accounts',
    'duplicate_merge' => 'disabled',
	'massupdate' => false,
  ),
  
  'lead_id' => 
  array (
    'name' => 'lead_id',
    'rname' => 'name',
    'id_name' => 'lead_id',
    'vname' => 'LBL_LEAD_ID',
    'group' => 'lead_name',
    'type' => 'relate',
    'table' => 'leads',
    'reportable' => true,
    'Importable' => false,
    'isnull' => 'false',
    'dbType' => 'id',
    'audited' => true,
    'duplicate_merge' => 'disabled',
	'massupdate' => false,
  ),
  'lead_name' => 
  array (
    'name' => 'lead_name',
    'vname' => 'LBL_LEAD_NAME',
    'type' => 'relate',
    'reportable' => false,
    //'source' => 'non-db',
    'table' => 'leads',
    'id_name' => 'lead_id',
    'module' => 'Leads',
    'duplicate_merge' => 'disabled',
	'massupdate' => false,
  ),
	
    'price' => array (
      'name' => 'price',
      'type' => 'int',
	  'len' => '1',
      'reportable'=>false,
    ),
    'currency_value' => array (
      'name' => 'currency_value',
      'type' => 'decimal',
	  'len' => '5,2',
	  'vname'=>'LBL_CURRENCY_VALUE',
      'reportable'=>false,
    ),
	'ecmlanguage' => 
    array(
    	'name' => 'ecmlanguage',
  	    'vname' => 'LBL_ECMLANGUAGE',
  	    'type' => 'enum',
  	    'options' => 'ecmlanguages_dom',
  	    'required' => true,
    	'len' => 35,
		'massupdate' => false,
    ),
    /*'archived' => 
    array(
	'name'=>'archived',
	'vname'=>'LBL_ARCHIVED',
	'type'=>'bool',
	'len'=>1,
    ),*/

  
//FOR SUBPANELS


),

//INDICES SECTION 
'indices' => array (
 array('name' =>'ecmpricekopiasspk',       'type' =>'primary', 'fields'=>array('id')),
 array('name' =>'idx_ecmpricekopias_name', 'type' =>'index',   'fields'=>array('name'))
)

//RELATIONSHIPS SECTION 
, 'relationships' => array (
     'ecmpricekopias_assigned_user' => array(
       'lhs_module'=> 'Users',           'lhs_table'=> 'users',                  'lhs_key' => 'id',
       'rhs_module'=> 'EcmPriceKopias', 'rhs_table'=> 'ecmpricekopias', 'rhs_key' => 'assigned_user_id',
       'relationship_type'=>'one-to-many')
  
    ,'ecmpricekopias_modified_user' => array(
       'lhs_module'=> 'Users',           'lhs_table'=> 'users',                  'lhs_key' => 'id',
       'rhs_module'=> 'EcmPriceKopias', 'rhs_table'=> 'ecmpricekopias', 'rhs_key' => 'modified_user_id',
       'relationship_type'=>'one-to-many')
  
    ,'ecmpricekopias_created_by' => array(
       'lhs_module'=> 'Users',           'lhs_table'=> 'users',                  'lhs_key' => 'id',
       'rhs_module'=> 'EcmPriceKopias', 'rhs_table'=> 'ecmpricekopias', 'rhs_key' => 'created_by',
       'relationship_type'=>'one-to-many')

),         
//THIS FLAG ENABLES OPTIMISTIC LOCKING FOR SAVES FROM EDITVIEW
    'optimistic_locking'=>true,                   
);
?>
