From ecb92f642aba67795812e99c64bc10282cbc9acd Mon Sep 17 00:00:00 2001 From: colemanw Date: Fri, 13 Oct 2023 19:42:49 -0400 Subject: [PATCH] CRM/Campaign - Refactor unnecessary uses of CRM_Utils_Array::value --- CRM/Campaign/BAO/Survey.php | 2 +- CRM/Campaign/Form/Campaign.php | 2 +- CRM/Campaign/Form/Petition.php | 8 ++++---- CRM/Campaign/Form/Survey/Main.php | 4 ++-- CRM/Campaign/Page/AJAX.php | 8 ++++---- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/CRM/Campaign/BAO/Survey.php b/CRM/Campaign/BAO/Survey.php index c6aa2dc2cb..f0220a12b2 100644 --- a/CRM/Campaign/BAO/Survey.php +++ b/CRM/Campaign/BAO/Survey.php @@ -674,7 +674,7 @@ INNER JOIN civicrm_contact contact_a ON ( activityTarget.contact_id = contact_a ); $menuLinks[] = sprintf('%s', $urlPath, - CRM_Utils_Array::value('title', $link), + $link['title'] ?? NULL, $link['title'] ); } diff --git a/CRM/Campaign/Form/Campaign.php b/CRM/Campaign/Form/Campaign.php index 7feef215f2..f5a1c523bb 100644 --- a/CRM/Campaign/Form/Campaign.php +++ b/CRM/Campaign/Form/Campaign.php @@ -291,7 +291,7 @@ class CRM_Campaign_Form_Campaign extends CRM_Core_Form { $params['created_date'] = date('YmdHis'); } // format params - $params['is_active'] = CRM_Utils_Array::value('is_active', $params, FALSE); + $params['is_active'] = $params['is_active'] ?? FALSE; $params['last_modified_id'] = $session->get('userID'); $params['last_modified_date'] = date('YmdHis'); $result = self::submit($params, $this); diff --git a/CRM/Campaign/Form/Petition.php b/CRM/Campaign/Form/Petition.php index 1cbd72d69b..55a7377984 100644 --- a/CRM/Campaign/Form/Petition.php +++ b/CRM/Campaign/Form/Petition.php @@ -291,7 +291,7 @@ WHERE $whereClause $params['last_modified_id'] = $session->get('userID'); $params['last_modified_date'] = date('YmdHis'); - $params['is_share'] = CRM_Utils_Array::value('is_share', $params, FALSE); + $params['is_share'] = $params['is_share'] ?? FALSE; if ($this->_surveyId) { @@ -309,9 +309,9 @@ WHERE $whereClause $params['created_date'] = date('YmdHis'); } - $params['bypass_confirm'] = CRM_Utils_Array::value('bypass_confirm', $params, 0); - $params['is_active'] = CRM_Utils_Array::value('is_active', $params, 0); - $params['is_default'] = CRM_Utils_Array::value('is_default', $params, 0); + $params['bypass_confirm'] = $params['bypass_confirm'] ?? 0; + $params['is_active'] = $params['is_active'] ?? 0; + $params['is_default'] = $params['is_default'] ?? 0; $params['custom'] = CRM_Core_BAO_CustomField::postProcess($params, $this->getEntityId(), $this->getDefaultEntity()); diff --git a/CRM/Campaign/Form/Survey/Main.php b/CRM/Campaign/Form/Survey/Main.php index 2aca9a250b..e23617951b 100644 --- a/CRM/Campaign/Form/Survey/Main.php +++ b/CRM/Campaign/Form/Survey/Main.php @@ -155,8 +155,8 @@ class CRM_Campaign_Form_Survey_Main extends CRM_Campaign_Form_Survey { $params['created_date'] = date('YmdHis'); } - $params['is_active'] = CRM_Utils_Array::value('is_active', $params, 0); - $params['is_default'] = CRM_Utils_Array::value('is_default', $params, 0); + $params['is_active'] = $params['is_active'] ?? 0; + $params['is_default'] = $params['is_default'] ?? 0; $params['custom'] = CRM_Core_BAO_CustomField::postProcess($params, $this->getEntityId(), $this->getDefaultEntity()); diff --git a/CRM/Campaign/Page/AJAX.php b/CRM/Campaign/Page/AJAX.php index 6236287a30..69e15a5585 100644 --- a/CRM/Campaign/Page/AJAX.php +++ b/CRM/Campaign/Page/AJAX.php @@ -254,9 +254,9 @@ class CRM_Campaign_Page_AJAX { TRUE, FALSE, FALSE, FALSE, FALSE, - CRM_Utils_Array::value('whereClause', $voterClause), + $voterClause['whereClause'] ?? NULL, NULL, - CRM_Utils_Array::value('fromClause', $voterClause) + $voterClause['fromClause'] ?? NULL ); $iTotal = $searchCount; @@ -287,9 +287,9 @@ class CRM_Campaign_Page_AJAX { FALSE, FALSE, FALSE, FALSE, FALSE, - CRM_Utils_Array::value('whereClause', $voterClause), + $voterClause['whereClause'] ?? NULL, $sortOrder, - CRM_Utils_Array::value('fromClause', $voterClause) + $voterClause['fromClause'] ?? NULL ); while ($result->fetch()) { $contactID = $result->contact_id; -- 2.25.1