forked from extern/egroupware
Fix missing fields in merge if info_contact is not a addressbook entry
This commit is contained in:
parent
c8369f9b39
commit
867c661796
@ -1427,13 +1427,7 @@ abstract class Merge
|
||||
// Get replacements for that application
|
||||
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
|
||||
// so we send only the used fields
|
||||
$content = $expand_sub_cfs[$field] ? $expand_sub_cfs[$field] : '';
|
||||
|
||||
$app_replacements[$field] = $class->get_replacements($values['#'.$field], $content);
|
||||
$app_replacements[$field] = $this->get_app_replacements($field_app, $values['#'.$field], $content);
|
||||
}
|
||||
$replacements[$placeholders[$index]] = $app_replacements[$field]['$$'.$sub[$index].'$$'];
|
||||
}
|
||||
@ -1444,6 +1438,44 @@ abstract class Merge
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the replacements for any entry specified by app & id
|
||||
*
|
||||
* @param stribg $app
|
||||
* @param string $id
|
||||
* @param string $content
|
||||
* @return array
|
||||
*/
|
||||
protected function get_app_replacements($app, $id, $content, $prefix)
|
||||
{
|
||||
$replacements = array();
|
||||
if($app == 'addressbook')
|
||||
{
|
||||
return $this->contact_replacements($id, $prefix);
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
$classname = "{$app}_merge";
|
||||
$class = new $classname();
|
||||
$method = $app.'_replacements';
|
||||
if(method_exists($class,$method))
|
||||
{
|
||||
$replacements = $class->$method($id, $prefix, $content);
|
||||
}
|
||||
else
|
||||
{
|
||||
$replacements = $class->get_replacements($id, $content);
|
||||
}
|
||||
}
|
||||
catch (\Exception $e)
|
||||
{
|
||||
// Don't break merge, just log it
|
||||
error_log($e->getMessage());
|
||||
}
|
||||
return $replacements;
|
||||
}
|
||||
|
||||
/**
|
||||
* Process special flags, such as IF or NELF
|
||||
*
|
||||
|
@ -69,15 +69,6 @@ class infolog_merge extends Api\Storage\Merge
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (!(strpos($content,'$$info_contact/') === false))
|
||||
{
|
||||
// Check to see if it's actually a contact, then load
|
||||
if(is_array($replacements['$$info_link$$']) && $replacements['$$info_link$$']['app'] == 'addressbook')
|
||||
{
|
||||
$replacements += $this->contact_replacements($replacements['$$info_link$$']['id'],'info_contact');
|
||||
}
|
||||
if(is_array($replacements['$$info_link$$'])) unset($replacements['$$info_link$$']);
|
||||
}
|
||||
return $replacements;
|
||||
}
|
||||
|
||||
@ -162,6 +153,12 @@ class infolog_merge extends Api\Storage\Merge
|
||||
$info['$$'.($prefix ? $prefix.'/':'').$key.'$$'] = $value;
|
||||
}
|
||||
|
||||
// Add contact fields
|
||||
if($array['info_link']['app'] && $array['info_link']['id'])
|
||||
{
|
||||
$info+=$this->get_app_replacements($array['info_link']['app'], $array['info_link']['id'], $content, 'info_contact');
|
||||
}
|
||||
|
||||
// Add parent
|
||||
if($record->info_id_parent)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user