dev/core#3066 - Add check for CiviPledge component
authorIan Wilson <iwilson@rnao.ca>
Mon, 14 Feb 2022 17:06:09 +0000 (12:06 -0500)
committerEileen McNaughton <emcnaughton@wikimedia.org>
Wed, 16 Feb 2022 20:54:32 +0000 (09:54 +1300)
Check that component is enabled before attempting to disconnect pledge payments from Failed / Cancelled contributions.

CRM/Contribute/BAO/Contribution.php

index 45f2f87863ef1bf2a6d9987b5f4ab1cc660ebf11..8851522c7486cfb77333e6206fa69391313083b5 100644 (file)
@@ -505,6 +505,7 @@ class CRM_Contribute_BAO_Contribution extends CRM_Contribute_DAO_Contribution {
     CRM_Contribute_BAO_ContributionSoft::processSoftContribution($params, $contribution);
 
     if (!empty($params['id']) && !empty($params['contribution_status_id'])
+      && CRM_Core_Component::isEnabled('CiviPledge')
     ) {
       self::disconnectPledgePaymentsIfCancelled((int) $params['id'], CRM_Core_PseudoConstant::getName('CRM_Contribute_BAO_Contribution', 'contribution_status_id', $params['contribution_status_id']));
     }