【问题标题】:How can I create custom file upload field in opportunities如何在商机中创建自定义文件上传字段
【发布时间】:2019-03-25 12:12:21
【问题描述】:

我正在使用糖 8.3。我正在尝试为上传文档创建自定义字段。 我已经创建了 vardef 文件,但是当我点击保存记录时,文件正确上传但没有显示在记录中。

custom/Extension/modules/Opportunities/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,

);

Before save attachment screenshot

After save attachment screenshot

【问题讨论】:

  • 你必须更具体。你试过什么?什么地方出了错?包括相关的配置和日志文件的 sn-ps。

标签: sugarcrm sugarbean


【解决方案1】:

从您提供的代码中,整个场景不是很清楚,我认为您应该从这些字段中删除 'source'=>'non-db', 属性以便保存它们在数据库中。

不要忘记执行修复并执行在修复结果中生成的查询,以便 Sugar 在机会表中创建适当的字段以保存您上传的文件数据。

【讨论】:

    猜你喜欢
    • 2019-05-04
    • 2012-11-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-01-11
    • 1970-01-01
    • 2012-12-13
    相关资源
    最近更新 更多