Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SearchUI:Move 'Find Contacts' upgrader steps from AdminUI to SearchUI #26919

Merged
merged 1 commit into from
Jul 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Move 'Find Contacts' upgrader steps from AdminUI to SearchUI
  • Loading branch information
aydun committed Jul 24, 2023
commit bece7e9bf684ba3f8a5e1858799f3dba1193ed1d
33 changes: 0 additions & 33 deletions ext/civicrm_admin_ui/CRM/CivicrmAdminUi/Upgrader.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,37 +8,4 @@
*/
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;
}

}
36 changes: 36 additions & 0 deletions ext/civicrm_search_ui/CRM/CivicrmSearchUi/Upgrader.php
Original file line number Diff line number Diff line change
@@ -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;
}

}
2 changes: 1 addition & 1 deletion ext/civicrm_search_ui/ang/afsearchContactSearch.aff.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": [],
Expand Down
1 change: 1 addition & 0 deletions ext/civicrm_search_ui/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>