diff --git a/CRM/Contribute/BAO/Contribution.php b/CRM/Contribute/BAO/Contribution.php index 66af29980467..96e3d6a32a4f 100644 --- a/CRM/Contribute/BAO/Contribution.php +++ b/CRM/Contribute/BAO/Contribution.php @@ -3380,7 +3380,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 = []; @@ -3403,10 +3403,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 7ac2c1597390..43133c429a9c 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', ];