我使用的是SugarCRM v6.5,我是个新手。在Lead中,我想在地址类型中添加一个字段来指示地址的类型(即办公室、家庭…)。因此,在工作室中,我创建了这个字段"type_address"作为一个简单的下拉列表(不知道英语中的术语,法语中是"listeàchoix simple"),并指示了用于填充它的选项。到目前为止,还可以,如果我在表单上显示它,它会正确填充。但我想把它添加到地址字段中,所以我打开了include''SSugarFields''Fields''address''fr_fr.EditView.tpl,并添加了一行,如下所示:
<tr style="background-color: yellowgreen;">
<td valign="top" width='25%' scope='row' ><label for="{{$typeaddr}}">{sugar_translate label='LBL_{{$key}}_ADRESS_TYPE' module='{{$module}}'}:</label>
{if $fields.{{$typeaddr}}.required || {{if $typeaddr|lower|in_array:$displayParams.required}}true{{else}}false{{/if}}}
<span class="required">{$APP.LBL_REQUIRED_SYMBOL}</span>
{/if}
</td>
<td>
<select name="{{$typeaddr}}" id="{{$typeaddr}}" title='' >
{html_options options=$fields.{{$typeaddr}}.options }
</select>
</td>
</tr>
在模板的顶部我放了:
{{assign var="typeaddr" value=$displayParams.key|cat:'_adress_type_c'}}
行显示,标签正常,但下拉列表不会填充。我试图在中指明选项列表''custom''Extension''modules''Leads''Ext''Vardefs''sugarfields_primary_address_type_c.php像这样:
$dictionary['Lead']['fields']['primary_adress_type_c']['type'] = 'base';
$dictionary['Lead']['fields']['primary_adress_type_c']['options'] = 'list_name_as_created_in_studio';
我还试着把它放在''custom''modules''Leads''metadata''editviewdefs.php 中
0 =>
array (
'name' => 'primary_adress_type_c',
'studio' => 'visible',
'label' => 'LBL_PRIMARY_ADRESS_TYPE',
'type' => 'base',
'options' => list_name_as_created_in_studio',
),
我尝试了enum和base。诀窍是,即使我放入"enum"和一组选项,它也不会填充。
我看不出我在哪里可以干涉它,我肯定忘了做点什么。
任何帮助都是受欢迎的,甚至是手册的链接(我读了它,没有找到任何帮助,但我可能会错过一些东西)
在文件include'SugarFields'Fields'Address'fr_FR.EditView.tpl
中,替换:
<select name="{{$typeaddr}}" id="{{$typeaddr}}" title='' >
{html_options options=$fields.{{$typeaddr}}.options }
</select>
带有:
{html_options name=primary_adress_type_c options=$primary_adress_type_c_options selected=$fields.primary_adress_type_c.value}
创建内容为的新文件custom/modules/Leads/views/view.edit.php
<?php
require_once('include/MVC/View/views/view.edit.php');
class LeadsViewEdit extends ViewEdit{
public function LeadsViewEdit(){
parent::ViewEdit();
}
public function preDisplay() {
parent::preDisplay();
$this->ss->assign('primary_adress_type_c_options', $GLOBALS['app_list_strings']['list_name_as_created_in_studio']);
}
public function display(){
parent::display();
}
}
?>