From ee165a1cf02e2016c64a553a080423682efbca48 Mon Sep 17 00:00:00 2001 From: Mathieu Lutfy Date: Thu, 23 Mar 2017 11:14:52 -0400 Subject: [PATCH] CRM-20336: Failed contributions should be set as failed, not left as pending. --- CRM/Contribute/BAO/Contribution.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/CRM/Contribute/BAO/Contribution.php b/CRM/Contribute/BAO/Contribution.php index 60b197bd78..846b6314cc 100644 --- a/CRM/Contribute/BAO/Contribution.php +++ b/CRM/Contribute/BAO/Contribution.php @@ -1053,6 +1053,15 @@ LEFT JOIN civicrm_line_item i ON ( i.contribution_id = c.id AND i.entity_table 'source_contact_id' => CRM_Core_Session::getLoggedInContactID() ? CRM_Core_Session::getLoggedInContactID() : $contactID, )); + + // CRM-20336 Make sure that the contribution status is Failed, not Pending. + $contributionStatus = CRM_Contribute_PseudoConstant::contributionStatus(NULL, 'name'); + $failed = array_search('Failed', $contributionStatus); + + civicrm_api3('contribution', 'create', array( + 'id' => $contributionID, + 'contribution_status_id' => $failed, + )); } /** -- 2.25.1