From b0261a95d56533b61417b88abcf4894a89e877ba Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Fri, 18 Jun 2021 19:50:29 +1200 Subject: [PATCH] [REF] Follow up clean up - remove contribution_mode Contribution mode was only set to be used to set isRelatedID here https://github.com/civicrm/civicrm-core/pull/20653/files#diff-4c9d0b1abe07057a4eea2b47bc627eecb95face8ed8d86c1c005312a52cca811L3420 but we removed that.... --- CRM/Contribute/BAO/Contribution.php | 6 +----- CRM/Contribute/Form/Contribution.php | 3 --- api/v3/Order.php | 2 +- tests/phpunit/api/v3/ContributionTest.php | 1 - 4 files changed, 2 insertions(+), 10 deletions(-) diff --git a/CRM/Contribute/BAO/Contribution.php b/CRM/Contribute/BAO/Contribution.php index 8ede9632837c..b0b67b1cfe0c 100644 --- a/CRM/Contribute/BAO/Contribution.php +++ b/CRM/Contribute/BAO/Contribution.php @@ -3377,7 +3377,7 @@ public static function isSubscriptionCancelled($contributionId) { * @return null|\CRM_Core_BAO_FinancialTrxn */ public static function recordFinancialAccounts(&$params, $financialTrxnValues = NULL) { - $skipRecords = $update = $return = $isRelatedId = FALSE; + $skipRecords = $update = $return = FALSE; $isUpdate = !empty($params['prevContribution']); $additionalParticipantId = []; @@ -3400,10 +3400,6 @@ public static function recordFinancialAccounts(&$params, $financialTrxnValues = $entityTable = 'civicrm_contribution'; } - if (CRM_Utils_Array::value('contribution_mode', $params) == 'membership') { - $isRelatedId = TRUE; - } - $entityID[] = $entityId; if (!empty($additionalParticipantId)) { $entityID += $additionalParticipantId; diff --git a/CRM/Contribute/Form/Contribution.php b/CRM/Contribute/Form/Contribution.php index 5796571d343a..b92089d811e6 100644 --- a/CRM/Contribute/Form/Contribution.php +++ b/CRM/Contribute/Form/Contribution.php @@ -1585,9 +1585,6 @@ protected function submit($submittedValues, $action, $pledgePaymentID) { $params['participant_id'] = $pId; $params['skipLineItem'] = 1; } - elseif ($isRelatedId) { - $params['contribution_mode'] = 'membership'; - } $params['line_item'] = $lineItem; $params['payment_processor_id'] = $params['payment_processor'] = $this->_paymentProcessor['id'] ?? NULL; $params['tax_amount'] = CRM_Utils_Array::value('tax_amount', $submittedValues, CRM_Utils_Array::value('tax_amount', $this->_values)); diff --git a/api/v3/Order.php b/api/v3/Order.php index 528a25ef38c5..8a794af79772 100644 --- a/api/v3/Order.php +++ b/api/v3/Order.php @@ -102,6 +102,7 @@ function civicrm_api3_order_create(array $params): array { } $entityParams['participant_status_id'] = $entityParams['participant_status_id'] ?? 'Pending from incomplete transaction'; $entityParams['status_id'] = $entityParams['participant_status_id']; + $params['contribution_mode'] = 'participant'; break; case 'membership': @@ -116,7 +117,6 @@ function civicrm_api3_order_create(array $params): array { if ($supportedEntity) { $entityParams['skipLineItem'] = TRUE; $entityResult = civicrm_api3($entity, 'create', $entityParams); - $params['contribution_mode'] = $entity; $entityIds[] = $params[$entity . '_id'] = $entityResult['id']; foreach ($lineItems['line_item'] as &$items) { $items['entity_id'] = $entityResult['id']; diff --git a/tests/phpunit/api/v3/ContributionTest.php b/tests/phpunit/api/v3/ContributionTest.php index e57891b89ea1..84bdcc9d73f3 100644 --- a/tests/phpunit/api/v3/ContributionTest.php +++ b/tests/phpunit/api/v3/ContributionTest.php @@ -3509,7 +3509,6 @@ public function testPendingToCompleteContribution(): void { 'payment_processor_id' => $this->paymentProcessorID, 'currency' => 'USD', 'contribution_page_id' => $this->_ids['contribution_page'], - 'contribution_mode' => 'membership', 'source' => 'Membership Signup and Renewal', ];