X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FContribute%2FPage%2FTab.php;h=f8ab5c536e1c52402169fde3b970876f5f65f7bb;hb=7fc328b34ceee79a202cc896b150c54b84ad03dc;hp=ebbf05e714deb567add4fc2c5b20c187b3686b66;hpb=28b58696e3564280b23c129c5726ab04601de543;p=civicrm-core.git diff --git a/CRM/Contribute/Page/Tab.php b/CRM/Contribute/Page/Tab.php index ebbf05e714..f8ab5c536e 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') && @@ -75,15 +82,10 @@ class CRM_Contribute_Page_Tab extends CRM_Core_Page { $links[CRM_Core_Action::DISABLE] = [ 'name' => ts('Cancel'), 'title' => ts('Cancel'), - 'ref' => 'crm-enable-disable', + 'url' => 'civicrm/contribute/unsubscribe', + 'qs' => 'reset=1&crid=%%crid%%&cid=%%cid%%&context=' . $context, ]; - if ($paymentProcessorObj->supports('cancelRecurring')) { - unset($links[CRM_Core_Action::DISABLE]['extra'], $links[CRM_Core_Action::DISABLE]['ref']); - $links[CRM_Core_Action::DISABLE]['url'] = "civicrm/contribute/unsubscribe"; - $links[CRM_Core_Action::DISABLE]['qs'] = "reset=1&crid=%%crid%%&cid=%%cid%%&context={$context}"; - } - if ($paymentProcessorObj->supports('UpdateSubscriptionBillingInfo')) { $links[CRM_Core_Action::RENEW] = [ 'name' => ts('Change Billing Details'), @@ -121,6 +123,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') ) {