From eb1e43261577799187817423f30d9d4e23230ff2 Mon Sep 17 00:00:00 2001 From: eileen <emcnaughton@wikimedia.org> Date: Wed, 21 Oct 2020 13:08:17 +1300 Subject: [PATCH] dev/core#927 Remove code to update recur on cancel & fail I've been racking my brains as to why we do this and it just feels like copy & paste that has survived forever This code is called only from the 2 PaypalIPN classes. In both cases the classes follow the same flow - ie if the payment is part of a recurring series, then call recur if the payment is NOT the first in the series then call repeattransaction only proceed to the 'single' function if we are confirming the first recurring payment or it is not recurring This means the cancelled & failed functions can only be reached when the flow is not recurring OR the payment is the first - in neither case does it make sense to copy date from one payment in the series to others - I'm pretty sure this precedes many many code changes --- CRM/Contribute/BAO/ContributionRecur.php | 1 + CRM/Core/Payment/BaseIPN.php | 14 -------------- 2 files changed, 1 insertion(+), 14 deletions(-) diff --git a/CRM/Contribute/BAO/ContributionRecur.php b/CRM/Contribute/BAO/ContributionRecur.php index a8f20086aa6..7128e8f17d2 100644 --- a/CRM/Contribute/BAO/ContributionRecur.php +++ b/CRM/Contribute/BAO/ContributionRecur.php @@ -557,6 +557,7 @@ INNER JOIN civicrm_contribution con ON ( con.id = mp.contribution_id ) * @param int $targetContributionId */ public static function copyCustomValues($recurId, $targetContributionId) { + CRM_Core_Error::deprecatedFunctionWarning('no alternative'); if ($recurId && $targetContributionId) { // get the initial contribution id of recur id $sourceContributionId = CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_Contribution', $recurId, 'id', 'contribution_recur_id'); diff --git a/CRM/Core/Payment/BaseIPN.php b/CRM/Core/Payment/BaseIPN.php index 614568b5188..7c33202a42f 100644 --- a/CRM/Core/Payment/BaseIPN.php +++ b/CRM/Core/Payment/BaseIPN.php @@ -186,13 +186,6 @@ class CRM_Core_Payment_BaseIPN { CRM_Contribute_BAO_ContributionRecur::addRecurLineItems($objects['contributionRecur']->id, $contribution); } - //add new soft credit against current contribution id and - //copy initial contribution custom fields for recurring contributions - if (!empty($objects['contributionRecur']) && $objects['contributionRecur']->id) { - CRM_Contribute_BAO_ContributionRecur::addrecurSoftCredit($objects['contributionRecur']->id, $contribution->id); - CRM_Contribute_BAO_ContributionRecur::copyCustomValues($objects['contributionRecur']->id, $contribution->id); - } - if (!empty($memberships)) { foreach ($memberships as $membership) { // @fixme Should we cancel only Pending memberships? per cancelled() @@ -264,13 +257,6 @@ class CRM_Core_Payment_BaseIPN { CRM_Contribute_BAO_ContributionRecur::addRecurLineItems($objects['contributionRecur']->id, $contribution); } - //add new soft credit against current $contribution and - //copy initial contribution custom fields for recurring contributions - if (!empty($objects['contributionRecur']) && $objects['contributionRecur']->id) { - CRM_Contribute_BAO_ContributionRecur::addrecurSoftCredit($objects['contributionRecur']->id, $contribution->id); - CRM_Contribute_BAO_ContributionRecur::copyCustomValues($objects['contributionRecur']->id, $contribution->id); - } - if (!empty($memberships)) { foreach ($memberships as $membership) { if ($membership) { -- GitLab