init
This commit is contained in:
321
modules/EcmTexts/EcmText.php
Executable file
321
modules/EcmTexts/EcmText.php
Executable file
@@ -0,0 +1,321 @@
|
||||
<?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.
|
||||
********************************************************************************/
|
||||
|
||||
require_once('data/SugarBean.php');
|
||||
require_once('include/utils.php');
|
||||
|
||||
class EcmText extends SugarBean {
|
||||
|
||||
var $field_name_map = array();
|
||||
|
||||
// STANDARD FIELDS
|
||||
var $id;
|
||||
var $name;
|
||||
var $description;
|
||||
var $date_entered;
|
||||
var $date_modified;
|
||||
var $deleted;
|
||||
var $created_by;
|
||||
|
||||
//TABLE COLUMNS
|
||||
var $bean_id;
|
||||
var $ecmlanguage;
|
||||
var $data;
|
||||
|
||||
// RELATED FIELDS
|
||||
|
||||
// SUBPANELS RELATED
|
||||
|
||||
// MODULE OBJECT DETAILS
|
||||
var $module_dir = "EcmTexts";
|
||||
var $table_name = "ecmtexts";
|
||||
var $object_name = "EcmText";
|
||||
|
||||
//RELATED TABLE NAMES
|
||||
|
||||
|
||||
// USED TO RETRIEVE RELATED FIELDS FROM FORM POSTS.
|
||||
var $additional_column_fields = Array (
|
||||
);
|
||||
|
||||
|
||||
//RELATIONSHIP FIELDS
|
||||
var $relationship_fields = Array (
|
||||
);
|
||||
|
||||
function EcmText() {
|
||||
parent::SugarBean();
|
||||
$this->setupCustomFields('EcmTexts');
|
||||
foreach($this->field_defs as $field) {
|
||||
$this->field_name_map[$field['name']] = $field;
|
||||
}
|
||||
}
|
||||
|
||||
var $new_schema = true;
|
||||
|
||||
function get_summary_text(){
|
||||
return "$this->name";
|
||||
}
|
||||
|
||||
function create_list_query($order_by, $where, $show_deleted = 0) {
|
||||
|
||||
// Fill in the assigned_user_name
|
||||
$custom_join = $this->custom_fields->getJOIN();
|
||||
$query = "SELECT ";
|
||||
$query .= "ecmtexts.*
|
||||
,users.user_name as assigned_user_name";
|
||||
if($custom_join) {
|
||||
$query .= $custom_join['select'];
|
||||
}
|
||||
$query .= " FROM ecmtexts
|
||||
LEFT JOIN users
|
||||
ON ecmtexts.assigned_user_id=users.id";
|
||||
$query .= " ";
|
||||
if($custom_join) {
|
||||
$query .= $custom_join['join'];
|
||||
}
|
||||
$where_auto = '1=1';
|
||||
if($show_deleted == 0) {
|
||||
$where_auto = " $this->table_name.deleted=0 ";
|
||||
} else if($show_deleted == 1) {
|
||||
$where_auto = " $this->table_name.deleted=1 ";
|
||||
}
|
||||
|
||||
if($where != "")
|
||||
$query .= "where $where AND ".$where_auto;
|
||||
else
|
||||
$query .= "where ".$where_auto;
|
||||
if(substr_count($order_by, '.') > 0) {
|
||||
$query .= " ORDER BY $order_by";
|
||||
}
|
||||
else if($order_by != "")
|
||||
$query .= " ORDER BY $order_by";
|
||||
else
|
||||
$query .= " ORDER BY ecmtexts.name";
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
||||
function create_export_query($order_by, $where) {
|
||||
|
||||
$custom_join = $this->custom_fields->getJOIN();
|
||||
$query = "SELECT
|
||||
ecmtexts.*,
|
||||
users.user_name assigned_user_name";
|
||||
if($custom_join) {
|
||||
$query .= $custom_join['select'];
|
||||
}
|
||||
$query .= " FROM ecmtexts ";
|
||||
$query .= " LEFT JOIN users
|
||||
ON ecmtexts.assigned_user_id=users.id";
|
||||
if($custom_join) {
|
||||
$query .= $custom_join['join'];
|
||||
}
|
||||
$query .= "";
|
||||
$where_auto = " ecmtexts.deleted=0
|
||||
";
|
||||
if($where != "")
|
||||
$query .= " where $where AND ".$where_auto;
|
||||
else
|
||||
$query .= " where ".$where_auto;
|
||||
if($order_by != "")
|
||||
$query .= " ORDER BY $order_by";
|
||||
else
|
||||
$query .= " ORDER BY ecmtexts.name";
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
||||
function fill_in_additional_list_fields(){
|
||||
|
||||
}
|
||||
|
||||
function fill_in_additional_detail_fields(){
|
||||
//FILL IN THE ASSIGNED_USER_NAME
|
||||
$this->assigned_user_name = get_assigned_user_name($this->assigned_user_id);
|
||||
$this->created_by_name = get_assigned_user_name($this->created_by);
|
||||
$this->modified_by_name = get_assigned_user_name($this->modified_user_id);
|
||||
//$result = $this->db->query("SELECT status FROM ecmtexts WHERE id='$this->id'");
|
||||
//if($result) $row = $this->db->fetchByAssoc($result);
|
||||
//$this->status = $row['status'];
|
||||
}
|
||||
|
||||
function get_list_view_data(){
|
||||
global $current_language;
|
||||
$this->fill_in_additional_detail_fields();
|
||||
$app_list_strings = return_app_list_strings_language($current_language);
|
||||
$mod_strings = return_module_language($current_language, 'EcmTexts');
|
||||
$the_array = parent::get_list_view_data();
|
||||
// THE NEW LISTVIEW CODE ONLY FETCHES COLUMNS THAT WE'RE DISPLAYING AND NOT ALL
|
||||
// THE COLUMNS SO WE NEED THESE CHECKS.
|
||||
$the_array['NAME'] = (($this->name == "") ? "<em>blank</em>" : $this->name);
|
||||
return $the_array;
|
||||
}
|
||||
|
||||
/**
|
||||
BUILDS A GENERIC SEARCH BASED ON THE QUERY STRING USING OR.
|
||||
DO NOT INCLUDE ANY $THIS-> BECAUSE THIS IS CALLED ON WITHOUT HAVING THE CLASS INSTANTIATED.
|
||||
*/
|
||||
function build_generic_where_clause ($the_query_string) {
|
||||
$where_clauses = Array();
|
||||
$the_query_string = PearDatabase::text(from_html($the_query_string));
|
||||
array_push($where_clauses, "ecmtexts.name like '$the_query_string%'");
|
||||
$the_where = "";
|
||||
foreach($where_clauses as $clause) {
|
||||
if($the_where != "") $the_where .= " or ";
|
||||
$the_where .= $clause;
|
||||
}
|
||||
return $the_where;
|
||||
}
|
||||
|
||||
function set_notification_body($xtpl, $simplemodule) {
|
||||
global $mod_strings, $app_list_strings;
|
||||
$xtpl->assign("NAME", $simplemodule->name);
|
||||
$xtpl->assign("DESCRIPTION", $simplemodule->description);
|
||||
return $xtpl;
|
||||
}
|
||||
|
||||
function bean_implements($interface) {
|
||||
switch($interface) {
|
||||
case 'ACL':return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function save($check_notify = FALSE) {
|
||||
$this->data = EcmText::encodeData($this->data);
|
||||
$return_id = parent::save($check_notify);
|
||||
return $return_id;
|
||||
}
|
||||
|
||||
function retrieve($id = -1, $encode=true,$deleted=true) {
|
||||
parent::retrieve($id,$encode,$deleted);
|
||||
if(isset($this->id) && $this->id != '') {
|
||||
$this->data = EcmText::decodeData($this->data);
|
||||
}
|
||||
}
|
||||
|
||||
public static function encodeData($data) {
|
||||
return base64_encode(serialize($data));
|
||||
}
|
||||
|
||||
static function decodeData($data) {
|
||||
return unserialize(base64_decode($data));
|
||||
}
|
||||
|
||||
static function SaveText($id=null,$bean_id=null,$name=null,$ecmlanguage=null,$data=array()) {
|
||||
if(!$name) return;
|
||||
if(!$ecmlanguage) {
|
||||
global $app_list_strings;
|
||||
foreach($app_list_strings['ecmlanguages_dom'] as $key => $value) { $ecmlanguage = $key; break; }
|
||||
}
|
||||
|
||||
$query = "SELECT `id` FROM `ecmtexts` WHERE ";
|
||||
$where = array();
|
||||
if($bean_id != '' && $bean_id != null) $where [] = "`bean_id` = '$bean_id'";
|
||||
if($name != '' && $name != null) $where [] = "`name` = '$name'";
|
||||
if($ecmlanguage != '' && $ecmlanguage != null) $where [] = "`ecmlanguage` = '$ecmlanguage'";
|
||||
$query .= implode(' AND ',$where);
|
||||
$query .= " LIMIT 1";
|
||||
$result = $GLOBALS['db']->query($query);
|
||||
if($result) {
|
||||
$row = $GLOBALS['db']->fetchByAssoc($result);
|
||||
if($row) {
|
||||
if(isset($row['id']))
|
||||
if($row['id'] != '') $id = $row['id'];
|
||||
}
|
||||
}
|
||||
|
||||
$et = new EcmText();
|
||||
$et->retrieve($id);
|
||||
$et->bean_id = $bean_id;
|
||||
$et->name = $name;
|
||||
$et->ecmlanguage = $ecmlanguage;
|
||||
$et->data = $data;
|
||||
$return_id = $et->save();
|
||||
return $return_id;
|
||||
}
|
||||
|
||||
static function LoadText($id='',$bean_id='',$name='',$ecmlanguage='',$onlyId = false,$limit = 1) {
|
||||
|
||||
$query = "SELECT `id`".((!$onlyId)?", `name`, `bean_id`, `ecmlanguage`, `data` ":"")." FROM `ecmtexts` WHERE ";
|
||||
$where = array();
|
||||
if($bean_id != '' && $bean_id != null) $where [] = "`bean_id` = '$bean_id'";
|
||||
if($name != '' && $name != null) $where [] = "`name` = '$name'";
|
||||
if($ecmlanguage != '' && $ecmlanguage != null) $where [] = "`ecmlanguage` = '$ecmlanguage'";
|
||||
$query .= implode(' AND ',$where);
|
||||
if($limit && $limit > 0) $query .= " LIMIT $limit";
|
||||
$return_array = array();
|
||||
$result = $GLOBALS['db']->query($query);
|
||||
|
||||
if($result) {
|
||||
while($row = $GLOBALS['db']->fetchByAssoc($result)) {
|
||||
if(!$onlyId)
|
||||
$return_array [] = array(
|
||||
'id' => $row['id'],
|
||||
'bean_id' => $row['bean_id'],
|
||||
'name' => $row['name'],
|
||||
'ecmlanguage' => $row['ecmlanguage'],
|
||||
'data' => EcmText::decodeData($row['data']),
|
||||
);
|
||||
else
|
||||
$return_array [] = $row['id'];
|
||||
}
|
||||
}
|
||||
|
||||
//$d = 'YToyOntzOjY6ImxhYmVscyI7YTozMDp7aTowO2E6Mzp7czo1OiJpbmRleCI7czoxOiIxIjtzOjU6ImxhYmVsIjtzOjIxOiJMQkxfUERGX0xJU1RfUE9TSVRJT04iO3M6MTE6InRyYW5zbGF0aW9uIjtzOjQ6IlBvei4iO31pOjE7YTozOntzOjU6ImluZGV4IjtzOjE6IjIiO3M6NToibGFiZWwiO3M6MTc6IkxCTF9QREZfTElTVF9DT0RFIjtzOjExOiJ0cmFuc2xhdGlvbiI7czo2OiJJbmRla3MiO31pOjI7YTozOntzOjU6ImluZGV4IjtzOjE6IjMiO3M6NToibGFiZWwiO3M6MTg6IkxCTF9QREZfTElTVF9JTUFHRSI7czoxMToidHJhbnNsYXRpb24iO3M6MDoiIjt9aTozO2E6Mzp7czo1OiJpbmRleCI7czoxOiI0IjtzOjU6ImxhYmVsIjtzOjIxOiJ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7czozMDoiUHJ6ZXdpZHl3YW55IHRlcm1pbiByZWFsaXphY2ppIjt9aToyNzthOjM6e3M6NToiaW5kZXgiO3M6MjoiMjgiO3M6NToibGFiZWwiO3M6MTU6IkxCTF9QREZfUEFZTUVOVCI7czoxMToidHJhbnNsYXRpb24iO3M6MTk6IldhcnVua2kgcMWCYXRub8WbY2kiO31pOjI4O2E6Mzp7czo1OiJpbmRleCI7czoyOiIyOSI7czo1OiJsYWJlbCI7czoxNToiTEJMX1BERl9DT05GSVJNIjtzOjExOiJ0cmFuc2xhdGlvbiI7czoyODoiUG90d2llcmR6ZW5pZSB6YW3Ds3dpZW5pYSBuciI7fWk6Mjk7YTozOntzOjU6ImluZGV4IjtzOjI6IjI5IjtzOjU6ImxhYmVsIjtzOjI2OiJMQkxfUERGX1BBUkVOVF9ET0NVTUVOVF9OTyI7czoxMToidHJhbnNsYXRpb24iO3M6MzI6IkRvdHljenkgUGHFhHN0d2EgemFtw7N3aWVuaWEgbnI6Ijt9fXM6NToidGV4dHMiO2E6Mjp7czo4OiJDb250YWN0cyI7YTozOntzOjExOiJoZWFkZXJfdGV4dCI7czoyNToiV2l0YWogJGNvbnRhY3RfZnVsbF9uYW1lISI7czoxMToiZm9vdGVyX3RleHQiO3M6Mjk6IlRla3N0IHBvZCB0YWJlbGthIGRsYSBDb250YWN0IjtzOjg6ImFkc190ZXh0IjtzOjQwOiJUZWtzdCBwb2dydWJpb255IHBvZCB0YWJlbGthIGRsYSBDb250YWN0Ijt9czo4OiJBY2NvdW50cyI7YTozOntzOjExOiJoZWFkZXJfdGV4dCI7czowOiIiO3M6MTE6ImZvb3Rlcl90ZXh0IjtzOjEzOiJUZWtzdCBzdG9wa2kuIjtzOjg6ImFkc190ZXh0IjtzOjE1OiJUZWtzdCBEb2RhdGtvd3kiO319fQ==';
|
||||
//echo '<pre>$return_array: ' . var_export(self::decodeData($d), true) . '</pre>';
|
||||
//echo self::encodeData(range(1,100));
|
||||
return $return_array;
|
||||
}
|
||||
|
||||
}
|
||||
88
modules/EcmTexts/field_arrays.php
Executable file
88
modules/EcmTexts/field_arrays.php
Executable file
@@ -0,0 +1,88 @@
|
||||
<?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.
|
||||
********************************************************************************/
|
||||
$fields_array['EcmText'] = array (
|
||||
|
||||
'column_fields' => Array (
|
||||
'id',
|
||||
'name',
|
||||
'description',
|
||||
'date_entered',
|
||||
'date_modified',
|
||||
'deleted',
|
||||
'created_by',
|
||||
|
||||
//NEW COLUMN FIELDS
|
||||
'bean_id',
|
||||
'ecmlanguage',
|
||||
'data'
|
||||
|
||||
),
|
||||
|
||||
'list_fields' => Array (
|
||||
'id',
|
||||
'name',
|
||||
'description',
|
||||
'date_entered',
|
||||
'date_modified',
|
||||
'deleted',
|
||||
'created_by',
|
||||
|
||||
//NEW COLUMN FIELDS
|
||||
'bean_id',
|
||||
'ecmlanguage',
|
||||
'data'
|
||||
),
|
||||
|
||||
'required_fields' => array (
|
||||
'name' => 1
|
||||
),
|
||||
|
||||
);
|
||||
?>
|
||||
207
modules/EcmTexts/vardefs.php
Executable file
207
modules/EcmTexts/vardefs.php
Executable file
@@ -0,0 +1,207 @@
|
||||
<?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['EcmText'] = array (
|
||||
|
||||
'table' => "ecmtexts",
|
||||
'comment' => 'EcmTexts',
|
||||
'duplicate_merge' => true,
|
||||
'unified_search' => true,
|
||||
|
||||
|
||||
//FIELDS SECTION
|
||||
|
||||
'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,
|
||||
'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'
|
||||
),
|
||||
|
||||
'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' => 'ecmquotes'.'_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' => 'ecmquotes'.'_modified_user',
|
||||
'vname' => 'LBL_MODIFIED_BY_USER',
|
||||
'link_type' => 'one',
|
||||
'module' => 'Users',
|
||||
'bean_name' => 'User',
|
||||
'source' => 'non-db',
|
||||
),
|
||||
|
||||
'deleted' => array (
|
||||
'name' => 'deleted',
|
||||
'vname' => 'LBL_DELETED_BY',
|
||||
'type' => 'bool',
|
||||
'required' => true,
|
||||
'reportable' => false,
|
||||
'comment' => 'Record deletion indicator'
|
||||
),
|
||||
|
||||
'bean_id' =>
|
||||
array (
|
||||
'name' => 'bean_id',
|
||||
'vname' => 'LBL_BEAN_ID',
|
||||
'dbType' => 'id',
|
||||
),
|
||||
|
||||
'ecmlanguage' =>
|
||||
array(
|
||||
'name' => 'ecmlanguage',
|
||||
'vname' => 'LBL_ECMLANGUAGE',
|
||||
'type' => 'enum',
|
||||
'options' => 'ecmlanguages_dom',
|
||||
'required' => true,
|
||||
'len' => 35
|
||||
),
|
||||
|
||||
'data' => array (
|
||||
'name' => 'data',
|
||||
'vname' => 'LBL_DATA',
|
||||
'type' => 'text',
|
||||
),
|
||||
|
||||
//FOR SUBPANELS
|
||||
|
||||
),
|
||||
|
||||
//INDICES SECTION
|
||||
'indices' => array (
|
||||
array('name' => 'ecmtexts'.'pk', 'type' => 'primary', 'fields' => array('id')),
|
||||
array('name' => 'idx_'.'ecmtexts'.'_name', 'type' => 'index', 'fields' => array('name'))
|
||||
),
|
||||
|
||||
//RELATIONSHIPS SECTION
|
||||
'relationships' => array (
|
||||
),
|
||||
|
||||
//THIS FLAG ENABLES OPTIMISTIC LOCKING FOR SAVES FROM EDITVIEW
|
||||
'optimistic_locking' => true,
|
||||
);
|
||||
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user