sugarcrm - 在弹出窗口中显示字段为 NULL 的记录
问题描述
select
当我们单击子面板内的按钮时,我能够过滤出现的记录。可以通过$initial_filter
像这样覆盖值来完成:
public function display($widget_data, $additionalFormFields = null, $nonbutton = false) {
global $app_strings; $initial_filter = '';
$initial_filter.='&SOME_FIELD='.urlencode("SOMEVALUE");
}
$_GET
当弹出窗口打开时,该初始过滤器将用作参数,因此它将知道要显示哪些记录
现在棘手的部分是我试图弄清楚如何过滤它,以便它显示 SOME_FIELD 为空的记录......我尝试了类似的东西SOME_FIELD=null
,SOME_FIELD=false
但它不起作用......如果有人可以提出任何建议,将不胜感激。
解决方案
您将需要修改列表视图查询和数据获取逻辑。查看以下详细信息以获取更多帮助:
仅用于列表视图:custom/modules/MODULE_NAME/views/view.list.php
以下是帮助代码:
require_once('include/MVC/View/views/view.list.php');
class MODULE_NAMEViewList extends ViewList {
function listViewProcess() {
global $current_user;
$this->params['custom_where'] = ' AND module_name.name = "test" ';
parent::listViewProcess();
}
}
对于列表和弹出视图(两者):
您需要更改create_new_list_query
实际准备查询的函数内部的逻辑。一些模块已经覆盖它一个 bean 级别(例如,请参阅modules/Leads/Lead.php
)。
如果您想以升级安全的方式覆盖它,则在自定义目录中创建一个文件,例如:custom/modules/Leads/Lead.php
,然后从核心 bean 类扩展它,如下所示:
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
require_once('modules/Leads/Lead.php');
class CustomLead extends Lead {
function create_new_list_query($order_by, $where,$filter=array(),$params=array(), $show_deleted = 0,$join_type='', $return_array = false,$parentbean=null, $singleSelect = false, $ifListForExport = false)
{
// Code from create_new_list_query in and then modify it accordingly.
}
}
在此位置注册新的 bean 类:custom/Extension/application/Ext/Include/custom_leads_class.php
注册代码如下所示:
<?php
$objectList['Leads'] = 'Lead';
$beanList['Leads'] = 'CustomLead';
$beanFiles['CustomLead'] = 'custom/modules/Leads/Lead.php';
?>
推荐阅读
- http-live-streaming - medialement.js 不适用于我在 iPhone 上的 hls
- python-3.x - 解码 Python 字符串
- python - BurpSuite 上的 POST 请求响应与 Python 不同
- java - 确定文件是否在 Java 中被 PGP 加密
- ios - 如何使单元格中的某些文本或单词不可见或可见?
- go - 如何使用 Golang 获取发布的二进制数据的文件名?
- android - 没有来自服务器的填充无法加载广告:3
- angular - Angular 5 Material 如何将下拉菜单添加到多级轮播样式的 SideNav?
- php - PHP 回显 5000 条记录并取消设置
- java - 为什么scanner.hasNextInt() 方法需要一个字母来开始处理数字?