From 64a252b34f5147768735719728479a7261475593 Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Sat, 15 Apr 2023 15:57:43 -0400 Subject: [PATCH] Fix dev/core#4240 - Saving entityReference field value via API --- CRM/Utils/Type.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/CRM/Utils/Type.php b/CRM/Utils/Type.php index d83fbbe83f..87087711d0 100644 --- a/CRM/Utils/Type.php +++ b/CRM/Utils/Type.php @@ -236,6 +236,7 @@ class CRM_Utils_Type { case 'Date': case 'Timestamp': case 'ContactReference': + case 'EntityReference': case 'MysqlOrderByDirection': $validatedData = self::validate($data, $type, $abort); if (isset($validatedData)) { @@ -380,6 +381,7 @@ class CRM_Utils_Type { 'Date', 'Timestamp', 'ContactReference', + 'EntityReference', 'MysqlColumnNameOrAlias', 'MysqlOrderByDirection', 'MysqlOrderBy', @@ -435,12 +437,13 @@ class CRM_Utils_Type { break; case 'ContactReference': + case 'EntityReference': // null is valid if (strlen(trim($data)) == 0) { return trim($data); } - if (CRM_Utils_Rule::validContact($data)) { + if (CRM_Utils_Rule::positiveInteger($data)) { return (int) $data; } break; -- 2.25.1