From: Seamus Lee Date: Thu, 3 Jan 2019 15:14:13 +0000 (+1100) Subject: Merge pull request #13280 from aydun/tokenrow_fix X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=44e82e1cf8eb9728c8db2b8ae3d55858f1e7848f;p=civicrm-core.git Merge pull request #13280 from aydun/tokenrow_fix Fix \Civi\Token\TokenRow::customToken() failure if field is not set --- 44e82e1cf8eb9728c8db2b8ae3d55858f1e7848f diff --cc Civi/Token/TokenRow.php index 5a223beb33,efe5275f2a..cb5982f004 --- a/Civi/Token/TokenRow.php +++ b/Civi/Token/TokenRow.php @@@ -136,13 -136,14 +136,14 @@@ class TokenRow */ public function customToken($entity, $customFieldID, $entityID) { $customFieldName = "custom_" . $customFieldID; - $fieldValue = civicrm_api3($entity, 'getvalue', array( + $record = civicrm_api3($entity, "getSingle", [ 'return' => $customFieldName, - 'id' => $entityID, - )); + 'id' => $entityID, + ]); + $fieldValue = \CRM_Utils_Array::value($customFieldName, $record, ''); // format the raw custom field value into proper display value - if ($fieldValue) { + if (isset($fieldValue)) { $fieldValue = \CRM_Core_BAO_CustomField::displayValue($fieldValue, $customFieldID); }