SugarCRM 按需将 TextField 转换为 DropDown

SugarCRM On-Demand Convert TextField to DropDown

类似的问题以前在这里发布过,但它仅适用于 On-Site SugarCRM 实例(也是很久以前的事)。

在我的例子中,我想在我无权访问配置文件的按需实例上将 "Billing Country" 字段从 'TextField' 更改为 'DropDdown'。我该怎么做?

到目前为止,我已经使用模块加载器尝试了不同的 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';

谁能告诉我我做错了什么?如果您有任何帮助或指导,我将不胜感激。请指教

干杯, H

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

您需要创建 manifest.php 文件并将该文件指向您想要 copy/upload 进行自定义的文件:

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',
        ),
    ),
);

然后创建:

custom/Extension/modules/Accounts/Ext/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。