Remove always true if
authoreileen <emcnaughton@wikimedia.org>
Mon, 19 Oct 2020 19:24:56 +0000 (08:24 +1300)
committereileen <emcnaughton@wikimedia.org>
Mon, 19 Oct 2020 19:24:56 +0000 (08:24 +1300)
Since paymentProcessorObj is loaded as the manual processor where another does not exist
the processor condition is always true - so this if is obsolete

CRM/Contribute/Page/Tab.php

index 0c0ebb32442e967ddf93fc12b8e397d6da94c11c..49b0ec7e7d522a935939bc24b4c9f6eee37c1462 100644 (file)
@@ -70,32 +70,26 @@ class CRM_Contribute_Page_Tab extends CRM_Core_Page {
 
     if ($recurID) {
       $paymentProcessorObj = Civi\Payment\System::singleton()->getById(CRM_Contribute_BAO_ContributionRecur::getPaymentProcessorID($recurID));
-      if ($paymentProcessorObj) {
-        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'),
-            'title' => ts('Change Billing Details'),
-            'url' => 'civicrm/contribute/updatebilling',
-            '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 (
-        (!CRM_Core_Permission::check('edit contributions') && $context === 'contribution') ||
-        (!$paymentProcessorObj->supports('ChangeSubscriptionAmount')
-          && !$paymentProcessorObj->supports('EditRecurringContribution')
-        )) {
-          unset($links[CRM_Core_Action::UPDATE]);
-        }
+      if ($paymentProcessorObj->supports('UpdateSubscriptionBillingInfo')) {
+        $links[CRM_Core_Action::RENEW] = [
+          'name' => ts('Change Billing Details'),
+          'title' => ts('Change Billing Details'),
+          'url' => 'civicrm/contribute/updatebilling',
+          'qs' => "reset=1&crid=%%crid%%&cid=%%cid%%&context={$context}",
+        ];
       }
-      else {
-        unset($links[CRM_Core_Action::DISABLE]);
+
+      if (
+      (!CRM_Core_Permission::check('edit contributions') && $context === 'contribution') ||
+      (!$paymentProcessorObj->supports('ChangeSubscriptionAmount')
+        && !$paymentProcessorObj->supports('EditRecurringContribution')
+      )) {
         unset($links[CRM_Core_Action::UPDATE]);
       }
     }