sugarcrm - 如何在商机中创建自定义文件上传字段
问题描述
我正在使用糖 8.3。我正在尝试为上传文档创建自定义字段。我已经创建了 vardef 文件,但是当我点击保存记录时,文件正确上传但没有显示在记录中。
自定义/扩展/模块/机会/Ext/Vardefs/custom_upload.php
<?php
$GLOBALS['dictionary']['Opportunity']['fields']['filename'] = array (
'name' => 'filename',
'vname' => 'LBL_FILENAME',
'type' => 'file',
'dbType' => 'varchar',
'len' => '255',
'reportable' => true,
'comment' => 'File name associated with the note (attachment)',
'importable' => false,
'source' => 'non-db',
'docUrl' => 'doc_url',
);
$GLOBALS['dictionary']['Opportunity']['fields']['file_mime_type'] = array(
'name' => 'file_mime_type',
'vname' => 'LBL_FILE_MIME_TYPE',
'type' => 'varchar',
'len' => '100',
'comment' => 'Attachment MIME type',
'importable' => false,
'source' => 'non-db',
);
$GLOBALS['dictionary']['Opportunity']['fields']['file_url'] = array (
'name'=>'file_url',
'vname' => 'LBL_FILE_URL',
'type'=>'varchar',
'source'=>'non-db',
'reportable'=>false,
'comment' => 'Path to file (can be URL)',
'importable' => false,
);
解决方案
从您提供的代码中,整个场景并不是很清楚,我认为您应该从这些字段中删除'source'=>'non-db',属性,以便将它们保存在数据库中。
不要忘记执行修复并执行在修复结果中生成的查询,以便 Sugar 在机会表中创建适当的字段以保存您上传的文件数据。
推荐阅读
- c++ - 如何使用 CGAL 获得多面体的中轴?
- flutter - Flutter 前一个 DropDownFormField 有数据后如何创建 DropDownFormField
- excel - 如何在不到一分钟的时间内从网络上进行电源查询刷新数据?
- ubuntu - 终端 Linux Ubuntu
- php - CURLOPT_URL 带下划线,怎么做?
- python - Python-打印数字的第三位数字
- sql - SQL:使用子查询与 FROM 从列表更新
- html - 即使使用 !important,CSS 覆盖似乎也不起作用
- docker - 如何在 Window 10 中使用 docker compose 为气流正确设置环境变量?气流初始化 1 错误:未设置 AIRFLOW_UID
- linux - 将 https://example 重定向到 https://www.example.com Vhost