From d1b0ffadd02326989aee2ab72211fb1057295452 Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Wed, 17 Apr 2019 10:16:57 -0400 Subject: [PATCH] (REF) Fix accepted params in CustomValueTable::setValues --- CRM/Core/BAO/CustomValueTable.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/CRM/Core/BAO/CustomValueTable.php b/CRM/Core/BAO/CustomValueTable.php index dac03b0075..98f0b96bcb 100644 --- a/CRM/Core/BAO/CustomValueTable.php +++ b/CRM/Core/BAO/CustomValueTable.php @@ -536,16 +536,17 @@ AND $cond * @return array */ public static function setValues(&$params) { + // For legacy reasons, accept this param in either format + if (empty($params['entityID']) && !empty($params['entity_id'])) { + $params['entityID'] = $params['entity_id']; + } - if (!isset($params['entityID']) || - CRM_Utils_Type::escape($params['entityID'], 'Integer', FALSE) === NULL - ) { + if (!isset($params['entityID']) || !CRM_Utils_Type::validate($params['entityID'], 'Integer', FALSE)) { return CRM_Core_Error::createAPIError(ts('entityID needs to be set and of type Integer')); } // first collect all the id/value pairs. The format is: // custom_X => value or custom_X_VALUEID => value (for multiple values), VALUEID == -1, -2 etc for new insertions - $values = []; $fieldValues = []; foreach ($params as $n => $v) { if ($customFieldInfo = CRM_Core_BAO_CustomField::getKeyID($n, TRUE)) { -- 2.25.1