Code cleanup - replace overcomplicated test for null with isset
authorColeman Watts <coleman@civicrm.org>
Fri, 3 Apr 2020 15:06:33 +0000 (11:06 -0400)
committerColeman Watts <coleman@civicrm.org>
Fri, 3 Apr 2020 15:06:33 +0000 (11:06 -0400)
CRM/Core/BAO/CustomGroup.php
CRM/Core/DAO.php

index 244c98f316abdb9848b5c28a8e6deea3372a4a54..2d952aeb2b452c7d39be112cabdeab57ef79e9c2 100644 (file)
@@ -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)
index e6e301e5081a48b1172af0274cfa91e8ca03335f..e6813869de29c2b848400e29c30fea6380efa531 100644 (file)
@@ -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];
         }