From 211353a830b4c2634983cdef41f73f573b3e792e Mon Sep 17 00:00:00 2001 From: CiviCRM Date: Tue, 30 Sep 2014 17:33:36 +0530 Subject: [PATCH] CRM-10206 --- CRM/Core/BAO/CustomField.php | 6 ++++-- api/v3/utils.php | 7 ++++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/CRM/Core/BAO/CustomField.php b/CRM/Core/BAO/CustomField.php index 24a8782cef..9f1e60b255 100644 --- a/CRM/Core/BAO/CustomField.php +++ b/CRM/Core/BAO/CustomField.php @@ -1526,6 +1526,7 @@ class CRM_Core_BAO_CustomField extends CRM_Core_DAO_CustomField { * @param int $entityId entity id (contribution, membership...) * @param boolean $inline consider inline custom groups only * @param boolean $checkPermission if false, do not include permissioning clause + * @param boolean $includeViewOnly if true, fields marked 'View Only' are included. Required for APIv3. * * @return array $customFormatted formatted custom field array * @static @@ -1534,7 +1535,8 @@ class CRM_Core_BAO_CustomField extends CRM_Core_DAO_CustomField { $customFieldExtend, $customValueId = NULL, $entityId = NULL, $inline = FALSE, - $checkPermission = TRUE + $checkPermission = TRUE, + $includeViewOnly = false ) { //get the custom fields for the entity //subtype and basic type @@ -1567,7 +1569,7 @@ class CRM_Core_BAO_CustomField extends CRM_Core_DAO_CustomField { } // return if field is a 'code' field - if (!empty($customFields[$customFieldId]['is_view'])) { + if (!$includeViewOnly && !empty($customFields[$customFieldId]['is_view'])) { return; } diff --git a/api/v3/utils.php b/api/v3/utils.php index 8c08e91a21..0c6075cf4c 100644 --- a/api/v3/utils.php +++ b/api/v3/utils.php @@ -943,8 +943,13 @@ function _civicrm_api3_custom_format_params($params, &$values, $extends, $entity if ($checkCheckBoxField && !empty($fields['custom_' . $customFieldID]) && $fields['custom_' . $customFieldID]['html_type'] == 'CheckBox') { formatCheckBoxField($value, 'custom_' . $customFieldID, $entity); } + // update custom field using get api, temporary value has to Overwrite + // get api return custom_customFieldID and custom_customFieldID_customValueID + if ($customValueID) { + $value = $params['custom_'.$customFieldID]; + } CRM_Core_BAO_CustomField::formatCustomField($customFieldID, $values['custom'], - $value, $extends, $customValueID, $entityId, FALSE, FALSE + $value, $extends, $customValueID, $entityId, FALSE, FALSE, TRUE ); } } -- 2.25.1