Implement home-accounts and select-account custom fields sub-placeholder expansions in the correct place, with the rest of them

This commit is contained in:
Nathan Gray 2013-06-05 17:03:27 +00:00
parent e8770a9611
commit 654054826f
2 changed files with 25 additions and 16 deletions

View File

@ -1246,20 +1246,40 @@ abstract class bo_merge
foreach($cf as $index => $field)
{
if($cfs[$field] && in_array($cfs[$field]['type'],array_keys($GLOBALS['egw_info']['apps'])) )
if($cfs[$field])
{
if(in_array($cfs[$field]['type'],array_keys($GLOBALS['egw_info']['apps'])))
{
$field_app = $cfs[$field]['type'];
}
else if ($cfs[$field]['type'] == 'home-accounts' || $cfs[$field]['type'] == 'select-account')
{
// Special case for home-accounts -> contact
$field_app = 'addressbook';
$account = $GLOBALS['egw']->accounts->read($values['#'.$field]);
$app_replacements[$field] = $this->contact_replacements($account['person_id']);
}
else if ($list = explode('-',$cfs[$field]['type']) && in_array($list[0], array_keys($GLOBALS['egw_info']['apps'])))
{
// Sub-type - use app
$field_app = $list[0];
}
else
{
continue;
}
// Get replacements for that application
$field_app = $cfs[$field]['type'];
if(!$app_replacements[$field_app])
if(!$app_replacements[$field])
{
$classname = "{$field_app}_merge";
$class = new $classname();
// If we send the real content, it can result in infinite loop of lookups
// This means you can't do {{#other_app/#other_app_cf/n_fn}}
$content = '';
$app_replacements[$field_app] = $class->get_replacements($values['#'.$field], $content);
$app_replacements[$field] = $class->get_replacements($values['#'.$field], $content);
}
$replacements[$placeholders[$index]] = $app_replacements[$field_app]['$$'.$sub[$index].'$$'];
$replacements[$placeholders[$index]] = $app_replacements[$field]['$$'.$sub[$index].'$$'];
}
else
{

View File

@ -101,17 +101,6 @@ class infolog_merge extends bo_merge
$this->cf_link_to_expand($record->get_record_array(), $content, $info);
}
foreach($this->bo->customfields as $name => $field)
{
if ($field['type'] == 'select-account')
{
$record_name = '#'.$name;
$account = $GLOBALS['egw']->accounts->read($record->$record_name);
$info += $this->contact_replacements($account['person_id'],
($prefix ? $prefix . '/' : '')."#$name"
);
}
}
importexport_export_csv::convert($record, $types, 'infolog', $selects);
if($record->info_contact)
{