Move 'Find Contacts' upgrader steps from AdminUI to SearchUI
authorAidan Saunders <aidan.saunders@squiffle.uk>
Mon, 24 Jul 2023 13:21:56 +0000 (14:21 +0100)
committerAidan Saunders <aidan.saunders@squiffle.uk>
Mon, 24 Jul 2023 14:30:14 +0000 (15:30 +0100)
ext/civicrm_admin_ui/CRM/CivicrmAdminUi/Upgrader.php
ext/civicrm_search_ui/CRM/CivicrmSearchUi/Upgrader.php [new file with mode: 0644]
ext/civicrm_search_ui/ang/afsearchContactSearch.aff.json
ext/civicrm_search_ui/info.xml

index 09dd44c6b6d0a10d387d3f482bce1a69dda21e0d..b88e7de59534404172600cdf74d75557d85aff5b 100644 (file)
@@ -8,37 +8,4 @@ use CRM_CivicrmAdminUi_ExtensionUtil as E;
  */
 class CRM_CivicrmAdminUi_Upgrader extends CRM_Extension_Upgrader_Base {
 
-  protected function replaceFindContactMenuPath($path) {
-    // point Find Contacts menu to the FB/SK version or back to the original path
-    // this is temporary until everything is in FB/SK and we can use the original path
-    $results = \Civi\Api4\Navigation::update(FALSE)
-      ->addValue('url', $path)
-      ->addWhere('name', '=', 'Find Contacts')
-      ->execute();
-  }
-
-  /**
-   * @todo "install" and "uninstall" may not be needed if enable and disable are present. See https://github.com/civicrm/civicrm-core/pull/26669
-   */
-  public function install(): void {
-    $this->replaceFindContactMenuPath('civicrm/adminui/contact/search');
-  }
-
-  public function uninstall(): void {
-    $this->replaceFindContactMenuPath('civicrm/contact/search');
-  }
-
-  public function enable(): void {
-    $this->replaceFindContactMenuPath('civicrm/adminui/contact/search');
-  }
-
-  public function disable(): void {
-    $this->replaceFindContactMenuPath('civicrm/contact/search');
-  }
-
-  public function upgrade_1000(): bool {
-    $this->replaceFindContactMenuPath('civicrm/adminui/contact/search');
-    return TRUE;
-  }
-
 }
diff --git a/ext/civicrm_search_ui/CRM/CivicrmSearchUi/Upgrader.php b/ext/civicrm_search_ui/CRM/CivicrmSearchUi/Upgrader.php
new file mode 100644 (file)
index 0000000..9efb2f0
--- /dev/null
@@ -0,0 +1,36 @@
+<?php
+// phpcs:disable
+use CRM_CivicrmSearchUi_ExtensionUtil as E;
+// phpcs:enable
+
+/**
+ * Collection of upgrade steps.
+ */
+class CRM_CivicrmSearchUi_Upgrader extends CRM_Extension_Upgrader_Base {
+
+  protected function replaceFindContactMenuPath($path) {
+    // point Find Contacts menu to the FB/SK version or back to the original path
+    // this is temporary until everything is in FB/SK and we can use the original path
+    $results = \Civi\Api4\Navigation::update(FALSE)
+      ->addValue('url', $path)
+      ->addWhere('name', '=', 'Find Contacts')
+      ->execute();
+  }
+
+  /**
+   * See https://github.com/civicrm/civicrm-core/pull/26669
+   */
+  public function enable(): void {
+    $this->replaceFindContactMenuPath('civicrm/searchui/contact/search');
+  }
+
+  public function disable(): void {
+    $this->replaceFindContactMenuPath('civicrm/contact/search');
+  }
+
+  public function upgrade_1000(): bool {
+    $this->replaceFindContactMenuPath('civicrm/searchui/contact/search');
+    return TRUE;
+  }
+
+}
index 9e3865e50a8b783d6f13c8882f6526b254626400..f56ff6fda189a8bb2dd82c1679156764935ea225 100644 (file)
@@ -2,7 +2,7 @@
     "type": "search",
     "title": "Find Contacts",
     "icon": "fa-list-alt",
-    "server_route": "civicrm/adminui/contact/search",
+    "server_route": "civicrm/searchui/contact/search",
     "permission": "access CiviCRM",
     "navigation": null,
     "requires": [],
index 417ea3355f2f0d96c6e0723f594321e4c747c2bb..cba7969b8f8f0ca2ff665e5b9bcd404bf92b2b1b 100644 (file)
@@ -39,4 +39,5 @@
     <mixin>setting-php@1.0.0</mixin>
     <mixin>smarty-v2@1.0.1</mixin>
   </mixins>
+  <upgrader>CRM_CivicrmSearchUi_Upgrader</upgrader>
 </extension>