From: eileen Date: Wed, 2 Jan 2019 22:05:20 +0000 (+1300) Subject: dev/core#619 fix regression on Address contact-reference fields not rendering results. X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=c94a15af6130c9310c5a2e53c32c24ecb5379c5c;p=civicrm-core.git dev/core#619 fix regression on Address contact-reference fields not rendering results. Fixing results not rendering on onbehalf profiles broke addresses - this limits the handling added for onbehalf to only apply to onbehalf. --- diff --git a/CRM/Core/BAO/CustomField.php b/CRM/Core/BAO/CustomField.php index 58e19ef541..1cd2f60b9a 100644 --- a/CRM/Core/BAO/CustomField.php +++ b/CRM/Core/BAO/CustomField.php @@ -1064,7 +1064,10 @@ class CRM_Core_BAO_CustomField extends CRM_Core_DAO_CustomField { $urlParams = "context=customfield&id={$field->id}"; $idOfelement = $elementName; // dev/core#362 if in an onbehalf profile clean up the name to get rid of square brackets that break the select 2 js - if (strpos($elementName, '[') && strpos($elementName, ']')) { + // However this caused regression https://lab.civicrm.org/dev/core/issues/619 so it has been hacked back to + // only affecting on behalf - next time someone looks at this code it should be with a view to overhauling it + // rather than layering on more hacks. + if (substr($elementName, 0, 8) === 'onbehalf' && strpos($elementName, '[') && strpos($elementName, ']')) { $idOfelement = substr(substr($elementName, (strpos($elementName, '[') + 1)), 0, -1); } $customUrls[$idOfelement] = CRM_Utils_System::url('civicrm/ajax/contactref',