Skip to content
Snippets Groups Projects
Commit eb1e4326 authored by eileen's avatar eileen
Browse files

#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
parent 47de3d1b
No related branches found
No related tags found
No related merge requests found
......@@ -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');
......
......@@ -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) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment