From 1cb13a1f13e70270a761c7c15cf3f64e30487c81 Mon Sep 17 00:00:00 2001 From: nathangray Date: Tue, 3 Apr 2018 15:26:48 -0600 Subject: [PATCH] * Api - Fix references to sub-fields of custom field entries only merged for the first entry of each type --- api/src/Storage/Merge.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) 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