Add php files
This commit is contained in:
206
modules/EcmCustomLists/EcmCustomList.php
Executable file
206
modules/EcmCustomLists/EcmCustomList.php
Executable file
@@ -0,0 +1,206 @@
|
||||
<?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".
|
||||
* ******************************************************************************
|
||||
*/
|
||||
/**
|
||||
* *******************************************************************************
|
||||
*
|
||||
* Description: TODO: To be written.
|
||||
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
|
||||
* All Rights Reserved.
|
||||
* Contributor(s): ______________________________________..
|
||||
* ******************************************************************************
|
||||
*/
|
||||
|
||||
require_once ('data/SugarBean.php');
|
||||
require_once ('include/utils.php');
|
||||
|
||||
// Task is used to store customer information.
|
||||
class EcmCustomList extends SugarBean {
|
||||
var $field_name_map;
|
||||
|
||||
// Stored fields
|
||||
var $id;
|
||||
var $date_entered;
|
||||
var $date_modified;
|
||||
var $assigned_user_id;
|
||||
var $modified_user_id;
|
||||
var $created_by;
|
||||
var $created_by_name;
|
||||
var $modified_by_name;
|
||||
var $description;
|
||||
var $name;
|
||||
var $assigned_user_name;
|
||||
var $table_name = "ecmcustomlists";
|
||||
var $object_name = "EcmCustomLists";
|
||||
var $module_dir = 'EcmCustomLists';
|
||||
var $importable = false;
|
||||
// This is used to retrieve related fields from form posts.
|
||||
var $additional_column_fields = Array (
|
||||
'assigned_user_name',
|
||||
'assigned_user_id'
|
||||
);
|
||||
function EcmCustomList() {
|
||||
parent::SugarBean ();
|
||||
}
|
||||
var $new_schema = true;
|
||||
function get_summary_text() {
|
||||
return "$this->name";
|
||||
}
|
||||
function create_list_query($order_by, $where, $show_deleted = 0) {
|
||||
$custom_join = $this->custom_fields->getJOIN ();
|
||||
$query = "SELECT ";
|
||||
|
||||
$query .= "
|
||||
$this->table_name.*,
|
||||
users.user_name as assigned_user_name";
|
||||
|
||||
if ($custom_join) {
|
||||
$query .= $custom_join ['select'];
|
||||
}
|
||||
$query .= " FROM ecmcustomlists ";
|
||||
|
||||
$query .= " LEFT JOIN users
|
||||
ON ecmcustomlists.assigned_user_id=users.id ";
|
||||
if ($custom_join) {
|
||||
$query .= $custom_join ['join'];
|
||||
}
|
||||
$where_auto = '1=1';
|
||||
if ($show_deleted == 0) {
|
||||
$where_auto = " ecmcustomlists.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 ($order_by != "")
|
||||
$query .= " ORDER BY " . $this->process_order_by ( $order_by, null );
|
||||
else
|
||||
$query .= " ORDER BY tasks.name";
|
||||
return $query;
|
||||
}
|
||||
function create_export_query(&$order_by, &$where) {
|
||||
$custom_join = $this->custom_fields->getJOIN ( true, true );
|
||||
{
|
||||
$query = 'SELECT ecmcustomlists.*';
|
||||
|
||||
if ($custom_join) {
|
||||
$query .= $custom_join ['select'];
|
||||
}
|
||||
$query .= ' FROM ecmcustomlists ';
|
||||
$where_auto = "ecmcustomlists.deleted=0";
|
||||
}
|
||||
|
||||
if ($custom_join) {
|
||||
$query .= $custom_join ['join'];
|
||||
}
|
||||
|
||||
if ($where != "")
|
||||
$query .= "where $where AND " . $where_auto;
|
||||
else
|
||||
$query .= "where " . $where_auto;
|
||||
|
||||
if ($order_by != "")
|
||||
$query .= " ORDER BY " . $this->process_order_by ( $order_by, null );
|
||||
else
|
||||
$query .= " ORDER BY ecmcustomlists.name";
|
||||
return $query;
|
||||
}
|
||||
function fill_in_additional_list_fields() {
|
||||
}
|
||||
function fill_in_additional_detail_fields() {
|
||||
parent::fill_in_additional_detail_fields ();
|
||||
global $app_strings;
|
||||
}
|
||||
function get_list_view_data() {
|
||||
global $action, $currentModule, $focus, $current_module_strings, $app_list_strings, $image_path, $timedate;
|
||||
|
||||
return array ();
|
||||
}
|
||||
function bean_implements($interface) {
|
||||
switch ($interface) {
|
||||
case 'ACL' :
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
function listviewACLHelper() {
|
||||
$array_assign = parent::listviewACLHelper ();
|
||||
$is_owner = false;
|
||||
if (! empty ( $this->parent_name )) {
|
||||
if (! empty ( $this->parent_name_owner )) {
|
||||
global $current_user;
|
||||
$is_owner = $current_user->id == $this->parent_name_owner;
|
||||
}
|
||||
}
|
||||
|
||||
if (! ACLController::moduleSupportsACL ( $this->parent_type ) || ACLController::checkAccess ( $this->parent_type, 'view', $is_owner )) {
|
||||
$array_assign ['PARENT'] = 'a';
|
||||
} else {
|
||||
$array_assign ['PARENT'] = 'span';
|
||||
}
|
||||
$is_owner = false;
|
||||
if (! empty ( $this->contact_name )) {
|
||||
if (! empty ( $this->contact_name_owner )) {
|
||||
global $current_user;
|
||||
$is_owner = $current_user->id == $this->contact_name_owner;
|
||||
}
|
||||
}
|
||||
|
||||
if (ACLController::checkAccess ( 'Contacts', 'view', $is_owner )) {
|
||||
$array_assign ['CONTACT'] = 'a';
|
||||
} else {
|
||||
$array_assign ['CONTACT'] = 'span';
|
||||
}
|
||||
|
||||
return $array_assign;
|
||||
}
|
||||
function save($check_notify = FALSE) {
|
||||
global $current_user;
|
||||
|
||||
$return_id = parent::save ( $check_notify );
|
||||
|
||||
return $return_id;
|
||||
}
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user