diff --git a/api/src/Storage/Merge.php b/api/src/Storage/Merge.php index 8f1cbb615c..dca3d49ec0 100644 --- a/api/src/Storage/Merge.php +++ b/api/src/Storage/Merge.php @@ -211,7 +211,7 @@ abstract class Merge * @param boolean $ignore_acl =false true: no acl check * @return array */ - public function contact_replacements($contact,$prefix='',$ignore_acl=false) + public function contact_replacements($contact,$prefix='',$ignore_acl=false, &$content = '') { if (!is_array($contact)) { @@ -287,6 +287,11 @@ abstract class Merge Customfields::format($field, (string)$contact[$name]); } + if($content && strpos($content, '$$#') !== FALSE) + { + $this->cf_link_to_expand($contact, $content, $replacements, 'addressbook'); + } + // Add in extra cat field $cats = array(); foreach(is_array($contact['cat_id']) ? $contact['cat_id'] : explode(',',$contact['cat_id']) as $cat_id) @@ -1357,7 +1362,6 @@ abstract class Merge $expand_sub_cfs[$cf[$index]] .= '$$'.$cf_sub . '$$ '; } } - $expand_sub_cfs = array_unique($expand_sub_cfs); foreach($cf as $index => $field) { @@ -1414,7 +1418,7 @@ abstract class Merge $replacements = array(); if($app == 'addressbook') { - return $this->contact_replacements($id, $prefix); + return $this->contact_replacements($id, $prefix, false, $content); } try