From 2f4c8346bdfccf8ef6f38e16b4647a65a279f756 Mon Sep 17 00:00:00 2001 From: Sunil Pawar Date: Thu, 16 Dec 2021 21:15:02 +0530 Subject: [PATCH] Fix Fatal on contribution tag and user dashboard when recurring payment supporting extension disabled --- CRM/Contribute/Page/Tab.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/CRM/Contribute/Page/Tab.php b/CRM/Contribute/Page/Tab.php index ebbf05e714..56411d1bc0 100644 --- a/CRM/Contribute/Page/Tab.php +++ b/CRM/Contribute/Page/Tab.php @@ -58,6 +58,13 @@ class CRM_Contribute_Page_Tab extends CRM_Core_Page { ], ]; + // In case there extension which have recurring payment and then + // extension is disabled and in that case payment object may be null + // To avoid the fatal error, return with VIEW link. + if (!is_object($paymentProcessorObj)) { + return $links; + } + $templateContribution = CRM_Contribute_BAO_ContributionRecur::getTemplateContribution($recurID); if ( (CRM_Core_Permission::check('edit contributions') || $context !== 'contribution') && @@ -121,6 +128,12 @@ class CRM_Contribute_Page_Tab extends CRM_Core_Page { public static function selfServiceRecurLinks(int $recurID): array { $links = []; $paymentProcessorObj = Civi\Payment\System::singleton()->getById(CRM_Contribute_BAO_ContributionRecur::getPaymentProcessorID($recurID)); + // In case there extension which have recurring payment and then + // extension is disabled and in that case payment object may be null + // To avoid the fatal error, return with VIEW link. + if (!is_object($paymentProcessorObj)) { + return $links; + } if ($paymentProcessorObj->supports('cancelRecurring') && $paymentProcessorObj->subscriptionURL($recurID, 'recur', 'cancel') ) { -- 2.25.1