SugarCRM On-Demand将TextField转换为DropDown

时间:2016-01-10 03:25:58

标签: php manifest sugarcrm

此前在此处发布了类似的问题,但它仅适用于现场SugarCRM实例(也是很久以前)。

在我的情况下,我想在On-Demand实例上将“Billing Country”字段从“TextField”更改为“DropDdown”,在该实例中我无法访问配置文件。我怎么能这样做?

到目前为止,我已经使用Module Loader尝试了不同的PHP文件,但它也无法正常工作。

请在下面找到我的PHP脚本:

<?php

$manifest = array(
    'acceptable_sugar_flavors' => array('CE', 'PRO', 'CORP', 'ENT', 'ULT'),
    'acceptable_sugar_versions' => array(
        'exact_matches' => array(),
        'regex_matches' => array(
            0 => '6\\.5\\.(.*?)',
            1 => '6\\.7\\.(.*?)',
            2 => '7\\.2\\.(.*?)',
            3 => '7\\.2\\.(.*?)\\.(.*?)',
            4 => '7\\.5\\.(.*?)\\.(.*?)',
            5 => '7\\.6\\.(.*?)\\.(.*?)'
        ),
    ),
    'name' => 'Textfield to Dropdown',
    'description' => 'Converting Billing Country textfield to Dropdown Field',
    'author' => 'myname',
    'icon' => '',
    'is_uninstallable' => true,
    'published_date' => '2015-01-09 19:00:00',
    'type' => 'module',
    'version' => '1.0',
);

$dictionary['Account']['fields']['billing_address_country']['type'] = 'enum';
$dictionary['Account']['fields']['billing_address_country']['ext1'] = 'countries_dom';

模块加载正常但快速修复后没有变化。我也尝试过以下变量:

$dictionary['Account']['fields']['billing_address_country']['isDropDown']=yes;

和...

$dictionary['Account']['fields']['billing_address_country']['Options']='countries_dom';

谁能告诉我我做错了什么?我很感激您的任何帮助或指导。请指教。

干杯, ħ

P.S。我正在使用SugarCRM On-Demand版本7.6.1

1 个答案:

答案 0 :(得分:1)

您需要创建manifest.php文件并将该点指向要复制/上传以进行自定义的文件:

<强> manifest.php:

<?php

$manifest = array(
    'built_in_version' => '7.6.1.0',
    'acceptable_sugar_versions' =>
        array(
            0 => '',
        ),
    'acceptable_sugar_flavors' =>
        array(
            0 => 'PRO',
            1 => 'CORP',
            2 => 'ENT',
            3 => 'ULT',
        ),
    'readme' => '',
    'key' => 'SO',
    'author' => 'Eric',
    'description' => 'Convert Accounts Billing Country TextField to Enum',
    'icon' => '',
    'is_uninstallable' => true,
    'name' => 'TextFieldToDropdownPkg',
    'published_date' => '2016-01-10 03:01:01',
    'type' => 'module',
    'version' => 1452378413,
    'remove_tables' => 'prompt',
);

$installdefs = array(
    'id' => 'TextFieldToDropdownPkg',
    'copy' => array(
        0 => array(
            'from' => '<basepath>/custom/Extension/modules/Accounts/Ext/Vardefs/custom_billing_address_country.php',
            'to' => 'custom/Extension/modules/Accounts/Ext/Vardefs/custom_billing_address_country.php',
        ),
    ),
);

然后创建:

自定义/扩展/模块/账户/外部/ Vardefs / custom_billing_address_country.php

<?php

$dictionary['Account']['fields']['billing_address_country']['comments']='Country for primary address';
$dictionary['Account']['fields']['billing_address_country']['group']='primary_address';
$dictionary['Account']['fields']['billing_address_country']['options']='countries_dom';
$dictionary['Account']['fields']['billing_address_country']['type']='enum';

将这些文件压缩并使用Module Loader。