나의 담당 My Items
1. 검색필드 정의 (search field definition)
/modules/Opportunities/metadata/SearchFields.php
custom/modules/Opportunities/metadata/SearchFields.php
'current_user_only'=> array(
'query_type'=>'default',
'db_field'=>array( 'assigned_user_id' ),
'type' => 'bool'
'my_items'=>true,
'vname' => 'LBL_CURRENT_USER_FILTER',
),
'open_only' => array(
'query_type'=>'default',
'db_field'=>array('sales_stage'),
'type'=>'bool',
'operator'=>'not in',
'closed_values' => array('Closed Won', 'Closed Lost'),
),
2. 검색폼에 정의한검색필드 배치
/modules/Opportunities/metadata/searchdefs.php
custom/modules/Opportunities/metadata/searchdefs.php
$searchdefs['Opportunities'] = array(
'templateMeta' => array (
'maxColumns' => '3',
'maxColumnsBasic' => '4',
'widths' => array (
'label' => '10',
'field' => '30',
),
),
'layout' => array (
'basic_search' => array (
'name' =>
array (
'name' => 'name',
'default' => true,
'width' => '10%',
),
'current_user_only' =>
array (
'name' => 'current_user_only',
'label' => 'LBL_CURRENT_USER_FILTER',
'type' => 'bool',
'default' => true,
'width' => '10%',
),
array (
'name' => 'open_only',
'label' => 'LBL_OPEN_ITEMS',
'type' => 'bool',
'default' => false,
'width' => '10%'
),
),
===================================================================
3. Dropdown 대신에 Checkbox
<참조>http://forums.sugarcrm.com/f6/checkbox-instead-dropdown-49260/
SearchView.tpl 로 인해 변경되고, SugarFieldBool.php는 수정함.
include\SugarFields\Fields\Bool\SugarFieldBool.php
C:\xampp\htdocs\s6\include\SearchForm
/include/SearchForm/SearchForm2.php
custom/include/SearchForm/SearchForm2.php
==================================================================
['query_type']=='case_insensitive'
('query_type' => 'default',
['query_type'] == 'format'
'query_type'=>'application'
=================================================================='operator'=>'not in',
operator'=>'in'),
'between';
if(in_array($parms['operator'], array('=', 'between', "not_equal", 'less_than', 'greater_than', 'less_than_equals', 'greater_than_equals')))
'operator'=>'=')
==========
C:\xampp\htdocs\sce1\include\SugarObjects\templates\company\metadata\SearchFields.php:
59 'email'=> array(
60 'query_type' => 'default',
61: 'operator' => 'subquery',
62 'subquery' => 'SELECT eabr.bean_id FROM email_addr_bean_rel eabr JOIN email_addresses ea ON (ea.id = eabr.email_address_id) WHERE eabr.deleted=0 AND ea.email_address LIKE',
63 'db_field' => array(
C:\xampp\htdocs\sce1\include\SugarObjects\templates\person\vardefs.php:
145 'query_type' => 'default',
146 'source' => 'non-db',
147: 'operator' => 'subquery',
148 'subquery' => 'SELECT eabr.bean_id FROM email_addr_bean_rel eabr JOIN email_addresses ea ON (ea.id = eabr.email_address_id) WHERE eabr.deleted=0 AND ea.email_address LIKE',
149 'db_field' => array(
=======================================================
현재 사용자 정보 얻기
global $current_user;
echo $current_user->id;
echo $current_user->user_name;
Write only this two lines of code to get the current user id :
global $current_user;
$dude_id = $current_user->id;
You can catch it looking at session variable :
$_SESSION['authenticated_user_id'])
====================================================
<?php
global $current_user;
$id = $current_user->id;
// created: 2013-04-23 19:01:33
$searchFields['Opportunities'] = array (
'sixx_only' => array (
'query_type' => 'default',
'db_field' => array ( 0 => 'assigned_user_id',),
//'field_value' => $id
'operator' => 'subquery',
'subquery' => 'select id
from users
WHERE deleted=0
AND users.reports_to_id = "'.$id.'" and 1 =',
'type' => 'bool',
),
'SS > Sugar' 카테고리의 다른 글
sugar error (0) | 2013.10.16 |
---|---|
Angel's Blog: SugarCRM: SOAP API Performance (0) | 2013.10.09 |
CONNECT BY LEVEL (0) | 2013.05.07 |
How to: Create an own chart Dashlet in 5.0.0c in 9 Steps (0) | 2013.01.20 |
dropdown by role (0) | 2012.08.20 |
campaign tracker (0) | 2012.07.16 |