From c309a8cd6f5f33286fb7743886ae4cdff3b68bc0 Mon Sep 17 00:00:00 2001 From: colemanw Date: Fri, 21 Jul 2023 20:24:36 -0700 Subject: [PATCH] (REF) Replace CRM_Utils_Array in context of conditional expressions --- CRM/Case/XMLProcessor/Process.php | 6 +++--- CRM/Core/BAO/UFField.php | 2 +- CRM/Cxn/ApiRouter.php | 2 +- CRM/SMS/Form/Upload.php | 2 +- CRM/Utils/System.php | 2 +- api/v3/Generic.php | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/CRM/Case/XMLProcessor/Process.php b/CRM/Case/XMLProcessor/Process.php index 97fc4e0459..a8e3984746 100644 --- a/CRM/Case/XMLProcessor/Process.php +++ b/CRM/Case/XMLProcessor/Process.php @@ -87,7 +87,7 @@ class CRM_Case_XMLProcessor_Process extends CRM_Case_XMLProcessor { $standardTimeline = $params['standardTimeline'] ?? NULL; $activitySetName = $params['activitySetName'] ?? NULL; - if ('Open Case' == CRM_Utils_Array::value('activityTypeName', $params)) { + if ('Open Case' == ($params['activityTypeName'] ?? '')) { // create relationships for the ones that are required foreach ($xml->CaseRoles as $caseRoleXML) { foreach ($caseRoleXML->RelationshipType as $relationshipTypeXML) { @@ -109,7 +109,7 @@ class CRM_Case_XMLProcessor_Process extends CRM_Case_XMLProcessor { } } - if ('Change Case Start Date' == CRM_Utils_Array::value('activityTypeName', $params)) { + if ('Change Case Start Date' == ($params['activityTypeName'] ?? '')) { // delete all existing activities which are non-empty $this->deleteEmptyActivity($params); } @@ -136,7 +136,7 @@ class CRM_Case_XMLProcessor_Process extends CRM_Case_XMLProcessor { * @param array $params */ public function processStandardTimeline($activitySetXML, &$params) { - if ('Change Case Type' == CRM_Utils_Array::value('activityTypeName', $params) + if ('Change Case Type' == ($params['activityTypeName'] ?? '') && CRM_Utils_Array::value('resetTimeline', $params, TRUE) ) { // delete all existing activities which are non-empty diff --git a/CRM/Core/BAO/UFField.php b/CRM/Core/BAO/UFField.php index afb2e3c7b1..88ef83cfe1 100644 --- a/CRM/Core/BAO/UFField.php +++ b/CRM/Core/BAO/UFField.php @@ -787,7 +787,7 @@ SELECT id if (!empty($index) && ( // it's empty so we set it OR - !CRM_Utils_Array::value($prefixName, $profileAddressFields) + empty($profileAddressFields[$prefixName]) //we are dealing with billing id (precedence) || $index == $billing_id // we are dealing with primary & billing not set diff --git a/CRM/Cxn/ApiRouter.php b/CRM/Cxn/ApiRouter.php index 1331e91904..0a5327c03c 100644 --- a/CRM/Cxn/ApiRouter.php +++ b/CRM/Cxn/ApiRouter.php @@ -32,7 +32,7 @@ class CRM_Cxn_ApiRouter { // FIXME: Shouldn't the X-Forwarded-Proto check be part of CRM_Utils_System::isSSL()? if (Civi::settings()->get('enableSSL') && !CRM_Utils_System::isSSL() && - strtolower(CRM_Utils_Array::value('X_FORWARDED_PROTO', CRM_Utils_System::getRequestHeaders())) != 'https' + strtolower(CRM_Utils_System::getRequestHeaders()['X_FORWARDED_PROTO'] ?? '') != 'https' ) { return civicrm_api3_create_error('System policy requires HTTPS.'); } diff --git a/CRM/SMS/Form/Upload.php b/CRM/SMS/Form/Upload.php index e33c9244a7..da40e49a7a 100644 --- a/CRM/SMS/Form/Upload.php +++ b/CRM/SMS/Form/Upload.php @@ -310,7 +310,7 @@ class CRM_SMS_Form_Upload extends CRM_Core_Form { } } - if (($params['upload_type'] || file_exists(CRM_Utils_Array::value('tmp_name', $files['textFile']))) || + if (($params['upload_type'] || file_exists($files['textFile']['tmp_name'] ?? '')) || (!$params['upload_type'] && $params['text_message']) ) { diff --git a/CRM/Utils/System.php b/CRM/Utils/System.php index 42eb98d4d6..8d57b5bed9 100644 --- a/CRM/Utils/System.php +++ b/CRM/Utils/System.php @@ -1253,7 +1253,7 @@ class CRM_Utils_System { // FIXME: Shouldn't the X-Forwarded-Proto check be part of CRM_Utils_System::isSSL()? if (Civi::settings()->get('enableSSL') && !self::isSSL() && - strtolower(CRM_Utils_Array::value('X_FORWARDED_PROTO', $req_headers)) != 'https' + strtolower($req_headers['X_FORWARDED_PROTO'] ?? '') != 'https' ) { // ensure that SSL is enabled on a civicrm url (for cookie reasons etc) $url = "https://{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}"; diff --git a/api/v3/Generic.php b/api/v3/Generic.php index 690ff54af4..85b44c5bc3 100644 --- a/api/v3/Generic.php +++ b/api/v3/Generic.php @@ -40,7 +40,7 @@ */ function civicrm_api3_generic_getfields($apiRequest, $unique = TRUE) { static $results = []; - if ((CRM_Utils_Array::value('cache_clear', $apiRequest['params']))) { + if (!empty($apiRequest['params']['cache_clear'])) { $results = []; // we will also clear pseudoconstants here - should potentially be moved to relevant BAO classes CRM_Core_PseudoConstant::flush(); -- 2.25.1