'field_value' => CRM_Core_BAO_CustomField::displayValue($values['data'], $properties['id'], $entityId),
'options_per_line' => CRM_Utils_Array::value('options_per_line', $properties),
);
+ // editable = whether this set contains any non-read-only fields
+ if (!isset($details[$groupID][$values['id']]['editable'])) {
+ $details[$groupID][$values['id']]['editable'] = FALSE;
+ }
+ if (empty($properties['is_view'])) {
+ $details[$groupID][$values['id']]['editable'] = TRUE;
+ }
// also return contact reference contact id if user has view all or edit all contacts perm
if ((CRM_Core_Permission::check('view all contacts') ||
CRM_Core_Permission::check('edit all contacts'))
{assign var="rowCount" value=1}
{foreach from=$viewCustomData item=customValues key=customGroupId}
{foreach from=$customValues item=cd_edit key=cvID}
- {assign var="customRegion" value='contact-custom-data-'|cat:$cd_edit.name}
- {crmRegion name=$customRegion}
+ {crmRegion name="custom-data-view-`$cd_edit.name`"}
{if $cd_edit.help_pre}
<div class="messages help">{$cd_edit.help_pre}</div>
{/if}
{if $multiRecordDisplay neq 'single'}
<table class="no-border">
{assign var='index' value=$groupId|cat:"_$cvID"}
- {if ($editOwnCustomData and $showEdit) or ($showEdit and $editCustomData and $groupId)}
+ {if ($showEdit && $cd_edit.editable && $groupId) && ($editOwnCustomData or $editCustomData)}
<tr>
<td>
<a
</div>
{/if}
<div class="crm-accordion-body">
- {if $groupId and $cvID and $editCustomData}
+ {if $groupId and $cvID and $editCustomData and $cd_edit.editable}
<div class="crm-submit-buttons">
<a href="#" class="crm-hover-button crm-custom-value-del"
data-post='{ldelim}"valueID": "{$cvID}", "groupID": "{$customGroupId}", "contactId": "{$contactId}", "key": "{crmKey name='civicrm/ajax/customvalue'}"{rdelim}'