dev/core#2843 push new link to the end
authorEileen McNaughton <emcnaughton@wikimedia.org>
Sat, 18 Sep 2021 20:58:47 +0000 (08:58 +1200)
committerEileen McNaughton <emcnaughton@wikimedia.org>
Sat, 18 Sep 2021 20:58:47 +0000 (08:58 +1200)
As discussed in https://lab.civicrm.org/dev/core/-/issues/2843
this makes the UI change less for users & reduces confusion

CRM/Contribute/Page/Tab.php

index 695ebfc6e7c7845ae57098f780400283c96e1e74..ebbf05e714deb567add4fc2c5b20c187b3686b66 100644 (file)
@@ -59,16 +59,6 @@ class CRM_Contribute_Page_Tab extends CRM_Core_Page {
     ];
 
     $templateContribution = CRM_Contribute_BAO_ContributionRecur::getTemplateContribution($recurID);
-    if (!empty($templateContribution['id']) && $paymentProcessorObj->supportsEditRecurringContribution()) {
-      // Use constant CRM_Core_Action::PREVIEW as there is no such thing as view template.
-      // And reusing view will mangle the actions.
-      $links[CRM_Core_Action::PREVIEW] = [
-        'name' => ts('View Template'),
-        'title' => ts('View Template Contribution'),
-        'url' => 'civicrm/contact/view/contribution',
-        'qs' => "reset=1&id={$templateContribution['id']}&cid=%%cid%%&action=view&context={$context}&force_create_template=1",
-      ];
-    }
     if (
       (CRM_Core_Permission::check('edit contributions') || $context !== 'contribution') &&
       ($paymentProcessorObj->supports('ChangeSubscriptionAmount')
@@ -102,6 +92,16 @@ class CRM_Contribute_Page_Tab extends CRM_Core_Page {
         'qs' => "reset=1&crid=%%crid%%&cid=%%cid%%&context={$context}",
       ];
     }
+    if (!empty($templateContribution['id']) && $paymentProcessorObj->supportsEditRecurringContribution()) {
+      // Use constant CRM_Core_Action::PREVIEW as there is no such thing as view template.
+      // And reusing view will mangle the actions.
+      $links[CRM_Core_Action::PREVIEW] = [
+        'name' => ts('View Template'),
+        'title' => ts('View Template Contribution'),
+        'url' => 'civicrm/contact/view/contribution',
+        'qs' => "reset=1&id={$templateContribution['id']}&cid=%%cid%%&action=view&context={$context}&force_create_template=1",
+      ];
+    }
 
     return $links;
   }