Hi, REByers
You have to create a text custom field into Opportunities module.
After that you have to create the file modules/Opportunities/controller.php and create 2 functions just like these one:
PHP Code:
function action_editview(){
global $app_list_strings, $iash_optional_inventory_checked, $iash_standard_inventory_checked, $iash_warrantied_checked;
$this->view = 'edit';
$GLOBALS['view'] = $this->view;
$array = array();
$result = $this->bean->db->query("SELECT a.id, a.name FROM accounts a INNER JOIN accounts_cstm ac ON a.id = ac.id_c WHERE a.deleted = 0 AND ac.organisation_type_id_c = '3'");
while($row = $this->bean->db->fetchByAssoc($result)) {
$array[$row['id']] = $row['name'];
}
$publisher_id = explode("^,^", @$this->bean->fetched_row['publisher_id']);
$this->bean->publisher_id = get_select_options_with_id($array, $publisher_id);
}
function action_detailview(){
global $app_list_strings, $iash_optional_inventory_checked, $iash_standard_inventory_checked, $iash_warrantied_checked;
$this->view = 'detail';
$GLOBALS['view'] = $this->view;
$ids = str_replace("^,^", "','", @$this->bean->fetched_row['publisher_id']);
$result = $this->bean->db->query("SELECT a.name FROM accounts a INNER JOIN accounts_cstm ac ON a.id = ac.id_c WHERE a.deleted = 0 AND ac.organisation_type_id_c = '3' AND a.id IN ('{$ids}')");
$this->bean->publisher_id = '';
while($row = $this->bean->db->fetchByAssoc($result)) {
$this->bean->publisher_id.= "<LI>{$row['name']}";
}
}
This is an example of populating a multienum field.
In the file detailviewdefs.php you add this customCode for the field:
PHP Code:
'customCode' => '{$fields.publisher_id.value}',
And in the file editviewdefs.php you add this customCode:
PHP Code:
'customCode' => '<select id="publisher_id[]" title="" style="width: 150px;" size="6" multiple="true" name="publisher_id[]">{$fields.publisher_id.value}</select>',
Cheers
Bookmarks