Commit 11e8ae53 authored by mattwire's avatar mattwire Committed by mattwire
Browse files

Clear cancel_date when setting a contribution back to pending

parent f6604369
......@@ -417,9 +417,11 @@ trait CRM_Core_Payment_MJWIPNTrait {
// But we need to go from Failed to Completed if payment succeeds following a failure.
// So we check for Failed status and update to Pending so it will transition to Completed.
// Fixed in 5.29 with
// Also set cancel_date to NULL because we are setting it for failed payments and UI will still display "greyed
// out" if it is set.
$failedContributionStatus = (int) CRM_Core_PseudoConstant::getKey('CRM_Contribute_BAO_Contribution', 'contribution_status_id', 'Failed');
if (isset($params['contribution_status_id']) && ((int) $params['contribution_status_id'] === $failedContributionStatus)) {
$sql = "UPDATE civicrm_contribution SET contribution_status_id=%1 WHERE id=%2";
$sql = "UPDATE civicrm_contribution SET contribution_status_id=%1,cancel_date=NULL WHERE id=%2";
$queryParams = [
1 => [CRM_Core_PseudoConstant::getKey('CRM_Contribute_BAO_Contribution', 'contribution_status_id', 'Pending'), 'Positive'],
2 => [$params['contribution_id'], 'Positive'],
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment