From 8a6b21855a5626870bdb7a7295190164adc331c1 Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Mon, 12 Jul 2021 14:32:44 -0400 Subject: [PATCH] Remove unused variables --- CRM/Activity/Form/Activity.php | 12 +----------- CRM/Campaign/Form/Campaign.php | 3 --- CRM/Campaign/Form/Petition/Signature.php | 8 -------- CRM/Case/Form/Case.php | 6 ------ CRM/Contact/Form/CustomData.php | 8 -------- CRM/Contact/Import/Parser/Contact.php | 10 +--------- CRM/Event/Form/ParticipantView.php | 3 --- CRM/Grant/Form/Grant.php | 8 +------- CRM/Pledge/Form/Pledge.php | 1 - 9 files changed, 3 insertions(+), 56 deletions(-) diff --git a/CRM/Activity/Form/Activity.php b/CRM/Activity/Form/Activity.php index c6b07c4a39..482937f3b1 100644 --- a/CRM/Activity/Form/Activity.php +++ b/CRM/Activity/Form/Activity.php @@ -915,17 +915,7 @@ class CRM_Activity_Form_Activity extends CRM_Contact_Form_Task { $params['activity_type_id'] = $this->_activityTypeId; } - if (!empty($params['hidden_custom']) && - !isset($params['custom']) - ) { - $customFields = CRM_Core_BAO_CustomField::getFields('Activity', FALSE, FALSE, - $this->_activityTypeId - ); - $customFields = CRM_Utils_Array::crmArrayMerge($customFields, - CRM_Core_BAO_CustomField::getFields('Activity', FALSE, FALSE, - NULL, NULL, TRUE - ) - ); + if (!empty($params['hidden_custom']) && !isset($params['custom'])) { $params['custom'] = CRM_Core_BAO_CustomField::postProcess($params, $this->_activityId, 'Activity' diff --git a/CRM/Campaign/Form/Campaign.php b/CRM/Campaign/Form/Campaign.php index be1e9bc39b..d6e7e2e03c 100644 --- a/CRM/Campaign/Form/Campaign.php +++ b/CRM/Campaign/Form/Campaign.php @@ -336,9 +336,6 @@ class CRM_Campaign_Form_Campaign extends CRM_Core_Form { } //process custom data. - $customFields = CRM_Core_BAO_CustomField::getFields('Campaign', FALSE, FALSE, - CRM_Utils_Array::value('campaign_type_id', $params) - ); $params['custom'] = CRM_Core_BAO_CustomField::postProcess($params, $form->_campaignId, 'Campaign' diff --git a/CRM/Campaign/Form/Petition/Signature.php b/CRM/Campaign/Form/Petition/Signature.php index ae55710cd4..31e7edde21 100644 --- a/CRM/Campaign/Form/Petition/Signature.php +++ b/CRM/Campaign/Form/Petition/Signature.php @@ -492,14 +492,6 @@ class CRM_Campaign_Form_Petition_Signature extends CRM_Core_Form { // get additional custom activity profile field data // to save with new signature activity record $surveyInfo = $this->bao->getSurveyInfo($this->_surveyId); - $customActivityFields = CRM_Core_BAO_CustomField::getFields('Activity', FALSE, FALSE, - $surveyInfo['activity_type_id'] - ); - $customActivityFields = CRM_Utils_Array::crmArrayMerge($customActivityFields, - CRM_Core_BAO_CustomField::getFields('Activity', FALSE, FALSE, - NULL, NULL, TRUE - ) - ); $params['custom'] = CRM_Core_BAO_CustomField::postProcess($params, NULL, diff --git a/CRM/Case/Form/Case.php b/CRM/Case/Form/Case.php index e2cb93223d..5d83a0ab82 100644 --- a/CRM/Case/Form/Case.php +++ b/CRM/Case/Form/Case.php @@ -389,12 +389,6 @@ class CRM_Case_Form_Case extends CRM_Core_Form { // 3. format activity custom data if (!empty($params['hidden_custom'])) { - $customFields = CRM_Core_BAO_CustomField::getFields('Activity', FALSE, FALSE, $this->_activityTypeId); - $customFields = CRM_Utils_Array::crmArrayMerge($customFields, - CRM_Core_BAO_CustomField::getFields('Activity', FALSE, FALSE, - NULL, NULL, TRUE - ) - ); $params['custom'] = CRM_Core_BAO_CustomField::postProcess($params, $this->_activityId, 'Activity' diff --git a/CRM/Contact/Form/CustomData.php b/CRM/Contact/Form/CustomData.php index a6b884c4c9..00b771fb7e 100644 --- a/CRM/Contact/Form/CustomData.php +++ b/CRM/Contact/Form/CustomData.php @@ -230,7 +230,6 @@ class CRM_Contact_Form_CustomData extends CRM_Core_Form { $valueIdDefaults = []; $groupTreeValueId = CRM_Core_BAO_CustomGroup::formatGroupTree($groupTree, $this->_copyValueId, $this); CRM_Core_BAO_CustomGroup::setDefaults($groupTreeValueId, $valueIdDefaults, FALSE, FALSE, $this->get('action')); - $tableId = $groupTreeValueId[$this->_groupID]['table_id']; foreach ($valueIdDefaults as $valueIdElementName => $value) { // build defaults for COPY action for new record saving $valueIdElementNamePieces = explode('_', $valueIdElementName); @@ -245,13 +244,6 @@ class CRM_Contact_Form_CustomData extends CRM_Core_Form { return $customDefaultValue; } - $groupTree = CRM_Core_BAO_CustomGroup::getTree($this->_contactType, - NULL, - $this->_tableID, - $this->_groupID, - $this->_contactSubType - ); - if (empty($_POST['hidden_custom_group_count'])) { // custom data building in edit mode (required to handle multi-value) $groupTree = CRM_Core_BAO_CustomGroup::getTree($this->_contactType, NULL, $this->_tableID, diff --git a/CRM/Contact/Import/Parser/Contact.php b/CRM/Contact/Import/Parser/Contact.php index 113248c951..70da804370 100644 --- a/CRM/Contact/Import/Parser/Contact.php +++ b/CRM/Contact/Import/Parser/Contact.php @@ -1632,15 +1632,7 @@ class CRM_Contact_Import_Parser_Contact extends CRM_Contact_Import_Parser { $defaults = []; $contactObj = CRM_Contact_BAO_Contact::retrieve($contactParams, $defaults); - $modeUpdate = $modeFill = FALSE; - - if ($onDuplicate == CRM_Import_Parser::DUPLICATE_UPDATE) { - $modeUpdate = TRUE; - } - - if ($onDuplicate == CRM_Import_Parser::DUPLICATE_FILL) { - $modeFill = TRUE; - } + $modeFill = ($onDuplicate == CRM_Import_Parser::DUPLICATE_FILL); $groupTree = CRM_Core_BAO_CustomGroup::getTree($params['contact_type'], NULL, $cid, 0, NULL); CRM_Core_BAO_CustomGroup::setDefaults($groupTree, $defaults, FALSE, FALSE); diff --git a/CRM/Event/Form/ParticipantView.php b/CRM/Event/Form/ParticipantView.php index 1d4f0bd454..4345047ff4 100644 --- a/CRM/Event/Form/ParticipantView.php +++ b/CRM/Event/Form/ParticipantView.php @@ -71,7 +71,6 @@ class CRM_Event_Form_ParticipantView extends CRM_Core_Form { $statusId = CRM_Core_DAO::getFieldValue('CRM_Event_BAO_Participant', $participantID, 'status_id', 'id'); $status = CRM_Core_DAO::getFieldValue('CRM_Event_BAO_ParticipantStatusType', $statusId, 'name', 'id'); - $status = CRM_Core_DAO::getFieldValue('CRM_Event_BAO_ParticipantStatusType', $statusId, 'name', 'id'); if ($status == 'Transferred') { $transferId = CRM_Core_DAO::getFieldValue('CRM_Event_BAO_Participant', $participantID, 'transferred_to_contact_id', 'id'); $pid = CRM_Core_DAO::getFieldValue('CRM_Event_BAO_Participant', $transferId, 'id', 'contact_id'); @@ -80,7 +79,6 @@ class CRM_Event_Form_ParticipantView extends CRM_Core_Form { $this->assign('transferId', $transferId); $this->assign('transferName', $transferName); } - $participantStatuses = CRM_Event_PseudoConstant::participantStatus(); // CRM-20879: Show 'Transfer or Cancel' option beside 'Change fee selection' // only if logged in user have 'edit event participants' permission and @@ -137,7 +135,6 @@ class CRM_Event_Form_ParticipantView extends CRM_Core_Form { $eventNameCustomDataTypeID = array_search('ParticipantEventName', $customDataType); $eventTypeCustomDataTypeID = array_search('ParticipantEventType', $customDataType); $allRoleIDs = explode(CRM_Core_DAO::VALUE_SEPARATOR, $values[$participantID]['role_id']); - $groupTree = []; $finalTree = []; foreach ($allRoleIDs as $k => $v) { diff --git a/CRM/Grant/Form/Grant.php b/CRM/Grant/Form/Grant.php index 04714b1b6a..6d9a7aab26 100644 --- a/CRM/Grant/Form/Grant.php +++ b/CRM/Grant/Form/Grant.php @@ -243,13 +243,7 @@ class CRM_Grant_Form_Grant extends CRM_Core_Form { $ids['note']['id'] = $this->_noteId; } - // build custom data getFields array - $customFieldsGrantType = CRM_Core_BAO_CustomField::getFields('Grant', FALSE, FALSE, - CRM_Utils_Array::value('grant_type_id', $params) - ); - $customFields = CRM_Utils_Array::crmArrayMerge($customFieldsGrantType, - CRM_Core_BAO_CustomField::getFields('Grant', FALSE, FALSE, NULL, NULL, TRUE) - ); + // build custom data array $params['custom'] = CRM_Core_BAO_CustomField::postProcess($params, $this->_id, 'Grant' diff --git a/CRM/Pledge/Form/Pledge.php b/CRM/Pledge/Form/Pledge.php index d7fe5c8837..d3759d761d 100644 --- a/CRM/Pledge/Form/Pledge.php +++ b/CRM/Pledge/Form/Pledge.php @@ -488,7 +488,6 @@ class CRM_Pledge_Form_Pledge extends CRM_Core_Form { if (!empty($formValues['hidden_custom'])) { $params['hidden_custom'] = 1; - $customFields = CRM_Core_BAO_CustomField::getFields('Pledge'); $params['custom'] = CRM_Core_BAO_CustomField::postProcess($formValues, $this->_id, 'Pledge' -- 2.25.1