From cd44719571a0f1bfa9c101cb6606acaaa703f443 Mon Sep 17 00:00:00 2001 From: yashodha Date: Thu, 11 Jun 2020 19:39:19 +0530 Subject: [PATCH] (dev/core#1787) Regression : File fields export results in DB error --- CRM/Export/BAO/ExportProcessor.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/CRM/Export/BAO/ExportProcessor.php b/CRM/Export/BAO/ExportProcessor.php index 100b8892ed..9402772dce 100644 --- a/CRM/Export/BAO/ExportProcessor.php +++ b/CRM/Export/BAO/ExportProcessor.php @@ -1109,9 +1109,16 @@ class CRM_Export_BAO_ExportProcessor { ) { //check for custom data if ($cfID = CRM_Core_BAO_CustomField::getKeyID($field)) { + $html_type = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_CustomField', $cfID, 'html_type'); + + //need to calculate the link to the file for file custom data + if ($html_type === 'File' && $fieldValue) { + $result = civicrm_api3('attachment', 'get', ['return' => ['url'], 'id' => $fieldValue]); + return $result['values'][$result['id']]['url']; + } + return CRM_Core_BAO_CustomField::displayValue($fieldValue, $cfID); } - elseif (in_array($field, [ 'email_greeting', 'postal_greeting', -- 2.25.1