From a9b69e9ff6d07db1c482c939476a7f5076940e9e Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Fri, 14 Nov 2014 21:03:49 -0500 Subject: [PATCH] CRM-15597 - Fix display of frozen custom contactRef fields --- CRM/Core/Form/Renderer.php | 6 ++++++ templates/CRM/Custom/Form/ContactReference.tpl | 2 ++ 2 files changed, 8 insertions(+) diff --git a/CRM/Core/Form/Renderer.php b/CRM/Core/Form/Renderer.php index d5eaf254c8..7eee0a3a42 100644 --- a/CRM/Core/Form/Renderer.php +++ b/CRM/Core/Form/Renderer.php @@ -244,6 +244,12 @@ class CRM_Core_Form_Renderer extends HTML_QuickForm_Renderer_ArraySmarty { $entity = $field->getAttribute('data-api-entity'); $vals = json_decode($field->getAttribute('data-entity-value'), TRUE); $display = array(); + + // Custom fields of type contactRef store their data in a slightly different format + if ($field->getAttribute('data-crm-custom') && $entity == 'contact') { + $vals = array(array('id' => $vals['id'], 'label' => $vals['text'])); + } + foreach ($vals as $val) { // Format contact as link if ($entity == 'contact' && CRM_Contact_BAO_Contact_Permission::allow($val['id'], CRM_Core_Permission::VIEW)) { diff --git a/templates/CRM/Custom/Form/ContactReference.tpl b/templates/CRM/Custom/Form/ContactReference.tpl index 44f7f001a4..7c04b5ac86 100644 --- a/templates/CRM/Custom/Form/ContactReference.tpl +++ b/templates/CRM/Custom/Form/ContactReference.tpl @@ -24,6 +24,7 @@ +--------------------------------------------------------------------+ *} {* Js needed to initialize custom field of type ContactReference *} +{if empty($form.$element_name.frozen)} {literal} {/literal} +{/if} -- 2.25.1