From 015ba54ed6e07415f8991354e161ceca069b0cd4 Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Fri, 3 Apr 2020 11:06:33 -0400 Subject: [PATCH] Code cleanup - replace overcomplicated test for null with isset --- CRM/Core/BAO/CustomGroup.php | 4 ++-- CRM/Core/DAO.php | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/CRM/Core/BAO/CustomGroup.php b/CRM/Core/BAO/CustomGroup.php index 244c98f316..2d952aeb2b 100644 --- a/CRM/Core/BAO/CustomGroup.php +++ b/CRM/Core/BAO/CustomGroup.php @@ -1296,10 +1296,10 @@ ORDER BY civicrm_custom_group.weight, continue; } foreach ($group['fields'] as $field) { - if (CRM_Utils_Array::value('element_value', $field) !== NULL) { + if (isset($field['element_value'])) { $value = $field['element_value']; } - elseif (CRM_Utils_Array::value('default_value', $field) !== NULL && + elseif (isset($field['default_value']) && ($action != CRM_Core_Action::UPDATE || // CRM-7548 !array_key_exists('element_value', $field) diff --git a/CRM/Core/DAO.php b/CRM/Core/DAO.php index e6e301e508..e6813869de 100644 --- a/CRM/Core/DAO.php +++ b/CRM/Core/DAO.php @@ -2049,9 +2049,8 @@ SELECT contact_id foreach ($fields as $fieldName => $fieldDef) { $dbName = $fieldDef['name']; $FKClassName = $fieldDef['FKClassName'] ?? NULL; - $required = $fieldDef['required'] ?? NULL; - if (CRM_Utils_Array::value($dbName, $params) !== NULL && !is_array($params[$dbName])) { + if (isset($params[$dbName]) && !is_array($params[$dbName])) { $object->$dbName = $params[$dbName]; } -- 2.25.1