From a9f512d8e7cca6ef47aa1621af3ac13fa2ac8cb1 Mon Sep 17 00:00:00 2001 From: eileen Date: Wed, 3 Feb 2021 09:55:16 +1300 Subject: [PATCH] Comment intent to remove call to transition components The other usages have been migrated to contributioncancelactions so only update-to-completed remains --- CRM/Contribute/BAO/Contribution.php | 2 ++ CRM/Contribute/Form/Contribution.php | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/CRM/Contribute/BAO/Contribution.php b/CRM/Contribute/BAO/Contribution.php index 6327b8ec3c..94fadc0286 100644 --- a/CRM/Contribute/BAO/Contribution.php +++ b/CRM/Contribute/BAO/Contribution.php @@ -2032,6 +2032,8 @@ LEFT JOIN civicrm_contribution contribution ON ( componentPayment.contribution_ * */ public static function transitionComponents($params) { + // @todo fix the one place that calls this function to use Payment.create + // remove this. // get minimum required values. $contactId = $params['contact_id'] ?? NULL; $componentId = $params['component_id'] ?? NULL; diff --git a/CRM/Contribute/Form/Contribution.php b/CRM/Contribute/Form/Contribution.php index 9c788015f1..955249973e 100644 --- a/CRM/Contribute/Form/Contribution.php +++ b/CRM/Contribute/Form/Contribution.php @@ -1567,6 +1567,8 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP $params['is_pay_later'] = 1; } elseif ($params['contribution_status_id'] == CRM_Core_PseudoConstant::getKey('CRM_Contribute_BAO_Contribution', 'contribution_status_id', 'Completed')) { + // @todo - if the contribution is new then it should be Pending status & then we use + // Payment.create to update to Completed. $params['is_pay_later'] = 0; } @@ -1597,6 +1599,9 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP // process associated membership / participant, CRM-4395 if ($contribution->id && $action & CRM_Core_Action::UPDATE) { + // @todo use Payment.create to do this, remove transitioncomponents function + // if contribution is being created with a completed status it should be + // created pending & then Payment.create adds the payment CRM_Contribute_BAO_Contribution::transitionComponents([ 'contribution_id' => $contribution->id, 'contribution_status_id' => $contribution->contribution_status_id, -- 2.25.1